Example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_DENIED

List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_DENIED

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_DENIED.

Prototype

int STATUS_DENIED

To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_DENIED.

Click Source Link

Usage

From source file:at.meduni.liferay.portlet.bbmrieric.model.D2BiobankClp.java

License:Open Source License

@Override
public boolean isDenied() {
    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
        return true;
    } else {/*w ww.  jav a 2 s .c  o m*/
        return false;
    }
}

From source file:com.liferay.akismet.hook.action.AkismetEditDiscussionAction.java

License:Open Source License

protected void updateStatus(HttpServletRequest request, HttpServletResponse response) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long messageId = ParamUtil.getLong(request, "messageId");

    boolean spam = ParamUtil.getBoolean(request, "spam");

    ServiceContext serviceContext = ServiceContextFactory.getInstance(request);

    if (spam) {/*from  w  ww. j a  v  a  2 s.com*/
        MBMessage message = MBMessageLocalServiceUtil.updateStatus(themeDisplay.getUserId(), messageId,
                WorkflowConstants.STATUS_DENIED, serviceContext);

        if (AkismetUtil.isMessageBoardsEnabled(message.getCompanyId())) {
            AkismetUtil.submitSpam(message);
        }
    } else {
        MBMessage message = MBMessageLocalServiceUtil.updateStatus(themeDisplay.getUserId(), messageId,
                WorkflowConstants.STATUS_APPROVED, serviceContext);

        if (AkismetUtil.isMessageBoardsEnabled(message.getCompanyId())) {
            AkismetUtil.submitHam(message);
        }
    }
}

From source file:com.liferay.akismet.hook.action.AkismetEditMessageAction.java

License:Open Source License

protected void updateStatus(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    checkPermission(themeDisplay.getScopeGroupId());

    long messageId = ParamUtil.getLong(actionRequest, "messageId");

    boolean spam = ParamUtil.getBoolean(actionRequest, "spam");

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    if (spam) {//w w  w .  ja v a 2  s  .  co m
        MBMessage message = MBMessageLocalServiceUtil.updateStatus(themeDisplay.getUserId(), messageId,
                WorkflowConstants.STATUS_DENIED, serviceContext);

        if (AkismetUtil.isMessageBoardsEnabled(message.getCompanyId())) {
            AkismetUtil.submitSpam(message);
        }
    } else {
        MBMessage message = MBMessageLocalServiceUtil.updateStatus(themeDisplay.getUserId(), messageId,
                WorkflowConstants.STATUS_APPROVED, serviceContext);

        if (AkismetUtil.isMessageBoardsEnabled(message.getCompanyId())) {
            AkismetUtil.submitHam(message);
        }
    }
}

From source file:com.liferay.akismet.hook.service.impl.AkismetMBMessageLocalServiceImpl.java

License:Open Source License

@Override
public MBMessage addDiscussionMessage(long userId, String userName, long groupId, String className,
        long classPK, long threadId, long parentMessageId, String subject, String body,
        ServiceContext serviceContext) throws PortalException {

    boolean enabled = isDiscussionsEnabled(userId, serviceContext);

    if (enabled) {
        serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT);
    }/*from   w  ww .  j  a va2s .  c  o  m*/

    MBMessage message = super.addDiscussionMessage(userId, userName, groupId, className, classPK, threadId,
            parentMessageId, subject, body, serviceContext);

    AkismetData akismetData = updateAkismetData(message, serviceContext);

    if (!enabled) {
        return message;
    }

    String content = subject + "\n\n" + body;

    int status = WorkflowConstants.STATUS_APPROVED;

    if (AkismetUtil.isSpam(userId, content, akismetData)) {
        status = WorkflowConstants.STATUS_DENIED;
    }

    return super.updateStatus(userId, message.getMessageId(), status, serviceContext);
}

From source file:com.liferay.akismet.hook.service.impl.AkismetMBMessageLocalServiceImpl.java

License:Open Source License

@Override
public MBMessage addMessage(long userId, String userName, long groupId, long categoryId, long threadId,
        long parentMessageId, String subject, String body, String format,
        List<ObjectValuePair<String, InputStream>> inputStreamOVPs, boolean anonymous, double priority,
        boolean allowPingbacks, ServiceContext serviceContext) throws PortalException {

    boolean enabled = isMessageBoardsEnabled(userId, groupId, serviceContext);

    if (enabled) {
        serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT);
    }//from   ww  w  .ja v  a 2 s .  c o m

    MBMessage message = super.addMessage(userId, userName, groupId, categoryId, threadId, parentMessageId,
            subject, body, format, inputStreamOVPs, anonymous, priority, allowPingbacks, serviceContext);

    AkismetData akismetData = updateAkismetData(message, serviceContext);

    if (!enabled) {
        return message;
    }

    String content = subject + "\n\n" + body;

    int status = WorkflowConstants.STATUS_APPROVED;

    if (AkismetUtil.isSpam(userId, content, akismetData)) {
        status = WorkflowConstants.STATUS_DENIED;
    }

    return super.updateStatus(userId, message.getMessageId(), status, serviceContext);
}

From source file:com.liferay.akismet.hook.service.impl.AkismetMBMessageLocalServiceImpl.java

License:Open Source License

