<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding type to a document uploaded in Alfresco through behaviour in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/adding-type-to-a-document-uploaded-in-alfresco-through-behaviour/m-p/50302#M19283</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I am trying to achieve this via Alfresco behaviour as procceding via Share has some limitation for my requirement.&lt;/P&gt;&lt;P&gt;Can anyone please correct me if the code attached is syntacially correct and I am approaching correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;public&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ApplyXyloAspect&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;implements&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;NodeServicePolicies&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;OnCreateNodePolicy&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;// Dependencies&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; NodeService nodeService&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; PolicyComponent policyComponent&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;// Behaviours&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; Behaviour onCreateNode&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;/**&lt;BR /&gt; ^When a document of type @XyloCmsType(name = "X:xz:Xylo") is created than aspects from xyloModel.xml&lt;BR /&gt; ^needs to be applied&lt;BR /&gt; */&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;public&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;init&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;// Create behaviours&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;// if workspace=workspace://SpacesStore/973e1b8d-bf61-8196-3278-fbbf0b4375gg&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;onCreateNode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;JavaBehaviour&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"onCreateNode"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; NotificationFrequency&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FIRST_EVENT&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="comment token"&gt;// Bind behaviours to node policies&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;policyComponent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;bindClassBehaviour&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Qname&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createQName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;NamespaceService&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ALFRESCO_URI&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"onCreateNode"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;BR /&gt; Qname&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createQName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XYLO&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NAMESPACE_XYLO_CONTENT_MODEL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; XYLO&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TYPE_xz_xyloModel&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;onCreateNode&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Oct 2018 21:26:27 GMT</pubDate>
    <dc:creator>rs1603</dc:creator>
    <dc:date>2018-10-12T21:26:27Z</dc:date>
    <item>
      <title>Adding type to a document uploaded in Alfresco through behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-type-to-a-document-uploaded-in-alfresco-through-behaviour/m-p/50302#M19283</link>
      <description>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 requirem</description>
      <pubDate>Fri, 12 Oct 2018 21:26:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-type-to-a-document-uploaded-in-alfresco-through-behaviour/m-p/50302#M19283</guid>
      <dc:creator>rs1603</dc:creator>
      <dc:date>2018-10-12T21:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding type to a document uploaded in Alfresco through behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-type-to-a-document-uploaded-in-alfresco-through-behaviour/m-p/50303#M19284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A compiler can check for you if the code is syntactically correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your use case is to assign aspects to nodes of your custom type, then there is no need for a behaviour / policy. You can specify default aspects in your type and Alfresco will always make sure these aspects are applied to any node of that type.&lt;/P&gt;&lt;P&gt;But from the sound of your question I reckon you have been using the Share Content Model Manager to define the model, so maybe you are restricted by that tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see any implementation of the onCreateNode method in your code. Your code formatting seems to be quite off, which would likely&amp;nbsp;cause errors in a compiler. There are no setters for the dependencies. I particularly dislike the use of "init" (init-method specified in Spring) for initialisation, but that is a personal preference and unfortunately all examples you find online are full of that. I just find it better / cleaner to use the afterPropertiesSet lifecycle method defined by implementing the interface InitializingBean.&lt;/P&gt;&lt;P&gt;I am going ahead and applying code highlighting to your post...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Oct 2018 12:46:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-type-to-a-document-uploaded-in-alfresco-through-behaviour/m-p/50303#M19284</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-10-14T12:46:54Z</dc:date>
    </item>
  </channel>
</rss>

