diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
index a4b2c6dfce..0c4e6e1714 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
@@ -115,6 +115,7 @@
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getExemptionCategories=ACL_ALLOW
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getReclassification=ACL_ALLOW
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getReclassificationValues=ACL_ALLOW
+ org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getExemptionCategoryById=ACL_ALLOW
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.*=ACL_DENY
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
index 70bd039bf1..6d69339d41 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
@@ -941,4 +941,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeService.java
index 0125b62992..093e208140 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeService.java
@@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import java.util.List;
import java.util.Set;
+import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ExemptionCategoryIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
@@ -80,6 +81,15 @@ public interface ClassificationSchemeService
*/
List getExemptionCategories();
+ /**
+ * Gets the exemption category for the given exemption category id
+ *
+ * @param exemptionCategoryId {@link String} The exemption category id for which the exemption category should be retrieved.
+ * @return The exemption category for the given exemption category id
+ * @throws ExemptionCategoryIdNotFound If the given exemption id is not found
+ */
+ ExemptionCategory getExemptionCategoryById(String exemptionCategoryId) throws ExemptionCategoryIdNotFound;
+
/**
* Identifies the reclassification type for the provided pair of {@link ClassificationLevel levels}.
*
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImpl.java
index 5b72bdffd6..abbcd8fc49 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImpl.java
@@ -19,7 +19,6 @@
package org.alfresco.module.org_alfresco_module_rm.classification;
import static java.util.Collections.unmodifiableSet;
-
import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank;
import java.util.Collections;
@@ -27,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ExemptionCategoryIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
@@ -162,4 +162,14 @@ public class ClassificationSchemeServiceImpl extends ServiceBaseImpl implements
}
return unmodifiableSet(result);
}
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService#getExemptionCategoryById(java.lang.String)
+ */
+ @Override
+ public ExemptionCategory getExemptionCategoryById(String exemptionCategoryId) throws ExemptionCategoryIdNotFound
+ {
+ checkNotBlank("exemptionCategoryId", exemptionCategoryId);
+ return exemptionCategoryManager.findCategoryById(exemptionCategoryId);
+ }
}
diff --git a/rm-server/source/java/org/alfresco/repo/jscript/app/ExemptionsCategoriesPropertyDecorator.java b/rm-server/source/java/org/alfresco/repo/jscript/app/ExemptionsCategoriesPropertyDecorator.java
new file mode 100644
index 0000000000..15ed413138
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/repo/jscript/app/ExemptionsCategoriesPropertyDecorator.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2005-2015 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.repo.jscript.app;
+
+import static org.alfresco.util.ParameterCheck.mandatory;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
+import org.alfresco.module.org_alfresco_module_rm.classification.ExemptionCategory;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONAware;
+import org.json.simple.JSONObject;
+
+import com.google.gson.Gson;
+
+/**
+ * Exemption categories property decorator
+ *
+ * @author Tuna Aksoy
+ * @since 3.0.a
+ */
+public class ExemptionsCategoriesPropertyDecorator extends BasePropertyDecorator
+{
+ /** Constants */
+ protected static final String ID = "id";
+ protected static final String LABEL = "label";
+ protected static final String VALUE = "value";
+ protected static final String DISPLAY_LABEL = "displayLabel";
+ protected static final String FULL_CATEGORY = "fullCategory";
+
+ /** Classification scheme service */
+ private ClassificationSchemeService classificationSchemeService;
+
+ /**
+ * @return the classificationSchemeService
+ */
+ protected ClassificationSchemeService getClassificationSchemeService()
+ {
+ return this.classificationSchemeService;
+ }
+
+ /**
+ * @param classificationSchemeService the classificationSchemeService to set
+ */
+ public void setClassificationSchemeService(ClassificationSchemeService classificationSchemeService)
+ {
+ this.classificationSchemeService = classificationSchemeService;
+ }
+
+ /**
+ * @see org.alfresco.repo.jscript.app.PropertyDecorator#decorate(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.io.Serializable)
+ */
+ @SuppressWarnings("unchecked")
+ public JSONAware decorate(QName propertyName, NodeRef nodeRef, Serializable value)
+ {
+ mandatory("value", value);
+
+ JSONArray jsonArray = new JSONArray();
+ JSONArray exemptionCategoryIds = new JSONArray();
+
+ if (value instanceof String)
+ {
+ exemptionCategoryIds = new Gson().fromJson((String) value, JSONArray.class);
+ }
+ else if (value instanceof List)
+ {
+ List values = (List) value;
+ for (String exemptionCategoryId : values)
+ {
+ exemptionCategoryIds.add(exemptionCategoryId);
+ }
+ }
+ else
+ {
+ throw new AlfrescoRuntimeException("Unexpected value instance: '" + value + "'.");
+ }
+
+ for (int i = 0; i < exemptionCategoryIds.size(); i++)
+ {
+ String exemptionCategoryId = (String) exemptionCategoryIds.get(i);
+ ExemptionCategory exemptionCategory = getClassificationSchemeService().getExemptionCategoryById(exemptionCategoryId);
+ String exemptionCategoryDisplayLabel = exemptionCategory.getDisplayLabel();
+ String exemptionCategoryFullCategory = exemptionCategoryId + ": " + exemptionCategoryDisplayLabel;
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put(ID, exemptionCategoryId);
+ jsonObject.put(LABEL, exemptionCategoryFullCategory);
+ jsonObject.put(VALUE, exemptionCategoryId);
+ jsonObject.put(DISPLAY_LABEL, exemptionCategoryDisplayLabel);
+ jsonObject.put(FULL_CATEGORY, exemptionCategoryFullCategory);
+
+ jsonArray.add(jsonObject);
+ }
+
+ return jsonArray;
+ }
+}
diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImplUnitTest.java
index 927cb772a1..e05d024f07 100644
--- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImplUnitTest.java
+++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationSchemeServiceImplUnitTest.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ExemptionCategoryIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils;
@@ -84,6 +85,7 @@ public class ClassificationSchemeServiceImplUnitTest
@Mock private DictionaryService mockDictionaryService;
@Mock private ClassificationLevelManager mockLevelManager;
@Mock private ClassificationReasonManager mockReasonManager;
+ @Mock private ExemptionCategoryManager mockExemptionCategoryManager;
@Captor private ArgumentCaptor