04-17-2017 11:13 AM
I implement the TaskListener, i gotr the exception while task being created.
code are
long workflowTaskId=0l;
long compId=0l;
@Override
public void notify(DelegateTask arg0) {
// TODO Auto-generated method stub
workflowTaskId=Long.parseLong(arg0.getId());
compId=Long.parseLong(arg0.getTenantId());
System.out.println("Company ID "+compId);
System.out.println("%%%%%%%Activiti Working*****************"+ arg0.getProcessInstanceId()+" "+arg0.getName()+arg0.getId());
getMethod();
}
private void getMethod(){
try{
Company company = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
//compId = company.getGroup().getGroupId();
}catch(PortalException e){}
catch (SystemException se) {
// TODO: handle exception
}
try{
System.out.println("workflowTaskId "+workflowTaskId);
System.out.println(WorkflowTaskManagerUtil.getWorkflowTask(compId, workflowTaskId));
System.out.println(WorkflowTaskManagerUtil.getWorkflowTask(compId, workflowTaskId).getOptionalAttributes());
System.out.println(WorkflowTaskManagerUtil.getWorkflowTask(compId, workflowTaskId).getOptionalAttributes().get("entryClassPK"));
String classPk= WorkflowTaskManagerUtil.getWorkflowTask(compId, workflowTaskId).getOptionalAttributes().get("entryClassPK").toString();
System.out.println("classPk "+classPk);
long fileEntryId=DLFileVersionLocalServiceUtil.getFileVersion(Long.parseLong(classPk)).getFileEntryId();
System.out.println("fileEntryId "+fileEntryId);
String name=DLFileVersionLocalServiceUtil.getFileVersion(Long.parseLong(classPk)).getTitle();
System.out.println("name "+name);
long chapfoldId=DLFileVersionLocalServiceUtil.getFileVersion(Long.parseLong(classPk)).getFolderId();
System.out.println("chapfoldId "+chapfoldId);
long bkfoldId=DLFolderLocalServiceUtil.fetchFolder(chapfoldId).getParentFolderId();
System.out.println("MytaskcreateListener Called \nworkflowTaskId "+workflowTaskId+"\nclassPk "+classPk+"\nfileEntryId "+fileEntryId+"\tname " +name+"\tbook "+bkfoldId );
}catch(PortalException p){}
catch (SystemException see) {
// TODO: handle exception
}
}
}
04-17-2017 12:16 PM
04-18-2017 12:07 AM
event : create
the Bpmn's xml code
<userTask id="usertask1" name="Update Due Date" activiti:candidateGroups="Administrator,Power User">
<extensionElements>
<activiti:taskListener event="create" class="com.library.model.listeners.MyTaskCreateListener" />
</extensionElements>
</userTask>
04-18-2017 10:52 AM
04-19-2017 12:39 AM
String classPk= WorkflowTaskManagerUtil.getWorkflowTask(compId, workflowTaskId).getOptionalAttributes().get("entryClassPK").toString();
The above mentioned line make NPE, and give warning is cannot find taskId
04-19-2017 12:58 PM
04-20-2017 02:53 AM
The populated workflowTaskId is a valid id, its confirmed
04-20-2017 07:35 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.