<?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 OpenCMIS - adding aspects with properties in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310407#M263537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This post is for all the people who are having problems with setting aspect-based properties via OpenCMIS. I post this just because I had really annoying experience while trying to create new file with custom aspects and properties and it might help some people out there. I spent hours and hours trying to figure out why my aspect-based properties appear to be null even tho I don't get anny error in console. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At first, you need Alfresco OpenCMIS extension and add the jar to the classpath.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Second step is to add the object factory class as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockcode&amp;gt;SessionFactory sessionFactory = SessionFactoryImpl.newInstance();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Map parameters = new HashMap();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;…&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;…&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Repository repository = (Repository)sessionFactory.getRepositories(parameters).get(0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Session session = repository.createSession();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With this you are now able to work with aspects (adding them, setting aspect-based properties as usual properties etc.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockcode&amp;gt;Map properties = new HashMap();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("cmis:name", name);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("cmis&lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://connect.hyland.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;bjectTypeId", "D:custom:customType, P:custom:customAspect");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("custom:customProperty", "custom property value");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; createDocument(properties, null, null);&amp;lt;/blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pretty straightforward sofar. Except the fact it didn't work for me and even tho all seemd to be ok, the aspects didn't really appear where they should and when I tried to get the property value, i got null value. Weird. After few hours of desparate attempts I started trying different atompub urls while connecting to the repository and I found out that the only one url actually working is this one:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockcode&amp;gt; parameters.put("org.apache.chemistry.opencmis.binding.atompub.url", "&lt;/SPAN&gt;&lt;A href="http://hostname:8080/alfresco/api/-default-/cmis/versions/1.1/browser" rel="nofollow noopener noreferrer"&gt;http://hostname:8080/alfresco/api/-default-/cmis/versions/1.1/browser&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and that's pretty much it, any other atompub url didn't work for me. Hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: Bam, tried it for the second time and i got this while connecting to repository:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;Unexpected document! Received: something unknown&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;well.. I'm done here, any help would be much appreciated&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit 2: I tried these parameters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockcode&amp;gt;parameters.put("org.apache.chemistry.opencmis.binding.spi.type", BindingType.BROWSER.value());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;parameters.put("org.apache.chemistry.opencmis.binding.browser.url", "&lt;/SPAN&gt;&lt;A href="http://hostname:8080/alfresco/api/-default-/cmis/versions/1.1/browser" rel="nofollow noopener noreferrer"&gt;http://hostname:8080/alfresco/api/-default-/cmis/versions/1.1/browser&lt;/A&gt;&lt;SPAN&gt;");&amp;lt;/blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It does connect, I get same results as before tho (aspects are not added or their values are null). It's funny how it worked only once &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit 3: ok, the old url actually works fine, lol&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;parameters.put("org.apache.chemistry.opencmis.binding.atompub.url", "&lt;/SPAN&gt;&lt;A href="http://hostname:8080/alfresco/cmisatom" rel="nofollow noopener noreferrer"&gt;http://hostname:8080/alfresco/cmisatom&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/blockcode&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still don't get why the new urls posted in this section in pinned topic don't work!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Mar 2014 22:36:15 GMT</pubDate>
    <dc:creator>bazter</dc:creator>
    <dc:date>2014-03-16T22:36:15Z</dc:date>
    <item>
      <title>OpenCMIS - adding aspects with properties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310407#M263537</link>
      <description>This post is for all the people who are having problems with setting aspect-based properties via OpenCMIS. I post this just because I had really annoying experience while trying to create new file with custom aspects and properties and it might help some people out there. I spent hours and hours try</description>
      <pubDate>Sun, 16 Mar 2014 22:36:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310407#M263537</guid>
      <dc:creator>bazter</dc:creator>
      <dc:date>2014-03-16T22:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCMIS - adding aspects with properties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310408#M263538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since you are using atom bingding ,you should provide atom url instead of browser url&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;parameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");&lt;BR /&gt; parameters.put("org.apache.chemistry.opencmis.binding.atompub.url", "&lt;A href="http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom&lt;/A&gt;");&lt;BR /&gt;…&lt;BR /&gt;Map properties = new HashMap();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("cmis:name", name);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("cmis:objectTypeId", "D:custom:customType, P:custom:customAspect");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties.put("custom:customProperty", "custom property value");&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;/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>Mon, 17 Mar 2014 03:26:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310408#M263538</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-03-17T03:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCMIS - adding aspects with properties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310409#M263539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I also spend many hrs to implement this. At last landed on your post.. it helped me.. Thanks &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why we need to use old url, did you find any information?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 15:11:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310409#M263539</guid>
      <dc:creator>rahulalfresco</dc:creator>
      <dc:date>2014-09-02T15:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCMIS - adding aspects with properties</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310410#M263540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great summary that will be of much help for many. May I add, for CMIS 1.1 (Alf 5.0.a), Groovy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; def properties = new HashMap&amp;lt;String,String&amp;gt;()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties[PropertyIds.NAME] = 'Test.pdf'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties[PropertyIds.OBJECT_TYPE_ID] = 'cmis:document'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties[PropertyIds.SECONDARY_OBJECT_TYPE_IDS] = ['P:cm:titled']&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties['cm:title'] = 'My CMIS 1.1 test with aspects'&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The example creates the properties for a document with the "Titled" aspect. So, while in CMIS 1.0 you would have created a comma separated string, with the alfresco-cmis extensions, with CMIS 1.1 you would just set an array of secondary object ids (aspects). So with CMIS 1.1 you do not need the extensions any more, but the API contains everything necessary.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2014 09:27:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/opencmis-adding-aspects-with-properties/m-p/310410#M263540</guid>
      <dc:creator>pco</dc:creator>
      <dc:date>2014-09-29T09:27:44Z</dc:date>
    </item>
  </channel>
</rss>

