diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
index caf3e20a14..b5289096aa 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
@@ -162,6 +162,12 @@
class="org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HasAspectCapabilityCondition">
-
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
index 116c8b8024..33f80ffab7 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
@@ -1,14 +1,48 @@
#
# i18n for Records Management Action Conditions
#
+# Is classified
+isClassified.title=Is Classified
+isClassified.description=Is the record or record folder classified.
+
+# Is cutoff
+isCutoff.title=Is Cutoff
+isCutoff.description=Is the record or record folder cutoff.
+
# Is declared
isDeclared.title=Is Record Declared
isDeclared.description=Is the record declared.
+# Is frozen
+isFrozen.title=Is Frozen
+isFrozen.description=Is the record or record folder frozen.
+
# Is filed
isRecordFiled.title=Is Record Filed
isRecordFiled.description=Is the record filed.
+# Is record folder closed
+isRecordFolderClosed.title=Is Record Folder Closed
+isRecordFolderClosed.description=Is the record folder closed.
+
+# Is vital
+isVital.title=Is Vital
+isVital.description=Is the record or record folder vital.
+
+# Has Disposition Action
+hasDispositionAction.title=Has Disposition Action
+hasDispositionAction.description=Has the node got the specified associated disposition action at the specified relative position.
+
+# Is kind
+isKind.title=Is Kind
+isKind.description=Is the node of a file plan component kind.
+isKind.kind.display-label=Kind
+
+# Is Record Type
+isRecordType.title=Is Record Type
+isRecordType.description=Is the record of the specified type.
+
+
#
# i18n for Records Management Actions
#
@@ -55,4 +89,21 @@ requestInfo.description=Starts a workflow for requesting more information for a
# Execute script
executeScript.title=Execute script
executeScript.description=Execute a script.
-executeScript.script-ref.display-label=Script
\ No newline at end of file
+executeScript.script-ref.display-label=Script
+
+# Action parameter constraints
+rm-ac-is-kind-kinds.file_plan=File Plan
+rm-ac-is-kind-kinds.record_category=Record Category
+rm-ac-is-kind-kinds.record_folder=Record Folder
+rm-ac-is-kind-kinds.record=Record
+
+rm-ac-disposition-action-relative-positions.next=Next
+rm-ac-disposition-action-relative-positions.previous=Previous
+rm-ac-disposition-action-relative-positions.current=Current
+rm-ac-disposition-action-relative-positions.any=Any
+
+#rm-ac-disposition-actions.Accession=Accession
+#rm-ac-disposition-actions.destroy=Destroy
+#rm-ac-disposition-actions.retain=Retain
+#rm-ac-disposition-actions.transfer=Transfer
+#rm-ac-disposition-actions.cutoff=Cutoff
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
index c0487c1d19..d1d7ea5699 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
@@ -13,16 +13,39 @@
+
+
+
+ FILE_PLAN
+ RECORD_CATEGORY
+ RECORD_FOLDER
+ RECORD
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -34,7 +57,6 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -795,7 +858,7 @@
-
+
${spaces.store}
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
index 41a02bd045..fc17c1cb35 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
@@ -777,6 +777,7 @@
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService.executeRecordsManagementAction=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService.executeRecordsManagementAction=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService.register=RM_ALLOW
+ org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService.register=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService.*=RM_DENY
]]>
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java
new file mode 100644
index 0000000000..90b1e55539
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm;
+
+/**
+ * Disposition action relative position enumeration class.
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public enum DispositionActionRelativePositions
+{
+ ANY, NEXT, PREVIOUS;
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
index fab7f67a18..1f69c6d03e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
@@ -27,9 +27,9 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPoliciesUtil;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution;
+import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPoliciesUtil;
import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -57,7 +57,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
/** Registered records management actions */
private Map rmActions = new HashMap(13);
private Map rmConditions = new HashMap(13);
- private Map dispositionActions = new HashMap(4);
+
+ private Map dispositionActions = new HashMap(5);
/** Policy component */
PolicyComponent policyComponent;
@@ -104,13 +105,13 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
*/
public void register(RecordsManagementAction rmAction)
{
- if (this.rmActions.containsKey(rmAction.getName()) == false)
+ if (rmActions.containsKey(rmAction.getName()) == false)
{
- this.rmActions.put(rmAction.getName(), rmAction);
+ rmActions.put(rmAction.getName(), rmAction);
if (rmAction.isDispositionAction() == true)
{
- this.dispositionActions.put(rmAction.getName(), rmAction);
+ dispositionActions.put(rmAction.getName(), rmAction);
}
}
}
@@ -198,8 +199,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
*/
public List getDispositionActions()
{
- List result = new ArrayList(this.rmActions.size());
- result.addAll(this.dispositionActions.values());
+ List result = new ArrayList(dispositionActions.size());
+ result.addAll(dispositionActions.values());
return Collections.unmodifiableList(result);
}
@@ -208,7 +209,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
*/
public RecordsManagementAction getDispositionAction(String name)
{
- return this.dispositionActions.get(name);
+ return dispositionActions.get(name);
}
/*
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java
new file mode 100644
index 0000000000..67058be72c
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2009-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+package org.alfresco.module.org_alfresco_module_rm.action.constraint;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.alfresco.repo.action.constraint.BaseParameterConstraint;
+
+/**
+ * A parameter constraint that reads in a list of allowable values from Spring configuration
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public class CustomParameterConstraint extends BaseParameterConstraint
+{
+
+ private List parameterValues;
+
+ /**
+ * @param parameterValues
+ */
+ public void setParameterValues(List parameterValues)
+ {
+ this.parameterValues = parameterValues;
+ }
+
+ /**
+ * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues()
+ */
+ protected Map getAllowableValuesImpl()
+ {
+ Map allowableValues = new HashMap(parameterValues.size());
+
+ for (Object parameterValue : parameterValues)
+ {
+ // Look up the I18N value
+ String displayLabel = getI18NLabel(parameterValue.toString());
+
+ // Add to the map of allowed values
+ allowableValues.put(parameterValue.toString(), displayLabel);
+ }
+
+ return allowableValues;
+ }
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java
new file mode 100644
index 0000000000..7e51ca40ea
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+package org.alfresco.module.org_alfresco_module_rm.action.constraint;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction;
+import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
+import org.alfresco.repo.action.constraint.BaseParameterConstraint;
+
+/**
+ * Record type parameter constraint
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public class DispositionActionParameterConstraint extends BaseParameterConstraint
+{
+ /** Name constant */
+ public static final String NAME = "rm-ac-record-types";
+
+ private RecordsManagementActionService rmActionService;
+
+ public void setRecordsManagementActionService(RecordsManagementActionService rmActionService)
+ {
+ this.rmActionService = rmActionService;
+ }
+
+ /**
+ * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues()
+ */
+ protected Map getAllowableValuesImpl()
+ {
+ List rmActions = rmActionService.getDispositionActions();
+
+ Map result = new HashMap(rmActions.size());
+ for (RecordsManagementAction rmAction : rmActions)
+ {
+ result.put(rmAction.getName(), rmAction.getLabel());
+ }
+ return result;
+ }
+
+
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java
new file mode 100644
index 0000000000..67e8611937
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+package org.alfresco.module.org_alfresco_module_rm.action.constraint;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
+import org.alfresco.repo.action.constraint.BaseParameterConstraint;
+import org.alfresco.service.cmr.dictionary.AspectDefinition;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * Record type parameter constraint
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public class RecordTypeParameterConstraint extends BaseParameterConstraint
+{
+ /** Name constant */
+ public static final String NAME = "rm-ac-record-types";
+
+ private RecordService recordService;
+
+ private DictionaryService dictionaryService;
+
+ public void setRecordService(RecordService recordService)
+ {
+ this.recordService = recordService;
+ }
+
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
+ /**
+ * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues()
+ */
+ protected Map getAllowableValuesImpl()
+ {
+ Set recordTypes = recordService.getRecordMetaDataAspects();
+
+ Map result = new HashMap(recordTypes.size());
+ for (QName recordType : recordTypes)
+ {
+
+ AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType);
+ if (aspectDefinition != null)
+ {
+ result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle());
+ }
+ }
+ return result;
+ }
+
+
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java
new file mode 100644
index 0000000000..c8e7b3c255
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2005-2013 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
+
+import java.util.List;
+
+import org.alfresco.module.org_alfresco_module_rm.DispositionActionRelativePositions;
+import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
+import org.alfresco.repo.action.ParameterDefinitionImpl;
+import org.alfresco.service.cmr.action.ActionCondition;
+import org.alfresco.service.cmr.action.ParameterDefinition;
+import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+
+
+
+/**
+ * Records management hasDispositionAction evaluator that evaluates whether the given node's disposition schedule has the specified disposition action.
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public class HasDispositionActionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase
+{
+ /**
+ * Evaluator constants
+ */
+ public static final String NAME = "hasDispositionAction";
+
+ public static final String PARAM_DISPOSITION_ACTION_RELATIVE_POSITION = "position";
+
+ public static final String PARAM_DISPOSITION_ACTION = "action";
+
+ private DispositionService dispositionService;
+
+ /**
+ * @param dispositionService
+ */
+ public void setDispositionService(DispositionService dispositionService)
+ {
+ this.dispositionService = dispositionService;
+ }
+
+ @Override
+ protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef)
+ {
+ boolean result = false;
+ String position = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION)).getLocalName();
+ String action = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION)).getLocalName();
+
+
+ if (position.equals(DispositionActionRelativePositions.ANY.toString()))
+ {
+
+ DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(actionedUponNodeRef);
+ if (dispositionSchedule != null)
+ {
+ for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions())
+ {
+ if (dispositionActionDefinition.getName().equals(action) == true)
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ else if (position.equals(DispositionActionRelativePositions.NEXT.toString()))
+ {
+ DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(actionedUponNodeRef);
+ if (nextDispositionAction != null)
+ {
+ // Get the disposition actions name
+ String actionName = nextDispositionAction.getName();
+ if (actionName.equals(action) == true)
+ {
+ result = true;
+ }
+ }
+ }
+ else if (position.equals(DispositionActionRelativePositions.PREVIOUS.toString()))
+ {
+ DispositionAction lastCompletedDispositionAction = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef);
+ if (lastCompletedDispositionAction != null)
+ {
+ // Get the disposition actions name
+ String actionName = lastCompletedDispositionAction.getName();
+ if (actionName.equals(action) == true)
+ {
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void addParameterDefinitions(List paramList)
+ {
+ paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION, DataTypeDefinition.QNAME, true,
+ getParamDisplayLabel(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION), false, "rm-ac-disposition-action-relative-positions"));
+ paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_DISPOSITION_ACTION), false,
+ "rm-ac-disposition-actions"));
+
+ }
+
+}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java
new file mode 100644
index 0000000000..faf73db118
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2005-2013 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
+
+import java.util.List;
+
+import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
+import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
+import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
+import org.alfresco.repo.action.ParameterDefinitionImpl;
+import org.alfresco.service.cmr.action.ActionCondition;
+import org.alfresco.service.cmr.action.ParameterDefinition;
+import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+
+
+
+/**
+ * Records management IsKind evaluator that evaluates according to the file plan
+ * component kind passed in.
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+/**
+ * @author ctan
+ */
+public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase
+{
+ /**
+ * Evaluator constants
+ */
+ public static final String NAME = "isKind";
+ public static final String PARAM_KIND = "kind";
+
+ private RecordsManagementService rmService;
+
+ /**
+ * @param rmService
+ */
+ public void setRecordsManagementService(RecordsManagementService rmService)
+ {
+ this.rmService = rmService;
+ }
+
+ @Override
+ protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef)
+ {
+ boolean result = false;
+ String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName();
+
+ FilePlanComponentKind filePlanComponentKind = rmService.getFilePlanComponentKind(actionedUponNodeRef);
+
+ if (filePlanComponentKind.equals(kind))
+ {
+ result = true;
+ }
+ return result;
+ }
+
+ @Override
+ protected void addParameterDefinitions(List paramList)
+ {
+ paramList.add(new ParameterDefinitionImpl(PARAM_KIND, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_KIND), false, "rm-ac-is-kind-kinds"));
+ }
+
+}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java
new file mode 100644
index 0000000000..9c4de772bf
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2005-2013 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
+
+import java.util.List;
+
+import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
+import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
+import org.alfresco.repo.action.ParameterDefinitionImpl;
+import org.alfresco.service.cmr.action.ActionCondition;
+import org.alfresco.service.cmr.action.ParameterDefinition;
+import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.namespace.QName;
+
+
+
+/**
+ * Records management IsRecordType evaluator that evaluates whether the record is of the specified type.
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+/**
+ * @author ctan
+ */
+public class IsRecordTypeEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase implements RecordsManagementModel
+{
+ /**
+ * Evaluator constants
+ */
+ public static final String NAME = "isRecordType";
+
+ public static final String PARAM_RECORD_TYPE = "type";
+
+ private NodeService nodeService;
+
+ /**
+ * @param nodeService
+ */
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ @Override
+ protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef)
+ {
+ boolean result = false;
+ String type = ((QName) actionCondition.getParameterValue(PARAM_RECORD_TYPE)).getLocalName();
+
+ if (type != null)
+ {
+ result = nodeService.hasAspect(actionedUponNodeRef, QName.createQName(RM_URI, type));
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void addParameterDefinitions(List paramList)
+ {
+ paramList.add(new ParameterDefinitionImpl(PARAM_RECORD_TYPE, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_RECORD_TYPE), false, "rm-ac-record-types"));
+ }
+
+}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java
index 134ed76824..b4847ae65a 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java
@@ -55,7 +55,7 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
protected void addParameterDefinitions(List paramList)
{
paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, DataTypeDefinition.TEXT, true,
- getParamDisplayLabel(PARAM_EVENT_NAME), false, "rm-ac-manual-event"));
+ getParamDisplayLabel(PARAM_EVENT_NAME), false, "rm-ac-manual-events"));
}
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java
new file mode 100644
index 0000000000..dedf7946fa
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition;
+
+import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Indicates whether the given node has an associated disposition schedule
+ *
+ * @author Craig Tan
+ * @since 2.1
+ */
+public class IsClassifiedCapabilityCondition extends AbstractCapabilityCondition
+{
+ /** Disposition service */
+ private DispositionService dispositionService;
+
+ /**
+ * @param dispositionService disposition service
+ */
+ public void setDispositionService(DispositionService dispositionService)
+ {
+ this.dispositionService = dispositionService;
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public boolean evaluate(NodeRef nodeRef)
+ {
+ boolean result = false;
+
+ DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef);
+ if (dispositionSchedule != null)
+ {
+ result = true;
+ }
+ return result;
+ }
+}
diff --git a/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java b/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
index d92acadf91..c4f47d1a70 100644
--- a/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
@@ -25,8 +25,12 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition;
+import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
+import org.alfresco.service.cmr.action.ActionConditionDefinition;
import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
/**
* Extended action service implementation.
@@ -34,11 +38,19 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Roy Wetherall
* @since 2.1
*/
-public class ExtendedActionServiceImpl extends ActionServiceImpl
+public class ExtendedActionServiceImpl extends ActionServiceImpl implements ApplicationContextAware
{
/** Records management service */
private RecordsManagementService recordsManagementService;
+ private ApplicationContext extendedApplicationContext;
+
+ public void setApplicationContext(ApplicationContext applicationContext)
+ {
+ super.setApplicationContext(applicationContext);
+ extendedApplicationContext = applicationContext;
+ }
+
/**
* @param recordsManagementService records management service
*/
@@ -47,6 +59,19 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl
this.recordsManagementService = recordsManagementService;
}
+ public ActionConditionDefinition getActionConditionDefinition(String name)
+ {
+ // get direct access to action condition definition (i.e. ignoring public flag of executer)
+ ActionConditionDefinition definition = null;
+ Object bean = extendedApplicationContext.getBean(name);
+ if (bean != null && bean instanceof ActionConditionEvaluator)
+ {
+ ActionConditionEvaluator evaluator = (ActionConditionEvaluator) bean;
+ definition = evaluator.getActionConditionDefintion();
+ }
+ return definition;
+ }
+
/**
* @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef)
*/