Added getTaskDefinitions to WorkflowService - required for delete model validation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6693 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2007-09-06 17:10:39 +00:00
parent 018f8eb9c0
commit ab85be5821
5 changed files with 90 additions and 0 deletions

View File

@@ -106,6 +106,7 @@ import org.jbpm.job.Timer;
import org.jbpm.jpdl.par.ProcessArchive;
import org.jbpm.jpdl.xml.Problem;
import org.jbpm.taskmgmt.def.Task;
import org.jbpm.taskmgmt.def.TaskMgmtDefinition;
import org.jbpm.taskmgmt.exe.PooledActor;
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.springframework.util.StringUtils;
@@ -560,6 +561,51 @@ public class JBPMEngine extends BPMEngine
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.workflow.WorkflowComponent#getAllTaskDefinitions(java.lang.String)
*/
@SuppressWarnings("unchecked")
public List<WorkflowTaskDefinition> getTaskDefinitions(final String workflowDefinitionId)
{
try
{
return (List<WorkflowTaskDefinition>)jbpmTemplate.execute(new JbpmCallback()
{
public Object doInJbpm(JbpmContext context)
{
// retrieve process
GraphSession graphSession = context.getGraphSession();
ProcessDefinition processDefinition = getProcessDefinition(graphSession, workflowDefinitionId);
if (processDefinition == null)
{
return null;
}
else
{
String processName = processDefinition.getName();
if (tenantService.isEnabled())
{
tenantService.checkDomain(processName); // throws exception if domain mismatch
}
TaskMgmtDefinition taskMgmtDef = processDefinition.getTaskMgmtDefinition();
List<WorkflowTaskDefinition> workflowTaskDefs = new ArrayList<WorkflowTaskDefinition>();
for (Object task : taskMgmtDef.getTasks().values())
{
workflowTaskDefs.add(createWorkflowTaskDefinition((Task)task));
}
return (workflowTaskDefs.size() == 0) ? null : workflowTaskDefs;
}
}
});
}
catch(JbpmException e)
{
throw new WorkflowException("Failed to retrieve workflow task definitions for workflow definition '" + workflowDefinitionId + "'", e);
}
}
/**
* Gets a jBPM process definition
*