mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Code fix for RM-1821. The fix is to strip RM-related aspects from all renditions of a rejected node, as was previously done only for the node itself.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@94473 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1052,6 +1052,7 @@
|
|||||||
<property name="versionService" ref="VersionService" />
|
<property name="versionService" ref="VersionService" />
|
||||||
<property name="relationshipService" ref="RelationshipService" />
|
<property name="relationshipService" ref="RelationshipService" />
|
||||||
<property name="recordsManagementContainerType" ref="rma.recordsManagementContainer"/>
|
<property name="recordsManagementContainerType" ref="rma.recordsManagementContainer"/>
|
||||||
|
<property name="renditionService" ref="RenditionService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="recordMetadataAspectBootstrap" class="org.alfresco.module.org_alfresco_module_rm.record.RecordMetadataBootstrap" init-method="init" abstract="true">
|
<bean id="recordMetadataAspectBootstrap" class="org.alfresco.module.org_alfresco_module_rm.record.RecordMetadataBootstrap" init-method="init" abstract="true">
|
||||||
|
@@ -68,7 +68,7 @@ public interface HoldService
|
|||||||
/**
|
/**
|
||||||
* Gets the list of item node references which are in the given hold
|
* Gets the list of item node references which are in the given hold
|
||||||
*
|
*
|
||||||
* @param ndoeRef {@link NodeRef} of the hold
|
* @param hold {@link NodeRef} of the hold
|
||||||
* @return Lost of item {@link NodeRef}s which are in the given hold
|
* @return Lost of item {@link NodeRef}s which are in the given hold
|
||||||
*/
|
*/
|
||||||
List<NodeRef> getHeld(NodeRef hold);
|
List<NodeRef> getHeld(NodeRef hold);
|
||||||
|
@@ -625,7 +625,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
afterCal.set(Calendar.MILLISECOND, 0);
|
afterCal.set(Calendar.MILLISECOND, 0);
|
||||||
propertyUnchanged = (beforeCal.compareTo(afterCal) == 0);
|
propertyUnchanged = (beforeCal.compareTo(afterCal) == 0);
|
||||||
}
|
}
|
||||||
else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue == Boolean.FALSE))
|
else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE)))
|
||||||
{
|
{
|
||||||
propertyUnchanged = true;
|
propertyUnchanged = true;
|
||||||
}
|
}
|
||||||
@@ -1281,17 +1281,17 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get record property values
|
// get record property values
|
||||||
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
final Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
||||||
String recordId = (String)properties.get(PROP_IDENTIFIER);
|
final String recordId = (String)properties.get(PROP_IDENTIFIER);
|
||||||
String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID);
|
final String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID);
|
||||||
String origionalName = (String)properties.get(PROP_ORIGIONAL_NAME);
|
final String originalName = (String)properties.get(PROP_ORIGIONAL_NAME);
|
||||||
NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION);
|
final NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION);
|
||||||
|
|
||||||
// we can only reject if the originating location is present
|
// we can only reject if the originating location is present
|
||||||
if (originatingLocation != null)
|
if (originatingLocation != null)
|
||||||
{
|
{
|
||||||
// first remove the secondary link association
|
// first remove the secondary link association
|
||||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
final List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||||
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
||||||
{
|
{
|
||||||
if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
|
if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
|
||||||
@@ -1301,37 +1301,28 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove all RM related aspects from the node
|
removeRmAspectsFrom(nodeRef);
|
||||||
Set<QName> aspects = nodeService.getAspects(nodeRef);
|
|
||||||
for (QName aspect : aspects)
|
|
||||||
{
|
|
||||||
if (RM_URI.equals(aspect.getNamespaceURI()))
|
|
||||||
{
|
|
||||||
// remove the aspect
|
|
||||||
nodeService.removeAspect(nodeRef, aspect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the records primary parent association
|
// get the records primary parent association
|
||||||
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
|
final ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
|
||||||
// move the record into the collaboration site
|
// move the record into the collaboration site
|
||||||
nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
|
nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
|
||||||
|
|
||||||
// rename to the origional name
|
// rename to the original name
|
||||||
if (origionalName != null)
|
if (originalName != null)
|
||||||
{
|
{
|
||||||
fileFolderService.rename(nodeRef, origionalName);
|
fileFolderService.rename(nodeRef, originalName);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||||
logger.debug("Rename " + name + " to " + origionalName);
|
logger.debug("Rename " + name + " to " + originalName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the information about the rejection details
|
// save the information about the rejection details
|
||||||
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(3);
|
final Map<QName, Serializable> aspectProperties = new HashMap<>(3);
|
||||||
aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
|
aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
|
||||||
aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date());
|
aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date());
|
||||||
aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
|
aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
|
||||||
@@ -1361,6 +1352,34 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Removes all RM related aspects from the specified node and any rendition children. */
|
||||||
|
private void removeRmAspectsFrom(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
// Note that when folder records are supported, we will need to recursively
|
||||||
|
// remove aspects from their descendants.
|
||||||
|
final Set<QName> aspects = nodeService.getAspects(nodeRef);
|
||||||
|
for (QName aspect : aspects)
|
||||||
|
{
|
||||||
|
if (RM_URI.equals(aspect.getNamespaceURI()))
|
||||||
|
{
|
||||||
|
nodeService.removeAspect(nodeRef, aspect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ChildAssociationRef renditionAssoc : renditionService.getRenditions(nodeRef))
|
||||||
|
{
|
||||||
|
final NodeRef renditionNode = renditionAssoc.getChildRef();
|
||||||
|
|
||||||
|
// Do not attempt to clean up rendition nodes which are not children of their source node.
|
||||||
|
final boolean renditionRequiresCleaning = nodeService.exists(renditionNode) &&
|
||||||
|
renditionAssoc.isPrimary();
|
||||||
|
|
||||||
|
if (renditionRequiresCleaning)
|
||||||
|
{
|
||||||
|
removeRmAspectsFrom(renditionNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
import org.alfresco.service.cmr.rendition.RenditionService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -51,6 +52,9 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
|
|||||||
/** Dictionary service */
|
/** Dictionary service */
|
||||||
protected DictionaryService dictionaryService;
|
protected DictionaryService dictionaryService;
|
||||||
|
|
||||||
|
/** Rendition service */
|
||||||
|
protected RenditionService renditionService;
|
||||||
|
|
||||||
/** Application context */
|
/** Application context */
|
||||||
protected ApplicationContext applicationContext;
|
protected ApplicationContext applicationContext;
|
||||||
|
|
||||||
@@ -77,6 +81,14 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
|
|||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param service service
|
||||||
|
*/
|
||||||
|
public void setRenditionService(RenditionService service)
|
||||||
|
{
|
||||||
|
this.renditionService = service;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dictionaryService dictionary service
|
* @param dictionaryService dictionary service
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user