Example usage for com.liferay.portal.kernel.workflow WorkflowHandlerRegistryUtil startWorkflowInstance

List of usage examples for com.liferay.portal.kernel.workflow WorkflowHandlerRegistryUtil startWorkflowInstance

Introduction

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

Prototype

public static <T> T startWorkflowInstance(final long companyId, final long groupId, final long userId,
            String className, final long classPK, final T model, ServiceContext serviceContext,
            Map<String, Serializable> workflowContext) throws PortalException 

Source Link

Usage

From source file:com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.java

License:Open Source License

protected BlogsEntry startWorkflowInstance(long userId, BlogsEntry entry, ServiceContext serviceContext)
        throws PortalException {

    Map<String, Serializable> workflowContext = new HashMap<>();

    workflowContext.put(WorkflowConstants.CONTEXT_URL, getEntryURL(entry, serviceContext));

    String userPortraitURL = StringPool.BLANK;
    String userURL = StringPool.BLANK;

    if (serviceContext.getThemeDisplay() != null) {
        User user = userPersistence.findByPrimaryKey(userId);

        userPortraitURL = user.getPortraitURL(serviceContext.getThemeDisplay());
        userURL = user.getDisplayURL(serviceContext.getThemeDisplay());
    }/*from w w  w .  j  a v a 2  s  . c  o m*/

    workflowContext.put(WorkflowConstants.CONTEXT_USER_PORTRAIT_URL, userPortraitURL);
    workflowContext.put(WorkflowConstants.CONTEXT_USER_URL, userURL);

    return WorkflowHandlerRegistryUtil.startWorkflowInstance(entry.getCompanyId(), entry.getGroupId(), userId,
            BlogsEntry.class.getName(), entry.getEntryId(), entry, serviceContext, workflowContext);
}

From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java

License:Open Source License

