mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Storing the information about the original location of a record
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@45740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1152,6 +1152,16 @@
|
|||||||
</properties>
|
</properties>
|
||||||
</aspect>
|
</aspect>
|
||||||
|
|
||||||
|
<!-- Aspect to hold the information about the original location of a record -->
|
||||||
|
<aspect name="rma:originalLocation">
|
||||||
|
<title>The original location of a record</title>
|
||||||
|
<properties>
|
||||||
|
<property name="rma:orgLocation">
|
||||||
|
<type>d:any</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</aspect>
|
||||||
|
|
||||||
</aspects>
|
</aspects>
|
||||||
|
|
||||||
</model>
|
</model>
|
@@ -103,10 +103,11 @@ public class HideRecordAction extends ActionExecuterAbstractBase implements Reco
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
NodeRef originalLocation = (NodeRef) nodeService.getProperty(actionedUponNodeRef, PROP_ORIGINAL_LOCATION);
|
||||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(actionedUponNodeRef);
|
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(actionedUponNodeRef);
|
||||||
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
||||||
{
|
{
|
||||||
if (childAssociationRef.isPrimary() == false)
|
if (childAssociationRef.isPrimary() == false && childAssociationRef.getParentRef().equals(originalLocation))
|
||||||
{
|
{
|
||||||
nodeService.removeChildAssociation(childAssociationRef);
|
nodeService.removeChildAssociation(childAssociationRef);
|
||||||
}
|
}
|
||||||
|
@@ -231,4 +231,8 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
|||||||
// Extended readers aspect
|
// Extended readers aspect
|
||||||
public static final QName ASPECT_EXTENDED_READERS = QName.createQName(RM_URI, "extendedReaders");
|
public static final QName ASPECT_EXTENDED_READERS = QName.createQName(RM_URI, "extendedReaders");
|
||||||
public static final QName PROP_READERS = QName.createQName(RM_URI, "readers");
|
public static final QName PROP_READERS = QName.createQName(RM_URI, "readers");
|
||||||
|
|
||||||
|
// Original location of a record
|
||||||
|
public static final QName ASPECT_ORIGINAL_LOCATION = QName.createQName(RM_URI, "originalLocation");
|
||||||
|
public static final QName PROP_ORIGINAL_LOCATION = QName.createQName(RM_URI, "orgLocation");
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.record;
|
package org.alfresco.module.org_alfresco_module_rm.record;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -34,9 +37,9 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
@@ -324,7 +327,12 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
|
nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
|
||||||
|
|
||||||
// maintain the original primary location
|
// maintain the original primary location
|
||||||
nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName());
|
ChildAssociationRef child = nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName());
|
||||||
|
|
||||||
|
// Add the information about the original location
|
||||||
|
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1);
|
||||||
|
aspectProperties.put(PROP_ORIGINAL_LOCATION, (Serializable) child.getParentRef());
|
||||||
|
nodeService.addAspect(nodeRef, ASPECT_ORIGINAL_LOCATION, aspectProperties);
|
||||||
|
|
||||||
// make the document a record
|
// make the document a record
|
||||||
makeRecord(nodeRef);
|
makeRecord(nodeRef);
|
||||||
|
Reference in New Issue
Block a user