1

Steps to create kaleo workflow in custom portlet Liferay 6.1.1 GA2.

Hi, I am new to liferay. I am using Liferay 6.1.1 GA2 version. Can somebody please provide me the steps to create workflow in custom portlets with some workable samples.

Thanks in advance.

4

2 回答 2

9

在service.xml中添加有关您的工作流 portlet 的实体。

IE

<entity name="XXWorkflow" local-service="true" remote-service="false">

        <!-- PK fields -->
        <column name="workflowId" type="long" primary="true" />

        <!-- Foreign key columns -->
        <column name="XXd" type="long" />
        <column name="companyId" type="long" />
        <column name="groupId" type="long" />
        <column name="userId" type="long"/>

        <!-- Workflow fields -->

        <!-- Resource -->

        <column name="resourcePrimKey" type="long"></column>
        <column name="title" type="String"></column>
        <column name="status" type="int"></column>
        <column name="statusByUserId" type="long"></column>
        <column name="statusByUserName" type="String"></column>
        <column name="statusDate" type="Date"></column>

        <!-- Finder methods -->

        <finder name="ResourcePrimKey" return-type="RfpWorkflow">
            <finder-column name="resourcePrimKey"></finder-column>
        </finder>

        <finder name="Status" return-type="Collection">
            <finder-column name="status"></finder-column>
        </finder>

        <finder name="R_S" return-type="RfpWorkflow">
            <finder-column name="resourcePrimKey"></finder-column>
            <finder-column name="status"></finder-column>
        </finder>

        <!-- end of workflow columns and finders -->

        <finder return-type="Collection" name="XXId">
            <finder-column name="XXId"></finder-column>
        </finder>

        <reference package-path="com.liferay.portal" entity="WorkflowInstanceLink"></reference>
        <reference package-path="com.liferay.portlet.asset" entity="AssetEntry"></reference>
        <reference package-path="com.liferay.portlet.social" entity="SocialActivity"></reference>

    </entity>

你的jsp文件: -

submit button action url = "processAction"

控制器

public void processAction(ActionRequest request, ActionResponse response)
    throws Exception {

    //do your required stuff

    workflowInitiation(request,response,XX.getXXId(),XX.getXXName());

    }


public void workflowInitiation(ActionRequest actionRequest,
            ActionResponse actionResponse,long XXId,String XXName) throws IOException, PortletException {
        // TODO Auto-generated method stub

        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
                .getAttribute(WebKeys.THEME_DISPLAY);
            System.out.println("Title : " + XXName);
            XXWorkflowImpl xxWorkflow = new XXWorkflowImpl();
            XXWorkflow.setTitle(xxName);
            XXWorkflow.setxxId(xxpId);
            XXWorkflow.setCompanyId(themeDisplay.getCompanyId());
            XXWorkflow.setGroupId(themeDisplay.getScopeGroupId());
            ThemeDisplay themeDisplay1 = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

            ServiceContext serviceContext;
            try {
                serviceContext = ServiceContextFactory.getInstance(XXPortlet.class.getName(), actionRequest);

                XXWorkflowLocalServiceUtil.addXXWorkflow(XXWorkflow,serviceContext, themeDisplay1.getUserId());
            } catch (PortalException e) {               
                e.printStackTrace();
            } catch (SystemException e) {               
                e.printStackTrace();
            }   
    }

汉德尔类

    public class XXWorkflowHandler extends BaseWorkflowHandler {

    public static final String CLASS_NAME = XXWorkflow.class.getName();

    public String getClassName() {
        return CLASS_NAME;
    }

    public String getType(Locale locale) {
        return LanguageUtil.get(locale, "model.resource." + CLASS_NAME);
    }


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

        long userId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
        long resourcePrimKey = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
        ServiceContext serviceContext = (ServiceContext) workflowContext.get("serviceContext");
        return RfpWorkflowLocalServiceUtil.updateStatus(userId, resourcePrimKey,status, serviceContext);

    }

}

在 portlet-name 之后添加你的 liferay-portlet.xml

<workflow-handler>com.xx.RFPWorkflowHandler</workflow-handler>

高温高压

于 2013-07-25T11:35:29.937 回答
1

您可以在此处为 Liferay 6.2 的自定义 portlet 中找到 Kaleo 工作流程的代码

https://drive.google.com/file/d/0B9B1NsG0lyx6ZmE0UWJCdjk0Mmc/view?usp=sharing

您可以在此处的 Liferay 6.1 http://sourceforge.net/projects/meeralferay/files/LiferayWorkFlowPortlet/的自定义 portlet 中找到 Kaleo 工作流的代码

您可以在自定义 portlet 中找到更具体的 Kaleo 工作流示例,该示例将仅显示已批准的反馈列表。 https://drive.google.com/file/d/0B9B1NsG0lyx6a3ctUERFNENDTUU/view?usp=sharing

于 2014-11-04T07:35:16.057 回答