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 ee5b9527c6..4f651f07dc 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
@@ -114,5 +114,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml
index 90690c276e..0236e1848f 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml
@@ -105,6 +105,7 @@
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml
index dd4dde9bcd..68c93efcc0 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml
@@ -17,6 +17,11 @@
+
+
+ cutoff
+
+
@@ -24,11 +29,18 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
index 1c4208ccef..79437c28cb 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
@@ -111,6 +111,12 @@
+
+
+
+
+
+
diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml
new file mode 100644
index 0000000000..c1c99e8dce
--- /dev/null
+++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml
@@ -0,0 +1,9 @@
+
+ Disposition Properties
+ Returns a list of the disposition properties based on the context provided.
+ /api/rma/dispositionproperties?recordlevel={recordlevel}&dispositionaction={dispositionaction}
+ argument
+ user
+ required
+ internal
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl
new file mode 100644
index 0000000000..9fd47f2e6b
--- /dev/null
+++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl
@@ -0,0 +1,14 @@
+{
+ "data" :
+ {
+ "properties":
+ [
+ <#list properties as item>
+ {
+ "label": "${item.label}",
+ "value": "${item.value}"
+ }<#if item_has_next>,#if>
+ #list>
+ ]
+ }
+}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java
new file mode 100644
index 0000000000..98cbe4afa2
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java
@@ -0,0 +1,63 @@
+/*
+ * 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.DispositionAction;
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Indicates whether a disposable item currently has a disposition date or not.
+ *
+ * @author Roy Wetherall
+ */
+public class HasDispositionDateCapabilityCondition 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;
+
+ DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
+ if (dispositionAction != null)
+ {
+ if (dispositionAction.getAsOfDate() != null)
+ {
+ result = true;
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java
index f40f283a55..3a13336a95 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java
@@ -45,10 +45,11 @@ public interface DispositionService
void registerDispositionProperty(DispositionProperty dispositionProperty);
/**
- * Returns the list of disposition period properties
+ * Returns the list of disposition period properties that apply given the context provided.
*
- * @return list of disposition period properties
+ * @return filtered list of disposition period properties
*/
+ Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction);
Collection getDispositionProperties();
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
index b1c095d0cb..35e59a7429 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
@@ -166,8 +166,24 @@ public class DispositionServiceImpl implements DispositionService, RecordsManage
}
/**
- * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties()
+ * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties(boolean, java.lang.String)
*/
+ @Override
+ public Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction)
+ {
+ Collection values = dispositionProperties.values();
+ List result = new ArrayList(values.size());
+ for (DispositionProperty dispositionProperty : values)
+ {
+ boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction);
+ if (test == true)
+ {
+ result.add(dispositionProperty);
+ }
+ }
+ return result;
+ }
+
@Override
public Collection getDispositionProperties()
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java
index 75216c4356..3d33c3ebc3 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java
@@ -6,6 +6,7 @@ package org.alfresco.module.org_alfresco_module_rm.disposition.property;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
+import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
@@ -35,6 +36,7 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
/** Property QName */
private QName propertyName;
+ /** Behaviour */
private JavaBehaviour behaviour;
/** Namespace service */
@@ -52,6 +54,15 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
/** Node service */
private NodeService nodeService;
+ /** Indicates whether this disposition property applies to a folder level disposition */
+ private boolean appliesToFolderLevel = true;
+
+ /** Indicates whether this disposition property applies to a record level disposition */
+ private boolean appliesToRecordLevel = true;
+
+ /** Set of disposition actions this property does not apply to */
+ private Set excludedDispositionActions;
+
/**
* @param namespaceService namespace service
*/
@@ -116,6 +127,30 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
return dictionaryService.getProperty(propertyName);
}
+ /**
+ * @param excludedDispositionActions list of excluded disposition actions
+ */
+ public void setExcludedDispositionActions(Set excludedDispositionActions)
+ {
+ this.excludedDispositionActions = excludedDispositionActions;
+ }
+
+ /**
+ * @param appliesToFolderLevel
+ */
+ public void setAppliesToFolderLevel(boolean appliesToFolderLevel)
+ {
+ this.appliesToFolderLevel = appliesToFolderLevel;
+ }
+
+ /**
+ * @param appliesToRecordLevel
+ */
+ public void setAppliesToRecordLevel(boolean appliesToRecordLevel)
+ {
+ this.appliesToRecordLevel = appliesToRecordLevel;
+ }
+
/**
* Bean initialisation method
*/
@@ -131,7 +166,40 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
ASPECT_DISPOSITION_LIFECYCLE,
behaviour);
}
+
+ /**
+ * Indicates whether the disposition property applies given the context.
+ *
+ * @param isRecordLevel true if record level disposition schedule, false otherwise
+ * @param dispositionAction disposition action name
+ * @return boolean true if applies, false otherwise
+ */
+ public boolean applies(boolean isRecordLevel, String dispositionAction)
+ {
+ boolean result = false;
+
+ if ((isRecordLevel == true && appliesToRecordLevel == true) ||
+ (isRecordLevel == false && appliesToFolderLevel == true))
+ {
+ if (excludedDispositionActions != null && excludedDispositionActions.size() != 0)
+ {
+ if (excludedDispositionActions.contains(dispositionAction) == false)
+ {
+ result = true;
+ }
+ }
+ else
+ {
+ result = true;
+ }
+ }
+
+ return result;
+ }
+ /**
+ * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
+ */
@Override
public void onUpdateProperties(
final NodeRef nodeRef,
@@ -197,6 +265,13 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
}
}
+ /**
+ * Indicates whether the property has been updated or not.
+ *
+ * @param before
+ * @param after
+ * @return
+ */
private boolean isPropertyUpdated(Map before, Map after)
{
boolean result = false;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java
new file mode 100644
index 0000000000..376144dc3f
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java
@@ -0,0 +1,106 @@
+/*
+ * 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.script;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
+import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty;
+import org.alfresco.service.cmr.dictionary.PropertyDefinition;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.springframework.extensions.webscripts.Cache;
+import org.springframework.extensions.webscripts.DeclarativeWebScript;
+import org.springframework.extensions.webscripts.Status;
+import org.springframework.extensions.webscripts.WebScriptRequest;
+import org.springframework.util.StringUtils;
+
+/**
+ * @author Roy Wetherall
+ */
+public class DispositionPropertiesGet extends DeclarativeWebScript
+{
+ protected DispositionService dispositionService;
+ protected NamespaceService namespaceService;
+
+ /**
+ * Sets the disposition service
+ *
+ * @param dispositionService the disposition service
+ */
+ public void setDispositionService(DispositionService dispositionService)
+ {
+ this.dispositionService = dispositionService;
+ }
+
+ /**
+ * Sets the NamespaceService instance
+ *
+ * @param namespaceService The NamespaceService instance
+ */
+ public void setNamespaceService(NamespaceService namespaceService)
+ {
+ this.namespaceService = namespaceService;
+ }
+
+ /*
+ * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
+ */
+ @Override
+ protected Map executeImpl(WebScriptRequest req, Status status, Cache cache)
+ {
+ boolean recordLevel = false;
+ String recordLevelValue = req.getParameter("recordlevel");
+ if (recordLevelValue != null)
+ {
+ recordLevel = Boolean.valueOf(recordLevelValue);
+ }
+ String dispositionAction = req.getParameter("dispositionaction");
+
+ Collection dispositionProperties = dispositionService.getDispositionProperties(recordLevel, dispositionAction);
+ List