mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- Another workflow checkpoint
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3596 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -868,6 +868,7 @@ title_my_alfresco=My Alfresco
|
|||||||
dashboard_info=My Alfresco Dashboard
|
dashboard_info=My Alfresco Dashboard
|
||||||
dashboard_description=Configure this view and build your personal Alfresco dashboard
|
dashboard_description=Configure this view and build your personal Alfresco dashboard
|
||||||
configure=Configure
|
configure=Configure
|
||||||
|
error_dashboard=An error occurred in one of the dashlets.
|
||||||
|
|
||||||
# My Alfresco Layout Manager wizard messages
|
# My Alfresco Layout Manager wizard messages
|
||||||
configure_dashboard_title=Configure Dashboard Wizard
|
configure_dashboard_title=Configure Dashboard Wizard
|
||||||
@@ -945,6 +946,9 @@ manage_workitem_desc=This dialog allows the work item to be managed
|
|||||||
workitem_properties=Work Item Properties
|
workitem_properties=Work Item Properties
|
||||||
id=Id
|
id=Id
|
||||||
status=Status
|
status=Status
|
||||||
|
completed=Completed
|
||||||
|
source=Source
|
||||||
|
priority=Priority
|
||||||
my_workitems_todo_title=My Work Items To Do
|
my_workitems_todo_title=My Work Items To Do
|
||||||
my_workitems_todo_desc=List of your workflow items still to complete
|
my_workitems_todo_desc=List of your workflow items still to complete
|
||||||
my_workitems_completed_title=My Completed Work Items
|
my_workitems_completed_title=My Completed Work Items
|
||||||
@@ -953,7 +957,7 @@ due_date=Due Date
|
|||||||
completed_on=Completed on
|
completed_on=Completed on
|
||||||
outcome=Outcome
|
outcome=Outcome
|
||||||
reassign=Reassign
|
reassign=Reassign
|
||||||
|
cancel_workflow=Cancel Workflow
|
||||||
|
|
||||||
# Admin Console messages
|
# Admin Console messages
|
||||||
title_admin_console=Administration Console
|
title_admin_console=Administration Console
|
||||||
|
@@ -15,10 +15,21 @@
|
|||||||
</property-sheet>
|
</property-sheet>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
|
<config evaluator="node-type" condition="wf:reviewTask">
|
||||||
|
<property-sheet>
|
||||||
|
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||||
|
<show-property name="bpm:taskId" ignore-if-missing="false" />
|
||||||
|
<show-property name="bpm:startDate" ignore-if-missing="false" />
|
||||||
|
<show-property name="bpm:status" ignore-if-missing="false" />
|
||||||
|
<show-property name="bpm:dueDate" ignore-if-missing="false" />
|
||||||
|
<show-property name="bpm:priority" ignore-if-missing="false" />
|
||||||
|
</property-sheet>
|
||||||
|
</config>
|
||||||
|
|
||||||
<config evaluator="node-type" condition="wf:submitReviewTask">
|
<config evaluator="node-type" condition="wf:submitReviewTask">
|
||||||
<property-sheet>
|
<property-sheet>
|
||||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||||
<!-- <show-property name="bpm:priority" ignore-if-missing="false" /> -->
|
<show-property name="wf:reviewPriority" ignore-if-missing="false" />
|
||||||
<show-property name="wf:reviewDueDate" ignore-if-missing="false" />
|
<show-property name="wf:reviewDueDate" ignore-if-missing="false" />
|
||||||
<separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
|
<separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
|
||||||
<show-association name="wf:reviewer" ignore-if-missing="false" />
|
<show-association name="wf:reviewer" ignore-if-missing="false" />
|
||||||
@@ -43,10 +54,25 @@
|
|||||||
|
|
||||||
<action id="reassign-workflow">
|
<action id="reassign-workflow">
|
||||||
<label-id>reassign</label-id>
|
<label-id>reassign</label-id>
|
||||||
<image>/images/icons/create_forum.gif</image>
|
<image>/images/icons/recover.gif</image>
|
||||||
<action>null</action>
|
<action>null</action>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
|
<action id="cancel-workflow">
|
||||||
|
<label-id>cancel_workflow</label-id>
|
||||||
|
<image>/images/icons/reject.gif</image>
|
||||||
|
<action>null</action>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<action id="remove-package-item">
|
||||||
|
<label-id>remove</label-id>
|
||||||
|
<image>/images/icons/delete.gif</image>
|
||||||
|
<action-listener>#{DialogManager.bean.removePackageItem}</action-listener>
|
||||||
|
<params>
|
||||||
|
<param name="id">#{actionContext.id}</param>
|
||||||
|
</params>
|
||||||
|
</action>
|
||||||
|
|
||||||
<action-group id="document_browse_menu">
|
<action-group id="document_browse_menu">
|
||||||
<action idref="start-workflow" />
|
<action idref="start-workflow" />
|
||||||
</action-group>
|
</action-group>
|
||||||
@@ -55,9 +81,32 @@
|
|||||||
<action idref="start-workflow" />
|
<action idref="start-workflow" />
|
||||||
</action-group>
|
</action-group>
|
||||||
|
|
||||||
<action-group id="workitem_actions">
|
<action-group id="manage_workitem_actions">
|
||||||
<action idref="reassign-workflow" />
|
<action idref="reassign-workflow" />
|
||||||
</action-group>
|
</action-group>
|
||||||
|
|
||||||
|
<action-group id="completed_workitem_actions">
|
||||||
|
<action idref="cancel-workflow" />
|
||||||
|
</action-group>
|
||||||
|
|
||||||
|
<action-group id="workflow_item_read_actions">
|
||||||
|
<action idref="details_doc" />
|
||||||
|
</action-group>
|
||||||
|
|
||||||
|
<action-group id="workflow_item_collection_actions">
|
||||||
|
<action idref="details_doc" />
|
||||||
|
<action idref="remove-package-item" />
|
||||||
|
</action-group>
|
||||||
|
|
||||||
|
<action-group id="workflow_item_edit_actions">
|
||||||
|
<!-- edit, checkout, checkin -->
|
||||||
|
<action idref="details_doc" />
|
||||||
|
<action idref="remove-package-item" />
|
||||||
|
</action-group>
|
||||||
|
|
||||||
|
<action-group id="workflow_package_collection_actions">
|
||||||
|
<action idref="add-package-item" />
|
||||||
|
</action-group>
|
||||||
</actions>
|
</actions>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
@@ -103,7 +152,7 @@
|
|||||||
<dialog name="manageWorkItem" page="/jsp/workflow/manage-workitem-dialog.jsp"
|
<dialog name="manageWorkItem" page="/jsp/workflow/manage-workitem-dialog.jsp"
|
||||||
managed-bean="ManageWorkItemDialog" icon="/images/icons/create_space_large.gif"
|
managed-bean="ManageWorkItemDialog" icon="/images/icons/create_space_large.gif"
|
||||||
title-id="manage_workitem_title" description-id="manage_workitem_desc"
|
title-id="manage_workitem_title" description-id="manage_workitem_desc"
|
||||||
actions-config-id="workitem_actions" />
|
actions-config-id="manage_workitem_actions" />
|
||||||
</dialogs>
|
</dialogs>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ public abstract class BaseDialogBean implements IDialogBean
|
|||||||
|
|
||||||
// rollback the transaction
|
// rollback the transaction
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||||
Utils.addErrorMessage(formatErrorMessage(e));
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
outcome = getErrorOutcome(e);
|
outcome = getErrorOutcome(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.event.ActionEvent;
|
||||||
import javax.transaction.UserTransaction;
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
@@ -25,10 +26,13 @@ import org.alfresco.web.app.Application;
|
|||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||||
import org.alfresco.web.bean.repository.MapNode;
|
import org.alfresco.web.bean.repository.MapNode;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.alfresco.web.bean.repository.NodePropertyResolver;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.bean.repository.TransientNode;
|
import org.alfresco.web.bean.repository.TransientNode;
|
||||||
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
|
import org.alfresco.web.ui.common.component.data.UIRichList;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -44,6 +48,8 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
protected WorkflowTask workItem;
|
protected WorkflowTask workItem;
|
||||||
protected WorkflowTransition[] transitions;
|
protected WorkflowTransition[] transitions;
|
||||||
protected List<Node> resources;
|
protected List<Node> resources;
|
||||||
|
protected WorkItemCompleteResolver completeResolver = new WorkItemCompleteResolver();
|
||||||
|
protected UIRichList packageItemsRichList;
|
||||||
|
|
||||||
protected static final String ID_PREFIX = "transition_";
|
protected static final String ID_PREFIX = "transition_";
|
||||||
protected static final String CLIENT_ID_PREFIX = "dialog:" + ID_PREFIX;
|
protected static final String CLIENT_ID_PREFIX = "dialog:" + ID_PREFIX;
|
||||||
@@ -179,12 +185,9 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// reset the flag so we can re-attempt the operation
|
|
||||||
isFinished = false;
|
|
||||||
|
|
||||||
// rollback the transaction
|
// rollback the transaction
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||||
Utils.addErrorMessage(formatErrorMessage(e));
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
outcome = this.getErrorOutcome(e);
|
outcome = this.getErrorOutcome(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,9 +195,114 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an item from the workflow package
|
||||||
|
*
|
||||||
|
* @param event The event containing a reference to the item to remove
|
||||||
|
*/
|
||||||
|
public void removePackageItem(ActionEvent event)
|
||||||
|
{
|
||||||
|
logger.info("remove package item: " + event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the complete flag for a workflow package item
|
||||||
|
*
|
||||||
|
* @param event The event containing a reference to the item to toggle the status for
|
||||||
|
*/
|
||||||
|
public void togglePackageItemComplete(ActionEvent event)
|
||||||
|
{
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
tx = Repository.getUserTransaction(context);
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
|
UIActionLink link = (UIActionLink)event.getComponent();
|
||||||
|
Map<String, String> params = link.getParameterMap();
|
||||||
|
|
||||||
|
// create the node ref for the item we are toggling
|
||||||
|
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(),
|
||||||
|
(String)params.get("id"));
|
||||||
|
|
||||||
|
// get the existing list of completed items
|
||||||
|
List<NodeRef> completedItems = (List<NodeRef>)this.workItem.properties.get(
|
||||||
|
WorkflowModel.PROP_COMPLETED_ITEMS);
|
||||||
|
|
||||||
|
if (completedItems == null)
|
||||||
|
{
|
||||||
|
// if it doesn't exist yet create the list and add the noderef
|
||||||
|
completedItems = new ArrayList<NodeRef>(1);
|
||||||
|
completedItems.add(nodeRef);
|
||||||
|
this.workItem.properties.put(WorkflowModel.PROP_COMPLETED_ITEMS,
|
||||||
|
(Serializable)completedItems);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (completedItems.contains(nodeRef))
|
||||||
|
{
|
||||||
|
// the item is already in the list remove it
|
||||||
|
completedItems.remove(nodeRef);
|
||||||
|
|
||||||
|
// NOTE: There is a bug somwehere which causes the list to be
|
||||||
|
// returned as a byte array instead of a list if an empty
|
||||||
|
// list is persisted, therefore if the list is now empty
|
||||||
|
// set the completed items back to null
|
||||||
|
if (completedItems.size() == 0)
|
||||||
|
{
|
||||||
|
this.workItem.properties.put(WorkflowModel.PROP_COMPLETED_ITEMS, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the noderef is not in the list yet so just add it
|
||||||
|
completedItems.add(nodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the task with the updated parameters
|
||||||
|
this.workflowService.updateTask(this.workItem.id, this.workItem.properties,
|
||||||
|
null, null);
|
||||||
|
|
||||||
|
// commit the transaction
|
||||||
|
tx.commit();
|
||||||
|
|
||||||
|
// reset the rich list if the change was successful
|
||||||
|
this.packageItemsRichList.setValue(null);
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
|
this.resources = Collections.<Node>emptyList();
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Bean Getters and Setters
|
// Bean Getters and Setters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rich list being used for the workflow package items
|
||||||
|
*
|
||||||
|
* @param richList The rich list instance
|
||||||
|
*/
|
||||||
|
public void setPackageItemsRichList(UIRichList richList)
|
||||||
|
{
|
||||||
|
this.packageItemsRichList = richList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rich list being used for the workflow package items
|
||||||
|
*
|
||||||
|
* @return The rich list instance
|
||||||
|
*/
|
||||||
|
public UIRichList getPackageItemsRichList()
|
||||||
|
{
|
||||||
|
return this.packageItemsRichList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Node representing the work item
|
* Returns the Node representing the work item
|
||||||
*
|
*
|
||||||
@@ -213,7 +321,17 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public List<Node> getResources()
|
public List<Node> getResources()
|
||||||
{
|
{
|
||||||
NodeRef workflowPackage = (NodeRef)this.workItem.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
NodeRef workflowPackage = null;
|
||||||
|
Serializable obj = this.workItem.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
||||||
|
// TODO: remove this workaroud where JBPM may return a String and not the NodeRef
|
||||||
|
if (obj instanceof NodeRef)
|
||||||
|
{
|
||||||
|
workflowPackage = (NodeRef)obj;
|
||||||
|
}
|
||||||
|
else if (obj instanceof String)
|
||||||
|
{
|
||||||
|
workflowPackage = new NodeRef((String)obj);
|
||||||
|
}
|
||||||
|
|
||||||
this.resources = new ArrayList<Node>(4);
|
this.resources = new ArrayList<Node>(4);
|
||||||
|
|
||||||
@@ -257,6 +375,13 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
MapNode node = new MapNode(nodeRef, this.nodeService, true);
|
MapNode node = new MapNode(nodeRef, this.nodeService, true);
|
||||||
this.browseBean.setupCommonBindingProperties(node);
|
this.browseBean.setupCommonBindingProperties(node);
|
||||||
|
|
||||||
|
// add property resolvers to show path information
|
||||||
|
node.addPropertyResolver("path", this.browseBean.resolverPath);
|
||||||
|
node.addPropertyResolver("displayPath", this.browseBean.resolverDisplayPath);
|
||||||
|
|
||||||
|
// add a property resolver to indicate whether the item has been completed or not
|
||||||
|
node.addPropertyResolver("completed", this.completeResolver);
|
||||||
|
|
||||||
this.resources.add(node);
|
this.resources.add(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,4 +422,33 @@ public class ManageWorkItemDialog extends BaseDialogBean
|
|||||||
{
|
{
|
||||||
this.workflowService = workflowService;
|
this.workflowService = workflowService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Helper methods
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Inner classes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property resolver to determine if the given node has been flagged as complete
|
||||||
|
*/
|
||||||
|
protected class WorkItemCompleteResolver implements NodePropertyResolver
|
||||||
|
{
|
||||||
|
public Object get(Node node)
|
||||||
|
{
|
||||||
|
String result = Application.getMessage(FacesContext.getCurrentInstance(), "no");
|
||||||
|
|
||||||
|
List<NodeRef> completedItems = (List<NodeRef>)workItem.properties.get(
|
||||||
|
WorkflowModel.PROP_COMPLETED_ITEMS);
|
||||||
|
|
||||||
|
if (completedItems != null && completedItems.size() > 0 &&
|
||||||
|
completedItems.contains(node.getNodeRef()))
|
||||||
|
{
|
||||||
|
result = Application.getMessage(FacesContext.getCurrentInstance(), "yes");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -87,12 +87,8 @@ public class StartWorkflowWizard extends BaseWizardBean
|
|||||||
QName type = this.nodeService.getType(itemToWorkflow);
|
QName type = this.nodeService.getType(itemToWorkflow);
|
||||||
|
|
||||||
NodeRef workflowPackage = null;
|
NodeRef workflowPackage = null;
|
||||||
if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) ||
|
if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) ||
|
||||||
this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDERLINK))
|
this.dictionaryService.isSubClass(type, ContentModel.TYPE_FILELINK))
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Workflow on a folder is not supported yet!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// create a workflow package and add the given item to workflow as a child
|
// create a workflow package and add the given item to workflow as a child
|
||||||
workflowPackage = this.workflowService.createPackage(null);
|
workflowPackage = this.workflowService.createPackage(null);
|
||||||
@@ -106,6 +102,13 @@ public class StartWorkflowWizard extends BaseWizardBean
|
|||||||
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
|
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup the context for the workflow (this is the space the workflow was launched from)
|
||||||
|
Node workflowContext = this.navigator.getCurrentNode();
|
||||||
|
if (workflowContext != null)
|
||||||
|
{
|
||||||
|
params.put(WorkflowModel.PROP_CONTEXT, (Serializable)workflowContext.getNodeRef());
|
||||||
|
}
|
||||||
|
|
||||||
// start the workflow to get access to the start task
|
// start the workflow to get access to the start task
|
||||||
WorkflowPath path = this.workflowService.startWorkflow(this.selectedWorkflow, params);
|
WorkflowPath path = this.workflowService.startWorkflow(this.selectedWorkflow, params);
|
||||||
if (path != null)
|
if (path != null)
|
||||||
|
@@ -7,14 +7,18 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.workflow.WorkflowModel;
|
||||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition;
|
import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.ISO9075;
|
import org.alfresco.util.ISO9075;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
@@ -22,6 +26,7 @@ import org.alfresco.web.bean.repository.Node;
|
|||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.bean.repository.TransientMapNode;
|
import org.alfresco.web.bean.repository.TransientMapNode;
|
||||||
import org.alfresco.web.bean.repository.User;
|
import org.alfresco.web.bean.repository.User;
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -32,6 +37,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*/
|
*/
|
||||||
public class WorkflowBean
|
public class WorkflowBean
|
||||||
{
|
{
|
||||||
|
protected NodeService nodeService;
|
||||||
protected WorkflowService workflowService;
|
protected WorkflowService workflowService;
|
||||||
protected List<Node> workItems;
|
protected List<Node> workItems;
|
||||||
protected List<Node> completedWorkItems;
|
protected List<Node> completedWorkItems;
|
||||||
@@ -50,10 +56,16 @@ public class WorkflowBean
|
|||||||
public List<Node> getWorkItemsToDo()
|
public List<Node> getWorkItemsToDo()
|
||||||
{
|
{
|
||||||
// get the current username
|
// get the current username
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
User user = Application.getCurrentUser(fc);
|
User user = Application.getCurrentUser(context);
|
||||||
String userName = ISO9075.encode(user.getUserName());
|
String userName = ISO9075.encode(user.getUserName());
|
||||||
|
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tx = Repository.getUserTransaction(context, true);
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
// get the current in progress tasks for the current user
|
// get the current in progress tasks for the current user
|
||||||
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
||||||
userName, WorkflowTaskState.IN_PROGRESS);
|
userName, WorkflowTaskState.IN_PROGRESS);
|
||||||
@@ -65,6 +77,16 @@ public class WorkflowBean
|
|||||||
this.workItems.add(createWorkItem(task));
|
this.workItems.add(createWorkItem(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commit the changes
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
// rollback the transaction
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||||
|
Utils.addErrorMessage("Failed to get to do work items: " + e.toString(), e);
|
||||||
|
}
|
||||||
|
|
||||||
return this.workItems;
|
return this.workItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +99,16 @@ public class WorkflowBean
|
|||||||
public List<Node> getWorkItemsCompleted()
|
public List<Node> getWorkItemsCompleted()
|
||||||
{
|
{
|
||||||
// get the current username
|
// get the current username
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
User user = Application.getCurrentUser(fc);
|
User user = Application.getCurrentUser(context);
|
||||||
String userName = ISO9075.encode(user.getUserName());
|
String userName = ISO9075.encode(user.getUserName());
|
||||||
|
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tx = Repository.getUserTransaction(context, true);
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
// get the current in progress tasks for the current user
|
// get the current in progress tasks for the current user
|
||||||
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
||||||
userName, WorkflowTaskState.COMPLETED);
|
userName, WorkflowTaskState.COMPLETED);
|
||||||
@@ -92,6 +120,16 @@ public class WorkflowBean
|
|||||||
this.completedWorkItems.add(createWorkItem(task));
|
this.completedWorkItems.add(createWorkItem(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commit the changes
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
// rollback the transaction
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||||
|
Utils.addErrorMessage("Failed to get completed work items: " + e.toString(), e);
|
||||||
|
}
|
||||||
|
|
||||||
return this.completedWorkItems;
|
return this.completedWorkItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +143,16 @@ public class WorkflowBean
|
|||||||
this.workflowService = workflowService;
|
this.workflowService = workflowService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the node service to use
|
||||||
|
*
|
||||||
|
* @param nodeService NodeService instance
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Helper methods
|
// Helper methods
|
||||||
|
|
||||||
@@ -169,6 +217,50 @@ public class WorkflowBean
|
|||||||
node.getProperties().put("type", taskDef.metadata.getTitle());
|
node.getProperties().put("type", taskDef.metadata.getTitle());
|
||||||
node.getProperties().put("id", task.id);
|
node.getProperties().put("id", task.id);
|
||||||
|
|
||||||
|
// add the name of the source space (if there is one)
|
||||||
|
// TODO: remove this workaroud where JBPM may return a String and not the NodeRef
|
||||||
|
Serializable obj = task.properties.get(WorkflowModel.PROP_CONTEXT);
|
||||||
|
NodeRef context = null;
|
||||||
|
if (obj instanceof NodeRef)
|
||||||
|
{
|
||||||
|
context = (NodeRef)obj;
|
||||||
|
}
|
||||||
|
else if (obj instanceof String)
|
||||||
|
{
|
||||||
|
context = new NodeRef((String)obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context != null)
|
||||||
|
{
|
||||||
|
String name = Repository.getNameForNode(this.nodeService, context);
|
||||||
|
node.getProperties().put("sourceSpaceName", name);
|
||||||
|
node.getProperties().put("sourceSpaceId", context.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the outcome label for any completed task
|
||||||
|
if (task.state.equals(WorkflowTaskState.COMPLETED))
|
||||||
|
{
|
||||||
|
String outcome = null;
|
||||||
|
String transition = (String)task.properties.get(WorkflowModel.PROP_OUTCOME);
|
||||||
|
if (transition != null)
|
||||||
|
{
|
||||||
|
WorkflowTransition[] transitions = task.path.node.transitions;
|
||||||
|
for (WorkflowTransition trans : transitions)
|
||||||
|
{
|
||||||
|
if (trans.id.equals(transition))
|
||||||
|
{
|
||||||
|
outcome = trans.title;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outcome != null)
|
||||||
|
{
|
||||||
|
node.getProperties().put("outcome", outcome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1785,6 +1785,10 @@
|
|||||||
<managed-bean-name>WorkflowBean</managed-bean-name>
|
<managed-bean-name>WorkflowBean</managed-bean-name>
|
||||||
<managed-bean-class>org.alfresco.web.bean.workflow.WorkflowBean</managed-bean-class>
|
<managed-bean-class>org.alfresco.web.bean.workflow.WorkflowBean</managed-bean-class>
|
||||||
<managed-bean-scope>session</managed-bean-scope>
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>nodeService</property-name>
|
||||||
|
<value>#{NodeService}</value>
|
||||||
|
</managed-property>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>workflowService</property-name>
|
<property-name>workflowService</property-name>
|
||||||
<value>#{WorkflowService}</value>
|
<value>#{WorkflowService}</value>
|
||||||
|
@@ -100,6 +100,7 @@
|
|||||||
<f:subview id="dash-body">
|
<f:subview id="dash-body">
|
||||||
<jsp:include page="<%=Application.getDashboardManager().getLayoutPage()%>" />
|
<jsp:include page="<%=Application.getDashboardManager().getLayoutPage()%>" />
|
||||||
</f:subview>
|
</f:subview>
|
||||||
|
<a:errors message="#{msg.error_dashboard}" styleClass="errorMessage" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -32,19 +32,21 @@
|
|||||||
border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle">
|
border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle">
|
||||||
|
|
||||||
<a:richList id="resources-list" viewMode="details" value="#{DialogManager.bean.resources}" var="r"
|
<a:richList id="resources-list" viewMode="details" value="#{DialogManager.bean.resources}" var="r"
|
||||||
|
binding="#{DialogManager.bean.packageItemsRichList}"
|
||||||
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow"
|
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow"
|
||||||
altRowStyleClass="recordSetRowAlt" width="100%" pageSize="10"
|
altRowStyleClass="recordSetRowAlt" width="100%" pageSize="10"
|
||||||
initialSortColumn="name" initialSortDescending="true">
|
initialSortColumn="name" initialSortDescending="true">
|
||||||
|
|
||||||
<%-- Primary column for details view mode --%>
|
<%-- Name column --%>
|
||||||
<a:column primary="true" width="200" style="padding:2px; text-align:left">
|
<a:column primary="true" width="200" style="padding:2px; text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
|
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<f:facet name="small-icon">
|
<f:facet name="small-icon">
|
||||||
<h:graphicImage url="/images/icons/post.gif" />
|
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}"
|
||||||
|
showLink="false" styleClass="inlineAction" />
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText value="#{r.name}" />
|
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Description column --%>
|
<%-- Description column --%>
|
||||||
@@ -60,7 +62,27 @@
|
|||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink label="#{msg.path}" value="path" styleClass="header"/>
|
<a:sortLink label="#{msg.path}" value="path" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText value="#{r.path}" />
|
<r:nodePath value="#{r.path}" />
|
||||||
|
</a:column>
|
||||||
|
|
||||||
|
<%-- Created Date column --%>
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<a:sortLink label="#{msg.created}" value="created" styleClass="header"/>
|
||||||
|
</f:facet>
|
||||||
|
<h:outputText value="#{r.created}">
|
||||||
|
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
||||||
|
</h:outputText>
|
||||||
|
</a:column>
|
||||||
|
|
||||||
|
<%-- Modified Date column --%>
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<a:sortLink label="#{msg.modified}" value="modified" styleClass="header"/>
|
||||||
|
</f:facet>
|
||||||
|
<h:outputText value="#{r.modified}">
|
||||||
|
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
||||||
|
</h:outputText>
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Actions column --%>
|
<%-- Actions column --%>
|
||||||
@@ -68,11 +90,23 @@
|
|||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText value="#{msg.actions}"/>
|
<h:outputText value="#{msg.actions}"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
|
<r:actions id="actions-col-actions" value="workflow_item_collection_actions"
|
||||||
<%-- actions are configured in web-client-config-actions.xml --%>
|
context="#{r}" showLink="false" styleClass="inlineAction" />
|
||||||
<r:actions id="actions-col-actions" value="workflow_actions" context="#{r}" showLink="false" styleClass="inlineAction" />
|
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<a:dataPager styleClass="pager" />
|
<%-- Completed column --%>
|
||||||
|
<%--
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<h:outputText value="#{msg.completed}" />
|
||||||
|
</f:facet>
|
||||||
|
<a:actionLink value="#{r.completed}" actionListener="#{DialogManager.bean.togglePackageItemComplete}">
|
||||||
|
<f:param name="id" value="#{r.id}" />
|
||||||
|
</a:actionLink>
|
||||||
|
</a:column>
|
||||||
|
--%>
|
||||||
</a:richList>
|
</a:richList>
|
||||||
|
|
||||||
|
<%-- Put the package actions here --%>
|
||||||
|
|
||||||
</a:panel>
|
</a:panel>
|
@@ -37,8 +37,10 @@
|
|||||||
</f:verbatim>
|
</f:verbatim>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
|
|
||||||
<h:panelGroup rendered="#{not empty WizardManager.bean.taskMetadataNode}">
|
<a:panel id="props-panel" label="#{msg.properties}" rendered="#{not empty WizardManager.bean.taskMetadataNode}"
|
||||||
|
border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle">
|
||||||
|
|
||||||
<r:propertySheetGrid id="task-props" value="#{WizardManager.bean.taskMetadataNode}"
|
<r:propertySheetGrid id="task-props" value="#{WizardManager.bean.taskMetadataNode}"
|
||||||
var="taskProps" columns="1" externalConfig="true" />
|
var="taskProps" columns="1" externalConfig="true" />
|
||||||
</h:panelGroup>
|
</a:panel>
|
||||||
|
|
@@ -35,6 +35,14 @@
|
|||||||
<h:outputText value="#{r.type}" />
|
<h:outputText value="#{r.type}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
|
<%-- Source column --%>
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<a:sortLink label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
|
||||||
|
</f:facet>
|
||||||
|
<h:outputText value="#{r.sourceSpaceName}" />
|
||||||
|
</a:column>
|
||||||
|
|
||||||
<%-- Completed date column --%>
|
<%-- Completed date column --%>
|
||||||
<a:column style="text-align:left">
|
<a:column style="text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
@@ -48,31 +56,19 @@
|
|||||||
<%-- Outcome column --%>
|
<%-- Outcome column --%>
|
||||||
<a:column style="text-align:left">
|
<a:column style="text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink label="#{msg.outcome}" value="bpm:status" styleClass="header"/>
|
<a:sortLink label="#{msg.outcome}" value="outcome" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText value="#{r['bpm:status']}" />
|
<h:outputText value="#{r.outcome}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Actions column --%>
|
<%-- Actions column --%>
|
||||||
<%--
|
|
||||||
<a:column actions="true" style="text-align:left">
|
<a:column actions="true" style="text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText value="#{msg.actions}"/>
|
<h:outputText value="#{msg.actions}"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<a:booleanEvaluator value="#{r.local}">
|
<r:actions value="completed_workitem_actions" context="#{r}" showLink="false"
|
||||||
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif" showLink="false"
|
styleClass="inlineAction" />
|
||||||
styleClass="inlineAction"
|
|
||||||
actionListener="#{RulesBean.setupRuleAction}" action="deleteRule">
|
|
||||||
<f:param name="id" value="#{r.id}" />
|
|
||||||
</a:actionLink>
|
|
||||||
<a:actionLink value="#{msg.change_details}" image="/images/icons/change_rule.gif"
|
|
||||||
showLink="false" styleClass="inlineAction"
|
|
||||||
actionListener="#{RulesBean.setupRuleAction}" action="wizard:editRule">
|
|
||||||
<f:param name="id" value="#{r.id}" />
|
|
||||||
</a:actionLink>
|
|
||||||
</a:booleanEvaluator>
|
|
||||||
</a:column>
|
</a:column>
|
||||||
--%>
|
|
||||||
|
|
||||||
<a:dataPager styleClass="pager" />
|
<a:dataPager styleClass="pager" />
|
||||||
</a:richList>
|
</a:richList>
|
||||||
|
@@ -43,6 +43,14 @@
|
|||||||
<h:outputText value="#{r.type}" />
|
<h:outputText value="#{r.type}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
|
<%-- Source column --%>
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<a:sortLink label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
|
||||||
|
</f:facet>
|
||||||
|
<h:outputText value="#{r.sourceSpaceName}" />
|
||||||
|
</a:column>
|
||||||
|
|
||||||
<%-- Due date column --%>
|
<%-- Due date column --%>
|
||||||
<a:column style="text-align:left">
|
<a:column style="text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
@@ -61,26 +69,22 @@
|
|||||||
<h:outputText value="#{r['bpm:status']}" />
|
<h:outputText value="#{r['bpm:status']}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
|
<%-- Priority column --%>
|
||||||
|
<a:column style="text-align:left">
|
||||||
|
<f:facet name="header">
|
||||||
|
<a:sortLink label="#{msg.priority}" value="bpm:priority" styleClass="header"/>
|
||||||
|
</f:facet>
|
||||||
|
<h:outputText value="#{r['bpm:priority']}" />
|
||||||
|
</a:column>
|
||||||
|
|
||||||
<%-- Actions column --%>
|
<%-- Actions column --%>
|
||||||
<%--
|
|
||||||
<a:column actions="true" style="text-align:left">
|
<a:column actions="true" style="text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText value="#{msg.actions}"/>
|
<h:outputText value="#{msg.actions}"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<a:booleanEvaluator value="#{r.local}">
|
<r:actions value="manage_workitem_actions" context="#{r}" showLink="false"
|
||||||
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif" showLink="false"
|
styleClass="inlineAction" />
|
||||||
styleClass="inlineAction"
|
|
||||||
actionListener="#{RulesBean.setupRuleAction}" action="deleteRule">
|
|
||||||
<f:param name="id" value="#{r.id}" />
|
|
||||||
</a:actionLink>
|
|
||||||
<a:actionLink value="#{msg.change_details}" image="/images/icons/change_rule.gif"
|
|
||||||
showLink="false" styleClass="inlineAction"
|
|
||||||
actionListener="#{RulesBean.setupRuleAction}" action="wizard:editRule">
|
|
||||||
<f:param name="id" value="#{r.id}" />
|
|
||||||
</a:actionLink>
|
|
||||||
</a:booleanEvaluator>
|
|
||||||
</a:column>
|
</a:column>
|
||||||
--%>
|
|
||||||
|
|
||||||
<a:dataPager styleClass="pager" />
|
<a:dataPager styleClass="pager" />
|
||||||
</a:richList>
|
</a:richList>
|
||||||
|
Reference in New Issue
Block a user