List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants DEFAULT_GROUP_ID
long DEFAULT_GROUP_ID
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants DEFAULT_GROUP_ID.
Click Source Link
From source file:com.liferay.invitation.invite.members.service.impl.MemberRequestLocalServiceImpl.java
License:Open Source License
protected String getCreateAccountURL(MemberRequest memberRequest, ServiceContext serviceContext) throws PortalException { String createAccountURL = (String) serviceContext.getAttribute("createAccountURL"); if (Validator.isNull(createAccountURL)) { createAccountURL = serviceContext.getPortalURL(); }//from ww w.j a v a2 s. c o m if (!workflowDefinitionLinkLocalService.hasWorkflowDefinitionLink(memberRequest.getCompanyId(), WorkflowConstants.DEFAULT_GROUP_ID, User.class.getName(), 0)) { String redirectURL = getRedirectURL(serviceContext); redirectURL = addParameterWithPortletNamespace(redirectURL, "key", memberRequest.getKey()); createAccountURL = addParameterWithPortletNamespace(createAccountURL, "redirect", redirectURL); } return createAccountURL; }
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/*from w w w. ja v a2s . c om*/ * @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:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java
License:Open Source License
@Override public WorkflowInstance startWorkflowInstance(String workflowDefinitionName, Integer workflowDefinitionVersion, final String transitionName, Map<String, Serializable> workflowContext, ServiceContext serviceContext) throws WorkflowException { fLogger.println("WorkflowEngine.startWorkflowInstance"); fLogger.println("\tworkflowDefinitionName: " + workflowDefinitionName); fLogger.println("\tworkflowDefinitionVersion: " + workflowDefinitionVersion); fLogger.println("\ttransitionName: " + transitionName); fLogger.println("\tworkflowContext:"); logMap(workflowContext, "\t\t"); fLogger.println("\tserviceContext:"); logServiceContext(serviceContext, "\t\t"); try {/*from ww w. j ava 2 s. c o m*/ KaleoDefinition kaleoDefinition = kaleoDefinitionLocalService.getKaleoDefinition(workflowDefinitionName, workflowDefinitionVersion, serviceContext); if (!kaleoDefinition.isActive()) { throw new WorkflowException("Inactive workflow definition with name " + workflowDefinitionName + " and version " + workflowDefinitionVersion); } KaleoNode kaleoStartNode = kaleoDefinition.getKaleoStartNode(); if (Validator.isNotNull(transitionName)) { // Validate that the transition actually exists before moving // forward kaleoStartNode.getKaleoTransition(transitionName); } long scopeGroupId = serviceContext.getScopeGroupId(); if (scopeGroupId != WorkflowConstants.DEFAULT_GROUP_ID) { Group group = _groupLocalService.getGroup(scopeGroupId); if (group.isLayout()) { group = _groupLocalService.getGroup(group.getParentGroupId()); serviceContext.setScopeGroupId(group.getGroupId()); } } KaleoInstance kaleoInstance = kaleoInstanceLocalService.addKaleoInstance( kaleoDefinition.getKaleoDefinitionId(), kaleoDefinition.getName(), kaleoDefinition.getVersion(), workflowContext, serviceContext); KaleoInstanceToken rootKaleoInstanceToken = kaleoInstance.getRootKaleoInstanceToken(workflowContext, serviceContext); rootKaleoInstanceToken.setCurrentKaleoNode(kaleoStartNode); kaleoLogLocalService.addWorkflowInstanceStartKaleoLog(rootKaleoInstanceToken, serviceContext); final ExecutionContext executionContext = new ExecutionContext(rootKaleoInstanceToken, workflowContext, serviceContext); TransactionCommitCallbackUtil.registerCallback(new Callable<Void>() { @Override public Void call() throws Exception { try { _kaleoSignaler.signalEntry(transitionName, executionContext); } catch (Exception e) { throw new WorkflowException("Unable to start workflow", e); } return null; } }); WorkflowInstance instance = _kaleoWorkflowModelConverter.toWorkflowInstance(kaleoInstance, rootKaleoInstanceToken, workflowContext); fLogger.println("\tRETURN instance:"); logWfInstance(instance, "\t\t"); fLogger.flush(); return instance; } catch (Exception e) { throw new WorkflowException(e); } }