mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge of all UI clustering changes originally applied to 2.2
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.workflow.WorkflowInstance;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -43,8 +44,10 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class CancelWorkflowDialog extends BaseDialogBean
|
||||
{
|
||||
protected WorkflowInstance workflowInstance;
|
||||
protected WorkflowService workflowService;
|
||||
private static final long serialVersionUID = -7875582893750792200L;
|
||||
|
||||
transient private WorkflowInstance workflowInstance;
|
||||
transient private WorkflowService workflowService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class);
|
||||
|
||||
@@ -63,7 +66,7 @@ public class CancelWorkflowDialog extends BaseDialogBean
|
||||
throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id");
|
||||
}
|
||||
|
||||
this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId);
|
||||
this.workflowInstance = getWorkflowService().getWorkflowById(workflowInstanceId);
|
||||
if (this.workflowInstance == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId);
|
||||
@@ -75,13 +78,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Cancelling workflow with id: " + this.workflowInstance.id);
|
||||
logger.debug("Cancelling workflow with id: " + this.getWorkflowInstance().id);
|
||||
|
||||
// cancel the workflow
|
||||
this.workflowService.cancelWorkflow(this.workflowInstance.id);
|
||||
this.getWorkflowService().cancelWorkflow(this.getWorkflowInstance().id);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Cancelled workflow with id: " + this.workflowInstance.id);
|
||||
logger.debug("Cancelled workflow with id: " + this.getWorkflowInstance().id);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
@@ -123,10 +126,10 @@ public class CancelWorkflowDialog extends BaseDialogBean
|
||||
String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"cancel_workflow_confirm");
|
||||
|
||||
String workflowLabel = this.workflowInstance.definition.title;
|
||||
if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0)
|
||||
String workflowLabel = this.getWorkflowInstance().definition.title;
|
||||
if (this.getWorkflowInstance().description != null && this.getWorkflowInstance().description.length() > 0)
|
||||
{
|
||||
workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")";
|
||||
workflowLabel = workflowLabel + " (" + this.getWorkflowInstance().description + ")";
|
||||
}
|
||||
|
||||
return MessageFormat.format(confirmMsg, new Object[] {workflowLabel});
|
||||
@@ -139,6 +142,10 @@ public class CancelWorkflowDialog extends BaseDialogBean
|
||||
*/
|
||||
public WorkflowService getWorkflowService()
|
||||
{
|
||||
if (workflowService == null)
|
||||
{
|
||||
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return workflowService;
|
||||
}
|
||||
|
||||
@@ -151,4 +158,24 @@ public class CancelWorkflowDialog extends BaseDialogBean
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
protected WorkflowInstance getWorkflowInstance()
|
||||
{
|
||||
if (workflowInstance == null)
|
||||
{
|
||||
String workflowInstanceId = this.parameters.get("workflow-instance-id");
|
||||
if (workflowInstanceId == null || workflowInstanceId.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id");
|
||||
}
|
||||
|
||||
this.workflowInstance = getWorkflowService().getWorkflowById(workflowInstanceId);
|
||||
if (this.workflowInstance == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId);
|
||||
}
|
||||
}
|
||||
return workflowInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -68,13 +68,10 @@ import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.repository.TransientNode;
|
||||
import org.alfresco.web.bean.repository.User;
|
||||
import org.alfresco.web.bean.wcm.AVMNode;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.alfresco.web.bean.wcm.AVMWorkflowUtil;
|
||||
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
||||
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.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -85,13 +82,15 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
protected WorkflowService workflowService;
|
||||
protected AVMService avmService;
|
||||
protected AVMSyncService avmSyncService;
|
||||
private static final long serialVersionUID = -3209544870892993135L;
|
||||
|
||||
transient private WorkflowService workflowService;
|
||||
transient private AVMService avmService;
|
||||
transient private AVMSyncService avmSyncService;
|
||||
protected Node taskNode;
|
||||
protected WorkflowTask task;
|
||||
protected WorkflowInstance workflowInstance;
|
||||
protected WorkflowTransition[] transitions;
|
||||
transient private WorkflowTask task;
|
||||
transient private WorkflowInstance workflowInstance;
|
||||
transient private WorkflowTransition[] transitions;
|
||||
protected NodeRef workflowPackage;
|
||||
protected List<Node> resources;
|
||||
protected TaskCompleteResolver completeResolver = new TaskCompleteResolver();
|
||||
@@ -133,7 +132,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
// get the task details
|
||||
String taskId = this.parameters.get("id");
|
||||
this.task = this.workflowService.getTaskById(taskId);
|
||||
this.task = this.getWorkflowService().getTaskById(taskId);
|
||||
|
||||
if (this.task != null)
|
||||
{
|
||||
@@ -153,7 +152,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
LOGGER.debug("Task: " + this.task);
|
||||
LOGGER.debug("Trasient node: " + this.taskNode);
|
||||
Boolean isSystemPackage = (Boolean)
|
||||
this.nodeService.getProperty(this.workflowPackage,
|
||||
this.getNodeService().getProperty(this.workflowPackage,
|
||||
WorkflowModel.PROP_IS_SYSTEM_PACKAGE);
|
||||
LOGGER.debug("Workflow package: " + this.workflowPackage +
|
||||
" system package: " + isSystemPackage);
|
||||
@@ -180,7 +179,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
throws Exception
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Saving task: " + this.task.id);
|
||||
LOGGER.debug("Saving task: " + this.getWorkflowTask().id);
|
||||
|
||||
// prepare the edited parameters for saving
|
||||
Map<QName, Serializable> params = WorkflowUtil.prepareTaskParams(this.taskNode);
|
||||
@@ -190,7 +189,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
// update the task with the updated parameters and resources
|
||||
updateResources();
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
@@ -200,11 +199,11 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
List<DialogButtonConfig> buttons = null;
|
||||
|
||||
if (this.task != null)
|
||||
if (this.getWorkflowTask() != null)
|
||||
{
|
||||
// get the transitions available from this task and
|
||||
// show them in the dialog as additional buttons
|
||||
this.transitions = this.task.path.node.transitions;
|
||||
this.transitions = this.getWorkflowTask().path.node.transitions;
|
||||
boolean isPooledTask = isPooledTask();
|
||||
|
||||
if (isPooledTask || this.transitions != null)
|
||||
@@ -256,13 +255,13 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "manage_task_title");
|
||||
|
||||
return titleStart + ": " + this.task.title;
|
||||
return titleStart + ": " + this.getWorkflowTask().title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerDescription()
|
||||
{
|
||||
return this.task.description;
|
||||
return this.getWorkflowTask().description;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -274,7 +273,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
String outcome = getDefaultFinishOutcome();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Taking ownership of task: " + this.task.id);
|
||||
LOGGER.debug("Taking ownership of task: " + this.getWorkflowTask().id);
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
UserTransaction tx = null;
|
||||
@@ -292,7 +291,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
// update the task with the updated parameters and resources
|
||||
updateResources();
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null);
|
||||
|
||||
// commit the changes
|
||||
tx.commit();
|
||||
@@ -314,7 +313,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
String outcome = getDefaultFinishOutcome();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Returning ownership of task to pool: " + this.task.id);
|
||||
LOGGER.debug("Returning ownership of task to pool: " + this.getWorkflowTask().id);
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
UserTransaction tx = null;
|
||||
@@ -330,7 +329,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
// update the task with the updated parameters and resources
|
||||
updateResources();
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null);
|
||||
|
||||
// commit the changes
|
||||
tx.commit();
|
||||
@@ -352,7 +351,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
String outcome = getDefaultFinishOutcome();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Transitioning task: " + this.task.id);
|
||||
LOGGER.debug("Transitioning task: " + this.getWorkflowTask().id);
|
||||
|
||||
// to find out which transition button was pressed we need
|
||||
// to look for the button's id in the request parameters,
|
||||
@@ -361,7 +360,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
Map reqParams = context.getExternalContext().getRequestParameterMap();
|
||||
|
||||
String selectedTransition = null;
|
||||
for (WorkflowTransition trans : this.transitions)
|
||||
for (WorkflowTransition trans : this.getWorkflowTransitions())
|
||||
{
|
||||
Object result = reqParams.get(CLIENT_ID_PREFIX + FacesHelper.makeLegalId(trans.title));
|
||||
if (result != null)
|
||||
@@ -387,10 +386,10 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
// update the task with the updated parameters and resources
|
||||
updateResources();
|
||||
this.workflowService.updateTask(this.task.id, params, null, null);
|
||||
this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null);
|
||||
|
||||
// signal the selected transition to the workflow task
|
||||
this.workflowService.endTask(this.task.id, selectedTransition);
|
||||
this.getWorkflowService().endTask(this.getWorkflowTask().id, selectedTransition);
|
||||
|
||||
// commit the changes
|
||||
tx.commit();
|
||||
@@ -601,6 +600,10 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
*/
|
||||
public WorkflowInstance getWorkflowInstance()
|
||||
{
|
||||
if (workflowInstance == null)
|
||||
{
|
||||
workflowInstance = getWorkflowTask().path.instance;
|
||||
}
|
||||
return this.workflowInstance;
|
||||
}
|
||||
|
||||
@@ -611,7 +614,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
*/
|
||||
public String getWorkflowDefinitionImageUrl()
|
||||
{
|
||||
return "/workflowdefinitionimage/" + this.workflowInstance.definition.id;
|
||||
return "/workflowdefinitionimage/" + this.getWorkflowInstance().definition.id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -621,7 +624,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
*/
|
||||
public String getPackageActionGroup()
|
||||
{
|
||||
return (String)this.task.properties.get(
|
||||
return (String)this.getWorkflowTask().properties.get(
|
||||
WorkflowModel.PROP_PACKAGE_ACTION_GROUP);
|
||||
}
|
||||
|
||||
@@ -632,7 +635,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
*/
|
||||
public String getPackageItemActionGroup()
|
||||
{
|
||||
return (String)this.task.properties.get(
|
||||
return (String)this.getWorkflowTask().properties.get(
|
||||
WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP);
|
||||
}
|
||||
|
||||
@@ -657,16 +660,16 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
|
||||
if (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
{
|
||||
if (this.nodeService.exists(this.workflowPackage))
|
||||
if (this.getNodeService().exists(this.workflowPackage))
|
||||
{
|
||||
final NodeRef stagingNodeRef = (NodeRef)
|
||||
this.nodeService.getProperty(this.workflowPackage,
|
||||
this.getNodeService().getProperty(this.workflowPackage,
|
||||
WCMModel.PROP_AVM_DIR_INDIRECTION);
|
||||
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
|
||||
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
|
||||
for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath,
|
||||
for (AVMDifference d : this.getAvmSyncService().compare(-1, packageAvmPath,
|
||||
-1, stagingAvmPath,
|
||||
null))
|
||||
{
|
||||
@@ -675,7 +678,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
if (d.getDifferenceCode() == AVMDifference.NEWER ||
|
||||
d.getDifferenceCode() == AVMDifference.CONFLICT)
|
||||
{
|
||||
this.addAVMNode(new AVMNode(this.avmService.lookup(d.getSourceVersion(),
|
||||
this.addAVMNode(new AVMNode(this.getAvmService().lookup(d.getSourceVersion(),
|
||||
d.getSourcePath(),
|
||||
true)));
|
||||
}
|
||||
@@ -685,7 +688,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
else
|
||||
{
|
||||
// get existing workflow package items
|
||||
List<ChildAssociationRef> childRefs = this.nodeService.getChildAssocs(
|
||||
List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(
|
||||
this.workflowPackage, ContentModel.ASSOC_CONTAINS,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
|
||||
@@ -694,7 +697,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
// create our Node representation from the NodeRef
|
||||
NodeRef nodeRef = ref.getChildRef();
|
||||
|
||||
if (!this.nodeService.exists(nodeRef))
|
||||
if (!this.getNodeService().exists(nodeRef))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Ignoring " + nodeRef + " as it has been removed from the repository");
|
||||
@@ -702,10 +705,10 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
else
|
||||
{
|
||||
// find it's type so we can see if it's a node we are interested in
|
||||
QName type = this.nodeService.getType(nodeRef);
|
||||
QName type = this.getNodeService().getType(nodeRef);
|
||||
|
||||
// make sure the type is defined in the data dictionary
|
||||
TypeDefinition typeDef = this.dictionaryService.getType(type);
|
||||
TypeDefinition typeDef = this.getDictionaryService().getType(type);
|
||||
|
||||
if (typeDef == null)
|
||||
{
|
||||
@@ -717,7 +720,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
// look for content nodes or links to content
|
||||
// NOTE: folders within workflow packages are ignored for now
|
||||
if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) ||
|
||||
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) ||
|
||||
ApplicationModel.TYPE_FILELINK.equals(type))
|
||||
{
|
||||
// if the node is not in the removed list then add create the
|
||||
@@ -738,7 +741,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
for (String newItem : this.packageItemsToAdd)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(newItem);
|
||||
if (this.nodeService.exists(nodeRef))
|
||||
if (this.getNodeService().exists(nodeRef))
|
||||
{
|
||||
// we know the type is correct as this was added as a result of a query
|
||||
// for all content items so just add the item to the resources list
|
||||
@@ -765,7 +768,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
}
|
||||
else if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("Failed to find workflow package for task: " + this.task.id);
|
||||
LOGGER.debug("Failed to find workflow package for task: " + this.getWorkflowTask().id);
|
||||
}
|
||||
|
||||
return this.resources;
|
||||
@@ -782,6 +785,15 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
protected WorkflowService getWorkflowService()
|
||||
{
|
||||
if (workflowService == null)
|
||||
{
|
||||
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the avm service to use
|
||||
*
|
||||
@@ -792,6 +804,15 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
protected AVMService getAvmService()
|
||||
{
|
||||
if (avmService == null)
|
||||
{
|
||||
avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService();
|
||||
}
|
||||
return avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the avm sync service to use
|
||||
@@ -804,12 +825,40 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
this.avmSyncService = avmSyncService;
|
||||
}
|
||||
|
||||
protected AVMSyncService getAvmSyncService()
|
||||
{
|
||||
if (avmSyncService == null)
|
||||
{
|
||||
avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService();
|
||||
}
|
||||
return avmSyncService;
|
||||
}
|
||||
|
||||
protected WorkflowTask getWorkflowTask()
|
||||
{
|
||||
if (task == null)
|
||||
{
|
||||
String taskId = this.parameters.get("id");
|
||||
task = this.getWorkflowService().getTaskById(taskId);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
||||
protected WorkflowTransition[] getWorkflowTransitions()
|
||||
{
|
||||
if (transitions == null)
|
||||
{
|
||||
transitions = getWorkflowTask().path.node.transitions;
|
||||
}
|
||||
return transitions;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
protected void addAVMNode(final AVMNode node)
|
||||
{
|
||||
node.getProperties().put("taskId", this.task.id);
|
||||
node.getProperties().put("taskId", this.getWorkflowTask().id);
|
||||
node.addPropertyResolver("path", AVMNode.RESOLVER_SANDBOX_RELATIVE_PATH);
|
||||
node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL);
|
||||
node.addPropertyResolver("fileType16", AVMNode.RESOLVER_FILE_TYPE_16);
|
||||
@@ -822,7 +871,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
if (node.isDirectory() && !node.getDescriptor().isDeleted())
|
||||
{
|
||||
for (final AVMNodeDescriptor d :
|
||||
this.avmService.getDirectoryListingArray(node.getDescriptor(), true))
|
||||
this.getAvmService().getDirectoryListingArray(node.getDescriptor(), true))
|
||||
{
|
||||
this.addAVMNode(new AVMNode(d));
|
||||
}
|
||||
@@ -832,7 +881,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
protected void createAndAddNode(NodeRef nodeRef)
|
||||
{
|
||||
// create our Node representation
|
||||
MapNode node = new MapNode(nodeRef, this.nodeService, true);
|
||||
MapNode node = new MapNode(nodeRef, this.getNodeService(), true);
|
||||
this.browseBean.setupCommonBindingProperties(node);
|
||||
|
||||
// add property resolvers to show path information
|
||||
@@ -843,7 +892,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
// node.addPropertyResolver("completed", this.completeResolver);
|
||||
|
||||
// add the id of the task being managed
|
||||
node.getProperties().put("taskId", this.task.id);
|
||||
node.getProperties().put("taskId", this.getWorkflowTask().id);
|
||||
|
||||
this.resources.add(node);
|
||||
}
|
||||
@@ -856,7 +905,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
{
|
||||
for (String removedItem : this.packageItemsToRemove)
|
||||
{
|
||||
this.nodeService.removeChild(this.workflowPackage, new NodeRef(removedItem));
|
||||
this.getNodeService().removeChild(this.workflowPackage, new NodeRef(removedItem));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,9 +916,9 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
for (String addedItem : this.packageItemsToAdd)
|
||||
{
|
||||
NodeRef addedNodeRef = new NodeRef(addedItem);
|
||||
this.nodeService.addChild(this.workflowPackage, addedNodeRef,
|
||||
this.getNodeService().addChild(this.workflowPackage, addedNodeRef,
|
||||
ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
||||
QName.createValidLocalName((String)this.nodeService.getProperty(
|
||||
QName.createValidLocalName((String)this.getNodeService().getProperty(
|
||||
addedNodeRef, ContentModel.PROP_NAME))));
|
||||
}
|
||||
}
|
||||
@@ -883,11 +932,13 @@ public class ManageTaskDialog extends BaseDialogBean
|
||||
*/
|
||||
protected class TaskCompleteResolver implements NodePropertyResolver
|
||||
{
|
||||
private static final long serialVersionUID = 5862037943275638314L;
|
||||
|
||||
public Object get(Node node)
|
||||
{
|
||||
String result = Application.getMessage(FacesContext.getCurrentInstance(), "no");
|
||||
|
||||
List<NodeRef> completedItems = (List<NodeRef>)task.properties.get(
|
||||
List<NodeRef> completedItems = (List<NodeRef>)getWorkflowTask().properties.get(
|
||||
WorkflowModel.PROP_COMPLETED_ITEMS);
|
||||
|
||||
if (completedItems != null && completedItems.size() > 0 &&
|
||||
|
@@ -59,10 +59,12 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class ReassignTaskDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = 5804171557325189475L;
|
||||
|
||||
protected String taskId;
|
||||
|
||||
protected WorkflowService workflowService;
|
||||
protected PersonService personService;
|
||||
transient private WorkflowService workflowService;
|
||||
transient private PersonService personService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ReassignTaskDialog.class);
|
||||
|
||||
@@ -100,7 +102,7 @@ public class ReassignTaskDialog 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.taskId, params, null, null);
|
||||
this.getWorkflowService().updateTask(this.taskId, params, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,26 +165,26 @@ public class ReassignTaskDialog extends BaseDialogBean
|
||||
tx.begin();
|
||||
|
||||
// build xpath to match available User/Person objects
|
||||
NodeRef peopleRef = personService.getPeopleContainer();
|
||||
NodeRef peopleRef = getPersonService().getPeopleContainer();
|
||||
// NOTE: see SearcherComponentTest
|
||||
String xpath = "*[not(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "userName='guest') and " +
|
||||
"(like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" +
|
||||
" or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false))]";
|
||||
|
||||
List<NodeRef> nodes = searchService.selectNodes(
|
||||
List<NodeRef> nodes = getSearchService().selectNodes(
|
||||
peopleRef,
|
||||
xpath,
|
||||
null,
|
||||
this.namespaceService,
|
||||
this.getNamespaceService(),
|
||||
false);
|
||||
|
||||
items = new SelectItem[nodes.size()];
|
||||
for (int index=0; index<nodes.size(); index++)
|
||||
{
|
||||
NodeRef personRef = nodes.get(index);
|
||||
String firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
String firstName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||
items[index] = item;
|
||||
}
|
||||
@@ -214,6 +216,15 @@ public class ReassignTaskDialog extends BaseDialogBean
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
protected WorkflowService getWorkflowService()
|
||||
{
|
||||
if (workflowService == null)
|
||||
{
|
||||
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param personService The PersonService to set.
|
||||
*/
|
||||
@@ -221,4 +232,13 @@ public class ReassignTaskDialog extends BaseDialogBean
|
||||
{
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
protected PersonService getPersonService()
|
||||
{
|
||||
if (personService == null)
|
||||
{
|
||||
personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService();
|
||||
}
|
||||
return personService;
|
||||
}
|
||||
}
|
||||
|
@@ -59,10 +59,12 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = 6501900045849920148L;
|
||||
|
||||
protected String workItemId;
|
||||
|
||||
protected WorkflowService workflowService;
|
||||
protected PersonService personService;
|
||||
transient private WorkflowService workflowService;
|
||||
transient private PersonService personService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ReassignWorkItemDialog.class);
|
||||
|
||||
@@ -100,7 +102,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.getWorkflowService().updateTask(this.workItemId, params, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,25 +165,25 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
tx.begin();
|
||||
|
||||
// build xpath to match available User/Person objects
|
||||
NodeRef peopleRef = personService.getPeopleContainer();
|
||||
NodeRef peopleRef = getPersonService().getPeopleContainer();
|
||||
// NOTE: see SearcherComponentTest
|
||||
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" +
|
||||
" or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false)]";
|
||||
|
||||
List<NodeRef> nodes = searchService.selectNodes(
|
||||
List<NodeRef> nodes = getSearchService().selectNodes(
|
||||
peopleRef,
|
||||
xpath,
|
||||
null,
|
||||
this.namespaceService,
|
||||
this.getNamespaceService(),
|
||||
false);
|
||||
|
||||
items = new SelectItem[nodes.size()];
|
||||
for (int index=0; index<nodes.size(); index++)
|
||||
{
|
||||
NodeRef personRef = nodes.get(index);
|
||||
String firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
String firstName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||
String username = (String)this.getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||
items[index] = item;
|
||||
}
|
||||
@@ -213,6 +215,15 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
protected WorkflowService getWorkflowService()
|
||||
{
|
||||
if (workflowService == null)
|
||||
{
|
||||
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param personService The PersonService to set.
|
||||
*/
|
||||
@@ -220,4 +231,13 @@ public class ReassignWorkItemDialog extends BaseDialogBean
|
||||
{
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
protected PersonService getPersonService()
|
||||
{
|
||||
if (personService == null)
|
||||
{
|
||||
personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService();
|
||||
}
|
||||
return personService;
|
||||
}
|
||||
}
|
||||
|
@@ -55,6 +55,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.MapNode;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -73,12 +74,18 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
private static final long serialVersionUID = -4370844066621902880L;
|
||||
|
||||
protected String selectedWorkflow;
|
||||
protected String previouslySelectedWorkflow;
|
||||
protected List<SelectItem> availableWorkflows;
|
||||
protected Map<String, WorkflowDefinition> workflows;
|
||||
|
||||
transient protected List<SelectItem> availableWorkflows;
|
||||
transient private Map<String, WorkflowDefinition> workflows;
|
||||
|
||||
protected Map<String, String> wcmWorkflows;
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
transient private WorkflowService workflowService;
|
||||
|
||||
protected Node startTaskNode;
|
||||
protected List<Node> resources;
|
||||
protected List<String> packageItemsToAdd;
|
||||
@@ -87,7 +94,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
protected boolean isItemBeingAdded = false;
|
||||
protected boolean nextButtonDisabled = false;
|
||||
|
||||
protected NodeService unprotectedNodeService;
|
||||
transient private NodeService unprotectedNodeService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(StartWorkflowWizard.class);
|
||||
|
||||
@@ -96,9 +103,27 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
this.unprotectedNodeService = unprotectedNodeService;
|
||||
}
|
||||
|
||||
protected NodeService getUnprotectedNodeService()
|
||||
{
|
||||
if (this.unprotectedNodeService == null)
|
||||
{
|
||||
this.unprotectedNodeService = (NodeService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "nodeService");
|
||||
}
|
||||
return this.unprotectedNodeService;
|
||||
}
|
||||
|
||||
protected Map<String, WorkflowDefinition> getWorkflows()
|
||||
{
|
||||
if (this.workflows == null)
|
||||
{
|
||||
initializeWorkflows();
|
||||
}
|
||||
return this.workflows;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
@@ -128,10 +153,10 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
// create the node ref for the item and determine its type
|
||||
NodeRef itemToWorkflow = new NodeRef(Repository.getStoreRef(), itemToWorkflowId);
|
||||
QName type = this.nodeService.getType(itemToWorkflow);
|
||||
QName type = this.getNodeService().getType(itemToWorkflow);
|
||||
|
||||
if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) ||
|
||||
this.dictionaryService.isSubClass(type, ApplicationModel.TYPE_FILELINK))
|
||||
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) ||
|
||||
this.getDictionaryService().isSubClass(type, ApplicationModel.TYPE_FILELINK))
|
||||
{
|
||||
this.packageItemsToAdd.add(itemToWorkflow.toString());
|
||||
}
|
||||
@@ -161,15 +186,15 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
logger.debug("Starting workflow with parameters: " + params);
|
||||
|
||||
// create a workflow package for the attached items and add them
|
||||
NodeRef workflowPackage = this.workflowService.createPackage(null);
|
||||
NodeRef workflowPackage = this.getWorkflowService().createPackage(null);
|
||||
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
|
||||
|
||||
for (String addedItem : this.packageItemsToAdd)
|
||||
{
|
||||
NodeRef addedNodeRef = new NodeRef(addedItem);
|
||||
this.unprotectedNodeService.addChild(workflowPackage, addedNodeRef,
|
||||
this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef,
|
||||
ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
||||
QName.createValidLocalName((String)this.nodeService.getProperty(
|
||||
QName.createValidLocalName((String)this.getNodeService().getProperty(
|
||||
addedNodeRef, ContentModel.PROP_NAME))));
|
||||
}
|
||||
|
||||
@@ -181,11 +206,11 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
// start the workflow to get access to the start task
|
||||
WorkflowPath path = this.workflowService.startWorkflow(this.selectedWorkflow, params);
|
||||
WorkflowPath path = this.getWorkflowService().startWorkflow(this.selectedWorkflow, params);
|
||||
if (path != null)
|
||||
{
|
||||
// extract the start task
|
||||
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
|
||||
List<WorkflowTask> tasks = this.getWorkflowService().getTasksForWorkflowPath(path.id);
|
||||
if (tasks.size() == 1)
|
||||
{
|
||||
WorkflowTask startTask = tasks.get(0);
|
||||
@@ -197,7 +222,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
// end the start task to trigger the first 'proper'
|
||||
// task in the workflow
|
||||
this.workflowService.endTask(startTask.id, null);
|
||||
this.getWorkflowService().endTask(startTask.id, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,19 +245,19 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
// definition and create a transient node to allow the property
|
||||
// sheet to collect the required data.
|
||||
|
||||
WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow);
|
||||
WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Selected workflow: "+ flowDef);
|
||||
|
||||
WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition;
|
||||
WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition();
|
||||
if (taskDef != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Start task definition: " + taskDef);
|
||||
|
||||
// create an instance of a task from the data dictionary
|
||||
this.startTaskNode = TransientNode.createNew(dictionaryService, taskDef.metadata,
|
||||
this.startTaskNode = TransientNode.createNew(getDictionaryService(), taskDef.metadata,
|
||||
"task_" + System.currentTimeMillis(), null);
|
||||
}
|
||||
|
||||
@@ -275,7 +300,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null)
|
||||
{
|
||||
String titlePattern = bundle.getString("start_named_workflow_wizard");
|
||||
WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow);
|
||||
WorkflowDefinition workflowDef = this.getWorkflows().get(this.selectedWorkflow);
|
||||
wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title});
|
||||
}
|
||||
else
|
||||
@@ -450,8 +475,8 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
String actionGroup = null;
|
||||
|
||||
WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow);
|
||||
WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition;
|
||||
WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow);
|
||||
WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition();
|
||||
if (taskDef != null)
|
||||
{
|
||||
PropertyDefinition propDef = taskDef.metadata.getProperties().get(
|
||||
@@ -474,8 +499,8 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
String actionGroup = null;
|
||||
|
||||
WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow);
|
||||
WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition;
|
||||
WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow);
|
||||
WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition();
|
||||
if (taskDef != null)
|
||||
{
|
||||
PropertyDefinition propDef = taskDef.metadata.getProperties().get(
|
||||
@@ -523,12 +548,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
return (workflows.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of workflows that can be started.
|
||||
*
|
||||
* @return List of SelectItem objects representing the workflows
|
||||
*/
|
||||
public List<SelectItem> getStartableWorkflows()
|
||||
private void initializeWorkflows()
|
||||
{
|
||||
// NOTE: we don't cache the list of startable workflows as they could get
|
||||
// updated, in which case we need the latest instance id, they could
|
||||
@@ -541,7 +561,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
// the list as these workflows are specific to WCM functionality and AVM stores
|
||||
Map<String, String> configuredWcmWorkflows = this.getWCMWorkflows();
|
||||
|
||||
List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
|
||||
List<WorkflowDefinition> workflowDefs = this.getWorkflowService().getDefinitions();
|
||||
for (WorkflowDefinition workflowDef : workflowDefs)
|
||||
{
|
||||
String name = workflowDef.name;
|
||||
@@ -568,7 +588,19 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
this.nextButtonDisabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of workflows that can be started.
|
||||
*
|
||||
* @return List of SelectItem objects representing the workflows
|
||||
*/
|
||||
public List<SelectItem> getStartableWorkflows()
|
||||
{
|
||||
if (availableWorkflows == null)
|
||||
{
|
||||
initializeWorkflows();
|
||||
}
|
||||
return availableWorkflows;
|
||||
}
|
||||
|
||||
@@ -582,7 +614,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
String url = null;
|
||||
if (selectedWorkflow != null)
|
||||
{
|
||||
WorkflowDefinition def = workflows.get(selectedWorkflow);
|
||||
WorkflowDefinition def = getWorkflows().get(selectedWorkflow);
|
||||
url = "/workflowdefinitionimage/" + def.id;
|
||||
}
|
||||
return url;
|
||||
@@ -608,10 +640,10 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
for (String newItem : this.packageItemsToAdd)
|
||||
{
|
||||
NodeRef nodeRef = new NodeRef(newItem);
|
||||
if (this.nodeService.exists(nodeRef))
|
||||
if (this.getNodeService().exists(nodeRef))
|
||||
{
|
||||
// create our Node representation
|
||||
MapNode node = new MapNode(nodeRef, this.nodeService, true);
|
||||
MapNode node = new MapNode(nodeRef, this.getNodeService(), true);
|
||||
this.browseBean.setupCommonBindingProperties(node);
|
||||
|
||||
// add property resolvers to show path information
|
||||
@@ -651,9 +683,19 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
|
||||
protected WorkflowService getWorkflowService()
|
||||
{
|
||||
if (this.workflowService == null)
|
||||
{
|
||||
this.workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return this.workflowService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
|
||||
/**
|
||||
* Resets the rich list
|
||||
*/
|
||||
|
@@ -41,6 +41,8 @@ public class ViewCompletedTaskDialog extends ManageTaskDialog
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
private static final long serialVersionUID = 1568710712589201055L;
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
@@ -67,6 +69,6 @@ public class ViewCompletedTaskDialog extends ManageTaskDialog
|
||||
{
|
||||
String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "view_completed_task_title");
|
||||
|
||||
return titleStart + ": " + this.task.title;
|
||||
return titleStart + ": " + this.getWorkflowTask().title;
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.workflow;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -61,11 +62,15 @@ import org.apache.commons.logging.LogFactory;
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class WorkflowBean
|
||||
public class WorkflowBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 2950475254440425384L;
|
||||
|
||||
protected NavigationBean navigationBean;
|
||||
protected NodeService nodeService;
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
transient private NodeService nodeService;
|
||||
transient private WorkflowService workflowService;
|
||||
|
||||
protected List<Node> tasks;
|
||||
protected List<Node> activeTasks;
|
||||
protected List<Node> pooledTasks;
|
||||
@@ -101,7 +106,7 @@ public class WorkflowBean
|
||||
|
||||
// query for all active tasks
|
||||
WorkflowTaskQuery query = new WorkflowTaskQuery();
|
||||
List<WorkflowTask> tasks = this.workflowService.queryTasks(query);
|
||||
List<WorkflowTask> tasks = this.getWorkflowService().queryTasks(query);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
this.activeTasks = new ArrayList<Node>(tasks.size());
|
||||
@@ -150,7 +155,7 @@ public class WorkflowBean
|
||||
tx.begin();
|
||||
|
||||
// get the current pooled tasks for the current user
|
||||
List<WorkflowTask> tasks = this.workflowService.getPooledTasks(userName);
|
||||
List<WorkflowTask> tasks = this.getWorkflowService().getPooledTasks(userName);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
this.pooledTasks = new ArrayList<Node>(tasks.size());
|
||||
@@ -199,7 +204,7 @@ public class WorkflowBean
|
||||
tx.begin();
|
||||
|
||||
// get the current in progress tasks for the current user
|
||||
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
||||
List<WorkflowTask> tasks = this.getWorkflowService().getAssignedTasks(
|
||||
userName, WorkflowTaskState.IN_PROGRESS);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
@@ -249,7 +254,7 @@ public class WorkflowBean
|
||||
tx.begin();
|
||||
|
||||
// get the current in progress tasks for the current user
|
||||
List<WorkflowTask> tasks = this.workflowService.getAssignedTasks(
|
||||
List<WorkflowTask> tasks = this.getWorkflowService().getAssignedTasks(
|
||||
userName, WorkflowTaskState.COMPLETED);
|
||||
|
||||
// create a list of transient nodes to represent
|
||||
@@ -297,6 +302,15 @@ public class WorkflowBean
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
protected WorkflowService getWorkflowService()
|
||||
{
|
||||
if (this.workflowService == null)
|
||||
{
|
||||
this.workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
|
||||
}
|
||||
return this.workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the node service to use
|
||||
*
|
||||
@@ -307,7 +321,14 @@ public class WorkflowBean
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
|
||||
protected NodeService getNodeService()
|
||||
{
|
||||
if (this.nodeService == null)
|
||||
{
|
||||
this.nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
|
||||
}
|
||||
return this.nodeService;
|
||||
}
|
||||
// ------------------------------------------------------------------------------
|
||||
// Navigation handlers
|
||||
|
||||
|
@@ -24,15 +24,22 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.workflow;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.workflow.WorkflowInterpreter;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Backing bean to support the Workflow Console
|
||||
*/
|
||||
public class WorkflowConsoleBean
|
||||
public class WorkflowConsoleBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -7531838393180855185L;
|
||||
|
||||
// command
|
||||
private String command = "";
|
||||
private String submittedCommand = "none";
|
||||
@@ -40,7 +47,7 @@ public class WorkflowConsoleBean
|
||||
private String result = null;
|
||||
|
||||
// supporting repository services
|
||||
private WorkflowInterpreter workflowInterpreter;
|
||||
transient private WorkflowInterpreter workflowInterpreter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,8 +57,17 @@ public class WorkflowConsoleBean
|
||||
{
|
||||
this.workflowInterpreter = workflowInterpreter;
|
||||
}
|
||||
|
||||
private WorkflowInterpreter getWorkflowInterpreter()
|
||||
{
|
||||
if (this.workflowInterpreter == null)
|
||||
{
|
||||
this.workflowInterpreter = (WorkflowInterpreter) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "workflowInterpreter");
|
||||
}
|
||||
return this.workflowInterpreter;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Gets the command result
|
||||
*
|
||||
* @return result
|
||||
@@ -153,7 +169,7 @@ public class WorkflowConsoleBean
|
||||
*/
|
||||
public String getCurrentUserName()
|
||||
{
|
||||
return workflowInterpreter.getCurrentUserName();
|
||||
return getWorkflowInterpreter().getCurrentUserName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +179,7 @@ public class WorkflowConsoleBean
|
||||
*/
|
||||
public String getCurrentWorkflowDef()
|
||||
{
|
||||
WorkflowDefinition def = workflowInterpreter.getCurrentWorkflowDef();
|
||||
WorkflowDefinition def = getWorkflowInterpreter().getCurrentWorkflowDef();
|
||||
return (def == null) ? "None" : def.title + " v" + def.version;
|
||||
}
|
||||
|
||||
@@ -177,7 +193,7 @@ public class WorkflowConsoleBean
|
||||
try
|
||||
{
|
||||
long startms = System.currentTimeMillis();
|
||||
String result = workflowInterpreter.interpretCommand(command);
|
||||
String result = getWorkflowInterpreter().interpretCommand(command);
|
||||
setDuration(System.currentTimeMillis() - startms);
|
||||
setResult(result);
|
||||
setCommand("");
|
||||
|
Reference in New Issue
Block a user