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 abe8d90671..27a9bf61de 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
@@ -1177,7 +1177,7 @@
-
+
@@ -1637,4 +1637,45 @@
-->
+
+
+
+
+
+
+
+
+
+ org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldService.java
new file mode 100644
index 0000000000..6dd9e3d1a3
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldService.java
@@ -0,0 +1,72 @@
+/*
+ * 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.fileplan.hold;
+
+import java.util.List;
+
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Hold service interface.
+ *
+ * @author Tuna Aksoy
+ * @since 2.2
+ */
+public interface HoldService
+{
+ /**
+ * Gets the list of the holds within the holds container for the given file plan
+ *
+ * @param filePlan The {@link NodeRef} of the file plan
+ * @return List of hold node references
+ */
+ List getHolds(NodeRef filePlan);
+
+ /**
+ * Adds the record to the given hold
+ *
+ * @param hold The {@link NodeRef} of the hold
+ * @param record The {@link NodeRef} of the record which will be added to the given hold
+ */
+ void addToHoldContainer(NodeRef hold, NodeRef record);
+
+ /**
+ * Adds the record to the given list of holds
+ *
+ * @param holds The list of {@link NodeRef}s of the holds
+ * @param record The {@link NodeRef} of the record which will be added to the given holds
+ */
+ void addToHoldContainers(List holds, NodeRef record);
+
+ /**
+ * Removes the record from the given hold
+ *
+ * @param hold The {@link NodeRef} of the hold
+ * @param record The {@link NodeRef} of the record which will be removed from the given hold
+ */
+ void removeFromHoldContainer(NodeRef hold, NodeRef record);
+
+ /**
+ * Removes the record from the given list of hold
+ *
+ * @param holds The list {@link NodeRef}s of the holds
+ * @param record The {@link NodeRef} of the record which will be removed from the given holds
+ */
+ void removeFromHoldContainers(List holds, NodeRef record);
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldServiceImpl.java
new file mode 100644
index 0000000000..c0c1753581
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/hold/HoldServiceImpl.java
@@ -0,0 +1,148 @@
+/*
+ * 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.fileplan.hold;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.namespace.NamespaceService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.util.ParameterCheck;
+
+/**
+ * Hold service implementation
+ *
+ * @author Tuna Aksoy
+ * @since 2.2
+ */
+public class HoldServiceImpl implements HoldService
+{
+ /** File Plan Service */
+ private FilePlanService filePlanService;
+
+ /** Node Service */
+ private NodeService nodeService;
+
+ /**
+ * Set the file plan service
+ *
+ * @param filePlanService the file plan service
+ */
+ public void setFilePlanService(FilePlanService filePlanService)
+ {
+ this.filePlanService = filePlanService;
+ }
+
+ /**
+ * Set the node service
+ *
+ * @param nodeService the node service
+ */
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService#getHolds(org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public List getHolds(NodeRef filePlan)
+ {
+ ParameterCheck.mandatory("filePlan", filePlan);
+
+ NodeRef holdContainer = filePlanService.getHoldContainer(filePlan);
+ List holdsAssocs = nodeService.getChildAssocs(holdContainer);
+ List holds = new ArrayList(holdsAssocs.size());
+ for (ChildAssociationRef holdAssoc : holdsAssocs)
+ {
+ holds.add(holdAssoc.getChildRef());
+ }
+
+ return holds;
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService#addToHoldContainer(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public void addToHoldContainer(NodeRef hold, NodeRef record)
+ {
+ ParameterCheck.mandatory("hold", hold);
+ ParameterCheck.mandatory("record", record);
+
+ List holds = new ArrayList(1);
+ holds.add(hold);
+ addToHoldContainers(Collections.unmodifiableList(holds), record);
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService#addToHoldContainers(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public void addToHoldContainers(List holds, NodeRef record)
+ {
+ ParameterCheck.mandatoryCollection("holds", holds);
+ ParameterCheck.mandatory("record", record);
+
+ String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME);
+ String validLocalName = QName.createValidLocalName(recordName);
+ QName name = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, validLocalName);
+
+ for (NodeRef hold : holds)
+ {
+ nodeService.addChild(hold, record, ContentModel.ASSOC_CONTAINS, name);
+ }
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService#removeFromHoldContainer(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public void removeFromHoldContainer(NodeRef hold, NodeRef record)
+ {
+ ParameterCheck.mandatory("hold", hold);
+ ParameterCheck.mandatory("record", record);
+
+ List holds = new ArrayList(1);
+ holds.add(hold);
+ removeFromHoldContainers(Collections.unmodifiableList(holds), record);
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.fileplan.hold.HoldService#removeFromHoldContainers(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
+ */
+ @Override
+ public void removeFromHoldContainers(List holds, NodeRef record)
+ {
+ ParameterCheck.mandatory("holds", holds);
+ ParameterCheck.mandatory("record", record);
+
+ for (NodeRef hold : holds)
+ {
+ nodeService.removeChild(hold, record);
+ }
+ }
+}