mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3030 - added filePlan aspect for every thumbnail from renditions
(cherry picked from commit 1de1bcf5f4
)
This commit is contained in:
@@ -103,6 +103,7 @@
|
||||
<property name="scriptService" ref="ScriptService" />
|
||||
<property name="namespaceService" ref="NamespaceService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="renditionService" ref="RenditionService" />
|
||||
</bean>
|
||||
|
||||
<bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour">
|
||||
|
@@ -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 thumbnail;
|
||||
for (ChildAssociationRef chAssRef : renditions)
|
||||
{
|
||||
thumbnail = chAssRef.getChildRef();
|
||||
if (nodeService.exists(thumbnail))
|
||||
{
|
||||
// Apply file plan component aspect to thumbnail
|
||||
nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user