AnsweredAssumed Answered

Adding type to a document uploaded in Alfresco through behaviour

Question asked by rs1603 on Oct 12, 2018
Latest reply on Oct 14, 2018 by afaust

I am trying to associate a document type to xz:xylo, whenever a document is uploaded in a particular workspace of Alfresco, it should get attached to a type which I defined in xyloModel.xml.

I am trying to achieve this via Alfresco behaviour as procceding via Share has some limitation for my requirement.

Can anyone please correct me if the code attached is syntacially correct and I am approaching correctly.


public class ApplyXyloAspect implements NodeServicePolicies.OnCreateNodePolicy {
// Dependencies
private NodeService nodeService;
private PolicyComponent policyComponent;
// Behaviours
private Behaviour onCreateNode;

^When a document of type @XyloCmsType(name = "X:xz:Xylo") is created than aspects from xyloModel.xml
^needs to be applied

public void init() {
// Create behaviours
// if workspace=workspace://SpacesStore/973e1b8d-bf61-8196-3278-fbbf0b4375gg
this.onCreateNode = new JavaBehaviour(this, "onCreateNode", NotificationFrequency.FIRST_EVENT);
// Bind behaviours to node policies
this.policyComponent.bindClassBehaviour(Qname.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"),