props)
- {
- String overridenViewId = null;
-
- if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
- {
- this.currentActionProperties.put("approveAction", "move");
- this.currentActionProperties.put("rejectStepPresent", "yes");
- this.currentActionProperties.put("rejectAction", "move");
- }
- else if (CheckInActionExecuter.NAME.equals(this.action))
- {
- this.currentActionProperties.put(PROP_CHECKIN_MINOR, new Boolean(true));
- }
-
- return overridenViewId;
- }
-
- /**
- * Build the param map for the current Action instance.
- *
- * Based on the params set by the UI, build the params needed to create the action.
- *
- * @return param map
- */
- protected Map buildActionParams()
- {
- // set up parameters maps for the action
- Map repoParams = new HashMap();
-
- if (AddFeaturesActionExecuter.NAME.equals(this.action))
- {
- QName aspect = Repository.resolveToQName((String)this.currentActionProperties.get(PROP_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));
- 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);
- repoParams.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
-
- // add the type and name of the association to create when the copy
- // is performed
- repoParams.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
- ContentModel.ASSOC_CONTAINS);
- 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);
- repoParams.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
-
- // add the type and name of the association to create when the move
- // is performed
- repoParams.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
- ContentModel.ASSOC_CONTAINS);
- 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
- 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
- boolean approveMove = true;
- String approveAction = (String)this.currentActionProperties.get(PROP_APPROVE_ACTION);
- if (approveAction != null && approveAction.equals("copy"))
- {
- approveMove = false;
- }
-
- repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
-
- // add the destination folder of the content
- NodeRef approveDestNodeRef = null;
- Object approveDestNode = this.currentActionProperties.get(PROP_APPROVE_FOLDER);
- if (approveDestNode instanceof NodeRef)
- {
- approveDestNodeRef = (NodeRef)approveDestNode;
- }
- else if (approveDestNode instanceof String)
- {
- approveDestNodeRef = new NodeRef((String)approveDestNode);
- }
- repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
-
- // determine whether we have a reject step or not
- boolean requireReject = true;
- String rejectStepPresent = (String)this.currentActionProperties.get(PROP_REJECT_STEP_PRESENT);
- if (rejectStepPresent != null && rejectStepPresent.equals("no"))
- {
- requireReject = false;
- }
-
- if (requireReject)
- {
- // add the reject step name
- 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
- boolean rejectMove = true;
- String rejectAction = (String)this.currentActionProperties.get(PROP_REJECT_ACTION);
- if (rejectAction != null && rejectAction.equals("copy"))
- {
- rejectMove = false;
- }
-
- repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
-
- // add the destination folder of the content
- NodeRef rejectDestNodeRef = null;
- Object rejectDestNode = this.currentActionProperties.get(PROP_REJECT_FOLDER);
- if (rejectDestNode instanceof NodeRef)
- {
- rejectDestNodeRef = (NodeRef)rejectDestNode;
- }
- else if (rejectDestNode instanceof String)
- {
- rejectDestNodeRef = new NodeRef((String)rejectDestNode);
- }
- repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
- }
- }
- else if (LinkCategoryActionExecuter.NAME.equals(this.action))
- {
- // add the classifiable 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);
- repoParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
- catNodeRef);
- }
- else if (CheckOutActionExecuter.NAME.equals(this.action))
- {
- // 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);
- repoParams.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
-
- // add the type and name of the association to create when the
- // check out is performed
- repoParams.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
- ContentModel.ASSOC_CONTAINS);
- 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
- repoParams.put(CheckInActionExecuter.PARAM_DESCRIPTION,
- this.currentActionProperties.get(PROP_CHECKIN_DESC));
-
- // add the minor change flag
- repoParams.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
- this.currentActionProperties.get(PROP_CHECKIN_MINOR));
- }
- else if (TransformActionExecuter.NAME.equals(this.action))
- {
- // add the transformer to use
- 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);
- repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
-
- // add the type and name of the association to create when the copy
- // is performed
- repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
- ContentModel.ASSOC_CONTAINS);
- 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
- repoParams.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
- this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER));
-
- // add the options
- 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);
- repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
-
- // add the type and name of the association to create when the copy
- // is performed
- repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
- ContentModel.ASSOC_CONTAINS);
- repoParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
- QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
- }
- else if (MailActionExecuter.NAME.equals(this.action))
- {
- // add the person(s) it's going to as a list of authorities
- List recipients = new ArrayList(emailRecipients.size());
- for (int i=0; i(20);
+
+ // instantiate each handler and store in the map
+ for (ConfigElement child : actionHandlerCfg.getChildren())
+ {
+ String actionName = child.getAttribute("name");
+ String handlerClass = child.getAttribute("class");
+
+ if (actionName != null && actionName.length() > 0 &&
+ handlerClass != null && handlerClass.length() > 0)
+ {
+ try
+ {
+ Class klass = Class.forName(handlerClass);
+ IHandler handler = (IHandler)klass.newInstance();
+ this.actionHandlers.put(actionName, handler);
+ }
+ catch (Exception e)
+ {
+ throw new AlfrescoRuntimeException("Failed to setup action handler for '" +
+ actionName + "'", e);
+ }
+ }
+ }
+ }
+ else
+ {
+ logger.warn("Could not find 'action-handlers' configuration element");
+ }
+ }
+ else
+ {
+ logger.warn("Could not find 'Action Wizards' configuration section");
+ }
+ }
}
-
// ------------------------------------------------------------------------------
// Inner classes
diff --git a/source/java/org/alfresco/web/bean/actions/IHandler.java b/source/java/org/alfresco/web/bean/actions/IHandler.java
new file mode 100644
index 0000000000..43cb444ff7
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/IHandler.java
@@ -0,0 +1,70 @@
+package org.alfresco.web.bean.actions;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Interface definition for a handler, classes that are responsible
+ * for marshalling data between the repository and the action based
+ * wizards.
+ *
+ * @author gavinc
+ */
+public interface IHandler
+{
+ /**
+ * Adds any properties to the given map that need default values
+ * before the UI is displayed to the user.
+ *
+ * @param props The current properties map
+ */
+ public void setupUIDefaults(Map props);
+
+ /**
+ * By default, a JSP with the same name as the handler will
+ * be loaded from a default location. If the handler has stored
+ * it's UI somewhere else the view id can be returned from this method.
+ *
+ * @return The path to the JSP for the handler
+ */
+ public String getJSPPath();
+
+ /**
+ * Called at the end of the wizard. The properties relevant to
+ * this handler have to be placed in the repository properties
+ * map in the correct form for sending to the node service.
+ *
+ * @param props The current properties map
+ * @param repoProps The repository properties map to prepare
+ */
+ public void prepareForSave(Map props,
+ Map repoProps);
+
+ /**
+ * Called at the start of the edit wizard. The repository properties
+ * map holds the current state of this rule. Any properties relevant
+ * to this handler should be retrieved and setup in the current
+ * properties map.
+ *
+ * @param props The current properties map
+ * @param repoParams The properties currently in the repository
+ */
+ public void prepareForEdit(Map props,
+ Map repoProps);
+
+ /**
+ * Generates a summary string for this handler. The current state of
+ * the wizard is passed as well as the current properties map.
+ *
+ * @param context Faces context
+ * @param wizard The current wizard
+ * @param props The properties map
+ * @return The summary string
+ */
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map props);
+}
diff --git a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java
index e9b140ad25..d57d42955b 100644
--- a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java
+++ b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java
@@ -2,6 +2,7 @@ package org.alfresco.web.bean.actions;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -37,8 +38,14 @@ public class RunActionWizard extends BaseActionWizard
// to setup the currentActionProperties and action variables
String actionName = (String)actionParams.get(PROP_ACTION_NAME);
this.action = actionName;
- this.currentActionProperties = actionParams;
- Map repoActionParams = buildActionParams();
+
+ // get the action handler to prepare for the save
+ Map repoActionParams = new HashMap();
+ IHandler handler = this.actionHandlers.get(this.action);
+ if (handler != null)
+ {
+ handler.prepareForSave(actionParams, repoActionParams);
+ }
// add the action to the rule
Action action = this.actionService.createAction(actionName);
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java
new file mode 100644
index 0000000000..baf02081b6
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java
@@ -0,0 +1,64 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "add-features" action.
+ *
+ * @author gavinc
+ */
+public class AddFeaturesHandler extends BaseActionHandler
+{
+ protected static final String PROP_ASPECT = "aspect";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(AddFeaturesActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoParams)
+ {
+ QName aspect = Repository.resolveToQName((String)actionProps.get(PROP_ASPECT));
+ repoParams.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoParams)
+ {
+ QName aspect = (QName)repoParams.get(AddFeaturesActionExecuter.PARAM_ASPECT_NAME);
+ actionProps.put(PROP_ASPECT, aspect.toString());
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String label = null;
+ String aspect = (String)actionProps.get(PROP_ASPECT);
+
+ // find the label used by looking through the SelectItem list
+ for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
+ {
+ if (item.getValue().equals(aspect))
+ {
+ label = item.getLabel();
+ break;
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_add_features"),
+ new Object[] {label});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/BaseActionHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/BaseActionHandler.java
new file mode 100644
index 0000000000..202427b9a6
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/BaseActionHandler.java
@@ -0,0 +1,34 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.alfresco.web.bean.actions.IHandler;
+
+/**
+ * Base class for all action handler implementations.
+ *
+ * @author gavinc
+ */
+public abstract class BaseActionHandler implements IHandler
+{
+ protected static final String ACTION_PAGES_LOCATION = "/jsp/actions/";
+ protected static final String PROP_DESTINATION = "destinationLocation";
+
+ public void setupUIDefaults(Map actionProps)
+ {
+ // do nothing by default, only those action handlers that need
+ // to setup defaults need override this method
+ }
+
+ /**
+ * Given the action name, generates the default path for the JSP
+ *
+ * @param actionName The name of the action
+ * @return The path to the JSP used for the action
+ */
+ protected String getJSPPath(String actionName)
+ {
+ return ACTION_PAGES_LOCATION + actionName + ".jsp";
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java
new file mode 100644
index 0000000000..174727ed6e
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java
@@ -0,0 +1,72 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.executer.CheckInActionExecuter;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "check-in" action.
+ *
+ * @author gavinc
+ */
+public class CheckInHandler extends BaseActionHandler
+{
+ protected static final String PROP_CHECKIN_DESC = "checkinDescription";
+ protected static final String PROP_CHECKIN_MINOR = "checkinMinorChange";
+
+ @Override
+ public void setupUIDefaults(Map actionProps)
+ {
+ actionProps.put(PROP_CHECKIN_MINOR, new Boolean(true));
+ }
+
+ public String getJSPPath()
+ {
+ return getJSPPath(CheckInActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ repoProps.put(CheckInActionExecuter.PARAM_DESCRIPTION,
+ actionProps.get(PROP_CHECKIN_DESC));
+
+ repoProps.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
+ actionProps.get(PROP_CHECKIN_MINOR));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ String checkDesc = (String)repoProps.get(CheckInActionExecuter.PARAM_DESCRIPTION);
+ actionProps.put(PROP_CHECKIN_DESC, checkDesc);
+
+ Boolean minorChange = (Boolean)repoProps.get(CheckInActionExecuter.PARAM_MINOR_CHANGE);
+ actionProps.put(PROP_CHECKIN_MINOR, minorChange);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String comment = (String)actionProps.get(PROP_CHECKIN_DESC);
+ Boolean minorChange = (Boolean)actionProps.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");
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_check_in"),
+ new Object[] {change, comment});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java
new file mode 100644
index 0000000000..62ce9551b4
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java
@@ -0,0 +1,63 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.CheckOutActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "check-out" action.
+ *
+ * @author gavinc
+ */
+public class CheckOutHandler extends BaseActionHandler
+{
+ public String getJSPPath()
+ {
+ return getJSPPath(CheckOutActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // specify the location the checked out working copy should go
+ // add the destination space id to the action properties
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+
+ // add the type and name of the association to create when the
+ // check out is performed
+ repoProps.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
+ ContentModel.ASSOC_CONTAINS);
+ repoProps.put(CheckOutActionExecuter.PARAM_ASSOC_QNAME,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "checkout"));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef destNodeRef = (NodeRef)repoProps.get(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String spaceName = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+
+ return MessageFormat.format(Application.getMessage(context, "action_check_out"),
+ new Object[] {spaceName});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java
new file mode 100644
index 0000000000..62484472bb
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java
@@ -0,0 +1,63 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.CopyActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "copy" action.
+ *
+ * @author gavinc
+ */
+public class CopyHandler extends BaseActionHandler
+{
+ public String getJSPPath()
+ {
+ return getJSPPath(CopyActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the destination space id to the action properties
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+
+ // add the type and name of the association to create when the copy
+ // is performed
+ repoProps.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
+ ContentModel.ASSOC_CONTAINS);
+ repoProps.put(CopyActionExecuter.PARAM_ASSOC_QNAME,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef destNodeRef = (NodeRef)repoProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String spaceName = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+
+ return MessageFormat.format(Application.getMessage(context, "action_copy"),
+ new Object[] {spaceName});
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java
new file mode 100644
index 0000000000..c83c129967
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java
@@ -0,0 +1,58 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.executer.ImporterActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "import" action.
+ *
+ * @author gavinc
+ */
+public class ImportHandler extends BaseActionHandler
+{
+ protected static final String IMPORT_ENCODING = "UTF-8";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(ImporterActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the encoding
+ repoProps.put(ImporterActionExecuter.PARAM_ENCODING, IMPORT_ENCODING);
+
+ // add the destination for the import
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(ImporterActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef destNodeRef = (NodeRef)repoProps.get(
+ ImporterActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String spaceName = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+
+ return MessageFormat.format(Application.getMessage(context, "action_import"),
+ new Object[] {spaceName});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java
new file mode 100644
index 0000000000..1512f58ede
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java
@@ -0,0 +1,60 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.LinkCategoryActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "link-category" action.
+ *
+ * @author gavinc
+ */
+public class LinkCategoryHandler extends BaseActionHandler
+{
+ protected static final String PROP_CATEGORY = "category";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(LinkCategoryActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the classifiable aspect
+ repoProps.put(LinkCategoryActionExecuter.PARAM_CATEGORY_ASPECT,
+ ContentModel.ASPECT_GEN_CLASSIFIABLE);
+
+ // put the selected category in the action params
+ NodeRef catNodeRef = (NodeRef)actionProps.get(PROP_CATEGORY);
+ repoProps.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
+ catNodeRef);
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef catNodeRef = (NodeRef)repoProps.get(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE);
+ actionProps.put(PROP_CATEGORY, catNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeRef cat = (NodeRef)actionProps.get(PROP_CATEGORY);
+ String name = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), cat);
+
+ return MessageFormat.format(Application.getMessage(context, "action_link_category"),
+ new Object[] {name});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java
new file mode 100644
index 0000000000..1a891d3f09
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java
@@ -0,0 +1,144 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.executer.MailActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.actions.BaseActionWizard.RecipientWrapper;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler implementation for the "mail" action.
+ *
+ * @author gavinc
+ */
+public class MailHandler extends BaseActionHandler
+{
+ public static final String PROP_TO = "to";
+ public static final String PROP_FROM = "from";
+ public static final String PROP_MESSAGE = "message";
+ public static final String PROP_SUBJECT = "subject";
+ public static final String PROP_TEMPLATE = "template";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(MailActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // get hold of the current wizard so we can extract some data from it
+ BaseActionWizard wizard = (BaseActionWizard)Application.
+ getWizardManager().getBean();
+
+ // add the person(s) it's going to as a list of authorities
+ List recipients = new ArrayList(wizard.getEmailRecipients().size());
+ for (int i=0; i < wizard.getEmailRecipients().size(); i++)
+ {
+ RecipientWrapper wrapper = wizard.getEmailRecipients().get(i);
+ recipients.add(wrapper.getAuthority());
+ }
+
+ repoProps.put(MailActionExecuter.PARAM_TO_MANY, (Serializable)recipients);
+
+ // add the actual email text to send
+ repoProps.put(MailActionExecuter.PARAM_TEXT, actionProps.get(PROP_MESSAGE));
+
+ // add the subject for the email
+ repoProps.put(MailActionExecuter.PARAM_SUBJECT, actionProps.get(PROP_SUBJECT));
+
+ // add the from address
+ String from = Application.getClientConfig(FacesContext.getCurrentInstance()).getFromEmailAddress();
+ repoProps.put(MailActionExecuter.PARAM_FROM, from);
+
+ // add the template if one was selected by the user
+ if (wizard.getUsingTemplate() != null)
+ {
+ repoProps.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(Repository.getStoreRef(),
+ wizard.getUsingTemplate()));
+ }
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ // get hold of the current wizard so we can extract some data from it
+ BaseActionWizard wizard = (BaseActionWizard)Application.
+ getWizardManager().getBean();
+
+ String subject = (String)repoProps.get(MailActionExecuter.PARAM_SUBJECT);
+ actionProps.put(PROP_SUBJECT, subject);
+
+ String message = (String)repoProps.get(MailActionExecuter.PARAM_TEXT);
+ actionProps.put(PROP_MESSAGE, message);
+
+ // handle single email or multiple authority recipients
+ String to = (String)repoProps.get(MailActionExecuter.PARAM_TO);
+ if (to != null)
+ {
+ actionProps.put(PROP_TO, to);
+ }
+ else
+ {
+ List recipients = (List)repoProps.get(MailActionExecuter.PARAM_TO_MANY);
+ if (recipients != null && recipients.size() != 0)
+ {
+ // rebuild the list of RecipientWrapper objects from the stored action
+ for (String authority : recipients)
+ {
+ wizard.getEmailRecipients().add(
+ new RecipientWrapper(wizard.displayLabelForAuthority(authority),
+ authority));
+ }
+ }
+ }
+
+ NodeRef templateRef = (NodeRef)repoProps.get(MailActionExecuter.PARAM_TEMPLATE);
+ if (templateRef != null)
+ {
+ actionProps.put(PROP_TEMPLATE, templateRef.getId());
+ wizard.setUsingTemplate(templateRef.getId());
+ }
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ BaseActionWizard actionWizard = (BaseActionWizard)wizard;
+
+ String addresses = (String)actionProps.get(PROP_TO);
+
+ if (addresses == null || addresses.length() == 0)
+ {
+ if (actionWizard.getEmailRecipients().size() != 0)
+ {
+ StringBuilder builder = new StringBuilder();
+
+ for (int i=0; i < actionWizard.getEmailRecipients().size(); i++)
+ {
+ RecipientWrapper wrapper = actionWizard.getEmailRecipients().get(i);
+ if (i != 0)
+ {
+ builder.append(", ");
+ }
+ builder.append(wrapper.getName());
+ }
+
+ addresses = builder.toString();
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_mail"),
+ new Object[] {addresses});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java
new file mode 100644
index 0000000000..27b257d4b8
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java
@@ -0,0 +1,62 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.MoveActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "move" action.
+ *
+ * @author gavinc
+ */
+public class MoveHandler extends BaseActionHandler
+{
+ public String getJSPPath()
+ {
+ return getJSPPath(MoveActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the destination space id to the action properties
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+
+ // add the type and name of the association to create when the move
+ // is performed
+ repoProps.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
+ ContentModel.ASSOC_CONTAINS);
+ repoProps.put(MoveActionExecuter.PARAM_ASSOC_QNAME,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "move"));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef destNodeRef = (NodeRef)repoProps.get(MoveActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String spaceName = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+
+ return MessageFormat.format(Application.getMessage(context, "action_move"),
+ new Object[] {spaceName});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java
new file mode 100644
index 0000000000..ed0f329c37
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java
@@ -0,0 +1,65 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.repo.action.executer.RemoveFeaturesActionExecuter;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "remove-features" action.
+ *
+ * @author gavinc
+ */
+public class RemoveFeaturesHandler extends BaseActionHandler
+{
+ protected static final String PROP_ASPECT = "aspect";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(RemoveFeaturesActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ QName aspect = Repository.resolveToQName((String)actionProps.get(PROP_ASPECT));
+ repoProps.put(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ QName aspect = (QName)repoProps.get(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME);
+ actionProps.put(PROP_ASPECT, aspect.toString());
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String label = null;
+ String aspect = (String)actionProps.get(PROP_ASPECT);
+
+ // find the label used by looking through the SelectItem list
+ for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
+ {
+ if (item.getValue().equals(aspect))
+ {
+ label = item.getLabel();
+ break;
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_remove_features"),
+ new Object[] {label});
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java
new file mode 100644
index 0000000000..d7b2c1f785
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java
@@ -0,0 +1,63 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.executer.ScriptActionExecutor;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.app.servlet.FacesHelper;
+import org.alfresco.web.bean.NavigationBean;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "script" action.
+ *
+ * @author gavinc
+ */
+public class ScriptHandler extends BaseActionHandler
+{
+ protected static final String PROP_SCRIPT = "script";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(ScriptActionExecutor.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the selected script noderef to the action properties
+ String id = (String)actionProps.get(PROP_SCRIPT);
+ NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
+ repoProps.put(ScriptActionExecutor.PARAM_SCRIPTREF, scriptRef);
+
+ NavigationBean navBean = (NavigationBean)FacesHelper.getManagedBean(
+ FacesContext.getCurrentInstance(), "NavigationBean");
+ repoProps.put(ScriptActionExecutor.PARAM_SPACEREF,
+ navBean.getCurrentNode().getNodeRef());
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ NodeRef scriptRef = (NodeRef)repoProps.get(ScriptActionExecutor.PARAM_SCRIPTREF);
+ actionProps.put(PROP_SCRIPT, scriptRef.getId());
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String id = (String)actionProps.get(PROP_SCRIPT);
+ NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
+ String scriptName = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), scriptRef);
+
+ return MessageFormat.format(Application.getMessage(context, "action_script"),
+ new Object[] {scriptName});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java
new file mode 100644
index 0000000000..504e50279f
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java
@@ -0,0 +1,181 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "simple-workflow" action.
+ *
+ * @author gavinc
+ */
+public class SimpleWorkflowHandler extends BaseActionHandler
+{
+ public static final String PROP_APPROVE_STEP_NAME = "approveStepName";
+ public static final String PROP_APPROVE_ACTION = "approveAction";
+ public static final String PROP_APPROVE_FOLDER = "approveFolder";
+ public static final String PROP_REJECT_STEP_PRESENT = "rejectStepPresent";
+ public static final String PROP_REJECT_STEP_NAME = "rejectStepName";
+ public static final String PROP_REJECT_ACTION = "rejectAction";
+ public static final String PROP_REJECT_FOLDER = "rejectFolder";
+
+ @Override
+ public void setupUIDefaults(Map actionProps)
+ {
+ actionProps.put(PROP_APPROVE_ACTION, "move");
+ actionProps.put(PROP_REJECT_STEP_PRESENT, "yes");
+ actionProps.put(PROP_REJECT_ACTION, "move");
+ }
+
+ public String getJSPPath()
+ {
+ return getJSPPath(SimpleWorkflowActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the approve step name
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP,
+ (String)actionProps.get(PROP_APPROVE_STEP_NAME));
+
+ // add whether the approve step will copy or move the content
+ boolean approveMove = true;
+ String approveAction = (String)actionProps.get(PROP_APPROVE_ACTION);
+ if (approveAction != null && approveAction.equals("copy"))
+ {
+ approveMove = false;
+ }
+
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
+
+ // add the destination folder of the content
+ NodeRef approveDestNodeRef = null;
+ Object approveDestNode = actionProps.get(PROP_APPROVE_FOLDER);
+ if (approveDestNode instanceof NodeRef)
+ {
+ approveDestNodeRef = (NodeRef)approveDestNode;
+ }
+ else if (approveDestNode instanceof String)
+ {
+ approveDestNodeRef = new NodeRef((String)approveDestNode);
+ }
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
+
+ // determine whether we have a reject step or not
+ boolean requireReject = true;
+ String rejectStepPresent = (String)actionProps.get(PROP_REJECT_STEP_PRESENT);
+ if (rejectStepPresent != null && rejectStepPresent.equals("no"))
+ {
+ requireReject = false;
+ }
+
+ if (requireReject)
+ {
+ // add the reject step name
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP,
+ (String)actionProps.get(PROP_REJECT_STEP_NAME));
+
+ // add whether the reject step will copy or move the content
+ boolean rejectMove = true;
+ String rejectAction = (String)actionProps.get(PROP_REJECT_ACTION);
+ if (rejectAction != null && rejectAction.equals("copy"))
+ {
+ rejectMove = false;
+ }
+
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
+
+ // add the destination folder of the content
+ NodeRef rejectDestNodeRef = null;
+ Object rejectDestNode = actionProps.get(PROP_REJECT_FOLDER);
+ if (rejectDestNode instanceof NodeRef)
+ {
+ rejectDestNodeRef = (NodeRef)rejectDestNode;
+ }
+ else if (rejectDestNode instanceof String)
+ {
+ rejectDestNodeRef = new NodeRef((String)rejectDestNode);
+ }
+ repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
+ }
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ String approveStep = (String)repoProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP);
+ Boolean approveMove = (Boolean)repoProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE);
+ NodeRef approveFolderNode = (NodeRef)repoProps.get(
+ SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER);
+
+ String rejectStep = (String)repoProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP);
+ Boolean rejectMove = (Boolean)repoProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE);
+ NodeRef rejectFolderNode = (NodeRef)repoProps.get(
+ SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER);
+
+ actionProps.put(PROP_APPROVE_STEP_NAME, approveStep);
+ actionProps.put(PROP_APPROVE_ACTION, approveMove ? "move" : "copy");
+ actionProps.put(PROP_APPROVE_FOLDER, approveFolderNode);
+
+ if (rejectStep == null && rejectMove == null && rejectFolderNode == null)
+ {
+ actionProps.put(PROP_REJECT_STEP_PRESENT, "no");
+ actionProps.put(PROP_REJECT_ACTION, "move");
+ }
+ else
+ {
+ actionProps.put(PROP_REJECT_STEP_PRESENT, "yes");
+ actionProps.put(PROP_REJECT_STEP_NAME, rejectStep);
+ actionProps.put(PROP_REJECT_ACTION, rejectMove ? "move" : "copy");
+ actionProps.put(PROP_REJECT_FOLDER, rejectFolderNode);
+ }
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
+
+ String approveStepName = (String)actionProps.get(PROP_APPROVE_STEP_NAME);
+ String approveAction = (String)actionProps.get(PROP_APPROVE_ACTION);
+ NodeRef approveFolder = (NodeRef)actionProps.get(PROP_APPROVE_FOLDER);
+ String approveFolderName = Repository.getNameForNode(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)actionProps.get(PROP_REJECT_STEP_PRESENT);
+ if (rejectStep != null && "yes".equals(rejectStep))
+ {
+ String rejectStepName = (String)actionProps.get(PROP_REJECT_STEP_NAME);
+ String rejectAction = (String)actionProps.get(PROP_REJECT_ACTION);
+ NodeRef rejectFolder = (NodeRef)actionProps.get(PROP_REJECT_FOLDER);
+ String rejectFolderName = Repository.getNameForNode(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);
+ }
+
+ return builder.toString();
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java
new file mode 100644
index 0000000000..4e66c15091
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java
@@ -0,0 +1,63 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "specialise-type" action.
+ *
+ * @author gavinc
+ */
+public class SpecialiseTypeHandler extends BaseActionHandler
+{
+ public static final String PROP_OBJECT_TYPE = "objecttype";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(SpecialiseTypeActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ String objectType = (String)actionProps.get(PROP_OBJECT_TYPE);
+ repoProps.put(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME,
+ QName.createQName(objectType));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ QName specialiseType = (QName)repoProps.get(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME);
+ actionProps.put(PROP_OBJECT_TYPE, specialiseType.toString());
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String label = null;
+ String objectType = (String)actionProps.get(PROP_OBJECT_TYPE);
+ for (SelectItem item : ((BaseActionWizard)wizard).getObjectTypes())
+ {
+ if (item.getValue().equals(objectType) == true)
+ {
+ label = item.getLabel();
+ break;
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_specialise_type"),
+ new Object[] {label});
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java
new file mode 100644
index 0000000000..e4206ee717
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java
@@ -0,0 +1,85 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.TransformActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "transform" action.
+ *
+ * @author gavinc
+ */
+public class TransformHandler extends BaseActionHandler
+{
+ protected static final String PROP_TRANSFORMER = "transformer";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(TransformActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the transformer to use
+ repoProps.put(TransformActionExecuter.PARAM_MIME_TYPE,
+ actionProps.get(PROP_TRANSFORMER));
+
+ // add the destination space id to the action properties
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+
+ // add the type and name of the association to create when the copy
+ // is performed
+ repoProps.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
+ ContentModel.ASSOC_CONTAINS);
+ repoProps.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ String transformer = (String)repoProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
+ actionProps.put(PROP_TRANSFORMER, transformer);
+
+ NodeRef destNodeRef = (NodeRef)repoProps.get(TransformActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String label = null;
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String name = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+ String transformer = (String)actionProps.get(PROP_TRANSFORMER);
+
+ // find the label used by looking through the SelectItem list
+ for (SelectItem item : ((BaseActionWizard)wizard).getTransformers())
+ {
+ if (item.getValue().equals(transformer))
+ {
+ label = item.getLabel();
+ break;
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_transform"),
+ new Object[] {name, label});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java
new file mode 100644
index 0000000000..2bc2a42809
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java
@@ -0,0 +1,95 @@
+package org.alfresco.web.bean.actions.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.executer.ImageTransformActionExecuter;
+import org.alfresco.repo.action.executer.TransformActionExecuter;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Action handler for the "transform-image" action.
+ *
+ * @author gavinc
+ */
+public class TransformImageHandler extends BaseActionHandler
+{
+ protected static final String PROP_IMAGE_TRANSFORMER = "imageTransformer";
+ protected static final String PROP_TRANSFORM_OPTIONS = "transformOptions";
+
+ public String getJSPPath()
+ {
+ return getJSPPath(ImageTransformActionExecuter.NAME);
+ }
+
+ public void prepareForSave(Map actionProps,
+ Map repoProps)
+ {
+ // add the transformer to use
+ repoProps.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
+ actionProps.get(PROP_IMAGE_TRANSFORMER));
+
+ // add the options
+ repoProps.put(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND,
+ actionProps.get(PROP_TRANSFORM_OPTIONS));
+
+ // add the destination space id to the action properties
+ NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
+ repoProps.put(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
+
+ // add the type and name of the association to create when the copy
+ // is performed
+ repoProps.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
+ ContentModel.ASSOC_CONTAINS);
+ repoProps.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
+ }
+
+ public void prepareForEdit(Map actionProps,
+ Map repoProps)
+ {
+ String transformer = (String)repoProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
+ actionProps.put(PROP_IMAGE_TRANSFORMER, transformer);
+
+ String options = (String)repoProps.get(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND);
+ actionProps.put(PROP_TRANSFORM_OPTIONS, options != null ? options : "");
+
+ NodeRef destNodeRef = (NodeRef)repoProps.get(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER);
+ actionProps.put(PROP_DESTINATION, destNodeRef);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map actionProps)
+ {
+ String label = null;
+ NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
+ String name = Repository.getNameForNode(
+ Repository.getServiceRegistry(context).getNodeService(), space);
+ String transformer = (String)actionProps.get(PROP_IMAGE_TRANSFORMER);
+ String option = (String)actionProps.get(PROP_TRANSFORM_OPTIONS);
+
+ // find the label used by looking through the SelectItem list
+ for (SelectItem item : ((BaseActionWizard)wizard).getImageTransformers())
+ {
+ if (item.getValue().equals(transformer))
+ {
+ label = item.getLabel();
+ break;
+ }
+ }
+
+ return MessageFormat.format(Application.getMessage(context, "action_transform_image"),
+ new Object[] {name, label, option});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java
index 2da95f2e0a..eb59e93ff3 100644
--- a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java
+++ b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java
@@ -1,7 +1,6 @@
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;
@@ -16,25 +15,21 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
-import org.alfresco.model.ContentModel;
-import org.alfresco.repo.action.evaluator.CompareMimeTypeEvaluator;
-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.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.action.ActionConditionDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
-import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.rule.Rule;
import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.rule.RuleType;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
+import org.alfresco.web.bean.actions.IHandler;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
@@ -48,9 +43,8 @@ import org.apache.commons.logging.LogFactory;
*/
public class CreateRuleWizard extends BaseActionWizard
{
- public static final String PROP_CONDITION_NAME = "conditionName";
- public static final String PROP_CONDITION_SUMMARY = "conditionSummary";
- public static final String PROP_CONDITION_NOT = "notcondition";
+ protected static final String PROP_CONDITION_NAME = "conditionName";
+ protected static final String PROP_CONDITION_SUMMARY = "conditionSummary";
protected RuleService ruleService;
protected RulesBean rulesBean;
@@ -60,6 +54,7 @@ public class CreateRuleWizard extends BaseActionWizard
private List types;
private List conditions;
+ protected Map conditionHandlers;
protected Map currentConditionProperties;
protected List