use of org.alfresco.repo.policy.annotation.Behaviour in project records-management by Alfresco.
the class RecordAspect method onMoveNode.
/**
* Record move behaviour
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT)
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) {
// check the records parent has actually changed
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) && isFilePlanComponent(oldChildAssocRef.getParentRef())) {
final NodeRef record = newChildAssocRef.getChildRef();
authenticationUtil.runAsSystem(new RunAsWork<Object>() {
public Object doWork() {
if (nodeService.exists(record) && recordService.isFiled(record)) {
// clean record
cleanDisposableItem(nodeService, record);
// re-file in the new folder
recordService.file(record);
}
return null;
}
});
}
}
use of org.alfresco.repo.policy.annotation.Behaviour in project records-management by Alfresco.
the class RecordCategoryType method onCreateChildAssociation.
/**
* On every event
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/
@Override
@Behaviour(kind = BehaviourKind.ASSOCIATION)
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) {
QName childType = nodeService.getType(childAssocRef.getChildRef());
// Some modules use hidden folders to store information (see RM-3283).
if (childType.equals(ContentModel.TYPE_FOLDER)) {
nodeService.setType(childAssocRef.getChildRef(), TYPE_RECORD_FOLDER);
}
validateNewChildAssociation(childAssocRef.getParentRef(), childAssocRef.getChildRef(), ACCEPTED_UNIQUE_CHILD_TYPES, ACCEPTED_NON_UNIQUE_CHILD_TYPES);
if (bNew) {
// setup the record folder
recordFolderService.setupRecordFolder(childAssocRef.getChildRef());
}
}
use of org.alfresco.repo.policy.annotation.Behaviour in project records-management by Alfresco.
the class UnfiledRecordContainerType method onCreateChildAssociation.
@Override
@Behaviour(kind = BehaviourKind.ASSOCIATION)
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) {
// We need to automatically cast the created folder to record folder if it is a plain folder
// This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes.
// Some modules use hidden folder subtypes to store information (see RM-3283).
QName childType = nodeService.getType(childAssocRef.getChildRef());
if (childType.equals(ContentModel.TYPE_FOLDER)) {
nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER);
}
// check the created child is of an accepted type
validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES);
}
Aggregations