<?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 Classification in javascript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/classification-in-javascript/m-p/173292#M126446</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi to everybody!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've had the following problem: in the javascript API, i did not found any example regarding classifiying a node quth a category.&amp;nbsp; I know&amp;nbsp; I need to apply the aspect cm:generalclassifiable, and i do so in this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;fileNode.addAspect("cm:generalclassifiable");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;and now I'd like to add a category defined with the web client, say 'XXX'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried with the following code: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;for each (cl in classification.getAllCategoryNodes("cm:generalclassifiable")){&lt;BR /&gt;&amp;nbsp; if(cl.name == "XXX"){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cl.createAssociation(fileNode,"cm:categories");&lt;BR /&gt;&amp;nbsp; }&lt;BR /&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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;but I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Failed to run Actions due to error: Found 2 integrity violations: The association target type is incorrect: Target Node: workspace://SpacesStore/26bff27f-6e9c-11dd-b8be-7d0580fc6f2a Association: Association[ class=ClassDef[name={&lt;A href="http://www.alfresco.org/model/content/1.0}category_root" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category_root&lt;/A&gt;], name={&lt;A href="http://www.alfresco.org/model/content/1.0}categories" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}categories&lt;/A&gt;, target class={&lt;A href="http://www.alfresco.org/model/content/1.0}category" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category&lt;/A&gt;, source role=null, target role=null] Required Target Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}category" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category&lt;/A&gt; Actual Target Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}content" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}content&lt;/A&gt; The association source type is incorrect: Source Node: workspace://SpacesStore/25f1899a-3e13-11dd-81b1-2be2a0263bea Association: Association[ class=ClassDef[name={&lt;A href="http://www.alfresco.org/model/content/1.0}category_root" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category_root&lt;/A&gt;], name={&lt;A href="http://www.alfresco.org/model/content/1.0}categories" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}categories&lt;/A&gt;, target class={&lt;A href="http://www.alfresco.org/model/content/1.0}category" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category&lt;/A&gt;, source role=null, target role=null] Required Source Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}category_root" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category_root&lt;/A&gt; Actual Source Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}category" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;while the opposite &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;for each (cl in classification.getAllCategoryNodes("cm:generalclassifiable")){&lt;BR /&gt;&amp;nbsp; if(cl.name == "XXX"){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileNode.createAssociation(cl,"cm:categories");&lt;BR /&gt;&amp;nbsp; }&lt;BR /&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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;gives me &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Failed to run Actions due to error: Found 1 integrity violations: The association source type is incorrect: Source Node: workspace://SpacesStore/83b0abc2-6e9c-11dd-b8be-7d0580fc6f2a Association: Association[ class=ClassDef[name={&lt;A href="http://www.alfresco.org/model/content/1.0}category_root" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category_root&lt;/A&gt;], name={&lt;A href="http://www.alfresco.org/model/content/1.0}categories" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}categories&lt;/A&gt;, target class={&lt;A href="http://www.alfresco.org/model/content/1.0}category" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category&lt;/A&gt;, source role=null, target role=null] Required Source Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}category_root" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}category_root&lt;/A&gt; Actual Source Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}content" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}content&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Another question: is there a way to get a category node by name? for example, if I know its name is Bar and its containing category is Foo, by searching for "Foo/Bar"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for any advice…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Aug 2008 09:48:30 GMT</pubDate>
    <dc:creator>ale_carraro</dc:creator>
    <dc:date>2008-08-20T09:48:30Z</dc:date>
    <item>
      <title>Classification in javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/classification-in-javascript/m-p/173292#M126446</link>
      <description>Hi to everybody!I've had the following problem: in the javascript API, i did not found any example regarding classifiying a node quth a category.&amp;nbsp; I know&amp;nbsp; I need to apply the aspect cm:generalclassifiable, and i do so in this way:fileNode.addAspect("cm:generalclassifiable");‍and now I'd like to add</description>
      <pubDate>Wed, 20 Aug 2008 09:48:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/classification-in-javascript/m-p/173292#M126446</guid>
      <dc:creator>ale_carraro</dc:creator>
      <dc:date>2008-08-20T09:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Classification in javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/classification-in-javascript/m-p/173293#M126447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Once you add generalclasifiable aspect, you have a property cm:categories defined. In your code sample, you were treating it as an asociation.&amp;nbsp; So the code should be more along the lines of (from memory):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fileNode.properties['cm:categories'].push(mycategory); //you need to use push for multi-valued variables, as i recall&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for searching, lucene query is your best bet.&amp;nbsp; Another technique that's used, if you bootstrap your categories for your module, you can set the nodeRef ids as part of the bootstrapping to some known value, and then pull them out based on that noderef.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are examples of this in the records management module.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2008 05:13:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/classification-in-javascript/m-p/173293#M126447</guid>
      <dc:creator>jbarmash</dc:creator>
      <dc:date>2008-08-26T05:13:09Z</dc:date>
    </item>
  </channel>
</rss>

