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

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

Introduction

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

Prototype

String CONTEXT_USER_ID

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

Click Source Link

Usage

From source file:com.liferay.message.boards.internal.workflow.BaseMBWorkflowHandler.java

License:Open Source License

@Override
public MBMessage updateStatus(int status, Map<String, Serializable> workflowContext) throws PortalException {

    MBMessageLocalService mbMessageLocalService = getMBMessageLocalService();

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return mbMessageLocalService.updateStatus(userId, classPK, status, serviceContext, workflowContext);
}

From source file:com.liferay.portlet.blogs.workflow.BlogsEntryWorkflowHandler.java

License:Open Source License

public BlogsEntry updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return BlogsEntryLocalServiceUtil.updateStatus(userId, classPK, status, serviceContext);
}

From source file:com.liferay.portlet.documentlibrary.workflow.DLFileEntryWorkflowHandler.java

License:Open Source License

public DLFileEntry updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return DLFileEntryLocalServiceUtil.updateStatus(userId, classPK, status, workflowContext, serviceContext);
}

From source file:com.liferay.portlet.dynamicdatalists.workflow.DDLRecordWorkflowHandler.java

License:Open Source License

public DDLRecord updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return DDLRecordLocalServiceUtil.updateStatus(userId, classPK, status, serviceContext);
}

From source file:com.liferay.portlet.journal.workflow.JournalArticleWorkflowHandler.java

License:Open Source License

public JournalArticle updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    JournalArticle article = JournalArticleLocalServiceUtil.getArticle(classPK);

    return JournalArticleLocalServiceUtil.updateStatus(userId, article, status, null, serviceContext);
}

From source file:com.liferay.portlet.messageboards.workflow.MBMessageWorkflowHandler.java

License:Open Source License

public Object updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return MBMessageLocalServiceUtil.updateStatus(userId, classPK, status, serviceContext);
}

From source file:com.liferay.portlet.wiki.workflow.WikiPageWorkflowHandler.java

License:Open Source License

public WikiPage updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    WikiPage page = WikiPageLocalServiceUtil.getPageByPageId(classPK);

    return WikiPageLocalServiceUtil.updateStatus(userId, page, status, serviceContext);
}

From source file:com.liferay.wiki.web.internal.workflow.WikiPageWorkflowHandler.java

License:Open Source License

@Override
public WikiPage updateStatus(int status, Map<String, Serializable> workflowContext) throws PortalException {

    long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
    long classPK = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    WikiPage page = _wikiPageLocalService.getPageByPageId(classPK);

    return _wikiPageLocalService.updateStatus(userId, page, status, serviceContext, workflowContext);
}

From source file:com.rivetlogic.elasticsearch.portlet.util.ElasticsearchPortletHelper.java

License:Open Source License

/**
 * This method prepares a Boolean filter builder with respective facet selections from Resource request object.
 *
 * @param request the request// w ww .  java  2 s  . co  m
 * @return the bool filter builder
 */
private BoolFilterBuilder prepareBoolFilterBuilder(ResourceRequest request) {

    /**Set a filter to get suggestions with Status Approved (0) */
    BoolFilterBuilder boolFilterBuilder = FilterBuilders.boolFilter().must(
            FilterBuilders.termFilter(ElasticsearchPortletConstants.STATUS, WorkflowConstants.STATUS_APPROVED));

    /** Iterate over Suggestion excluded index types and add to Boolfilter. Since these are excluded, mustNot filter should be used */
    for (Iterator<String> iterator = propsValues.getSuggestionExcludedTypes().iterator(); iterator.hasNext();) {
        boolFilterBuilder.mustNot(FilterBuilders.typeFilter(iterator.next()));
    }

    /** Process facet selections and apply appropriate filters here
    Apply UserId filter */
    long userId = ParamUtil.getLong(request, WorkflowConstants.CONTEXT_USER_ID);
    if (userId > ElasticsearchPortletConstants.INTEGER_ZERO_VALUE) {
        boolFilterBuilder.must(FilterBuilders.termFilter(WorkflowConstants.CONTEXT_USER_ID, userId));
    }

    /** Apply modified filter */
    String selectedRange = ParamUtil.getString(request, ElasticsearchPortletConstants.FILTER_MODIFIED);
    if (Validator.isNotNull(selectedRange) && !selectedRange.isEmpty()) {
        String[] rangeArray = fetchFromToValuesInRage(selectedRange);
        boolFilterBuilder.must(FilterBuilders.rangeFilter(ElasticsearchPortletConstants.FILTER_MODIFIED_DATE)
                .from(rangeArray[0].trim()).to(rangeArray[1].trim()));
    }

    /**  Apply AssetCategoryIds filter */
    long assetCategoryIds = ParamUtil.getLong(request, ElasticsearchPortletConstants.FILTER_ASSET_CATEGORY);
    if (assetCategoryIds > ElasticsearchPortletConstants.INTEGER_ZERO_VALUE) {
        boolFilterBuilder.must(FilterBuilders.termFilter(ElasticsearchPortletConstants.FILTER_ASSET_CATEGORY,
                assetCategoryIds));
    }

    /**  Apply FolderId filter */
    long folderId = ParamUtil.getLong(request, ElasticsearchPortletConstants.FILTER_FOLDERID);
    if (folderId > ElasticsearchPortletConstants.INTEGER_ZERO_VALUE) {
        boolFilterBuilder
                .must(FilterBuilders.termFilter(ElasticsearchPortletConstants.FILTER_FOLDERID, folderId));
    }

    /** Apply Site id filter */
    long groupId = ParamUtil.getLong(request, WorkflowConstants.CONTEXT_GROUP_ID);
    if (groupId != WorkflowConstants.DEFAULT_GROUP_ID) {
        boolFilterBuilder
                .must(FilterBuilders.termFilter(ElasticsearchPortletConstants.FILTER_SCOPE_GROUPID, groupId))
                .must(FilterBuilders.termFilter(WorkflowConstants.CONTEXT_GROUP_ID, groupId));
    }

    /**  Entryclassname is a special case since object is directly mapped to Index type in Elasticsearch.
     So instead of applying a filter, we use respective Entryclassname type */
    String selectedClassName = ParamUtil.getString(request, ElasticsearchPortletConstants.ENTRY_CLASSNAME);
    if (Validator.isNotNull(selectedClassName)) {
        /** Convert selectedClassName to index type by replacing . with _*/
        selectedClassName = selectedClassName.replace(StringPool.PERIOD, StringPool.UNDERLINE);
        boolFilterBuilder.must(FilterBuilders.typeFilter(selectedClassName));
    }
    return boolFilterBuilder;
}

From source file:org.portlets.lia.mine.workflow.IssueWorkflowHandler.java

License:Open Source License

public Object updateStatus(int status, Map<String, Serializable> workflowContext)
        throws PortalException, SystemException {

    long userId = GetterUtil.getLong(workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));

    long resourcePrimKey = GetterUtil.getLong(workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

    ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");

    return IssueLocalServiceUtil.updateStatus(userId, resourcePrimKey, status, serviceContext);
}