serviceTask, trying to parse class name programatically
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2014 04:12 PM
I'm building a UI for starting a process. I parse the process definition to know what metadata each step will need. I can't figure out how to get the class name for a service task programatically:
for (PvmActivity activity : processDefinition.getActivities()) {
String type = (String) activity.getProperty("type");
if (type == "userTask") {
….
} else if (type == "serviceTask") {
System.out.println(activity.getProperty("activiti:class"));
}
}
Any idea of how to get the serviceTask class name from the process definition? Depending on the service class, I will prompt the user for different metadata to add to the process variables.
Thanks,
Ryan
for (PvmActivity activity : processDefinition.getActivities()) {
String type = (String) activity.getProperty("type");
if (type == "userTask") {
….
} else if (type == "serviceTask") {
System.out.println(activity.getProperty("activiti:class"));
}
}
Any idea of how to get the serviceTask class name from the process definition? Depending on the service class, I will prompt the user for different metadata to add to the process variables.
Thanks,
Ryan
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 02:02 AM
Hi Ryan,
you can get the class name of a service task from BpmnModel of the process:
<java>
BpmnModel bpmnModel = repositoryService.getBpmnModel(PROCESS_DEFINITION_ID);
for (Process process : bpmnModel.getProcesses())
{
for (FlowElement flowElement : process.getFlowElements())
{
if(flowElement instanceof ServiceTask){
ServiceTask serviceTask = (ServiceTask) flowElement;
String className = serviceTask.getImplementation();
// do something…
}
}
}
</java>
you can get the class name of a service task from BpmnModel of the process:
<java>
BpmnModel bpmnModel = repositoryService.getBpmnModel(PROCESS_DEFINITION_ID);
for (Process process : bpmnModel.getProcesses())
{
for (FlowElement flowElement : process.getFlowElements())
{
if(flowElement instanceof ServiceTask){
ServiceTask serviceTask = (ServiceTask) flowElement;
String className = serviceTask.getImplementation();
// do something…
}
}
}
</java>