mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge V3.2 To HEAD
17834: Fix for ETHREEOH-3613. Now you can add two different pieces of content with the same name to a package. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.web.bean.workflow;
|
package org.alfresco.web.bean.workflow;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -137,26 +138,23 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
{
|
{
|
||||||
// setup a transient node to represent the task we're managing
|
// setup a transient node to represent the task we're managing
|
||||||
WorkflowTaskDefinition taskDef = this.task.definition;
|
WorkflowTaskDefinition taskDef = this.task.definition;
|
||||||
this.taskNode = new TransientNode(taskDef.metadata.getName(),
|
this.taskNode = new TransientNode(taskDef.metadata.getName(), "task_" + System.currentTimeMillis(),
|
||||||
"task_" + System.currentTimeMillis(), this.task.properties);
|
this.task.properties);
|
||||||
|
|
||||||
// get access to the workflow instance for the task
|
// get access to the workflow instance for the task
|
||||||
this.workflowInstance = this.task.path.instance;
|
this.workflowInstance = this.task.path.instance;
|
||||||
|
|
||||||
// setup the workflow package for the task
|
// setup the workflow package for the task
|
||||||
this.workflowPackage = (NodeRef)this.task.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
this.workflowPackage = (NodeRef) this.task.properties.get(WorkflowModel.ASSOC_PACKAGE);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
LOGGER.debug("Task: " + this.task);
|
LOGGER.debug("Task: " + this.task);
|
||||||
LOGGER.debug("Trasient node: " + this.taskNode);
|
LOGGER.debug("Trasient node: " + this.taskNode);
|
||||||
Boolean isSystemPackage = (Boolean)
|
Boolean isSystemPackage = (Boolean) this.getNodeService().getProperty(this.workflowPackage,
|
||||||
this.getNodeService().getProperty(this.workflowPackage,
|
|
||||||
WorkflowModel.PROP_IS_SYSTEM_PACKAGE);
|
WorkflowModel.PROP_IS_SYSTEM_PACKAGE);
|
||||||
LOGGER.debug("Workflow package: " + this.workflowPackage +
|
LOGGER.debug("Workflow package: " + this.workflowPackage + " system package: " + isSystemPackage);
|
||||||
" system package: " + isSystemPackage);
|
boolean isWCMWorkflow = (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM));
|
||||||
boolean isWCMWorkflow = (this.workflowPackage.getStoreRef().getProtocol().equals(
|
|
||||||
StoreRef.PROTOCOL_AVM));
|
|
||||||
LOGGER.debug("is wcm workflow: " + isWCMWorkflow);
|
LOGGER.debug("is wcm workflow: " + isWCMWorkflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,8 +172,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome)
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("Saving task: " + this.getWorkflowTask().id);
|
LOGGER.debug("Saving task: " + this.getWorkflowTask().id);
|
||||||
@@ -236,10 +233,11 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
Object hiddenTransitions = this.taskNode.getProperties().get(WorkflowModel.PROP_HIDDEN_TRANSITIONS);
|
Object hiddenTransitions = this.taskNode.getProperties().get(WorkflowModel.PROP_HIDDEN_TRANSITIONS);
|
||||||
for (WorkflowTransition trans : this.transitions)
|
for (WorkflowTransition trans : this.transitions)
|
||||||
{
|
{
|
||||||
if (hiddenTransitions == null ||
|
if (hiddenTransitions == null
|
||||||
(hiddenTransitions instanceof String && ((String)hiddenTransitions).equals("")) ||
|
|| (hiddenTransitions instanceof String && ((String) hiddenTransitions).equals(""))
|
||||||
(hiddenTransitions instanceof String && !((String)hiddenTransitions).equals(trans.id)) ||
|
|| (hiddenTransitions instanceof String && !((String) hiddenTransitions)
|
||||||
(hiddenTransitions instanceof List) && !((List<String>)hiddenTransitions).contains(trans.id))
|
.equals(trans.id)) || (hiddenTransitions instanceof List<?>)
|
||||||
|
&& !((List<?>) hiddenTransitions).contains(trans.id))
|
||||||
{
|
{
|
||||||
buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null,
|
buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null,
|
||||||
"#{DialogManager.bean.transition}", "false", null));
|
"#{DialogManager.bean.transition}", "false", null));
|
||||||
@@ -281,7 +279,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("deprecation")
|
||||||
public String takeOwnership()
|
public String takeOwnership()
|
||||||
{
|
{
|
||||||
String outcome = getDefaultFinishOutcome();
|
String outcome = getDefaultFinishOutcome();
|
||||||
@@ -291,7 +289,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
|
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
// before taking ownership check the task still exists and is not completed
|
// before taking ownership check the task still exists and is not
|
||||||
|
// completed
|
||||||
WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id);
|
WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id);
|
||||||
if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED)
|
if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED)
|
||||||
{
|
{
|
||||||
@@ -322,7 +321,16 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// 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), e);
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
outcome = this.getErrorOutcome(e);
|
outcome = this.getErrorOutcome(e);
|
||||||
}
|
}
|
||||||
@@ -330,7 +338,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("deprecation")
|
||||||
public String returnOwnership()
|
public String returnOwnership()
|
||||||
{
|
{
|
||||||
String outcome = getDefaultFinishOutcome();
|
String outcome = getDefaultFinishOutcome();
|
||||||
@@ -339,7 +347,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
LOGGER.debug("Returning ownership of task to pool: " + this.getWorkflowTask().id);
|
LOGGER.debug("Returning ownership of task to pool: " + this.getWorkflowTask().id);
|
||||||
|
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
// before returning ownership check the task still exists and is not completed
|
// before returning ownership check the task still exists and is not
|
||||||
|
// completed
|
||||||
WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id);
|
WorkflowTask checkTask = this.getWorkflowService().getTaskById(this.getWorkflowTask().id);
|
||||||
if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED)
|
if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED)
|
||||||
{
|
{
|
||||||
@@ -368,7 +377,16 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// 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), e);
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
outcome = this.getErrorOutcome(e);
|
outcome = this.getErrorOutcome(e);
|
||||||
}
|
}
|
||||||
@@ -376,7 +394,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("deprecation")
|
||||||
public String transition()
|
public String transition()
|
||||||
{
|
{
|
||||||
String outcome = getDefaultFinishOutcome();
|
String outcome = getDefaultFinishOutcome();
|
||||||
@@ -396,7 +414,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
// to find out which transition button was pressed we need
|
// to find out which transition button was pressed we need
|
||||||
// to look for the button's id in the request parameters,
|
// to look for the button's id in the request parameters,
|
||||||
// the first non-null result is the button that was pressed.
|
// the first non-null result is the button that was pressed.
|
||||||
Map reqParams = context.getExternalContext().getRequestParameterMap();
|
Map<?, ?> reqParams = context.getExternalContext().getRequestParameterMap();
|
||||||
|
|
||||||
String selectedTransition = null;
|
String selectedTransition = null;
|
||||||
for (WorkflowTransition trans : this.getWorkflowTransitions())
|
for (WorkflowTransition trans : this.getWorkflowTransitions())
|
||||||
@@ -439,7 +457,16 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// 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), e);
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
outcome = this.getErrorOutcome(e);
|
outcome = this.getErrorOutcome(e);
|
||||||
}
|
}
|
||||||
@@ -448,7 +475,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares the dialog to allow the user to add an item to the workflow package
|
* Prepares the dialog to allow the user to add an item to the workflow
|
||||||
|
* package
|
||||||
*
|
*
|
||||||
* @param event The event
|
* @param event The event
|
||||||
*/
|
*/
|
||||||
@@ -484,9 +512,12 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
|
|
||||||
for (String item : this.itemsToAdd)
|
for (String item : this.itemsToAdd)
|
||||||
{
|
{
|
||||||
// if this item is in the remove list it means it was there originally
|
// if this item is in the remove list it means it was there
|
||||||
// and has now been re-added, as a result we don't need to do anything
|
// originally
|
||||||
// to the original workflow package, therefore remove from the remove list
|
// and has now been re-added, as a result we don't need to do
|
||||||
|
// anything
|
||||||
|
// to the original workflow package, therefore remove from the
|
||||||
|
// remove list
|
||||||
if (this.packageItemsToRemove != null && this.packageItemsToRemove.contains(item))
|
if (this.packageItemsToRemove != null && this.packageItemsToRemove.contains(item))
|
||||||
{
|
{
|
||||||
this.packageItemsToRemove.remove(item);
|
this.packageItemsToRemove.remove(item);
|
||||||
@@ -518,13 +549,14 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public void removePackageItem(ActionEvent event)
|
public void removePackageItem(ActionEvent event)
|
||||||
{
|
{
|
||||||
UIActionLink link = (UIActionLink)event.getComponent();
|
UIActionLink link = (UIActionLink) event.getComponent();
|
||||||
Map<String, String> params = link.getParameterMap();
|
Map<String, String> params = link.getParameterMap();
|
||||||
String nodeRef = new NodeRef(Repository.getStoreRef(), params.get("id")).toString();
|
String nodeRef = new NodeRef(Repository.getStoreRef(), params.get("id")).toString();
|
||||||
|
|
||||||
if (this.packageItemsToAdd != null && this.packageItemsToAdd.contains(nodeRef))
|
if (this.packageItemsToAdd != null && this.packageItemsToAdd.contains(nodeRef))
|
||||||
{
|
{
|
||||||
// remove the item from the added list if it was added in this dialog session
|
// remove the item from the added list if it was added in this
|
||||||
|
// dialog session
|
||||||
this.packageItemsToAdd.remove(nodeRef);
|
this.packageItemsToAdd.remove(nodeRef);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
@@ -551,7 +583,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
/**
|
/**
|
||||||
* Toggles the complete flag for a workflow package item
|
* Toggles the complete flag for a workflow package item
|
||||||
*
|
*
|
||||||
* @param event The event containing a reference to the item to toggle the status for
|
* @param event The event containing a reference to the item to toggle the
|
||||||
|
* status for
|
||||||
*/
|
*/
|
||||||
public void togglePackageItemComplete(ActionEvent event)
|
public void togglePackageItemComplete(ActionEvent event)
|
||||||
{
|
{
|
||||||
@@ -562,7 +595,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
// Bean Getters and Setters
|
// Bean Getters and Setters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a String array of NodeRef's that are being added to the workflow package
|
* Returns a String array of NodeRef's that are being added to the workflow
|
||||||
|
* package
|
||||||
*
|
*
|
||||||
* @return String array of NodeRef's
|
* @return String array of NodeRef's
|
||||||
*/
|
*/
|
||||||
@@ -582,7 +616,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether an item is currently being added to the workflow package
|
* Determines whether an item is currently being added to the workflow
|
||||||
|
* package
|
||||||
*
|
*
|
||||||
* @return true if an item is being added
|
* @return true if an item is being added
|
||||||
*/
|
*/
|
||||||
@@ -628,7 +663,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public boolean isPooledTask()
|
public boolean isPooledTask()
|
||||||
{
|
{
|
||||||
List pooledActors = (List)taskNode.getAssociations().get(WorkflowModel.ASSOC_POOLED_ACTORS);
|
List<?> pooledActors = (List<?>) taskNode.getAssociations().get(WorkflowModel.ASSOC_POOLED_ACTORS);
|
||||||
return (pooledActors != null && pooledActors.size() > 0);
|
return (pooledActors != null && pooledActors.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,24 +698,23 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public String getPackageActionGroup()
|
public String getPackageActionGroup()
|
||||||
{
|
{
|
||||||
return (String)this.getWorkflowTask().properties.get(
|
return (String) this.getWorkflowTask().properties.get(WorkflowModel.PROP_PACKAGE_ACTION_GROUP);
|
||||||
WorkflowModel.PROP_PACKAGE_ACTION_GROUP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the action group the current task uses for each workflow package item
|
* Returns the action group the current task uses for each workflow package
|
||||||
|
* item
|
||||||
*
|
*
|
||||||
* @return action group id
|
* @return action group id
|
||||||
*/
|
*/
|
||||||
public String getPackageItemActionGroup()
|
public String getPackageItemActionGroup()
|
||||||
{
|
{
|
||||||
return (String)this.getWorkflowTask().properties.get(
|
return (String) this.getWorkflowTask().properties.get(WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP);
|
||||||
WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of resources associated with this task
|
* Returns a list of resources associated with this task i.e. the children
|
||||||
* i.e. the children of the workflow package
|
* of the workflow package
|
||||||
*
|
*
|
||||||
* @return The list of nodes
|
* @return The list of nodes
|
||||||
*/
|
*/
|
||||||
@@ -699,34 +733,37 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
|
|
||||||
List<NodeRef> contents = this.workflowService.getPackageContents(getWorkflowTask().id);
|
List<NodeRef> contents = this.workflowService.getPackageContents(getWorkflowTask().id);
|
||||||
|
|
||||||
|
|
||||||
for (NodeRef nodeRef : contents)
|
for (NodeRef nodeRef : contents)
|
||||||
{
|
{
|
||||||
if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||||
{
|
{
|
||||||
Pair<Integer, String> vp = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
Pair<Integer, String> vp = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
||||||
this.addAVMNode(new AVMNode(this.getAvmService().lookup(vp.getFirst(),
|
this.addAVMNode(new AVMNode(this.getAvmService().lookup(vp.getFirst(), vp.getSecond(), true)));
|
||||||
vp.getSecond(),
|
|
||||||
true)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this.getNodeService().exists(nodeRef))
|
if (this.getNodeService().exists(nodeRef))
|
||||||
{
|
{
|
||||||
// find it's type so we can see if it's a node we are interested in
|
// find it's type so we can see if it's a node we
|
||||||
|
// are interested in
|
||||||
QName type = this.getNodeService().getType(nodeRef);
|
QName type = this.getNodeService().getType(nodeRef);
|
||||||
|
|
||||||
// make sure the type is defined in the data dictionary
|
// make sure the type is defined in the data
|
||||||
|
// dictionary
|
||||||
if (this.getDictionaryService().getType(type) != null)
|
if (this.getDictionaryService().getType(type) != null)
|
||||||
{
|
{
|
||||||
// look for content nodes or links to content
|
// look for content nodes or links to content
|
||||||
// NOTE: folders within workflow packages are ignored for now
|
// NOTE: folders within workflow packages are
|
||||||
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) || ApplicationModel.TYPE_FILELINK.equals(type))
|
// ignored for now
|
||||||
|
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
|
// if the node is not in the removed list
|
||||||
// client side representation and add to the list
|
// then add create the
|
||||||
if (this.packageItemsToRemove == null ||
|
// client side representation and add to the
|
||||||
this.packageItemsToRemove.contains(nodeRef.toString()) == false)
|
// list
|
||||||
|
if (this.packageItemsToRemove == null
|
||||||
|
|| this.packageItemsToRemove.contains(nodeRef.toString()) == false)
|
||||||
{
|
{
|
||||||
createAndAddNode(nodeRef);
|
createAndAddNode(nodeRef);
|
||||||
}
|
}
|
||||||
@@ -736,8 +773,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now iterate through the items to add list and add them to the
|
||||||
// now iterate through the items to add list and add them to the list of resources
|
// list of resources
|
||||||
if (this.packageItemsToAdd != null)
|
if (this.packageItemsToAdd != null)
|
||||||
{
|
{
|
||||||
for (String newItem : this.packageItemsToAdd)
|
for (String newItem : this.packageItemsToAdd)
|
||||||
@@ -745,8 +782,10 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
NodeRef nodeRef = new NodeRef(newItem);
|
NodeRef nodeRef = new NodeRef(newItem);
|
||||||
if (this.getNodeService().exists(nodeRef))
|
if (this.getNodeService().exists(nodeRef))
|
||||||
{
|
{
|
||||||
// we know the type is correct as this was added as a result of a query
|
// we know the type is correct as this was added as
|
||||||
// for all content items so just add the item to the resources list
|
// a result of a query
|
||||||
|
// for all content items so just add the item to the
|
||||||
|
// resources list
|
||||||
createAndAddNode(nodeRef);
|
createAndAddNode(nodeRef);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -762,10 +801,19 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
this.resources = Collections.<Node>emptyList();
|
this.resources = Collections.<Node> emptyList();
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try
|
||||||
|
{
|
||||||
|
if (tx != null)
|
||||||
|
{
|
||||||
|
tx.rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception tex)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (LOGGER.isDebugEnabled())
|
else if (LOGGER.isDebugEnabled())
|
||||||
@@ -779,8 +827,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
/**
|
/**
|
||||||
* Sets the workflow service to use
|
* Sets the workflow service to use
|
||||||
*
|
*
|
||||||
* @param workflowService
|
* @param workflowService WorkflowService instance
|
||||||
* WorkflowService instance
|
|
||||||
*/
|
*/
|
||||||
public void setWorkflowService(WorkflowService workflowService)
|
public void setWorkflowService(WorkflowService workflowService)
|
||||||
{
|
{
|
||||||
@@ -799,8 +846,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
/**
|
/**
|
||||||
* Sets the avm service to use
|
* Sets the avm service to use
|
||||||
*
|
*
|
||||||
* @param avmService
|
* @param avmService AvmService instance
|
||||||
* AvmService instance
|
|
||||||
*/
|
*/
|
||||||
public void setAvmService(final AVMService avmService)
|
public void setAvmService(final AVMService avmService)
|
||||||
{
|
{
|
||||||
@@ -819,8 +865,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
/**
|
/**
|
||||||
* Sets the avm sync service to use
|
* Sets the avm sync service to use
|
||||||
*
|
*
|
||||||
* @param avmSyncService
|
* @param avmSyncService AvmSycService instance
|
||||||
* AvmSycService instance
|
|
||||||
*/
|
*/
|
||||||
public void setAvmSyncService(final AVMSyncService avmSyncService)
|
public void setAvmSyncService(final AVMSyncService avmSyncService)
|
||||||
{
|
{
|
||||||
@@ -848,7 +893,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
{
|
{
|
||||||
if (wpService == null)
|
if (wpService == null)
|
||||||
{
|
{
|
||||||
wpService = (WebProjectService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "WebProjectService");
|
wpService = (WebProjectService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(),
|
||||||
|
"WebProjectService");
|
||||||
}
|
}
|
||||||
return wpService;
|
return wpService;
|
||||||
}
|
}
|
||||||
@@ -889,8 +935,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
this.resources.add(node);
|
this.resources.add(node);
|
||||||
if (node.isDirectory() && !node.getDescriptor().isDeleted())
|
if (node.isDirectory() && !node.getDescriptor().isDeleted())
|
||||||
{
|
{
|
||||||
for (final AVMNodeDescriptor d :
|
for (final AVMNodeDescriptor d : this.getAvmService().getDirectoryListingArray(node.getDescriptor(), true))
|
||||||
this.getAvmService().getDirectoryListingArray(node.getDescriptor(), true))
|
|
||||||
{
|
{
|
||||||
this.addAVMNode(new AVMNode(d));
|
this.addAVMNode(new AVMNode(d));
|
||||||
}
|
}
|
||||||
@@ -907,8 +952,9 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
node.addPropertyResolver("path", this.browseBean.resolverPath);
|
node.addPropertyResolver("path", this.browseBean.resolverPath);
|
||||||
node.addPropertyResolver("displayPath", this.browseBean.resolverDisplayPath);
|
node.addPropertyResolver("displayPath", this.browseBean.resolverDisplayPath);
|
||||||
|
|
||||||
// add a property resolver to indicate whether the item has been completed or not
|
// add a property resolver to indicate whether the item has been
|
||||||
// node.addPropertyResolver("completed", this.completeResolver);
|
// completed or not
|
||||||
|
// node.addPropertyResolver("completed", this.completeResolver);
|
||||||
|
|
||||||
// add the id of the task being managed
|
// add the id of the task being managed
|
||||||
node.getProperties().put("taskId", this.getWorkflowTask().id);
|
node.getProperties().put("taskId", this.getWorkflowTask().id);
|
||||||
@@ -919,8 +965,7 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
protected void updateResources()
|
protected void updateResources()
|
||||||
{
|
{
|
||||||
// remove any items the user selected to remove
|
// remove any items the user selected to remove
|
||||||
if (this.workflowPackage != null && this.packageItemsToRemove != null &&
|
if (this.workflowPackage != null && this.packageItemsToRemove != null && this.packageItemsToRemove.size() > 0)
|
||||||
this.packageItemsToRemove.size() > 0)
|
|
||||||
{
|
{
|
||||||
for (String removedItem : this.packageItemsToRemove)
|
for (String removedItem : this.packageItemsToRemove)
|
||||||
{
|
{
|
||||||
@@ -929,16 +974,18 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add any items the user selected to add
|
// add any items the user selected to add
|
||||||
if (this.workflowPackage != null && this.packageItemsToAdd != null &&
|
if (this.workflowPackage != null && this.packageItemsToAdd != null && this.packageItemsToAdd.size() > 0)
|
||||||
this.packageItemsToAdd.size() > 0)
|
|
||||||
{
|
{
|
||||||
for (String addedItem : this.packageItemsToAdd)
|
for (String addedItem : this.packageItemsToAdd)
|
||||||
{
|
{
|
||||||
NodeRef addedNodeRef = new NodeRef(addedItem);
|
NodeRef addedNodeRef = new NodeRef(addedItem);
|
||||||
this.getNodeService().addChild(this.workflowPackage, addedNodeRef,
|
this.getNodeService().addChild(
|
||||||
ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
this.workflowPackage,
|
||||||
QName.createValidLocalName((String)this.getNodeService().getProperty(
|
addedNodeRef,
|
||||||
addedNodeRef, ContentModel.PROP_NAME))));
|
WorkflowModel.ASSOC_PACKAGE_CONTAINS,
|
||||||
|
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName
|
||||||
|
.createValidLocalName((String) this.getNodeService().getProperty(addedNodeRef,
|
||||||
|
ContentModel.PROP_NAME))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -947,7 +994,8 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
// Inner classes
|
// Inner classes
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property resolver to determine if the given node has been flagged as complete
|
* Property resolver to determine if the given node has been flagged as
|
||||||
|
* complete
|
||||||
*/
|
*/
|
||||||
protected class TaskCompleteResolver implements NodePropertyResolver
|
protected class TaskCompleteResolver implements NodePropertyResolver
|
||||||
{
|
{
|
||||||
@@ -956,16 +1004,11 @@ public class ManageTaskDialog extends BaseDialogBean
|
|||||||
public Object get(Node node)
|
public Object get(Node node)
|
||||||
{
|
{
|
||||||
String result = Application.getMessage(FacesContext.getCurrentInstance(), "no");
|
String result = Application.getMessage(FacesContext.getCurrentInstance(), "no");
|
||||||
|
List<?> completedItems = (List<?>) getWorkflowTask().properties.get(WorkflowModel.PROP_COMPLETED_ITEMS);
|
||||||
List<NodeRef> completedItems = (List<NodeRef>)getWorkflowTask().properties.get(
|
if (completedItems != null && completedItems.size() > 0 && completedItems.contains(node.getNodeRef()))
|
||||||
WorkflowModel.PROP_COMPLETED_ITEMS);
|
|
||||||
|
|
||||||
if (completedItems != null && completedItems.size() > 0 &&
|
|
||||||
completedItems.contains(node.getNodeRef()))
|
|
||||||
{
|
{
|
||||||
result = Application.getMessage(FacesContext.getCurrentInstance(), "yes");
|
result = Application.getMessage(FacesContext.getCurrentInstance(), "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -207,7 +207,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
|||||||
{
|
{
|
||||||
NodeRef addedNodeRef = new NodeRef(addedItem);
|
NodeRef addedNodeRef = new NodeRef(addedItem);
|
||||||
this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef,
|
this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef,
|
||||||
ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
WorkflowModel.ASSOC_PACKAGE_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
||||||
QName.createValidLocalName((String)this.getNodeService().getProperty(
|
QName.createValidLocalName((String)this.getNodeService().getProperty(
|
||||||
addedNodeRef, ContentModel.PROP_NAME))));
|
addedNodeRef, ContentModel.PROP_NAME))));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user