RM-6926 Don't trigger onUpdateProperties policy when a frozen node is added to another hold

This commit is contained in:
cagache
2019-08-20 14:56:46 +03:00
parent a142a79b45
commit b9039afde2
2 changed files with 38 additions and 0 deletions

View File

@@ -587,6 +587,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
addFrozenAspect(nodeRef, props);
// Link the record to the hold
//set in transaction cache in order not to trigger update policy when adding the association
transactionalResourceHelper.getSet("frozen").add(nodeRef);
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS);
// audit item being added to the hold

View File

@@ -245,4 +245,40 @@ public class AddActiveContentToHoldTest extends BaseRMTestCase
}
});
}
/**
* Given active content on hold
* When I try to add content to another hold
* And I have file permission on the other hold
* And I have the appropriate capability to add to hold
* Then the active content is contained within both holds
* And the active content remains frozen
*/
public void testAddDocumentToAnotherHold()
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
private NodeRef hold;
private NodeRef hold2;
public void given()
{
hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate());
hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate());
holdService.addToHold(hold, dmDocument);
}
public void when()
{
holdService.addToHold(hold2, dmDocument);
}
public void then()
{
assertTrue(freezeService.isFrozen(dmDocument));
assertTrue(holdService.heldBy(dmDocument, true).contains(hold));
assertTrue(holdService.heldBy(dmDocument, true).contains(hold2));
}
});
}
}