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:
Tuna Aksoy
2013-01-22 21:57:06 +00:00
parent e593bb5cb5
commit 785f6adde3
4 changed files with 180 additions and 157 deletions

View File

@@ -1152,6 +1152,16 @@
</properties>
</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>
</model>

View File

@@ -103,10 +103,11 @@ public class HideRecordAction extends ActionExecuterAbstractBase implements Reco
}
else
{
NodeRef originalLocation = (NodeRef) nodeService.getProperty(actionedUponNodeRef, PROP_ORIGINAL_LOCATION);
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(actionedUponNodeRef);
for (ChildAssociationRef childAssociationRef : parentAssocs)
{
if (childAssociationRef.isPrimary() == false)
if (childAssociationRef.isPrimary() == false && childAssociationRef.getParentRef().equals(originalLocation))
{
nodeService.removeChildAssociation(childAssociationRef);
}

View File

@@ -231,4 +231,8 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
// Extended readers aspect
public static final QName ASPECT_EXTENDED_READERS = QName.createQName(RM_URI, "extendedReaders");
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");
}

View File

@@ -18,10 +18,13 @@
*/
package org.alfresco.module.org_alfresco_module_rm.record;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
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.vital.VitalRecordServiceImpl;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.JavaBehaviour;
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.RunAsWork;
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());
// 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
makeRecord(nodeRef);