diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl
index 6df92865f6..928522c250 100644
--- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl
+++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl
@@ -1,3 +1,4 @@
+<#escape x as jsonUtils.encodeJSONString(x)>
{
"data":
{
@@ -5,9 +6,11 @@
[
<#list holds as hold>
{
- "name": "${hold}"
+ "name": "${hold.name}",
+ "nodeRef": "${hold.nodeRef}"
}<#if hold_has_next>,#if>
#list>
]
}
-}
\ No newline at end of file
+}
+#escape>
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java
new file mode 100644
index 0000000000..3c21114ba5
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2005-2014 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.hold;
+
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Hold POJO
+ *
+ * @author Tuna Aksoy
+ * @since 2.2
+ */
+public class Hold
+{
+ /** Hold name */
+ private String Name;
+
+ /** Hold node reference */
+ private NodeRef nodeRef;
+
+ /**
+ * Constructor
+ *
+ * @param name The name of the hold
+ * @param nodeRef The {@link NodeRef} of the hold
+ */
+ public Hold(String name, NodeRef nodeRef)
+ {
+ this.Name = name;
+ this.nodeRef = nodeRef;
+ }
+
+ /**
+ * Gets the hold name
+ *
+ * @return The name of the hold
+ */
+ public String getName()
+ {
+ return this.Name;
+ }
+
+ /**
+ * Gets the hold node reference
+ *
+ * @return The {@link NodeRef} of the hold
+ */
+ public NodeRef getNodeRef()
+ {
+ return this.nodeRef;
+ }
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
index 7c75d9ec03..6dd6318731 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
@@ -104,16 +104,16 @@ public class HoldsGet extends DeclarativeWebScript
holds.addAll(holdService.getHoldsForItem(itemNodeRef));
}
- List holdNames = new ArrayList(holds.size());
- for (NodeRef hold : holds)
+ List holdObjects = new ArrayList(holds.size());
+ for (NodeRef nodeRef : holds)
{
- String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME);
- holdNames.add(holdName);
+ String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
+ holdObjects.add(new Hold(name, nodeRef));
}
Map model = new HashMap(1);
- sortByName(holdNames);
- model.put("holds", holdNames);
+ sortHoldByName(holdObjects);
+ model.put("holds", holdObjects);
return model;
}
@@ -169,16 +169,16 @@ public class HoldsGet extends DeclarativeWebScript
/**
* Helper method to sort the holds by their names
*
- * @param holdNames List of hold names to sort
+ * @param holds List of holds to sort
*/
- private void sortByName(List holdNames)
+ private void sortHoldByName(List holds)
{
- Collections.sort(holdNames, new Comparator()
+ Collections.sort(holds, new Comparator()
{
@Override
- public int compare(String o1, String o2)
+ public int compare(Hold h1, Hold h2)
{
- return o1.toLowerCase().compareTo(o2.toLowerCase());
+ return h1.getName().toLowerCase().compareTo(h2.getName().toLowerCase());
}
});
}