Merge branch 'feature-2.3/RM-2188_PreviewNotAvailableDeclaredRecord' into 'release/V2.3'

Feature 2.3/rm 2188 preview not available declared record

Backported changes from fixed issue RM-3030 in V2.4.

See merge request !493
This commit is contained in:
Roxana Lucanu-Ghetu
2016-09-20 10:05:53 +01:00
2 changed files with 26 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.rendition.RenditionService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.ScriptService;
@@ -73,6 +74,9 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
/** file plan service */
private FilePlanService filePlanService;
/** rendition service */
private RenditionService renditionService;
/**
* @param scriptService set script service
*/
@@ -97,6 +101,14 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
this.filePlanService = filePlanService;
}
/**
* @param renditionService rendition service
*/
public void setRenditionService(RenditionService service)
{
this.renditionService = service;
}
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
@@ -211,6 +223,19 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
{
nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root);
}
// If the node has any renditions, they inherit the file plan from their source node.
List<ChildAssociationRef> renditions = renditionService.getRenditions(nodeRef);
NodeRef rendition;
for (ChildAssociationRef chAssRef : renditions)
{
rendition = chAssRef.getChildRef();
if (nodeService.exists(rendition))
{
// Apply file plan component aspect to node's renditions
nodeService.addAspect(rendition, ASPECT_FILE_PLAN_COMPONENT, null);
}
}
}
return null;