diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml
index d23a9f7b37..9c4f1065f4 100644
--- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml
+++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml
@@ -549,7 +549,7 @@
true
- rma:filePlanComponent
+ sys:base
false
true
diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
index b463de52b8..209626c3d7 100644
--- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
+++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
@@ -1042,7 +1042,7 @@
+
+
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml
index c58f296207..a1b5dac8dc 100644
--- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml
+++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml
@@ -1,10 +1,10 @@
Adds item(s) to the hold(s)
+ WebScript to add item(s) (record(s) / record folder(s) / active content(s)) to the hold(s) in the holds container.
The body of the post should be in the form
{
- "nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s)),
+ "nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s) / active content(s)),
"holds" : array of nodeRefs for the hold(s)
}
]]>
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml
index 13edad40eb..f3684436e1 100644
--- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml
+++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml
@@ -1,10 +1,10 @@
Removes item(s) from the hold(s)
+ WebScript to remove item(s) (record(s) / record folder(s) / active content(s)) from the hold(s) in the holds container.
The body of the put should be in the form
{
- "nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s)),
+ "nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s) / active content(s)),
"holds" : array of nodeRefs for the hold(s)
}
]]>
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java
index 93ca463d99..d4aadb59d9 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java
@@ -41,6 +41,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent;
+import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
@@ -108,6 +109,9 @@ public class HoldServiceImpl extends ServiceBaseImpl
/** records management audit service */
private RecordsManagementAuditService recordsManagementAuditService;
+ /** Capability service */
+ private CapabilityService capabilityService;
+
/**
* Set the file plan service
*
@@ -166,6 +170,14 @@ public class HoldServiceImpl extends ServiceBaseImpl
this.recordsManagementAuditService = recordsManagementAuditService;
}
+ /**
+ * @param capabilityService capability service
+ */
+ public void setCapabilityService(CapabilityService capabilityService)
+ {
+ this.capabilityService = capabilityService;
+ }
+
/**
* Initialise hold service
*/
@@ -563,7 +575,9 @@ public class HoldServiceImpl extends ServiceBaseImpl
throw new IntegrityException(I18NUtil.getMessage("rm.hold.not-hold", holdName), null);
}
- if (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.DENIED)
+ if (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.DENIED ||
+ !AccessStatus.ALLOWED.equals(
+ capabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)))
{
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED));
}
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java
index a9b30bb8f0..e09c2bc2c9 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java
@@ -33,9 +33,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.json.JSONArray;
@@ -68,6 +70,9 @@ public abstract class BaseHold extends DeclarativeWebScript
/** node service */
private NodeService nodeService;
+ /** Dictionary service */
+ private DictionaryService dictionaryService;
+
/**
* Set the hold service
*
@@ -95,13 +100,21 @@ public abstract class BaseHold extends DeclarativeWebScript
}
/**
- * @param nodeService node service
+ * @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
+ /**
+ * @param dictionaryService dictionary service
+ */
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
/**
* Returns the hold service
*
@@ -130,7 +143,8 @@ public abstract class BaseHold extends DeclarativeWebScript
* It will either add the item(s) to the hold(s) or remove it/them from the hold(s)
*
* @param holds List of hold {@link NodeRef}(s)
- * @param nodeRefs List of item {@link NodeRef}(s) (record(s) / record folder(s)) which will be either added to the hold(s) or removed from the hold(s)
+ * @param nodeRefs List of item {@link NodeRef}(s) (record(s) / record folder(s) / active content(s)) which will be
+ * either added to the hold(s) or removed from the hold(s)
*/
abstract void doAction(List holds, List nodeRefs);
@@ -163,7 +177,8 @@ public abstract class BaseHold extends DeclarativeWebScript
}
/**
- * Helper method to get the {@link NodeRef}s for the items(s) (record(s) / record folder(s)) which will be added to the hold(s)
+ * Helper method to get the {@link NodeRef}s for the items(s) (record(s) / record folder(s) / active content(s))
+ * which will be added to the hold(s)
*
* @param json The request content as JSON object
* @return List of item {@link NodeRef}s which will be added to the hold(s)
@@ -193,7 +208,7 @@ public abstract class BaseHold extends DeclarativeWebScript
/**
* Helper method for checking the node reference for an item
*
- * @param nodeRef The {@link NodeRef} of an item (record / record folder)
+ * @param nodeRef The {@link NodeRef} of an item (record / record folder / active content)
*/
private void checkItemNodeRef(NodeRef nodeRef)
{
@@ -203,15 +218,16 @@ public abstract class BaseHold extends DeclarativeWebScript
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Item being added to hold does not exist.");
}
- // ensure that the node we are adding to the hold is a record or record folder
- if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef))
+ // ensure that the node we are adding to the hold is a record or record folder or active content
+ if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef) &&
+ !dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT))
{
- throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record or record folder.");
+ throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record, a record folder or active content.");
}
}
/**
- * Helper method to get the list of {@link NodeRef}(s) for the hold(s) which will contain the item (record / record folder)
+ * Helper method to get the list of {@link NodeRef}(s) for the hold(s) which will contain the item (record / record folder / active content)
*
* @param json The request content as JSON object
* @return List of {@link NodeRef}(s) of the hold(s)
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
index 38ba69eb1d..e12e422acd 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java
@@ -134,7 +134,7 @@ public class HoldsGet extends DeclarativeWebScript
List holdObjects = new ArrayList<>(holds.size());
for (NodeRef nodeRef : holds)
{
- // only add if user has filling permisson on the hold
+ // only add if user has filling permission on the hold
if (!fileOnly || permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED)
{
String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
@@ -215,7 +215,7 @@ public class HoldsGet extends DeclarativeWebScript
String includedInHold = req.getParameter("includedInHold");
if (StringUtils.isNotBlank(includedInHold))
{
- result = Boolean.valueOf(includedInHold).booleanValue();
+ result = Boolean.parseBoolean(includedInHold);
}
return result;
}
@@ -226,7 +226,7 @@ public class HoldsGet extends DeclarativeWebScript
String fillingOnly = req.getParameter("fileOnly");
if (StringUtils.isNotBlank(fillingOnly))
{
- result = Boolean.valueOf(fillingOnly).booleanValue();
+ result = Boolean.parseBoolean(fillingOnly);
}
return result;
}
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java
index 1bdbe63d9e..c34ec088ec 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java
@@ -53,6 +53,7 @@ import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
+import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
@@ -69,6 +70,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -91,6 +93,8 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
protected NodeRef hold2;
protected NodeRef activeContent;
+ @Mock (name="capabilityService")
+ protected CapabilityService mockedCapabilityService;
@Spy @InjectMocks HoldServiceImpl holdService;
@Before
@@ -104,6 +108,9 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
hold = generateNodeRef(TYPE_HOLD);
hold2 = generateNodeRef(TYPE_HOLD);
+ when(mockedCapabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)).thenReturn(AccessStatus.ALLOWED);
+ when(mockedCapabilityService.getCapabilityAccessState(hold2, RMPermissionModel.ADD_TO_HOLD)).thenReturn(AccessStatus.ALLOWED);
+
activeContent = generateNodeRef();
QName contentSubtype = QName.createQName("contentSubtype", "contentSubtype");
when(mockedNodeService.getType(activeContent)).thenReturn(contentSubtype);
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java
index 6af4611888..918b4cb4ff 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java
@@ -27,12 +27,17 @@
package org.alfresco.module.org_alfresco_module_rm.script.hold;
+import static org.mockito.Mockito.when;
+
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.test.util.BaseWebScriptUnitTest;
import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.security.AccessStatus;
+import org.alfresco.service.cmr.security.PermissionService;
/**
* Base hold web script unit test.
@@ -45,10 +50,12 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
/** test holds */
protected NodeRef hold1NodeRef;
protected NodeRef hold2NodeRef;
+ protected NodeRef dmNodeRef;
protected List holds;
protected List records;
protected List recordFolders;
protected List filePlanComponents;
+ protected List activeContents;
/**
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before()
@@ -62,6 +69,14 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
hold1NodeRef = generateHoldNodeRef("hold1");
hold2NodeRef = generateHoldNodeRef("hold2");
+ // generate active content
+ dmNodeRef = generateNodeRef(TYPE_CONTENT);
+ when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED);
+ when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true);
+
+ // list of active contents
+ activeContents = Collections.singletonList(dmNodeRef);
+
// list of holds
holds = new ArrayList<>(2);
Collections.addAll(holds, hold1NodeRef, hold2NodeRef);
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java
index 07e27bdac1..595156acf1 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java
@@ -148,7 +148,7 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
}
/**
- * Test for expected excpetion when the item being added to the hold
+ * Test for expected exception when the item being added to the hold
* does not exist.
*/
@SuppressWarnings("unchecked")
@@ -229,15 +229,14 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
/**
* Test for expected exception when adding an item to a hold
- * that isn't a record or record folder.
+ * that isn't a record, record folder or active content.
*/
@SuppressWarnings("unchecked")
@Test
- public void nodeRefIsNotARecordOrRecordFolder() throws Exception
+ public void nodeRefIsNotARecordOrRecordFolderOrActiveContent() throws Exception
{
// build json content to send to server
- List notAHold = Collections.singletonList(recordFolder);
- String content = buildContent(filePlanComponents, notAHold);
+ String content = buildContent(filePlanComponents, holds);
// expected exception
exception.expect(WebScriptException.class);
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java
index 2b02132e25..3d1a3567d6 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java
@@ -31,8 +31,11 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
+import org.alfresco.service.cmr.repository.NodeRef;
import org.json.JSONObject;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -106,4 +109,40 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
// verify that the record was added to the holds
verify(mockedHoldService, times(1)).addToHolds(holds, recordFolders);
}
+
+ /**
+ * Test that active content can be added to holds.
+ */
+ @Test
+ public void addActiveContentToHolds() throws Exception
+ {
+ // build json to send to server
+ String content = buildContent(activeContents, holds);
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
+ assertNotNull(json);
+
+ // verify that the active content was added to the holds
+ verify(mockedHoldService, times(1)).addToHolds(holds, activeContents);
+ }
+
+ /**
+ * Test that active content can be added to holds along with records and record folders.
+ */
+ @Test
+ public void addActiveContentAndRecordsAndRecordFoldersToHolds() throws Exception
+ {
+ List items = new ArrayList<>(3);
+ Collections.addAll(items, dmNodeRef, record, recordFolder);
+ // build json to send to server
+ String content = buildContent(items, holds);
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
+ assertNotNull(json);
+
+ // verify that the active content was added to the holds along with records and record folders
+ verify(mockedHoldService, times(1)).addToHolds(holds, items);
+ }
}
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java
index e51cb261ab..47a744a374 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java
@@ -31,8 +31,11 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
+import org.alfresco.service.cmr.repository.NodeRef;
import org.json.JSONObject;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -106,4 +109,40 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
// verify that the record was removed from holds
verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolders);
}
+
+ /**
+ * Test that active content can be removed from holds.
+ */
+ @Test
+ public void removeActiveContentFromHolds() throws Exception
+ {
+ // build json to send to server
+ String content = buildContent(activeContents, holds);
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
+ assertNotNull(json);
+
+ // verify that the active content was removed from holds
+ verify(mockedHoldService, times(1)).removeFromHolds(holds, activeContents);
+ }
+
+ /**
+ * Test that active content can be removed from holds along with records and record folders.
+ */
+ @Test
+ public void removeActiveContentAndRecordsAndRecordFoldersToHolds() throws Exception
+ {
+ List items = new ArrayList<>(3);
+ Collections.addAll(items, dmNodeRef, record, recordFolder);
+ // build json to send to server
+ String content = buildContent(items, holds);
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
+ assertNotNull(json);
+
+ // verify that the active content was removed from holds along with records and record folders
+ verify(mockedHoldService, times(1)).removeFromHolds(holds, items);
+ }
}
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java
index 16ca47c494..6ade793b80 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java
@@ -215,6 +215,60 @@ public class HoldsGetUnitTest extends BaseHoldWebScriptUnitTest
// check the JSON result
testForBothHolds(json);
}
+
+ /**
+ * Test the retrieval of holds that hold active content.
+ */
+ @Test
+ public void getHoldsThatActiveContentIsHeldBy() throws Exception
+ {
+ // setup interactions
+ doReturn(holds).when(mockedHoldService).heldBy(dmNodeRef, true);
+
+ // setup web script parameters
+ Map parameters = buildParameters
+ (
+ "store_type", filePlan.getStoreRef().getProtocol(),
+ "store_id", filePlan.getStoreRef().getIdentifier(),
+ "id", filePlan.getId(),
+ "itemNodeRef", dmNodeRef.toString()
+ );
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(parameters);
+ assertNotNull(json);
+
+ // check the JSON result
+ testForBothHolds(json);
+
+ }
+
+ /**
+ * Test the retrieval of holds that do not hold active content.
+ */
+ @Test
+ public void getHoldsThatActiveContentIsNotHeldBy() throws Exception
+ {
+ // setup interactions
+ doReturn(holds).when(mockedHoldService).heldBy(dmNodeRef, false);
+
+ // setup web script parameters
+ Map parameters = buildParameters
+ (
+ "store_type", filePlan.getStoreRef().getProtocol(),
+ "store_id", filePlan.getStoreRef().getIdentifier(),
+ "id", filePlan.getId(),
+ "itemNodeRef", dmNodeRef.toString(),
+ "includedInHold", "false"
+ );
+
+ // execute web script
+ JSONObject json = executeJSONWebScript(parameters);
+ assertNotNull(json);
+
+ // check the JSON result
+ testForBothHolds(json);
+ }
public void getFileOnlyHolds() throws Exception
{