protected void startWorkflowInstance(long userId, JournalArticle article, ServiceContext serviceContext)
        throws PortalException {

    Map<String, Serializable> workflowContext = new HashMap<>();

    WorkflowHandlerRegistryUtil.startWorkflowInstance(article.getCompanyId(), article.getGroupId(), userId,
            JournalArticle.class.getName(), article.getId(), article, serviceContext, workflowContext);
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppHelperLocalServiceImpl.java

License:Open Source License

public void addFileEntry(long userId, FileEntry fileEntry, FileVersion fileVersion,
        ServiceContext serviceContext) throws PortalException, SystemException {

    updateAsset(userId, fileEntry, fileVersion, serviceContext.getAssetCategoryIds(),
            serviceContext.getAssetTagNames(), serviceContext.getAssetLinkEntryIds());

    if (PropsValues.DL_FILE_ENTRY_COMMENTS_ENABLED) {
        mbMessageLocalService.addDiscussionMessage(fileEntry.getUserId(), fileEntry.getUserName(),
                fileEntry.getGroupId(), DLFileEntryConstants.getClassName(), fileEntry.getFileEntryId(),
                WorkflowConstants.ACTION_PUBLISH);
    }/*from ww  w . ja  v a2  s .  c  o m*/

    if (fileVersion instanceof LiferayFileVersion) {
        DLFileVersion dlFileVersion = (DLFileVersion) fileVersion.getModel();

        Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();

        workflowContext.put("event", DLSyncConstants.EVENT_ADD);

        WorkflowHandlerRegistryUtil.startWorkflowInstance(dlFileVersion.getCompanyId(),
                dlFileVersion.getGroupId(), userId, DLFileEntry.class.getName(),
                dlFileVersion.getFileVersionId(), dlFileVersion, serviceContext, workflowContext);
    }

    registerDLProcessorCallback(fileEntry);
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.java

License:Open Source License

protected void startWorkflowInstance(long userId, ServiceContext serviceContext, DLFileVersion dlFileVersion,
        String syncEventType) throws PortalException, SystemException {

    Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();

    workflowContext.put("event", syncEventType);

    WorkflowHandlerRegistryUtil.startWorkflowInstance(dlFileVersion.getCompanyId(), dlFileVersion.getGroupId(),
            userId, DLFileEntry.class.getName(), dlFileVersion.getFileVersionId(), dlFileVersion,
            serviceContext, workflowContext);
}

From source file:com.liferay.portlet.documentlibrary.util.DLImpl.java

License:Open Source License

@Override
public void startWorkflowInstance(long userId, DLFileVersion dlFileVersion, String syncEventType,
        ServiceContext serviceContext) throws PortalException {

    Map<String, Serializable> workflowContext = new HashMap<>();

    workflowContext.put(WorkflowConstants.CONTEXT_URL, getEntryURL(dlFileVersion, serviceContext));
    workflowContext.put("event", syncEventType);

    WorkflowHandlerRegistryUtil.startWorkflowInstance(dlFileVersion.getCompanyId(), dlFileVersion.getGroupId(),
            userId, DLFileEntryConstants.getClassName(), dlFileVersion.getFileVersionId(), dlFileVersion,
            serviceContext, workflowContext);
}

From source file:com.liferay.wiki.service.impl.WikiPageLocalServiceImpl.java

License:Open Source License

protected WikiPage startWorkflowInstance(long userId, WikiPage page, ServiceContext serviceContext)
        throws PortalException {

    Map<String, Serializable> workflowContext = new HashMap<>();

    workflowContext.put(WorkflowConstants.CONTEXT_COMMAND, serviceContext.getCommand());
    workflowContext.put(WorkflowConstants.CONTEXT_URL, getPageURL(page, serviceContext));

    return WorkflowHandlerRegistryUtil.startWorkflowInstance(page.getCompanyId(), page.getGroupId(), userId,
            WikiPage.class.getName(), page.getPageId(), page, serviceContext, workflowContext);
}

From source file:org.un.ldcportal.ismapplications.service.impl.ISMApplicationLocalServiceImpl.java

License:Open Source License

public ISMApplication addISMApplication(ISMApplication newISMApplication, long userId,
        ServiceContext serviceContext) throws SystemException, PortalException {

    ISMApplication ismApplication = ismApplicationPersistence
            .create(counterLocalService.increment(ISMApplication.class.getName()));

    ismApplication.setCompanyId(newISMApplication.getCompanyId());
    ismApplication.setGroupId(newISMApplication.getGroupId());
    ismApplication.setUserId(serviceContext.getUserId());
    ismApplication.setApplicationReason(newISMApplication.getApplicationReason());
    ismApplication.setApplicationAdditional(newISMApplication.getApplicationAdditional());
    ismApplication.setIsmId(newISMApplication.getIsmId());
    ismApplication.setStatus(WorkflowConstants.STATUS_DRAFT);

    ismApplicationPersistence.update(ismApplication, false);

    resourceLocalService.addResources(newISMApplication.getCompanyId(), newISMApplication.getGroupId(), userId,
            ISMApplication.class.getName(), ismApplication.getPrimaryKey(), false, true, true);

    assetEntryLocalService.updateEntry(userId, ismApplication.getGroupId(), ISMApplication.class.getName(),
            ismApplication.getIsmApplicationId(), serviceContext.getAssetCategoryIds(),
            serviceContext.getAssetTagNames());

    // Workflow/*from   w ww .  ja  v a2 s.c o  m*/
    long moderatorId = ismLocalService.getISM(newISMApplication.getIsmId()).getModeratorId();

    Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();
    workflowContext.put(ISM_MODERATOR_ID, moderatorId);

    WorkflowHandlerRegistryUtil.startWorkflowInstance(ismApplication.getCompanyId(),
            ismApplication.getGroupId(), userId, ISMApplication.class.getName(), ismApplication.getPrimaryKey(),
            ismApplication, serviceContext, workflowContext);

    return ismApplication;
}