mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge remote-tracking branch 'remotes/origin/feature/RM-6873_RemoveActiveContentFromHold' into feature/RM-6911_AddActiveContentToHoldRestAPI
This commit is contained in:
@@ -190,35 +190,33 @@ public class FrozenAspect extends BaseBehaviourBean
|
||||
kind = BehaviourKind.CLASS,
|
||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
||||
)
|
||||
public void onRemoveAspect(final NodeRef record, QName aspectTypeQName)
|
||||
public void onRemoveAspect(final NodeRef nodeRef, QName aspectTypeQName)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork()
|
||||
{
|
||||
if (nodeService.exists(record) &&
|
||||
isRecord(record))
|
||||
if (nodeService.exists(nodeRef) &&
|
||||
(isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT)))
|
||||
{
|
||||
// get the owning record folder
|
||||
NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef();
|
||||
// get the owning folder
|
||||
NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
|
||||
// check that the aspect has been added
|
||||
if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN))
|
||||
if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN))
|
||||
{
|
||||
// decrement current count
|
||||
int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT);
|
||||
int currentCount = (Integer)nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT);
|
||||
if (currentCount > 0)
|
||||
{
|
||||
currentCount = currentCount - 1;
|
||||
nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount);
|
||||
nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user