mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
No parameter conditions and actions can now be added with no client changes & made all summary strings use parameters in correct way
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2772 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,7 +22,6 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
||||
import org.alfresco.repo.action.executer.CheckInActionExecuter;
|
||||
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
|
||||
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
||||
import org.alfresco.repo.action.executer.CopyActionExecuter;
|
||||
import org.alfresco.repo.action.executer.ImageTransformActionExecuter;
|
||||
import org.alfresco.repo.action.executer.ImporterActionExecuter;
|
||||
@@ -544,19 +543,30 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
actionProps.put(PROP_ACTION_NAME, this.action);
|
||||
this.currentActionProperties = actionProps;
|
||||
|
||||
// setup any defaults for the UI or handle actions with no parameters
|
||||
String overridenViewId = setupUIDefaultsForAction(actionProps);
|
||||
if (overridenViewId != null)
|
||||
// determine whether the action being added has any parameters
|
||||
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action);
|
||||
if (actionDef.hasParameterDefinitions())
|
||||
{
|
||||
viewId = overridenViewId;
|
||||
// setup any defaults for the UI and override the viewId if necessary
|
||||
String overridenViewId = setupUIDefaultsForAction(actionProps);
|
||||
if (overridenViewId != null)
|
||||
{
|
||||
viewId = overridenViewId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just add the action to the list and use the title as the summary
|
||||
actionProps.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
|
||||
this.allActionsProperties.add(actionProps);
|
||||
|
||||
// come back to the same page we're on now as there are no params to collect
|
||||
viewId = this.returnViewId;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Added '" + this.action + "' action to list");
|
||||
|
||||
// reset the selected action drop down
|
||||
this.action = null;
|
||||
|
||||
// go to the page to collect the settings
|
||||
goToPage(context, viewId);
|
||||
}
|
||||
@@ -597,15 +607,14 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
this.currentActionProperties.put(PROP_ACTION_SUMMARY, summary);
|
||||
}
|
||||
|
||||
if (this.editingAction)
|
||||
{
|
||||
this.action = null;
|
||||
}
|
||||
else
|
||||
if (this.editingAction == false)
|
||||
{
|
||||
this.allActionsProperties.add(this.currentActionProperties);
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.action = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(context, this.returnViewId);
|
||||
}
|
||||
@@ -633,15 +642,14 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
*/
|
||||
public void cancelAddAction()
|
||||
{
|
||||
if (this.editingAction)
|
||||
{
|
||||
this.action = null;
|
||||
}
|
||||
else
|
||||
if (this.editingAction == false)
|
||||
{
|
||||
this.currentActionProperties.clear();
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.action = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(FacesContext.getCurrentInstance(), this.returnViewId);
|
||||
}
|
||||
@@ -823,15 +831,6 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
{
|
||||
this.currentActionProperties.put(PROP_CHECKIN_MINOR, new Boolean(true));
|
||||
}
|
||||
else if (ContentMetadataExtracter.NAME.equals(this.action))
|
||||
{
|
||||
// This one (currently) has no parameters, so just add it...
|
||||
props.put(PROP_ACTION_SUMMARY, buildActionSummary());
|
||||
this.allActionsProperties.add(props);
|
||||
|
||||
// come back to the same page we're on now
|
||||
overridenViewId = this.returnViewId;
|
||||
}
|
||||
|
||||
return overridenViewId;
|
||||
}
|
||||
@@ -846,48 +845,48 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
protected Map<String, Serializable> buildActionParams()
|
||||
{
|
||||
// set up parameters maps for the action
|
||||
Map<String, Serializable> actionParams = new HashMap<String, Serializable>();
|
||||
Map<String, Serializable> repoParams = new HashMap<String, Serializable>();
|
||||
|
||||
if (AddFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
QName aspect = Repository.resolveToQName((String)this.currentActionProperties.get(PROP_ASPECT));
|
||||
actionParams.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
|
||||
repoParams.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
|
||||
}
|
||||
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
QName aspect = Repository.resolveToQName((String)this.currentActionProperties.get(PROP_ASPECT));
|
||||
actionParams.put(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
|
||||
repoParams.put(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
|
||||
}
|
||||
else if (CopyActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the destination space id to the action properties
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
|
||||
// add the type and name of the association to create when the copy
|
||||
// is performed
|
||||
actionParams.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
repoParams.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
ContentModel.ASSOC_CONTAINS);
|
||||
actionParams.put(CopyActionExecuter.PARAM_ASSOC_QNAME,
|
||||
repoParams.put(CopyActionExecuter.PARAM_ASSOC_QNAME,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
|
||||
}
|
||||
else if (MoveActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the destination space id to the action properties
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
|
||||
// add the type and name of the association to create when the move
|
||||
// is performed
|
||||
actionParams.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
repoParams.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
ContentModel.ASSOC_CONTAINS);
|
||||
actionParams.put(MoveActionExecuter.PARAM_ASSOC_QNAME,
|
||||
repoParams.put(MoveActionExecuter.PARAM_ASSOC_QNAME,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "move"));
|
||||
}
|
||||
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the approve step name
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP,
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP,
|
||||
(String)this.currentActionProperties.get(PROP_APPROVE_STEP_NAME));
|
||||
|
||||
// add whether the approve step will copy or move the content
|
||||
@@ -898,7 +897,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
approveMove = false;
|
||||
}
|
||||
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
|
||||
|
||||
// add the destination folder of the content
|
||||
NodeRef approveDestNodeRef = null;
|
||||
@@ -911,7 +910,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
{
|
||||
approveDestNodeRef = new NodeRef((String)approveDestNode);
|
||||
}
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
|
||||
|
||||
// determine whether we have a reject step or not
|
||||
boolean requireReject = true;
|
||||
@@ -924,7 +923,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
if (requireReject)
|
||||
{
|
||||
// add the reject step name
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP,
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP,
|
||||
(String)this.currentActionProperties.get(PROP_REJECT_STEP_NAME));
|
||||
|
||||
// add whether the reject step will copy or move the content
|
||||
@@ -935,7 +934,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
rejectMove = false;
|
||||
}
|
||||
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
|
||||
|
||||
// add the destination folder of the content
|
||||
NodeRef rejectDestNodeRef = null;
|
||||
@@ -948,18 +947,18 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
{
|
||||
rejectDestNodeRef = new NodeRef((String)rejectDestNode);
|
||||
}
|
||||
actionParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
|
||||
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
|
||||
}
|
||||
}
|
||||
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the classifiable aspect
|
||||
actionParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_ASPECT,
|
||||
repoParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_ASPECT,
|
||||
ContentModel.ASPECT_GEN_CLASSIFIABLE);
|
||||
|
||||
// put the selected category in the action params
|
||||
NodeRef catNodeRef = (NodeRef)this.currentActionProperties.get(PROP_CATEGORY);
|
||||
actionParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
|
||||
repoParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
|
||||
catNodeRef);
|
||||
}
|
||||
else if (CheckOutActionExecuter.NAME.equals(this.action))
|
||||
@@ -967,61 +966,61 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
// specify the location the checked out working copy should go
|
||||
// add the destination space id to the action properties
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
|
||||
// add the type and name of the association to create when the
|
||||
// check out is performed
|
||||
actionParams.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
repoParams.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
ContentModel.ASSOC_CONTAINS);
|
||||
actionParams.put(CheckOutActionExecuter.PARAM_ASSOC_QNAME,
|
||||
repoParams.put(CheckOutActionExecuter.PARAM_ASSOC_QNAME,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "checkout"));
|
||||
}
|
||||
else if (CheckInActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the description for the checkin to the action params
|
||||
actionParams.put(CheckInActionExecuter.PARAM_DESCRIPTION,
|
||||
repoParams.put(CheckInActionExecuter.PARAM_DESCRIPTION,
|
||||
this.currentActionProperties.get(PROP_CHECKIN_DESC));
|
||||
|
||||
// add the minor change flag
|
||||
actionParams.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
|
||||
repoParams.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
|
||||
this.currentActionProperties.get(PROP_CHECKIN_MINOR));
|
||||
}
|
||||
else if (TransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the transformer to use
|
||||
actionParams.put(TransformActionExecuter.PARAM_MIME_TYPE,
|
||||
repoParams.put(TransformActionExecuter.PARAM_MIME_TYPE,
|
||||
this.currentActionProperties.get(PROP_TRANSFORMER));
|
||||
|
||||
// add the destination space id to the action properties
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
|
||||
// add the type and name of the association to create when the copy
|
||||
// is performed
|
||||
actionParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
ContentModel.ASSOC_CONTAINS);
|
||||
actionParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
|
||||
repoParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
|
||||
}
|
||||
else if (ImageTransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the transformer to use
|
||||
actionParams.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
|
||||
repoParams.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
|
||||
this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER));
|
||||
|
||||
// add the options
|
||||
actionParams.put(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND,
|
||||
repoParams.put(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND,
|
||||
this.currentActionProperties.get(PROP_TRANSFORM_OPTIONS));
|
||||
|
||||
// add the destination space id to the action properties
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
|
||||
// add the type and name of the association to create when the copy
|
||||
// is performed
|
||||
actionParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
|
||||
ContentModel.ASSOC_CONTAINS);
|
||||
actionParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
|
||||
repoParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
|
||||
}
|
||||
else if (MailActionExecuter.NAME.equals(this.action))
|
||||
@@ -1034,51 +1033,51 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
recipients.add(wrapper.authority);
|
||||
}
|
||||
|
||||
actionParams.put(MailActionExecuter.PARAM_TO_MANY, (Serializable)recipients);
|
||||
repoParams.put(MailActionExecuter.PARAM_TO_MANY, (Serializable)recipients);
|
||||
|
||||
// add the actual email text to send
|
||||
actionParams.put(MailActionExecuter.PARAM_TEXT,
|
||||
repoParams.put(MailActionExecuter.PARAM_TEXT,
|
||||
this.currentActionProperties.get(PROP_MESSAGE));
|
||||
|
||||
// add the subject for the email
|
||||
actionParams.put(MailActionExecuter.PARAM_SUBJECT,
|
||||
repoParams.put(MailActionExecuter.PARAM_SUBJECT,
|
||||
this.currentActionProperties.get(PROP_SUBJECT));
|
||||
|
||||
// add the from address
|
||||
String from = Application.getClientConfig(FacesContext.getCurrentInstance()).getFromEmailAddress();
|
||||
actionParams.put(MailActionExecuter.PARAM_FROM, from);
|
||||
repoParams.put(MailActionExecuter.PARAM_FROM, from);
|
||||
|
||||
// add the template if one was selected by the user
|
||||
if (this.usingTemplate != null)
|
||||
{
|
||||
actionParams.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(Repository.getStoreRef(), this.usingTemplate));
|
||||
repoParams.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(Repository.getStoreRef(), this.usingTemplate));
|
||||
}
|
||||
}
|
||||
else if (ImporterActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the encoding
|
||||
actionParams.put(ImporterActionExecuter.PARAM_ENCODING, IMPORT_ENCODING);
|
||||
repoParams.put(ImporterActionExecuter.PARAM_ENCODING, IMPORT_ENCODING);
|
||||
|
||||
// add the destination for the import
|
||||
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
actionParams.put(ImporterActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
repoParams.put(ImporterActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
|
||||
}
|
||||
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
// add the specialisation type
|
||||
String objectType = (String)this.currentActionProperties.get(PROP_OBJECT_TYPE);
|
||||
actionParams.put(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME, QName.createQName(objectType));
|
||||
repoParams.put(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME, QName.createQName(objectType));
|
||||
}
|
||||
else if (ScriptActionExecutor.NAME.equals(this.action))
|
||||
{
|
||||
// add the selected script noderef to the action properties
|
||||
String id = (String)this.currentActionProperties.get(PROP_SCRIPT);
|
||||
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
|
||||
actionParams.put(ScriptActionExecutor.PARAM_SCRIPTREF, scriptRef);
|
||||
actionParams.put(ScriptActionExecutor.PARAM_SPACEREF, this.navigator.getCurrentNode().getNodeRef());
|
||||
repoParams.put(ScriptActionExecutor.PARAM_SCRIPTREF, scriptRef);
|
||||
repoParams.put(ScriptActionExecutor.PARAM_SPACEREF, this.navigator.getCurrentNode().getNodeRef());
|
||||
}
|
||||
|
||||
return actionParams;
|
||||
return repoParams;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1088,192 +1087,235 @@ public abstract class BaseActionWizard extends BaseWizardBean
|
||||
*/
|
||||
protected String buildActionSummary()
|
||||
{
|
||||
String summaryResult = null;
|
||||
String summary = null;
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
|
||||
String actionName = (String)this.currentActionProperties.get(PROP_ACTION_NAME);
|
||||
if (actionName != null)
|
||||
if (AddFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
StringBuilder summary = new StringBuilder();
|
||||
summary.append(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"action_" + actionName.replace('-', '_')));
|
||||
summary.append(" ");
|
||||
String label = null;
|
||||
String aspect = (String)this.currentActionProperties.get(PROP_ASPECT);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getAspects())
|
||||
{
|
||||
if (item.getValue().equals(aspect))
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_add_features"),
|
||||
new Object[] {label});
|
||||
}
|
||||
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String label = null;
|
||||
String aspect = (String)this.currentActionProperties.get(PROP_ASPECT);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getAspects())
|
||||
{
|
||||
if (item.getValue().equals(aspect))
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_remove_features"),
|
||||
new Object[] {label});
|
||||
}
|
||||
else if (CopyActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
|
||||
// define a summary to be added for each action
|
||||
if (AddFeaturesActionExecuter.NAME.equals(actionName) || RemoveFeaturesActionExecuter.NAME.equals(actionName))
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_copy"),
|
||||
new Object[] {spaceName});
|
||||
}
|
||||
else if (MoveActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_move"),
|
||||
new Object[] {spaceName});
|
||||
}
|
||||
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String approveStepName = (String)this.currentActionProperties.get(PROP_APPROVE_STEP_NAME);
|
||||
String approveAction = (String)this.currentActionProperties.get(PROP_APPROVE_ACTION);
|
||||
NodeRef approveFolder = (NodeRef)this.currentActionProperties.get(PROP_APPROVE_FOLDER);
|
||||
String approveFolderName = Repository.getNameForNode(this.nodeService, approveFolder);
|
||||
String approveMsg = MessageFormat.format(Application.getMessage(context, "action_simple_workflow"),
|
||||
new Object[] {Application.getMessage(context, approveAction),
|
||||
approveFolderName, approveStepName});
|
||||
|
||||
String rejectMsg = null;
|
||||
String rejectStep = (String)this.currentActionProperties.get(PROP_REJECT_STEP_PRESENT);
|
||||
if (rejectStep != null && "yes".equals(rejectStep))
|
||||
{
|
||||
String aspect = (String)this.currentActionProperties.get(PROP_ASPECT);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getAspects())
|
||||
String rejectStepName = (String)this.currentActionProperties.get(PROP_REJECT_STEP_NAME);
|
||||
String rejectAction = (String)this.currentActionProperties.get(PROP_REJECT_ACTION);
|
||||
NodeRef rejectFolder = (NodeRef)this.currentActionProperties.get(PROP_REJECT_FOLDER);
|
||||
String rejectFolderName = Repository.getNameForNode(this.nodeService, rejectFolder);
|
||||
rejectMsg = MessageFormat.format(Application.getMessage(context, "action_simple_workflow"),
|
||||
new Object[] {Application.getMessage(context, rejectAction),
|
||||
rejectFolderName, rejectStepName});
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(approveMsg);
|
||||
if (rejectMsg != null)
|
||||
{
|
||||
builder.append(" ");
|
||||
builder.append(rejectMsg);
|
||||
}
|
||||
|
||||
summary = builder.toString();
|
||||
}
|
||||
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef cat = (NodeRef)this.currentActionProperties.get(PROP_CATEGORY);
|
||||
String name = Repository.getNameForNode(this.nodeService, cat);
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_link_category"),
|
||||
new Object[] {name});
|
||||
}
|
||||
else if (CheckOutActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_check_out"),
|
||||
new Object[] {spaceName});
|
||||
}
|
||||
else if (CheckInActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String comment = (String)this.currentActionProperties.get(PROP_CHECKIN_DESC);
|
||||
Boolean minorChange = (Boolean)this.currentActionProperties.get(PROP_CHECKIN_MINOR);
|
||||
String change = null;
|
||||
if (minorChange != null && minorChange.booleanValue())
|
||||
{
|
||||
change = Application.getMessage(context, "minor_change");
|
||||
}
|
||||
else
|
||||
{
|
||||
change = Application.getMessage(context, "major_change");
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_check_in"),
|
||||
new Object[] {change, comment});
|
||||
}
|
||||
else if (TransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String label = null;
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String name = Repository.getNameForNode(this.nodeService, space);
|
||||
String transformer = (String)this.currentActionProperties.get(PROP_TRANSFORMER);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getTransformers())
|
||||
{
|
||||
if (item.getValue().equals(transformer))
|
||||
{
|
||||
if (item.getValue().equals(aspect))
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_transform"),
|
||||
new Object[] {name, label});
|
||||
}
|
||||
else if (ImageTransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String label = null;
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String name = Repository.getNameForNode(this.nodeService, space);
|
||||
String transformer = (String)this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER);
|
||||
String option = (String)this.currentActionProperties.get(PROP_TRANSFORM_OPTIONS);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getImageTransformers())
|
||||
{
|
||||
if (item.getValue().equals(transformer))
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_transform_image"),
|
||||
new Object[] {name, label, option});
|
||||
}
|
||||
else if (MailActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String addresses = (String)this.currentActionProperties.get(PROP_TO);
|
||||
|
||||
if (addresses == null || addresses.length() == 0)
|
||||
{
|
||||
if (this.emailRecipients.size() != 0)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (int i=0; i<this.emailRecipients.size(); i++)
|
||||
{
|
||||
summary.append("'").append(item.getLabel()).append("'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SimpleWorkflowActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
// just leave the summary as the title for now
|
||||
String approveStepName = (String)this.currentActionProperties.get(PROP_APPROVE_STEP_NAME);
|
||||
String approveAction = (String)this.currentActionProperties.get(PROP_APPROVE_ACTION);
|
||||
NodeRef approveFolder = (NodeRef)this.currentActionProperties.get(PROP_APPROVE_FOLDER);
|
||||
String approveFolderName = Repository.getNameForNode(this.nodeService, approveFolder);
|
||||
String approveMsg = MessageFormat.format(summary.toString(),
|
||||
new Object[] {Application.getMessage(FacesContext.getCurrentInstance(), approveAction),
|
||||
approveFolderName, approveStepName});
|
||||
|
||||
String rejectStep = (String)this.currentActionProperties.get(PROP_REJECT_STEP_PRESENT);
|
||||
|
||||
String rejectMsg = null;
|
||||
if (rejectStep != null && "yes".equals(rejectStep))
|
||||
{
|
||||
String rejectStepName = (String)this.currentActionProperties.get(PROP_REJECT_STEP_NAME);
|
||||
String rejectAction = (String)this.currentActionProperties.get(PROP_REJECT_ACTION);
|
||||
NodeRef rejectFolder = (NodeRef)this.currentActionProperties.get(PROP_REJECT_FOLDER);
|
||||
String rejectFolderName = Repository.getNameForNode(this.nodeService, rejectFolder);
|
||||
rejectMsg = MessageFormat.format(summary.toString(),
|
||||
new Object[] {Application.getMessage(FacesContext.getCurrentInstance(), rejectAction),
|
||||
rejectFolderName, rejectStepName});
|
||||
}
|
||||
|
||||
summary = new StringBuilder(approveMsg);
|
||||
if (rejectMsg != null)
|
||||
{
|
||||
summary.append(" ");
|
||||
summary.append(rejectMsg);
|
||||
}
|
||||
}
|
||||
else if (LinkCategoryActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
NodeRef cat = (NodeRef)this.currentActionProperties.get(PROP_CATEGORY);
|
||||
String name = Repository.getNameForNode(this.nodeService, cat);
|
||||
summary.append("'").append(name).append("'");
|
||||
}
|
||||
else if (TransformActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String name = Repository.getNameForNode(this.nodeService, space);
|
||||
String transformer = (String)this.currentActionProperties.get(PROP_TRANSFORMER);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getTransformers())
|
||||
{
|
||||
if (item.getValue().equals(transformer))
|
||||
{
|
||||
transformer = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// recreate the summary object as it contains parameters
|
||||
String msg = MessageFormat.format(summary.toString(), new Object[] {name, transformer});
|
||||
summary = new StringBuilder(msg);
|
||||
}
|
||||
else if (ImageTransformActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String name = Repository.getNameForNode(this.nodeService, space);
|
||||
String transformer = (String)this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER);
|
||||
String option = (String)this.currentActionProperties.get(PROP_TRANSFORM_OPTIONS);
|
||||
|
||||
// find the label used by looking through the SelectItem list
|
||||
for (SelectItem item : this.getImageTransformers())
|
||||
{
|
||||
if (item.getValue().equals(transformer))
|
||||
{
|
||||
transformer = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// recreate the summary object as it contains parameters
|
||||
String msg = MessageFormat.format(summary.toString(), new Object[] {name, transformer, option});
|
||||
summary = new StringBuilder(msg);
|
||||
}
|
||||
else if (CopyActionExecuter.NAME.equals(actionName) || "move".equals(actionName) || "check-out".equals(actionName))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
summary.append("'").append(spaceName).append("'");
|
||||
}
|
||||
else if (MailActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
String address = (String)this.currentActionProperties.get(PROP_TO);
|
||||
if (address != null && address.length() != 0)
|
||||
{
|
||||
summary.append("'").append(address).append("'");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.emailRecipients.size() != 0)
|
||||
{
|
||||
summary.append("'");
|
||||
for (int i=0; i<this.emailRecipients.size(); i++)
|
||||
RecipientWrapper wrapper = this.emailRecipients.get(i);
|
||||
if (i != 0)
|
||||
{
|
||||
RecipientWrapper wrapper = this.emailRecipients.get(i);
|
||||
if (i != 0)
|
||||
{
|
||||
summary.append(", ");
|
||||
}
|
||||
summary.append(wrapper.getName());
|
||||
builder.append(", ");
|
||||
}
|
||||
summary.append("'");
|
||||
builder.append(wrapper.getName());
|
||||
}
|
||||
|
||||
addresses = builder.toString();
|
||||
}
|
||||
}
|
||||
else if (CheckInActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
String comment = (String)this.currentActionProperties.get(PROP_CHECKIN_DESC);
|
||||
Boolean minorChange = (Boolean)this.currentActionProperties.get(PROP_CHECKIN_MINOR);
|
||||
String change = null;
|
||||
if (minorChange != null && minorChange.booleanValue())
|
||||
{
|
||||
change = Application.getMessage(FacesContext.getCurrentInstance(), "minor_change");
|
||||
}
|
||||
else
|
||||
{
|
||||
change = Application.getMessage(FacesContext.getCurrentInstance(), "major_change");
|
||||
}
|
||||
|
||||
// recreate the summary object as it contains parameters
|
||||
String msg = MessageFormat.format(summary.toString(), new Object[] {change, comment});
|
||||
summary = new StringBuilder(msg);
|
||||
}
|
||||
else if (ImporterActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
summary.append("'").append(spaceName).append("'");
|
||||
}
|
||||
else if (SpecialiseTypeActionExecuter.NAME.equals(actionName))
|
||||
{
|
||||
String label = null;
|
||||
String objectType = (String)this.currentActionProperties.get(PROP_OBJECT_TYPE);
|
||||
for (SelectItem item : getObjectTypes())
|
||||
{
|
||||
if (item.getValue().equals(objectType) == true)
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary.append("'").append(label).append("'");
|
||||
}
|
||||
else if (ScriptActionExecutor.NAME.equals(actionName))
|
||||
{
|
||||
String id = (String)this.currentActionProperties.get(PROP_SCRIPT);
|
||||
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
|
||||
String scriptName = Repository.getNameForNode(this.nodeService, scriptRef);
|
||||
summary.append("'").append(scriptName).append("'");
|
||||
}
|
||||
|
||||
summaryResult = summary.toString();
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_mail"),
|
||||
new Object[] {addresses});
|
||||
}
|
||||
else if (ImporterActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
|
||||
String spaceName = Repository.getNameForNode(this.nodeService, space);
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_import"),
|
||||
new Object[] {spaceName});
|
||||
}
|
||||
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String label = null;
|
||||
String objectType = (String)this.currentActionProperties.get(PROP_OBJECT_TYPE);
|
||||
for (SelectItem item : getObjectTypes())
|
||||
{
|
||||
if (item.getValue().equals(objectType) == true)
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_specialise_type"),
|
||||
new Object[] {label});
|
||||
}
|
||||
else if (ScriptActionExecutor.NAME.equals(this.action))
|
||||
{
|
||||
String id = (String)this.currentActionProperties.get(PROP_SCRIPT);
|
||||
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
|
||||
String scriptName = Repository.getNameForNode(this.nodeService, scriptRef);
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, "action_script"),
|
||||
new Object[] {scriptName});
|
||||
}
|
||||
else
|
||||
{
|
||||
// as the default case (i.e. for actions with no parameters) use the title
|
||||
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action);
|
||||
summary = actionDef.getTitle();
|
||||
}
|
||||
|
||||
return summaryResult;
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.alfresco.web.bean.rules;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -21,9 +22,6 @@ import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.HasAspectEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
|
||||
import org.alfresco.repo.action.evaluator.IsSubTypeEvaluator;
|
||||
import org.alfresco.repo.action.executer.CheckInActionExecuter;
|
||||
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
||||
import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
@@ -231,11 +229,14 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
// add all the conditions to the rule
|
||||
for (Map<String, Serializable> condParams : this.allConditionsProperties)
|
||||
{
|
||||
Map<String, Serializable> repoCondParams = buildConditionParams(condParams);
|
||||
String conditionName = (String)condParams.get(PROP_CONDITION_NAME);
|
||||
this.condition = conditionName;
|
||||
this.currentConditionProperties = condParams;
|
||||
Map<String, Serializable> repoCondParams = buildConditionParams();
|
||||
|
||||
// add the condition to the rule
|
||||
ActionCondition condition = this.actionService.createActionCondition(
|
||||
(String)condParams.get(PROP_CONDITION_NAME));
|
||||
ActionCondition condition = this.actionService.
|
||||
createActionCondition(conditionName);
|
||||
condition.setParameterValues(repoCondParams);
|
||||
|
||||
// specify whether the condition result should be inverted
|
||||
@@ -539,20 +540,33 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
HashMap<String, Serializable> condProps = new HashMap<String, Serializable>(3);
|
||||
condProps.put(PROP_CONDITION_NAME, this.condition);
|
||||
this.currentConditionProperties = condProps;
|
||||
|
||||
// setup any defaults for the UI or handle actions with no parameters
|
||||
String overridenViewId = setupUIDefaultsForCondition(condProps);
|
||||
if (overridenViewId != null)
|
||||
|
||||
// determine whether the condition being added has any parameters
|
||||
ActionConditionDefinition conditionDef = this.actionService.
|
||||
getActionConditionDefinition(this.condition);
|
||||
if (conditionDef.hasParameterDefinitions())
|
||||
{
|
||||
viewId = overridenViewId;
|
||||
// setup any defaults for the UI and override the viewId if necessary
|
||||
String overridenViewId = setupUIDefaultsForCondition(condProps);
|
||||
if (overridenViewId != null)
|
||||
{
|
||||
viewId = overridenViewId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just add the condition to the list and use the title as the summary
|
||||
condProps.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle());
|
||||
condProps.put(PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
this.allConditionsProperties.add(condProps);
|
||||
|
||||
// come back to the same page we're on now as there are no params to collect
|
||||
viewId = this.returnViewId;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Added '" + this.condition + "' condition to list");
|
||||
|
||||
// reset the selected condition drop down
|
||||
this.condition = null;
|
||||
|
||||
// go to the page to collect the settings
|
||||
goToPage(context, viewId);
|
||||
}
|
||||
@@ -593,15 +607,14 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, summary);
|
||||
}
|
||||
|
||||
if (this.editingCondition)
|
||||
{
|
||||
this.condition = null;
|
||||
}
|
||||
else
|
||||
if (this.editingCondition == false)
|
||||
{
|
||||
this.allConditionsProperties.add(this.currentConditionProperties);
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.condition = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(context, this.returnViewId);
|
||||
}
|
||||
@@ -629,15 +642,14 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
*/
|
||||
public void cancelAddCondition()
|
||||
{
|
||||
if (this.editingCondition)
|
||||
{
|
||||
this.condition = null;
|
||||
}
|
||||
else
|
||||
if (this.editingCondition == false)
|
||||
{
|
||||
this.currentConditionProperties.clear();
|
||||
}
|
||||
|
||||
// reset the action drop down
|
||||
this.condition = null;
|
||||
|
||||
// refresh the wizard
|
||||
goToPage(FacesContext.getCurrentInstance(), this.returnViewId);
|
||||
}
|
||||
@@ -678,59 +690,52 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
*/
|
||||
protected String setupUIDefaultsForCondition(HashMap<String, Serializable> props)
|
||||
{
|
||||
String overridenViewId = null;
|
||||
// NOTE: none of the built in conditions have any defaults to setup
|
||||
|
||||
if ("no-condition".equals(this.condition))
|
||||
{
|
||||
// there are no parameters so just add it
|
||||
props.put(PROP_CONDITION_SUMMARY, Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), "condition_no_condition"));
|
||||
props.put(PROP_CONDITION_NOT, Boolean.FALSE);
|
||||
this.allConditionsProperties.add(props);
|
||||
|
||||
// come back to the same page we're on now
|
||||
overridenViewId = this.returnViewId;
|
||||
}
|
||||
|
||||
return overridenViewId;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Map of properties for the given condition in the format the repo is expecting
|
||||
*
|
||||
* @param params The Map of properties built from the UI
|
||||
* @return The Map the repo is expecting
|
||||
*/
|
||||
protected Map<String, Serializable> buildConditionParams(Map<String, Serializable> params)
|
||||
protected Map<String, Serializable> buildConditionParams()
|
||||
{
|
||||
Map<String, Serializable> repoParams = new HashMap<String, Serializable>(params.size());
|
||||
Map<String, Serializable> repoParams = new HashMap<String, Serializable>();
|
||||
|
||||
String condName = (String)params.get(PROP_CONDITION_NAME);
|
||||
if (ComparePropertyValueEvaluator.NAME.equals(condName))
|
||||
if (ComparePropertyValueEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
repoParams.put(ComparePropertyValueEvaluator.PARAM_VALUE, params.get(PROP_CONTAINS_TEXT));
|
||||
// add the text to compare
|
||||
String text = (String)this.currentConditionProperties.get(PROP_CONTAINS_TEXT);
|
||||
repoParams.put(ComparePropertyValueEvaluator.PARAM_VALUE, text);
|
||||
}
|
||||
else if (InCategoryEvaluator.NAME.equals(condName))
|
||||
else if (InCategoryEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
// put the selected category in the condition params
|
||||
repoParams.put(InCategoryEvaluator.PARAM_CATEGORY_VALUE, params.get(PROP_CATEGORY));
|
||||
NodeRef nodeRef = (NodeRef)this.currentConditionProperties.get(PROP_CATEGORY);
|
||||
repoParams.put(InCategoryEvaluator.PARAM_CATEGORY_VALUE, nodeRef);
|
||||
|
||||
// add the classifiable aspect
|
||||
repoParams.put(InCategoryEvaluator.PARAM_CATEGORY_ASPECT, ContentModel.ASPECT_GEN_CLASSIFIABLE);
|
||||
}
|
||||
else if (IsSubTypeEvaluator.NAME.equals(condName))
|
||||
else if (IsSubTypeEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
// add the model type
|
||||
repoParams.put(IsSubTypeEvaluator.PARAM_TYPE, QName.createQName((String)params.get(PROP_MODEL_TYPE)));
|
||||
QName type = QName.createQName((String)this.currentConditionProperties.get(PROP_MODEL_TYPE));
|
||||
repoParams.put(IsSubTypeEvaluator.PARAM_TYPE, type);
|
||||
}
|
||||
else if (HasAspectEvaluator.NAME.equals(condName))
|
||||
else if (HasAspectEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
// add the aspect
|
||||
repoParams.put(HasAspectEvaluator.PARAM_ASPECT, QName.createQName((String)params.get(PROP_ASPECT)));
|
||||
QName aspect = QName.createQName((String)this.currentConditionProperties.get(PROP_ASPECT));
|
||||
repoParams.put(HasAspectEvaluator.PARAM_ASPECT, aspect);
|
||||
}
|
||||
else if (CompareMimeTypeEvaluator.NAME.equals(condName))
|
||||
else if (CompareMimeTypeEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
repoParams.put(CompareMimeTypeEvaluator.PARAM_VALUE, params.get(PROP_MIMETYPE));
|
||||
// add the mimetype
|
||||
String mimeType = (String)this.currentConditionProperties.get(PROP_MIMETYPE);
|
||||
repoParams.put(CompareMimeTypeEvaluator.PARAM_VALUE, mimeType);
|
||||
}
|
||||
|
||||
return repoParams;
|
||||
@@ -743,85 +748,93 @@ public class CreateRuleWizard extends BaseActionWizard
|
||||
*/
|
||||
protected String buildConditionSummary()
|
||||
{
|
||||
String summaryResult = null;
|
||||
|
||||
String condName = (String)this.currentConditionProperties.get(PROP_CONDITION_NAME);
|
||||
if (condName != null)
|
||||
String summary = null;
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
Boolean not = (Boolean)this.currentConditionProperties.get(PROP_CONDITION_NOT);
|
||||
|
||||
if (ComparePropertyValueEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
StringBuilder summary = new StringBuilder();
|
||||
String msgId = not.booleanValue() ?
|
||||
"condition_compare_property_value_not" : "condition_compare_property_value";
|
||||
|
||||
String msgId = "condition_" + condName.replace('-', '_');
|
||||
String text = (String)this.currentConditionProperties.get(PROP_CONTAINS_TEXT);
|
||||
|
||||
// JSF is putting the boolean into the map as a Boolean object so we
|
||||
// need to handle that - adding a converter doesn't seem to help!
|
||||
Boolean not = (Boolean)this.currentConditionProperties.get(PROP_CONDITION_NOT);
|
||||
if (not.booleanValue())
|
||||
summary = MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {text});
|
||||
}
|
||||
else if (InCategoryEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_in_category_not" : "condition_in_category";
|
||||
|
||||
String name = Repository.getNameForNode(this.nodeService,
|
||||
(NodeRef)this.currentConditionProperties.get(PROP_CATEGORY));
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {name});
|
||||
}
|
||||
else if (IsSubTypeEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_is_subtype_not" : "condition_is_subtype";
|
||||
|
||||
String label = null;
|
||||
String typeName = (String)this.currentConditionProperties.get(PROP_MODEL_TYPE);
|
||||
for (SelectItem item : this.getModelTypes())
|
||||
{
|
||||
msgId = msgId + "_not";
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Looking up condition summary string: " + msgId);
|
||||
|
||||
summary.append(Application.getMessage(FacesContext.getCurrentInstance(), msgId));
|
||||
summary.append(" ");
|
||||
|
||||
// define a summary to be added for each condition
|
||||
if (InCategoryEvaluator.NAME.equals(condName))
|
||||
{
|
||||
String name = Repository.getNameForNode(this.nodeService,
|
||||
(NodeRef)this.currentConditionProperties.get(PROP_CATEGORY));
|
||||
summary.append("'").append(name).append("'");
|
||||
}
|
||||
else if (ComparePropertyValueEvaluator.NAME.equals(condName))
|
||||
{
|
||||
summary.append("'");
|
||||
summary.append(this.currentConditionProperties.get(PROP_CONTAINS_TEXT));
|
||||
summary.append("'");
|
||||
}
|
||||
else if (IsSubTypeEvaluator.NAME.equals(condName))
|
||||
{
|
||||
// find the label used by looking through the SelectItem list
|
||||
String typeName = (String)this.currentConditionProperties.get(PROP_MODEL_TYPE);
|
||||
for (SelectItem item : this.getModelTypes())
|
||||
if (item.getValue().equals(typeName))
|
||||
{
|
||||
if (item.getValue().equals(typeName))
|
||||
{
|
||||
summary.append("'").append(item.getLabel()).append("'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (HasAspectEvaluator.NAME.equals(condName))
|
||||
{
|
||||
// find the label used by looking through the SelectItem list
|
||||
String aspectName = (String)this.currentConditionProperties.get(PROP_ASPECT);
|
||||
for (SelectItem item : this.getAspects())
|
||||
{
|
||||
if (item.getValue().equals(aspectName))
|
||||
{
|
||||
summary.append("'").append(item.getLabel()).append("'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CompareMimeTypeEvaluator.NAME.equals(condName))
|
||||
{
|
||||
String mimetype = (String)this.currentConditionProperties.get(PROP_MIMETYPE);
|
||||
for (SelectItem item : this.getMimeTypes())
|
||||
{
|
||||
if (item.getValue().equals(mimetype))
|
||||
{
|
||||
summary.append("'").append(item.getLabel()).append("'");
|
||||
break;
|
||||
}
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summaryResult = summary.toString();
|
||||
summary = MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {label});
|
||||
}
|
||||
else if (HasAspectEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_has_aspect_not" : "condition_has_aspect";
|
||||
|
||||
String label = null;
|
||||
String aspectName = (String)this.currentConditionProperties.get(PROP_ASPECT);
|
||||
for (SelectItem item : this.getAspects())
|
||||
{
|
||||
if (item.getValue().equals(aspectName))
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {label});
|
||||
}
|
||||
else if (CompareMimeTypeEvaluator.NAME.equals(this.condition))
|
||||
{
|
||||
String msgId = not.booleanValue() ? "condition_compare_mime_type_not" : "condition_compare_mime_type";
|
||||
|
||||
String label = null;
|
||||
String mimetype = (String)this.currentConditionProperties.get(PROP_MIMETYPE);
|
||||
for (SelectItem item : this.getMimeTypes())
|
||||
{
|
||||
if (item.getValue().equals(mimetype))
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
summary = MessageFormat.format(Application.getMessage(context, msgId),
|
||||
new Object[] {label});
|
||||
}
|
||||
else
|
||||
{
|
||||
// as the default case (i.e. for conditions with no parameters) use the title
|
||||
ActionConditionDefinition conditionDef = this.actionService.
|
||||
getActionConditionDefinition(this.condition);
|
||||
summary = conditionDef.getTitle();
|
||||
}
|
||||
|
||||
return summaryResult;
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -175,27 +175,27 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
*/
|
||||
protected void populateAction(Map<String, Serializable> actionProps)
|
||||
{
|
||||
if (this.action.equals(AddFeaturesActionExecuter.NAME))
|
||||
if (AddFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
QName aspect = (QName)actionProps.get(AddFeaturesActionExecuter.PARAM_ASPECT_NAME);
|
||||
this.currentActionProperties.put(PROP_ASPECT, aspect.toString());
|
||||
}
|
||||
else if (this.action.equals(RemoveFeaturesActionExecuter.NAME))
|
||||
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
QName aspect = (QName)actionProps.get(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME);
|
||||
this.currentActionProperties.put(PROP_ASPECT, aspect.toString());
|
||||
}
|
||||
else if (this.action.equals(CopyActionExecuter.NAME))
|
||||
else if (CopyActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(MoveActionExecuter.NAME))
|
||||
else if (MoveActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(MoveActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(SimpleWorkflowActionExecuter.NAME))
|
||||
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String approveStep = (String)actionProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP);
|
||||
Boolean approveMove = (Boolean)actionProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE);
|
||||
@@ -223,17 +223,17 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
this.currentActionProperties.put(PROP_REJECT_FOLDER, rejectFolderNode);
|
||||
}
|
||||
}
|
||||
else if (this.action.equals(LinkCategoryActionExecuter.NAME))
|
||||
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef catNodeRef = (NodeRef)actionProps.get(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE);
|
||||
this.currentActionProperties.put(PROP_CATEGORY, catNodeRef);
|
||||
}
|
||||
else if (this.action.equals(CheckOutActionExecuter.NAME))
|
||||
else if (CheckOutActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(CheckInActionExecuter.NAME))
|
||||
else if (CheckInActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String checkDesc = (String)actionProps.get(CheckInActionExecuter.PARAM_DESCRIPTION);
|
||||
this.currentActionProperties.put(PROP_CHECKIN_DESC, checkDesc);
|
||||
@@ -241,7 +241,7 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
Boolean minorChange = (Boolean)actionProps.get(CheckInActionExecuter.PARAM_MINOR_CHANGE);
|
||||
this.currentActionProperties.put(PROP_CHECKIN_MINOR, minorChange);
|
||||
}
|
||||
else if (this.action.equals(TransformActionExecuter.NAME))
|
||||
else if (TransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String transformer = (String)actionProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
|
||||
this.currentActionProperties.put(PROP_TRANSFORMER, transformer);
|
||||
@@ -249,7 +249,7 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(ImageTransformActionExecuter.NAME))
|
||||
else if (ImageTransformActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String transformer = (String)actionProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
|
||||
this.currentActionProperties.put(PROP_IMAGE_TRANSFORMER, transformer);
|
||||
@@ -260,7 +260,7 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(MailActionExecuter.NAME))
|
||||
else if (MailActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
String subject = (String)actionProps.get(MailActionExecuter.PARAM_SUBJECT);
|
||||
this.currentActionProperties.put(PROP_SUBJECT, subject);
|
||||
@@ -295,17 +295,17 @@ public class EditRuleWizard extends CreateRuleWizard
|
||||
this.usingTemplate = templateRef.getId();
|
||||
}
|
||||
}
|
||||
else if (this.action.equals(ImporterActionExecuter.NAME))
|
||||
else if (ImporterActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef destNodeRef = (NodeRef)actionProps.get(ImporterActionExecuter.PARAM_DESTINATION_FOLDER);
|
||||
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
|
||||
}
|
||||
else if (this.action.equals(SpecialiseTypeActionExecuter.NAME) == true)
|
||||
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
|
||||
{
|
||||
QName specialiseType = (QName)actionProps.get(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME);
|
||||
this.currentActionProperties.put(PROP_OBJECT_TYPE, specialiseType.toString());
|
||||
}
|
||||
else if (this.action.equals(ScriptActionExecutor.NAME))
|
||||
else if (ScriptActionExecutor.NAME.equals(this.action))
|
||||
{
|
||||
NodeRef scriptRef = (NodeRef)actionProps.get(ScriptActionExecutor.PARAM_SCRIPTREF);
|
||||
this.currentActionProperties.put(PROP_SCRIPT, scriptRef.getId());
|
||||
|
Reference in New Issue
Block a user