mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1267: Delete Record capability is needed to delete the reference
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1@62862 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1116,7 +1116,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||
*/
|
||||
public void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId)
|
||||
public void removeCustomReference(final NodeRef fromNode, final NodeRef toNode, final QName assocId)
|
||||
{
|
||||
Map<QName, AssociationDefinition> availableAssocs = this.getCustomReferenceDefinitions();
|
||||
|
||||
@@ -1133,14 +1133,23 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
// TODO: Ask for a more efficient method such as
|
||||
// nodeService.removeChildAssociation(fromNode, toNode, chRef.getTypeQName(), null);
|
||||
|
||||
List<ChildAssociationRef> children = nodeService.getChildAssocs(fromNode);
|
||||
for (ChildAssociationRef chRef : children)
|
||||
{
|
||||
if (assocId.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(toNode))
|
||||
{
|
||||
nodeService.removeChildAssociation(chRef);
|
||||
}
|
||||
}
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
List<ChildAssociationRef> children = nodeService.getChildAssocs(fromNode);
|
||||
for (ChildAssociationRef chRef : children)
|
||||
{
|
||||
if (assocId.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(toNode))
|
||||
{
|
||||
nodeService.removeChildAssociation(chRef);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user