Performance improvement for GET workflow-instances REST API.

Added "priority" and "dueDate" to WorkflowInstance object, which means a query for the workflow start task is no longer required to retrieve this information. A query was previously being done for every row in the results.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22210 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2010-09-02 21:17:57 +00:00
parent 0d052c414e
commit b184b46d7d
2 changed files with 24 additions and 0 deletions

View File

@@ -2898,6 +2898,8 @@ public class JBPMEngine extends BPMEngine
WorkflowInstance workflowInstance = new WorkflowInstance(); WorkflowInstance workflowInstance = new WorkflowInstance();
workflowInstance.id = createGlobalId(new Long(instance.getId()).toString()); workflowInstance.id = createGlobalId(new Long(instance.getId()).toString());
workflowInstance.description = (String)instance.getContextInstance().getVariable(mapQNameToName(WorkflowModel.PROP_WORKFLOW_DESCRIPTION)); workflowInstance.description = (String)instance.getContextInstance().getVariable(mapQNameToName(WorkflowModel.PROP_WORKFLOW_DESCRIPTION));
workflowInstance.priority = (Integer)instance.getContextInstance().getVariable(mapQNameToName(WorkflowModel.PROP_WORKFLOW_PRIORITY));
workflowInstance.dueDate = (Date)instance.getContextInstance().getVariable(mapQNameToName(WorkflowModel.PROP_WORKFLOW_DUE_DATE));
workflowInstance.definition = createWorkflowDefinition(instance.getProcessDefinition()); workflowInstance.definition = createWorkflowDefinition(instance.getProcessDefinition());
workflowInstance.active = !instance.hasEnded(); workflowInstance.active = !instance.hasEnded();
JBPMNode initiator = (JBPMNode)instance.getContextInstance().getVariable("initiator"); JBPMNode initiator = (JBPMNode)instance.getContextInstance().getVariable("initiator");

View File

@@ -47,9 +47,15 @@ public class WorkflowInstance implements Serializable
/** Initiator (cm:person) - null if System initiated */ /** Initiator (cm:person) - null if System initiated */
public NodeRef initiator; public NodeRef initiator;
/** Workflow priority */
public Integer priority;
/** Workflow Start Date */ /** Workflow Start Date */
public Date startDate; public Date startDate;
/** Workflow Due Date */
public Date dueDate;
/** Workflow End Date */ /** Workflow End Date */
public Date endDate; public Date endDate;
@@ -102,6 +108,14 @@ public class WorkflowInstance implements Serializable
return initiator; return initiator;
} }
/**
* @return the priority, null if there is no priority set
*/
public Integer getPriority()
{
return this.priority;
}
/** /**
* @return the startDate * @return the startDate
*/ */
@@ -109,6 +123,14 @@ public class WorkflowInstance implements Serializable
{ {
return startDate; return startDate;
} }
/**
* @return the dueDate
*/
public Date getDueDate()
{
return dueDate;
}
/** /**
* @return the endDate * @return the endDate