mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Renamed "work item" to "task"
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3634 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,20 +39,20 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Manage WorkItem" dialog.
|
||||
* Bean implementation for the "Manage Task" dialog.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class ManageWorkItemDialog extends BaseDialogBean
|
||||
public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
protected WorkflowService workflowService;
|
||||
protected Node workItemNode;
|
||||
protected WorkflowTask workItem;
|
||||
protected Node taskNode;
|
||||
protected WorkflowTask task;
|
||||
protected WorkflowInstance workflowInstance;
|
||||
protected WorkflowTransition[] transitions;
|
||||
protected NodeRef workflowPackage;
|
||||
protected List<Node> resources;
|
||||
protected WorkItemCompleteResolver completeResolver = new WorkItemCompleteResolver();
|
||||
protected TaskCompleteResolver completeResolver = new TaskCompleteResolver();
|
||||
protected UIRichList packageItemsRichList;
|
||||
protected List<String> packageItemsToAdd;
|
||||
protected List<String> packageItemsToRemove;
|
||||
@@ -62,7 +62,7 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
protected static final String ID_PREFIX = "transition_";
|
||||
protected static final String CLIENT_ID_PREFIX = "dialog:" + ID_PREFIX;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ManageWorkItemDialog.class);
|
||||
private static final Log logger = LogFactory.getLog(ManageTaskDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
@@ -73,8 +73,8 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
super.init(parameters);
|
||||
|
||||
// reset variables
|
||||
this.workItem = null;
|
||||
this.workItemNode = null;
|
||||
this.task = null;
|
||||
this.taskNode = null;
|
||||
this.workflowInstance = null;
|
||||
this.transitions = null;
|
||||
this.workflowPackage = null;
|
||||
@@ -90,20 +90,20 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
|
||||
// get the task details
|
||||
String taskId = this.parameters.get("id");
|
||||
this.workItem = this.workflowService.getTaskById(taskId);
|
||||
this.task = this.workflowService.getTaskById(taskId);
|
||||
|
||||
if (this.workItem != null)
|
||||
if (this.task != null)
|
||||
{
|
||||
// setup a transient node to represent the work item we're managing
|
||||
WorkflowTaskDefinition taskDef = this.workItem.definition;
|
||||
this.workItemNode = new TransientNode(taskDef.metadata.getName(),
|
||||
"task_" + System.currentTimeMillis(), this.workItem.properties);
|
||||
// setup a transient node to represent the task we're managing
|
||||
WorkflowTaskDefinition taskDef = this.task.definition;
|
||||
this.taskNode = new TransientNode(taskDef.metadata.getName(),
|
||||
"task_" + System.currentTimeMillis(), this.task.properties);
|
||||
|
||||
// get access to the workflow instance for the work item
|
||||
this.workflowInstance = this.workItem.path.instance;
|
||||
// get access to the workflow instance for the task
|
||||
this.workflowInstance = this.task.path.instance;
|
||||
|
||||
// setup the workflow package for the task
|
||||
Serializable obj = this.workItem.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
||||
Serializable obj = this.task.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
||||
// TODO: remove this workaroud where JBPM may return a String and not the NodeRef
|
||||
if (obj instanceof NodeRef)
|
||||
{
|
||||
@@ -115,8 +115,8 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found workflow package for work item '" +
|
||||
this.workItem.id + "': " + this.workflowPackage );
|
||||
logger.debug("Found workflow package for task '" +
|
||||
this.task.id + "': " + this.workflowPackage );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saving task: " + this.workItem.id);
|
||||
logger.debug("Saving task: " + this.task.id);
|
||||
|
||||
// prepare the edited parameters for saving
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareWorkItemParams(this.workItemNode);
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.taskNode);
|
||||
|
||||
// remove any items the user selected to remove
|
||||
if (this.workflowPackage != null && this.packageItemsToRemove != null &&
|
||||
@@ -155,7 +155,7 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
}
|
||||
|
||||
// update the task with the updated parameters
|
||||
this.workflowService.updateTask(this.workItem.id, params, null, null);
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
@@ -165,11 +165,11 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
{
|
||||
List<DialogButtonConfig> buttons = null;
|
||||
|
||||
if (this.workItem != null)
|
||||
if (this.task != null)
|
||||
{
|
||||
// get the transitions available from this work item and
|
||||
// get the transitions available from this task and
|
||||
// show them in the dialog as additional buttons
|
||||
this.transitions = this.workItem.path.node.transitions;
|
||||
this.transitions = this.task.path.node.transitions;
|
||||
|
||||
if (this.transitions != null)
|
||||
{
|
||||
@@ -207,7 +207,7 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
String outcome = getDefaultFinishOutcome();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Transitioning work item: " + this.workItemNode.getId());
|
||||
logger.debug("Transitioning task: " + this.taskNode.getId());
|
||||
|
||||
// to find out which transition button was pressed we need
|
||||
// to look for the button's id in the request parameters,
|
||||
@@ -237,19 +237,19 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
tx.begin();
|
||||
|
||||
// prepare the edited parameters for saving
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareWorkItemParams(this.workItemNode);
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.taskNode);
|
||||
|
||||
// update the task with the updated parameters
|
||||
this.workflowService.updateTask(this.workItem.id, params, null, null);
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
|
||||
// signal the selected transition to the workflow task
|
||||
this.workflowService.endTask(this.workItem.id, selectedTransition);
|
||||
this.workflowService.endTask(this.task.id, selectedTransition);
|
||||
|
||||
// commit the changes
|
||||
tx.commit();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Ended work item with transition: " + selectedTransition);
|
||||
logger.debug("Ended task with transition: " + selectedTransition);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
@@ -428,13 +428,13 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Node representing the work item
|
||||
* Returns the Node representing the task
|
||||
*
|
||||
* @return The node
|
||||
*/
|
||||
public Node getWorkItemNode()
|
||||
public Node getTaskNode()
|
||||
{
|
||||
return this.workItemNode;
|
||||
return this.taskNode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -454,7 +454,7 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
*/
|
||||
public String getPackageActionGroup()
|
||||
{
|
||||
return (String)this.workItem.properties.get(
|
||||
return (String)this.task.properties.get(
|
||||
WorkflowModel.PROP_PACKAGE_ACTION_GROUP);
|
||||
}
|
||||
|
||||
@@ -465,12 +465,12 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
*/
|
||||
public String getPackageItemActionGroup()
|
||||
{
|
||||
return (String)this.workItem.properties.get(
|
||||
return (String)this.task.properties.get(
|
||||
WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of resources associated with this work item
|
||||
* Returns a list of resources associated with this task
|
||||
* i.e. the children of the workflow package
|
||||
*
|
||||
* @return The list of nodes
|
||||
@@ -568,7 +568,7 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
}
|
||||
else if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Failed to find workflow package for work item: " + this.workItem.id);
|
||||
logger.debug("Failed to find workflow package for task: " + this.task.id);
|
||||
}
|
||||
|
||||
return this.resources;
|
||||
@@ -610,13 +610,13 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
||||
/**
|
||||
* Property resolver to determine if the given node has been flagged as complete
|
||||
*/
|
||||
protected class WorkItemCompleteResolver implements NodePropertyResolver
|
||||
protected class TaskCompleteResolver implements NodePropertyResolver
|
||||
{
|
||||
public Object get(Node node)
|
||||
{
|
||||
String result = Application.getMessage(FacesContext.getCurrentInstance(), "no");
|
||||
|
||||
List<NodeRef> completedItems = (List<NodeRef>)workItem.properties.get(
|
||||
List<NodeRef> completedItems = (List<NodeRef>)task.properties.get(
|
||||
WorkflowModel.PROP_COMPLETED_ITEMS);
|
||||
|
||||
if (completedItems != null && completedItems.size() > 0 &&
|
@@ -29,18 +29,18 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Reassign Work Item" dialog
|
||||
* Bean implementation for the "Reassign Task" dialog
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
public class ReassignTaskDialog extends BaseDialogBean
|
||||
{
|
||||
protected String workItemId;
|
||||
protected String taskId;
|
||||
|
||||
protected WorkflowService workflowService;
|
||||
protected PersonService personService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ReassignWorkItemDialog.class);
|
||||
private static final Log logger = LogFactory.getLog(ReassignTaskDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
@@ -50,10 +50,10 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
this.workItemId = this.parameters.get("workitem-id");
|
||||
if (this.workItemId == null || this.workItemId.length() == 0)
|
||||
this.taskId = this.parameters.get("task-id");
|
||||
if (this.taskId == null || this.taskId.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Reassign workitem dialog called without task id");
|
||||
throw new IllegalArgumentException("Reassign task dialog called without task id");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Reassigning work item with id: " + this.workItemId);
|
||||
logger.debug("Reassigning task with id: " + this.taskId);
|
||||
|
||||
UIComponent picker = context.getViewRoot().findComponent("dialog:dialog-body:user-picker");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
String userName = user[0];
|
||||
Map<QName, Serializable> params = new HashMap<QName, Serializable>(1);
|
||||
params.put(ContentModel.PROP_OWNER, userName);
|
||||
this.workflowService.updateTask(this.workItemId, params, null, null);
|
||||
this.workflowService.updateTask(this.taskId, params, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -91,7 +91,7 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Reassigning work item with id: " + this.workItemId);
|
||||
logger.debug("Reassigning task with id: " + this.taskId);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
@Override
|
||||
protected String getErrorMessageId()
|
||||
{
|
||||
return "error_reassign_workitem";
|
||||
return "error_reassign_task";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
@@ -115,7 +115,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
logger.debug("Starting workflow: " + this.selectedWorkflow);
|
||||
|
||||
// prepare the parameters from the current state of the property sheet
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareWorkItemParams(this.startTaskNode);
|
||||
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.startTaskNode);
|
||||
|
||||
// create a workflow package for the attached items and add them
|
||||
if (this.packageItemsToAdd.size() > 0)
|
||||
@@ -472,7 +472,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of resources associated with this work item
|
||||
* Returns a list of resources associated with this task
|
||||
* i.e. the children of the workflow package
|
||||
*
|
||||
* @return The list of nodes
|
||||
|
@@ -39,8 +39,8 @@ public class WorkflowBean
|
||||
{
|
||||
protected NodeService nodeService;
|
||||
protected WorkflowService workflowService;
|
||||
protected List<Node> workItems;
|
||||
protected List<Node> completedWorkItems;
|
||||
protected List<Node> tasks;
|
||||
protected List<Node> completedTasks;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(WorkflowBean.class);
|
||||
|
||||
@@ -48,12 +48,12 @@ public class WorkflowBean
|
||||
// Bean Getters and Setters
|
||||
|
||||
/**
|
||||
* Returns a list of nodes representing the to do work items the
|
||||
* Returns a list of nodes representing the to do tasks the
|
||||
* current user has.
|
||||
*
|
||||
* @return List of to do work items
|
||||
* @return List of to do tasks
|
||||
*/
|
||||
public List<Node> getWorkItemsToDo()
|
||||
public List<Node> getTasksToDo()
|
||||
{
|
||||
// get the current username
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
@@ -71,14 +71,14 @@ public class WorkflowBean
|
||||
userName, WorkflowTaskState.IN_PROGRESS);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
this.workItems = new ArrayList<Node>(tasks.size());
|
||||
this.tasks = new ArrayList<Node>(tasks.size());
|
||||
for (WorkflowTask task : tasks)
|
||||
{
|
||||
Node node = createWorkItem(task);
|
||||
this.workItems.add(node);
|
||||
Node node = createTask(task);
|
||||
this.tasks.add(node);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Added to do work item: " + node);
|
||||
logger.debug("Added to do task: " + node);
|
||||
}
|
||||
|
||||
// commit the changes
|
||||
@@ -88,19 +88,19 @@ public class WorkflowBean
|
||||
{
|
||||
// rollback the transaction
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||
Utils.addErrorMessage("Failed to get to do work items: " + e.toString(), e);
|
||||
Utils.addErrorMessage("Failed to get to do tasks: " + e.toString(), e);
|
||||
}
|
||||
|
||||
return this.workItems;
|
||||
return this.tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of nodes representing the completed work items the
|
||||
* Returns a list of nodes representing the completed tasks the
|
||||
* current user has.
|
||||
*
|
||||
* @return List of completed work items
|
||||
* @return List of completed tasks
|
||||
*/
|
||||
public List<Node> getWorkItemsCompleted()
|
||||
public List<Node> getTasksCompleted()
|
||||
{
|
||||
// get the current username
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
@@ -118,14 +118,14 @@ public class WorkflowBean
|
||||
userName, WorkflowTaskState.COMPLETED);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
this.completedWorkItems = new ArrayList<Node>(tasks.size());
|
||||
this.completedTasks = new ArrayList<Node>(tasks.size());
|
||||
for (WorkflowTask task : tasks)
|
||||
{
|
||||
Node node = createWorkItem(task);
|
||||
this.completedWorkItems.add(node);
|
||||
Node node = createTask(task);
|
||||
this.completedTasks.add(node);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Added completed work item: " + node);
|
||||
logger.debug("Added completed task: " + node);
|
||||
}
|
||||
|
||||
// commit the changes
|
||||
@@ -135,10 +135,10 @@ public class WorkflowBean
|
||||
{
|
||||
// rollback the transaction
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||
Utils.addErrorMessage("Failed to get completed work items: " + e.toString(), e);
|
||||
Utils.addErrorMessage("Failed to get completed tasks: " + e.toString(), e);
|
||||
}
|
||||
|
||||
return this.completedWorkItems;
|
||||
return this.completedTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ public class WorkflowBean
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
public static Map<QName, Serializable> prepareWorkItemParams(Node node)
|
||||
public static Map<QName, Serializable> prepareTaskParams(Node node)
|
||||
{
|
||||
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
|
||||
|
||||
@@ -211,7 +211,7 @@ public class WorkflowBean
|
||||
*
|
||||
* @param task The task to create a representation of
|
||||
*/
|
||||
protected TransientMapNode createWorkItem(WorkflowTask task)
|
||||
protected TransientMapNode createTask(WorkflowTask task)
|
||||
{
|
||||
// get the type of the task
|
||||
WorkflowTaskDefinition taskDef = task.definition;
|
||||
|
Reference in New Issue
Block a user