mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Test for FreezeService
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@43583 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,134 +26,134 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
/**
|
/**
|
||||||
* Freeze Service Interface
|
* Freeze Service Interface
|
||||||
*
|
*
|
||||||
* TODO Fill the implementation of this service out and consolidate existing freeze code. For now consider this a guide for a future service implementation.
|
* TODO
|
||||||
* Implementation used to consolidate freeze behaviours in 2.0.
|
* Implementation used to consolidate freeze behaviours in 2.0.
|
||||||
* When implementing consider application of freeze to 'any' node references, not just records and record folders. (Consider implecations for security and
|
* When implementing consider application of freeze to 'any' node references, not just records and record folders.
|
||||||
* capabilities)
|
* (Consider implications for security and capabilities)
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface FreezeService
|
public interface FreezeService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze
|
* Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze
|
||||||
* reason.
|
* reason.
|
||||||
*
|
*
|
||||||
* @param nodeRef hold node reference
|
* @param nodeRef hold node reference
|
||||||
* @return boolean true if hold, false otherwise
|
* @return boolean true if hold, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isHold(NodeRef nodeRef);
|
boolean isHold(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the passed node reference is frozen.
|
* Indicates whether the passed node reference is frozen.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @return boolean true if frozen, false otherwise
|
* @return boolean true if frozen, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isFrozen(NodeRef nodeRef);
|
boolean isFrozen(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 'root' frozen node references in a hold.
|
* Get the 'root' frozen node references in a hold.
|
||||||
*
|
*
|
||||||
* @param hold hold node reference
|
* @param hold hold node reference
|
||||||
* @return Set<NodeRef> frozen node references
|
* @return Set<NodeRef> frozen node references
|
||||||
*/
|
*/
|
||||||
Set<NodeRef> getFrozen(NodeRef hold);
|
Set<NodeRef> getFrozen(NodeRef hold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freezes a node with the provided reason, creating a hold node reference.
|
* Freezes a node with the provided reason, creating a hold node reference.
|
||||||
*
|
*
|
||||||
* @param reason freeze reason
|
* @param reason freeze reason
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @return NodeRef hold node reference
|
* @return NodeRef hold node reference
|
||||||
*/
|
*/
|
||||||
NodeRef freeze(String reason, NodeRef nodeRef);
|
NodeRef freeze(String reason, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freezes a node, adding it an existing hold.
|
* Freezes a node, adding it an existing hold.
|
||||||
*
|
*
|
||||||
* @param hold hold node reference
|
* @param hold hold node reference
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
*/
|
*/
|
||||||
void freeze(NodeRef hold, NodeRef nodeRef);
|
void freeze(NodeRef hold, NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freezes a collection of nodes with the given reason, creating a hold.
|
* Freezes a collection of nodes with the given reason, creating a hold.
|
||||||
*
|
*
|
||||||
* @param reason freeze reason
|
* @param reason freeze reason
|
||||||
* @param nodeRefs set of nodes to freeze
|
* @param nodeRefs set of nodes to freeze
|
||||||
* @return NodeRef hold node reference
|
* @return NodeRef hold node reference
|
||||||
*/
|
*/
|
||||||
NodeRef freeze(String reason, Set<NodeRef> nodeRefs);
|
NodeRef freeze(String reason, Set<NodeRef> nodeRefs);
|
||||||
|
|
||||||
/**
|
|
||||||
* Freeze a collection of nodes, adding them to an existing hold.
|
|
||||||
*
|
|
||||||
* @param hold hold node reference
|
|
||||||
* @param nodeRefs set of nodes to freeze
|
|
||||||
*/
|
|
||||||
void freeze(NodeRef hold, Set<NodeRef> nodeRefs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unfreeze a frozen node.
|
|
||||||
* <p>
|
|
||||||
* The unfrozen node is automatically removed from the hold(s) it is in. If the hold is
|
|
||||||
* subsequently empty, the hold is automatically deleted.
|
|
||||||
*
|
|
||||||
* @param nodeRef node reference
|
|
||||||
*/
|
|
||||||
void unFreeze(NodeRef nodeRef);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unfreeze a collection of nodes.
|
|
||||||
* <p>
|
|
||||||
* The unfrozen nodes are automatically removed from the hold(s) the are in. If the hold(s) is
|
|
||||||
* subsequently empty, the hold is automatically deleted.
|
|
||||||
*
|
|
||||||
* @param nodeRefs set of nodes to unfreeze
|
|
||||||
*/
|
|
||||||
void unFreeze(Set<NodeRef> nodeRefs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unfreezes all nodes within a hold and deletes the hold.
|
|
||||||
*
|
|
||||||
* @param hold hold node reference
|
|
||||||
*/
|
|
||||||
void relinquish(NodeRef hold);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the freeze reason for a hold.
|
|
||||||
*
|
|
||||||
* @param hold hold node reference
|
|
||||||
* @return String freeze reason
|
|
||||||
*/
|
|
||||||
String getReason(NodeRef hold);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the freeze reason for a given hold.
|
|
||||||
*
|
|
||||||
* @param hold hold node reference
|
|
||||||
* @param reason updated reason
|
|
||||||
*/
|
|
||||||
void updateReason(NodeRef hold, String reason);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hold node references for a given file plan
|
* Freeze a collection of nodes, adding them to an existing hold.
|
||||||
* or an empty set if there is not any hold node available
|
*
|
||||||
*
|
* @param hold hold node reference
|
||||||
* @param filePlan file plan for which the hold nodes will be retrieved
|
* @param nodeRefs set of nodes to freeze
|
||||||
* @return Set<NodeRef> hold node references
|
*/
|
||||||
*/
|
void freeze(NodeRef hold, Set<NodeRef> nodeRefs);
|
||||||
Set<NodeRef> getHolds(NodeRef filePlan);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether or not the given node has frozen children
|
* Unfreeze a frozen node.
|
||||||
*
|
* <p>
|
||||||
* @param nodeRef The nodeRef for which will be checked if it has frozen children
|
* The unfrozen node is automatically removed from the hold(s) it is in. If the hold is
|
||||||
* @return true if the given nodeRef has frozen children, false otherwise
|
* subsequently empty, the hold is automatically deleted.
|
||||||
*/
|
*
|
||||||
boolean hasFrozenChildren(NodeRef nodeRef);
|
* @param nodeRef node reference
|
||||||
|
*/
|
||||||
|
void unFreeze(NodeRef nodeRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfreeze a collection of nodes.
|
||||||
|
* <p>
|
||||||
|
* The unfrozen nodes are automatically removed from the hold(s) the are in. If the hold(s) is
|
||||||
|
* subsequently empty, the hold is automatically deleted.
|
||||||
|
*
|
||||||
|
* @param nodeRefs set of nodes to unfreeze
|
||||||
|
*/
|
||||||
|
void unFreeze(Set<NodeRef> nodeRefs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfreezes all nodes within a hold and deletes the hold.
|
||||||
|
*
|
||||||
|
* @param hold hold node reference
|
||||||
|
*/
|
||||||
|
void relinquish(NodeRef hold);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the freeze reason for a hold.
|
||||||
|
*
|
||||||
|
* @param hold hold node reference
|
||||||
|
* @return String freeze reason
|
||||||
|
*/
|
||||||
|
String getReason(NodeRef hold);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the freeze reason for a given hold.
|
||||||
|
*
|
||||||
|
* @param hold hold node reference
|
||||||
|
* @param reason updated reason
|
||||||
|
*/
|
||||||
|
void updateReason(NodeRef hold, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hold node references for a given file plan
|
||||||
|
* or an empty set if there is not any hold node available
|
||||||
|
*
|
||||||
|
* @param filePlan file plan for which the hold nodes will be retrieved
|
||||||
|
* @return Set<NodeRef> hold node references
|
||||||
|
*/
|
||||||
|
Set<NodeRef> getHolds(NodeRef filePlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether or not the given node has frozen children
|
||||||
|
*
|
||||||
|
* @param nodeRef The nodeRef for which will be checked if it has frozen children
|
||||||
|
* @return true if the given nodeRef has frozen children, false otherwise
|
||||||
|
*/
|
||||||
|
boolean hasFrozenChildren(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the date of the freeze for the given node, null if the node is not frozen
|
* Gets the date of the freeze for the given node, null if the node is not frozen
|
||||||
|
@@ -182,9 +182,27 @@ public class FreezeServiceImplTest extends BaseRMTestCase
|
|||||||
assertNotNull(freezeService.getFreezeInitiator(recordTwo));
|
assertNotNull(freezeService.getFreezeInitiator(recordTwo));
|
||||||
assertFalse(freezeService.isFrozen(recordThree));
|
assertFalse(freezeService.isFrozen(recordThree));
|
||||||
|
|
||||||
// FIXME
|
// Relinquish the first hold
|
||||||
freezeService.unFreeze(recordTwo);
|
holdNodeRef = holdAssocs.iterator().next();
|
||||||
freezeService.unFreeze(recordOne);
|
freezeService.relinquish(holdNodeRef);
|
||||||
|
|
||||||
|
// Check the existing hold
|
||||||
|
holdAssocs = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holdAssocs);
|
||||||
|
assertEquals(1, holdAssocs.size());
|
||||||
|
|
||||||
|
// Relinquish the second hold
|
||||||
|
holdNodeRef = holdAssocs.iterator().next();
|
||||||
|
freezeService.unFreeze(freezeService.getFrozen(holdNodeRef));
|
||||||
|
|
||||||
|
// All holds should be deleted
|
||||||
|
holdAssocs = freezeService.getHolds(filePlan);
|
||||||
|
assertEquals(0, holdAssocs.size());
|
||||||
|
|
||||||
|
// Check the nodes are unfrozen
|
||||||
|
assertFalse(freezeService.isFrozen(recordOne));
|
||||||
|
assertFalse(freezeService.isFrozen(recordTwo));
|
||||||
|
assertFalse(freezeService.isFrozen(recordThree));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user