Merge branch 'feature-2.4/RM-3266_ForegroundRejectActionInUnfiledRecordsNotWorking' into 'release/V2.4'

Feature 2.4/rm 3266 foreground reject action in unfiled records not working

RM-3266 - Documents get into a "hybrid" state when the Unfiled records inherited from File Plan rule rejects declared records.

If we run the reject rule in foreground it will run in the same transaction with create-record. **CreateRecordAction** will move the file to RM site and add all the RM aspects to it (including rma:filePlanComponent) then **RejectAction** will move the file back to the collaboration site and remove all the RM aspects from it. Because the two actions run in the same transaction **FilePlanComponentAspect.onAddAspect** will run at the end of the transaction to set the property rma:rootNodeRef and apply the rma:filePlanComponent aspect on all the renditions. By setting the property rma:rootNodeRef the **rma:filePlanComponent** is added back on the node.

When listing the files in the community site these nodes match the rmDocLibRecord template becuse they have **rma:filePlanComponent** aspect but we fail to list them because they are not records. The rejected files should match rmDocLibRejectedRecord template.

I added an extra check in the onAddAspect method to make sure we don't add back RM properties if the aspect rma:filePlanComponent has been removed in the same transaction it has been added.

Another solution that worked is changing the notification frequency of the onAddAspect method from **NotificationFrequency.TRANSACTION_COMMIT** to **NotificationFrequency.EVERY_EVENT** but I think it will affect the performance a lot more.

See merge request !113
This commit is contained in:
Roy Wetherall
2016-04-11 19:38:14 +01:00

View File

@@ -224,7 +224,8 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
@Override
public Void doWork()
{
if (nodeService.exists(nodeRef))
// Check if the node exists and the aspect hasn't been removed in the same transaction (see RM-3266)
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName))
{
// Look up the root and set on the aspect if found
NodeRef root = filePlanService.getFilePlan(nodeRef);