在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>
高温高压