mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Story: RM-1212 (As a records user I want to perform a records search, select multiple records/record folders from the results and add them all to a hold(s) I have permission to see so that I can easily discover and freeze relevant records)
Sub-tasks: * RM-1400 (Change the service so that all holds will be retrieved when adding multiple records/folders) * RM-1402 (Change the REST API so that all holds will be retrieved when adding multiple records/folders) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@65918 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Adds an item to the hold(s)</shortname>
|
<shortname>Adds item(s) to the hold(s)</shortname>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
WebScript to add an item (record / record folder) to the hold(s) in the holds container.<br/>
|
WebScript to add item(s) (record(s) / record folder(s)) to the hold(s) in the holds container.<br/>
|
||||||
The body of the post should be in the form<br/>
|
The body of the post should be in the form<br/>
|
||||||
{<br/>
|
{<br/>
|
||||||
"nodeRef" : nodeRef of the item (record / record folder),<br/>
|
"nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s)),<br/>
|
||||||
"holds" : array of nodeRef for the hold(s)<br/>
|
"holds" : array of nodeRefs for the hold(s)<br/>
|
||||||
}<br/>
|
}<br/>
|
||||||
]]>
|
]]>
|
||||||
</description>
|
</description>
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Removes an item from the hold(s)</shortname>
|
<shortname>Removes item(s) from the hold(s)</shortname>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
WebScript to remove an item (record / record folder) from the hold(s) in the holds container.<br/>
|
WebScript to remove item(s) (record(s) / record folder(s)) from the hold(s) in the holds container.<br/>
|
||||||
The body of the put should be in the form<br/>
|
The body of the put should be in the form<br/>
|
||||||
{<br/>
|
{<br/>
|
||||||
"nodeRef" : nodeRef of the item (record / record folder),<br/>
|
"nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s)),<br/>
|
||||||
"holds" : array of nodeRef for the hold(s)<br/>
|
"holds" : array of nodeRefs for the hold(s)<br/>
|
||||||
}<br/>
|
}<br/>
|
||||||
]]>
|
]]>
|
||||||
</description>
|
</description>
|
||||||
|
@@ -38,7 +38,7 @@ public interface HoldService
|
|||||||
* @return boolean true if hold, false otherwise
|
* @return boolean true if hold, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isHold(NodeRef nodeRef);
|
boolean isHold(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of all the holds within the holds container in the given file plan
|
* Gets the list of all the holds within the holds container in the given file plan
|
||||||
*
|
*
|
||||||
@@ -48,9 +48,10 @@ public interface HoldService
|
|||||||
List<NodeRef> getHolds(NodeRef filePlan);
|
List<NodeRef> getHolds(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the node reference for the hold with the given name in the given file plan
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name {@link String} The name of the hold
|
||||||
* @return
|
* @return {@link NodeRef} of the hold with the given name
|
||||||
*/
|
*/
|
||||||
NodeRef getHold(NodeRef filePlan, String name);
|
NodeRef getHold(NodeRef filePlan, String name);
|
||||||
|
|
||||||
@@ -63,44 +64,49 @@ public interface HoldService
|
|||||||
* @return List of hold node references
|
* @return List of hold node references
|
||||||
*/
|
*/
|
||||||
List<NodeRef> heldBy(NodeRef nodeRef, boolean includedInHold);
|
List<NodeRef> heldBy(NodeRef nodeRef, boolean includedInHold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the list of item node references which are in the given hold
|
||||||
*
|
*
|
||||||
* @param ndoeRef
|
* @param ndoeRef {@link NodeRef} of the hold
|
||||||
* @return
|
* @return Lost of item {@link NodeRef}s which are in the given hold
|
||||||
*/
|
*/
|
||||||
List<NodeRef> getHeld(NodeRef hold);
|
List<NodeRef> getHeld(NodeRef hold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates a hold with the given name, reason and description for the given file plan
|
||||||
*
|
*
|
||||||
* @param filePlan
|
* @param filePlan The {@link NodeRef} of the file plan
|
||||||
* @param name
|
* @param name {@link String} The name of the hold
|
||||||
* @param reason
|
* @param reason {@link String} The reason of the hold
|
||||||
* @param description
|
* @param description {@link String} The description of the hold
|
||||||
* @return
|
* @return The {@link NodeRef} of the created hold
|
||||||
*/
|
*/
|
||||||
NodeRef createHold(NodeRef filePlan, String name, String reason, String description);
|
NodeRef createHold(NodeRef filePlan, String name, String reason, String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the hold reason for the given hold node reference
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* @return
|
* @return {@link String} The reason of the hold
|
||||||
*/
|
*/
|
||||||
String getHoldReason(NodeRef hold);
|
String getHoldReason(NodeRef hold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the hold reason
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
* @param reason
|
* @param reason {@link String} The reason for the hold
|
||||||
*/
|
*/
|
||||||
void setHoldReason(NodeRef hold, String reason);
|
void setHoldReason(NodeRef hold, String reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Deletes the hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold
|
||||||
*/
|
*/
|
||||||
void deleteHold(NodeRef hold);
|
void deleteHold(NodeRef hold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the record to the given hold
|
* Adds the record to the given hold
|
||||||
*
|
*
|
||||||
@@ -108,11 +114,12 @@ public interface HoldService
|
|||||||
* @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given hold
|
* @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given hold
|
||||||
*/
|
*/
|
||||||
void addToHold(NodeRef hold, NodeRef nodeRef);
|
void addToHold(NodeRef hold, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Adds the items to the the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The {@link NodeRef} of the hold to which the items will be added
|
||||||
* @param nodeRefs
|
* @param nodeRefs The item {@link NodeRef}s which will be added to the hold
|
||||||
*/
|
*/
|
||||||
void addToHold(NodeRef hold, List<NodeRef> nodeRefs);
|
void addToHold(NodeRef hold, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
@@ -124,6 +131,14 @@ public interface HoldService
|
|||||||
*/
|
*/
|
||||||
void addToHolds(List<NodeRef> holds, NodeRef nodeRef);
|
void addToHolds(List<NodeRef> holds, NodeRef nodeRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given items to the given list of holds
|
||||||
|
*
|
||||||
|
* @param holds List of holds to which the given items will be added
|
||||||
|
* @param nodeRefs The list of items which will be added to the given holds
|
||||||
|
*/
|
||||||
|
void addToHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the record from the given hold
|
* Removes the record from the given hold
|
||||||
*
|
*
|
||||||
@@ -131,31 +146,42 @@ public interface HoldService
|
|||||||
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold
|
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold
|
||||||
*/
|
*/
|
||||||
void removeFromHold(NodeRef hold, NodeRef nodeRef);
|
void removeFromHold(NodeRef hold, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes the given items from the given hold
|
||||||
*
|
*
|
||||||
* @param hold
|
* @param hold The hold {@link NodeRef} from which the given items will be removed
|
||||||
* @param nodeRefs
|
* @param nodeRefs The list of items which will be removed from the given holds
|
||||||
*/
|
*/
|
||||||
void removeFromHold(NodeRef hold, List<NodeRef> nodeRefs);
|
void removeFromHold(NodeRef hold, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the record from the given list of hold
|
* Removes the item from the given list of hold
|
||||||
*
|
*
|
||||||
* @param holds The list {@link NodeRef}s of the holds
|
* @param holds The list {@link NodeRef}s of the holds
|
||||||
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds
|
* @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds
|
||||||
*/
|
*/
|
||||||
void removeFromHolds(List<NodeRef> holds, NodeRef nodeRef);
|
void removeFromHolds(List<NodeRef> holds, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Removes the items from the given holds
|
||||||
* @param nodeRef
|
*
|
||||||
|
* @param holds List of hold {@link NodeRef}s from which the items will be removed
|
||||||
|
* @param nodeRefs List of item {@link NodeRef}s which will be removed from the given holds
|
||||||
|
*/
|
||||||
|
void removeFromHolds(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given {@link NodeRef} from all the holds
|
||||||
|
*
|
||||||
|
* @param nodeRef The {@link NodeRef} of item which will be removed from all the holds
|
||||||
*/
|
*/
|
||||||
void removeFromAllHolds(NodeRef nodeRef);
|
void removeFromAllHolds(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Removes the given list of {@link NodeRef}s from all the holds
|
||||||
* @param nodeRefs
|
*
|
||||||
|
* @param nodeRefs The list of item {@link NodeRef}s which will be removed from all the holds
|
||||||
*/
|
*/
|
||||||
void removeFromAllHolds(List<NodeRef> nodeRefs);
|
void removeFromAllHolds(List<NodeRef> nodeRefs);
|
||||||
}
|
}
|
||||||
|
@@ -497,6 +497,21 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, java.util.List)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addToHolds(List<NodeRef> holds, List<NodeRef> nodeRefs)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatoryCollection("holds", holds);
|
||||||
|
ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs);
|
||||||
|
|
||||||
|
for (NodeRef nodeRef : nodeRefs)
|
||||||
|
{
|
||||||
|
addToHolds(holds, nodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@@ -564,6 +579,21 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, java.util.List)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeFromHolds(List<NodeRef> holds, List<NodeRef> nodeRefs)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatoryCollection("holds", holds);
|
||||||
|
ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs);
|
||||||
|
|
||||||
|
for (NodeRef nodeRef : nodeRefs)
|
||||||
|
{
|
||||||
|
removeFromHolds(holds, nodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
|
@@ -49,13 +49,13 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
/** Hold Service */
|
/** Hold Service */
|
||||||
private HoldService holdService;
|
private HoldService holdService;
|
||||||
|
|
||||||
/** record service */
|
/** record service */
|
||||||
private RecordService recordService;
|
private RecordService recordService;
|
||||||
|
|
||||||
/** record folder service */
|
/** record folder service */
|
||||||
private RecordFolderService recordFolderService;
|
private RecordFolderService recordFolderService;
|
||||||
|
|
||||||
/** node service */
|
/** node service */
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
this.holdService = holdService;
|
this.holdService = holdService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordFolderService record folder service
|
* @param recordFolderService record folder service
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +76,7 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
this.recordFolderService = recordFolderService;
|
this.recordFolderService = recordFolderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordService record service
|
* @param recordService record service
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +84,7 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
this.recordService = recordService;
|
this.recordService = recordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
@@ -111,19 +111,19 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
JSONObject json = getJSONFromContent(req);
|
JSONObject json = getJSONFromContent(req);
|
||||||
List<NodeRef> holds = getHolds(json);
|
List<NodeRef> holds = getHolds(json);
|
||||||
NodeRef nodeRef = getItemNodeRef(json);
|
List<NodeRef> nodeRefs = getItemNodeRefs(json);
|
||||||
doAction(holds, nodeRef);
|
doAction(holds, nodeRefs);
|
||||||
return new HashMap<String, Object>();
|
return new HashMap<String, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract method which will be implemented in the subclasses.
|
* Abstract method which will be implemented in the subclasses.
|
||||||
* It will either add the item to the hold(s) or remove it from the hold(s)
|
* 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 holds List of hold {@link NodeRef}(s)
|
||||||
* @param nodeRef {@link NodeRef} of an item (record / record folder) which will be either added to the hold(s) or removed from the hol(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)
|
||||||
*/
|
*/
|
||||||
abstract void doAction(List<NodeRef> holds, NodeRef nodeRef);
|
abstract void doAction(List<NodeRef> holds, List<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method the get the json object from the request
|
* Helper method the get the json object from the request
|
||||||
@@ -154,40 +154,51 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to get the {@link NodeRef} for the item (record / record folder) 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)) which will be added to the hold(s)
|
||||||
*
|
*
|
||||||
* @param json The request content as JSON object
|
* @param json The request content as JSON object
|
||||||
* @return The {@link NodeRef} of the item which will be added to the hold(s)
|
* @return List of item {@link NodeRef}s which will be added to the hold(s)
|
||||||
*/
|
*/
|
||||||
protected NodeRef getItemNodeRef(JSONObject json)
|
protected List<NodeRef> getItemNodeRefs(JSONObject json)
|
||||||
{
|
{
|
||||||
String nodeRefString = null;
|
List<NodeRef> nodeRefs = new ArrayList<NodeRef>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nodeRefString = json.getString("nodeRef");
|
JSONArray nodeRefsArray = json.getJSONArray("nodeRefs");
|
||||||
|
for (int i = 0; i < nodeRefsArray.length(); i++)
|
||||||
|
{
|
||||||
|
NodeRef nodeReference = new NodeRef(nodeRefsArray.getString(i));
|
||||||
|
checkItemNodeRef(nodeReference);
|
||||||
|
nodeRefs.add(nodeReference);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (JSONException je)
|
catch (JSONException je)
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
"Could not get the nodeRef from the json object.", je);
|
"Could not get information from the json array.", je);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRef nodeRef = new NodeRef(nodeRefString);
|
|
||||||
|
|
||||||
|
return nodeRefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for checking the node reference for an item
|
||||||
|
*
|
||||||
|
* @param nodeRef The {@link NodeRef} of an item (record / record folder)
|
||||||
|
*/
|
||||||
|
private void checkItemNodeRef(NodeRef nodeRef)
|
||||||
|
{
|
||||||
// ensure that the node exists
|
// ensure that the node exists
|
||||||
if (!nodeService.exists(nodeRef))
|
if (!nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Item being added to hold does not exist.");
|
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
|
// ensure that the node we are adding to the hold is a record or record folder
|
||||||
// record folder
|
|
||||||
if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef))
|
if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef))
|
||||||
{
|
{
|
||||||
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 or record folder.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,27 +216,36 @@ public abstract class BaseHold extends DeclarativeWebScript
|
|||||||
for (int i = 0; i < holdsArray.length(); i++)
|
for (int i = 0; i < holdsArray.length(); i++)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = new NodeRef(holdsArray.getString(i));
|
NodeRef nodeRef = new NodeRef(holdsArray.getString(i));
|
||||||
|
checkHoldNodeRef(nodeRef);
|
||||||
// check the hold exists
|
|
||||||
if (!nodeService.exists(nodeRef))
|
|
||||||
{
|
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The hold does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the noderef is actually a hold
|
|
||||||
if (!holdService.isHold(nodeRef))
|
|
||||||
{
|
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items are being added to a node that isn't a hold.");
|
|
||||||
}
|
|
||||||
|
|
||||||
holds.add(nodeRef);
|
holds.add(nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (JSONException je)
|
catch (JSONException je)
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
"Could not get information from json array.", je);
|
"Could not get information from the json array.", je);
|
||||||
}
|
}
|
||||||
|
|
||||||
return holds;
|
return holds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for checking the node reference for a hold
|
||||||
|
*
|
||||||
|
* @param nodeRef The {@link NodeRef} of a hold
|
||||||
|
*/
|
||||||
|
private void checkHoldNodeRef(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
// check the hold exists
|
||||||
|
if (!nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The hold does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the noderef is actually a hold
|
||||||
|
if (!holdService.isHold(nodeRef))
|
||||||
|
{
|
||||||
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items are being added to a node that isn't a hold.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,11 +31,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public class HoldPost extends BaseHold
|
public class HoldPost extends BaseHold
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void doAction(List<NodeRef> holds, NodeRef nodeRef)
|
void doAction(List<NodeRef> holds, List<NodeRef> nodeRefs)
|
||||||
{
|
{
|
||||||
getHoldService().addToHolds(holds, nodeRef);
|
getHoldService().addToHolds(holds, nodeRefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,11 +31,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public class HoldPut extends BaseHold
|
public class HoldPut extends BaseHold
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void doAction(List<NodeRef> holds, NodeRef nodeRef)
|
void doAction(List<NodeRef> holds, List<NodeRef> nodeRefs)
|
||||||
{
|
{
|
||||||
getHoldService().removeFromHolds(holds, nodeRef);
|
getHoldService().removeFromHolds(holds, nodeRefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Base hold web script unit test.
|
* Base hold web script unit test.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@@ -19,7 +19,10 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
|
|||||||
protected NodeRef hold1NodeRef;
|
protected NodeRef hold1NodeRef;
|
||||||
protected NodeRef hold2NodeRef;
|
protected NodeRef hold2NodeRef;
|
||||||
protected List<NodeRef> holds;
|
protected List<NodeRef> holds;
|
||||||
|
protected List<NodeRef> records;
|
||||||
|
protected List<NodeRef> recordFolders;
|
||||||
|
protected List<NodeRef> filePlanComponents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before()
|
||||||
*/
|
*/
|
||||||
@@ -27,13 +30,22 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
|
|||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
super.before();
|
super.before();
|
||||||
|
|
||||||
// generate test holds
|
// generate test holds
|
||||||
hold1NodeRef = generateHoldNodeRef("hold1");
|
hold1NodeRef = generateHoldNodeRef("hold1");
|
||||||
hold2NodeRef = generateHoldNodeRef("hold2");
|
hold2NodeRef = generateHoldNodeRef("hold2");
|
||||||
|
|
||||||
// list of holds
|
// list of holds
|
||||||
holds = new ArrayList<NodeRef>(2);
|
holds = new ArrayList<NodeRef>(2);
|
||||||
Collections.addAll(holds, hold1NodeRef, hold2NodeRef);
|
Collections.addAll(holds, hold1NodeRef, hold2NodeRef);
|
||||||
|
|
||||||
|
// list of records
|
||||||
|
records = Collections.singletonList(record);
|
||||||
|
|
||||||
|
// list of record folders
|
||||||
|
recordFolders = Collections.singletonList(recordFolder);
|
||||||
|
|
||||||
|
// list of file plan components
|
||||||
|
filePlanComponents = Collections.singletonList(filePlanComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,34 +13,51 @@ import org.springframework.extensions.webscripts.WebScriptException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Base hold web script with content unit test.
|
* Base hold web script with content unit test.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebScriptUnitTest
|
public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebScriptUnitTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Helper method to build JSON content to send to hold webscripts.
|
* Helper method to build JSON content to send to hold webscripts.
|
||||||
*/
|
*/
|
||||||
protected String buildContent(NodeRef nodeRef, List<NodeRef> holds)
|
protected String buildContent(List<NodeRef> nodeRefs, List<NodeRef> holds)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder(255);
|
StringBuilder builder = new StringBuilder(255);
|
||||||
builder.append("{");
|
builder.append("{");
|
||||||
|
|
||||||
if (nodeRef != null)
|
if (nodeRefs != null)
|
||||||
{
|
{
|
||||||
builder.append("'nodeRef':'").append(nodeRef.toString()).append("'");
|
builder.append("'nodeRefs':[");
|
||||||
|
|
||||||
|
boolean bFirst = true;
|
||||||
|
for (NodeRef nodeRef : nodeRefs)
|
||||||
|
{
|
||||||
|
if (bFirst == false)
|
||||||
|
{
|
||||||
|
builder.append(",");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bFirst = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append("'" + nodeRef.toString() + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeRef != null && holds != null)
|
if (nodeRefs != null && holds != null)
|
||||||
{
|
{
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holds != null)
|
if (holds != null)
|
||||||
{
|
{
|
||||||
builder.append("'holds':[");
|
builder.append("'holds':[");
|
||||||
|
|
||||||
boolean bFirst = true;
|
boolean bFirst = true;
|
||||||
for (NodeRef hold : holds)
|
for (NodeRef hold : holds)
|
||||||
{
|
{
|
||||||
@@ -52,18 +69,18 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
{
|
{
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append("'" + hold.toString() + "'");
|
builder.append("'" + hold.toString() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append("}");
|
builder.append("}");
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when invalid JSON sent
|
* Test for expected exception when invalid JSON sent
|
||||||
*/
|
*/
|
||||||
@@ -72,16 +89,16 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
public void sendInvalidJSON() throws Exception
|
public void sendInvalidJSON() throws Exception
|
||||||
{
|
{
|
||||||
// invalid JSON
|
// invalid JSON
|
||||||
String content = "invalid JSON";
|
String content = "invalid JSON";
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when one of the holds doesn't exist.
|
* Test for expected exception when one of the holds doesn't exist.
|
||||||
*/
|
*/
|
||||||
@@ -91,40 +108,40 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
{
|
{
|
||||||
// setup interactions
|
// setup interactions
|
||||||
when(mockedNodeService.exists(eq(hold1NodeRef))).thenReturn(false);
|
when(mockedNodeService.exists(eq(hold1NodeRef))).thenReturn(false);
|
||||||
|
|
||||||
// build content
|
// build content
|
||||||
String content = buildContent(record, holds);
|
String content = buildContent(records, holds);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected excpetion when the item being added to the hold
|
* Test for expected excpetion when the item being added to the hold
|
||||||
* does not exist.
|
* does not exist.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void nodeRefDoesNotExist() throws Exception
|
public void nodeRefDoesNotExist() throws Exception
|
||||||
{
|
{
|
||||||
// setup interactions
|
// setup interactions
|
||||||
when(mockedNodeService.exists(eq(record))).thenReturn(false);
|
when(mockedNodeService.exists(eq(record))).thenReturn(false);
|
||||||
|
|
||||||
// build content
|
// build content
|
||||||
String content = buildContent(record, holds);
|
String content = buildContent(records, holds);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when hold information is missing from
|
* Test for expected exception when hold information is missing from
|
||||||
* sent JSON.
|
* sent JSON.
|
||||||
@@ -134,16 +151,16 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
public void holdMissingFromContent() throws Exception
|
public void holdMissingFromContent() throws Exception
|
||||||
{
|
{
|
||||||
// build content
|
// build content
|
||||||
String content = buildContent(record, null);
|
String content = buildContent(records, null);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when noderef information is missing
|
* Test for expected exception when noderef information is missing
|
||||||
* from send JSON.
|
* from send JSON.
|
||||||
@@ -154,15 +171,15 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
{
|
{
|
||||||
// build content
|
// build content
|
||||||
String content = buildContent(null, holds);
|
String content = buildContent(null, holds);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when adding an item to something
|
* Test for expected exception when adding an item to something
|
||||||
* that isn't a hold.
|
* that isn't a hold.
|
||||||
@@ -173,16 +190,16 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
{
|
{
|
||||||
// build json content to send to server
|
// build json content to send to server
|
||||||
List<NodeRef> notAHold = Collections.singletonList(recordFolder);
|
List<NodeRef> notAHold = Collections.singletonList(recordFolder);
|
||||||
String content = buildContent(record, notAHold);
|
String content = buildContent(records, notAHold);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for expected exception when adding an item to a hold
|
* Test for expected exception when adding an item to a hold
|
||||||
* that isn't a record or record folder.
|
* that isn't a record or record folder.
|
||||||
@@ -193,13 +210,13 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
{
|
{
|
||||||
// build json content to send to server
|
// build json content to send to server
|
||||||
List<NodeRef> notAHold = Collections.singletonList(recordFolder);
|
List<NodeRef> notAHold = Collections.singletonList(recordFolder);
|
||||||
String content = buildContent(filePlanComponent, notAHold);
|
String content = buildContent(filePlanComponents, notAHold);
|
||||||
|
|
||||||
// expected exception
|
// expected exception
|
||||||
exception.expect(WebScriptException.class);
|
exception.expect(WebScriptException.class);
|
||||||
exception.expect(badRequest());
|
exception.expect(badRequest());
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
executeWebScript(Collections.EMPTY_MAP, content);
|
executeWebScript(Collections.EMPTY_MAP, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold ReST API POST implementation unit test.
|
* Hold ReST API POST implementation unit test.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@@ -40,10 +40,10 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
{
|
{
|
||||||
/** classpath location of ftl template for web script */
|
/** classpath location of ftl template for web script */
|
||||||
private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.post.json.ftl";
|
private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.post.json.ftl";
|
||||||
|
|
||||||
/** HoldPost webscript instance */
|
/** HoldPost webscript instance */
|
||||||
protected @Spy @InjectMocks HoldPost webScript;
|
protected @Spy @InjectMocks HoldPost webScript;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript()
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +52,7 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
{
|
{
|
||||||
return webScript;
|
return webScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate()
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
{
|
{
|
||||||
return WEBSCRIPT_TEMPLATE;
|
return WEBSCRIPT_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that a record can be added to holds.
|
* Test that a record can be added to holds.
|
||||||
*/
|
*/
|
||||||
@@ -70,16 +70,16 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
public void addRecordToHolds() throws Exception
|
public void addRecordToHolds() throws Exception
|
||||||
{
|
{
|
||||||
// build json to send to server
|
// build json to send to server
|
||||||
String content = buildContent(record, holds);
|
String content = buildContent(records, holds);
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
||||||
assertNotNull(json);
|
assertNotNull(json);
|
||||||
|
|
||||||
// verify that the record was added to the holds
|
// verify that the record was added to the holds
|
||||||
verify(mockedHoldService, times(1)).addToHolds(holds, record);
|
verify(mockedHoldService, times(1)).addToHolds(holds, records);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that a record folder can be added to holds.
|
* Test that a record folder can be added to holds.
|
||||||
*/
|
*/
|
||||||
@@ -88,13 +88,13 @@ public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
public void addRecordFolderToHolds() throws Exception
|
public void addRecordFolderToHolds() throws Exception
|
||||||
{
|
{
|
||||||
// build json to send to server
|
// build json to send to server
|
||||||
String content = buildContent(recordFolder, holds);
|
String content = buildContent(recordFolders, holds);
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
||||||
assertNotNull(json);
|
assertNotNull(json);
|
||||||
|
|
||||||
// verify that the record was added to the holds
|
// verify that the record was added to the holds
|
||||||
verify(mockedHoldService, times(1)).addToHolds(holds, recordFolder);
|
verify(mockedHoldService, times(1)).addToHolds(holds, recordFolders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold ReST API PUT implementation unit test.
|
* Hold ReST API PUT implementation unit test.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@@ -40,10 +40,10 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
{
|
{
|
||||||
/** classpath location of ftl template for web script */
|
/** classpath location of ftl template for web script */
|
||||||
private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.put.json.ftl";
|
private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.put.json.ftl";
|
||||||
|
|
||||||
/** HoldPut webscript instance */
|
/** HoldPut webscript instance */
|
||||||
protected @Spy @InjectMocks HoldPut webScript;
|
protected @Spy @InjectMocks HoldPut webScript;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript()
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +52,7 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
{
|
{
|
||||||
return webScript;
|
return webScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate()
|
||||||
*/
|
*/
|
||||||
@@ -60,8 +60,8 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
protected String getWebScriptTemplate()
|
protected String getWebScriptTemplate()
|
||||||
{
|
{
|
||||||
return WEBSCRIPT_TEMPLATE;
|
return WEBSCRIPT_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that a record can be removed from holds.
|
* Test that a record can be removed from holds.
|
||||||
*/
|
*/
|
||||||
@@ -70,16 +70,16 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
public void removeRecordFromHolds() throws Exception
|
public void removeRecordFromHolds() throws Exception
|
||||||
{
|
{
|
||||||
// build json to send to server
|
// build json to send to server
|
||||||
String content = buildContent(record, holds);
|
String content = buildContent(records, holds);
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
||||||
assertNotNull(json);
|
assertNotNull(json);
|
||||||
|
|
||||||
// verify that the record was removed from holds
|
// verify that the record was removed from holds
|
||||||
verify(mockedHoldService, times(1)).removeFromHolds(holds, record);
|
verify(mockedHoldService, times(1)).removeFromHolds(holds, records);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that a record folder can be removed from holds.
|
* Test that a record folder can be removed from holds.
|
||||||
*/
|
*/
|
||||||
@@ -88,13 +88,13 @@ public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest
|
|||||||
public void removeRecordFolderFromHolds() throws Exception
|
public void removeRecordFolderFromHolds() throws Exception
|
||||||
{
|
{
|
||||||
// build json to send to server
|
// build json to send to server
|
||||||
String content = buildContent(recordFolder, holds);
|
String content = buildContent(recordFolders, holds);
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content);
|
||||||
assertNotNull(json);
|
assertNotNull(json);
|
||||||
|
|
||||||
// verify that the record was removed from holds
|
// verify that the record was removed from holds
|
||||||
verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolder);
|
verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user