@Override
public MBMessage addMessage(long userId, String userName, long groupId, long categoryId, String subject,
        String body, String format, List<ObjectValuePair<String, InputStream>> inputStreamOVPs,
        boolean anonymous, double priority, boolean allowPingbacks, ServiceContext serviceContext)
        throws PortalException {

    boolean enabled = isMessageBoardsEnabled(userId, groupId, serviceContext);

    if (enabled) {
        serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT);
    }/*from  w w  w . j  a v  a 2 s . co m*/

    MBMessage message = super.addMessage(userId, userName, groupId, categoryId, subject, body, format,
            inputStreamOVPs, anonymous, priority, allowPingbacks, serviceContext);

    AkismetData akismetData = updateAkismetData(message, serviceContext);

    if (!enabled) {
        return message;
    }

    String content = subject + "\n\n" + body;

    int status = WorkflowConstants.STATUS_APPROVED;

    if (AkismetUtil.isSpam(userId, content, akismetData)) {
        status = WorkflowConstants.STATUS_DENIED;
    }

    return super.updateStatus(userId, message.getMessageId(), status, serviceContext);
}

From source file:com.liferay.akismet.hook.service.impl.AkismetMBMessageLocalServiceImpl.java

License:Open Source License

@Override
public MBMessage updateDiscussionMessage(long userId, long messageId, String className, long classPK,
        String subject, String body, ServiceContext serviceContext) throws PortalException {

    boolean enabled = isDiscussionsEnabled(userId, serviceContext);

    if (enabled) {
        serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT);
    }// w  w w.  j ava  2s . c o  m

    MBMessage message = super.updateDiscussionMessage(userId, messageId, className, classPK, subject, body,
            serviceContext);

    AkismetData akismetData = updateAkismetData(message, serviceContext);

    if (!enabled) {
        return message;
    }

    String content = subject + "\n\n" + body;

    int status = WorkflowConstants.STATUS_APPROVED;

    if (AkismetUtil.isSpam(userId, content, akismetData)) {
        status = WorkflowConstants.STATUS_DENIED;
    }

    return super.updateStatus(userId, message.getMessageId(), status, serviceContext);
}

From source file:com.liferay.akismet.hook.service.impl.AkismetMBMessageLocalServiceImpl.java

License:Open Source License

@Override
public MBMessage updateMessage(long userId, long messageId, String subject, String body,
        List<ObjectValuePair<String, InputStream>> inputStreamOVPs, List<String> existingFiles, double priority,
        boolean allowPingbacks, ServiceContext serviceContext) throws PortalException {

    MBMessage message = super.getMBMessage(messageId);

    boolean enabled = isMessageBoardsEnabled(userId, message.getGroupId(), serviceContext);

    if (enabled) {
        serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT);
    }/*from  w ww.ja  va  2s.  co  m*/

    message = super.updateMessage(userId, messageId, subject, body, inputStreamOVPs, existingFiles, priority,
            allowPingbacks, serviceContext);

    AkismetData akismetData = updateAkismetData(message, serviceContext);

    if (!enabled) {
        return message;
    }

    String content = subject + "\n\n" + body;

    int status = WorkflowConstants.STATUS_APPROVED;

    if (AkismetUtil.isSpam(userId, content, akismetData)) {
        status = WorkflowConstants.STATUS_DENIED;
    }

    return super.updateStatus(userId, message.getMessageId(), status, serviceContext);
}

From source file:com.liferay.akismet.moderation.messaging.DeleteMBMessagesListener.java

License:Open Source License

protected void deleteSpam(long companyId) throws PortalException {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(MBMessage.class,
            PortalClassLoaderUtil.getClassLoader());

    Property statusProperty = PropertyFactoryUtil.forName("status");

    dynamicQuery.add(statusProperty.eq(WorkflowConstants.STATUS_DENIED));

    Property statusDateProperty = PropertyFactoryUtil.forName("statusDate");

    dynamicQuery.add(statusDateProperty.lt(AkismetUtil.getRetainSpamTime()));

    List<MBMessage> mbMessages = MBMessageLocalServiceUtil.dynamicQuery(dynamicQuery);

    for (MBMessage mbMessage : mbMessages) {
        try {//from   ww w  .  java2 s. c o  m
            MBMessageLocalServiceUtil.deleteMBMessage(mbMessage.getMessageId());
        } catch (NoSuchMessageException nsme) {
        }
    }
}

From source file:com.liferay.akismet.moderation.messaging.DeleteSpamListener.java

License:Open Source License

protected void deleteSpamMessages(long companyId) throws PortalException, SystemException {

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(MBMessage.class,
            PortalClassLoaderUtil.getClassLoader());

    Property statusProperty = PropertyFactoryUtil.forName("status");

    dynamicQuery.add(statusProperty.eq(WorkflowConstants.STATUS_DENIED));

    Property statusDateProperty = PropertyFactoryUtil.forName("statusDate");

    dynamicQuery.add(statusDateProperty.lt(AkismetUtil.getRetainSpamTime()));

    List<MBMessage> mbMessages = MBMessageLocalServiceUtil.dynamicQuery(dynamicQuery);

    for (MBMessage mbMessage : mbMessages) {
        try {// w  w w . j ava2s . c  o  m
            MBMessageLocalServiceUtil.deleteMBMessage(mbMessage.getMessageId());
        } catch (NoSuchMessageException nsme) {
        }
    }
}