AnsweredAssumed Answered

Not able to read aspect properties using CMIS?

Question asked by sepgs2004 on Feb 26, 2016
Latest reply on May 27, 2016 by sepgs2004
I am able to read the document using its path. I can see that it is the object that I am interested in.
On the folder that this document is, I have created a rule to add the aspect to any thing that comes in.
Now, in share, when I look at this document, by editing its properties, I see all the cm:document properties as well as my aspect properties with values.

I would like to read the properties of the aspect. I am using plain CMIS api, not the OpenCMIS extension.
When I do that, I see the regular properties only (as a result of the call object.getProperties()), not the properties of my aspect.
Similarly, getSecondaryTypes() call gives null.

As I said earlier, in share ui, I am able to see all the aspect properties, when click edit properties on the object.

Following is my code snippet:


Document object = (Document) cmisSession.getObjectByPath(path2Object);
if (object != null) {
   log.info("\tName            [" + object.getName() + "]");
   log.info("\tDescription     [" + object.getDescription() + "]");
                 
   List<Property<?>> properties = object.getProperties();
   if (properties != null) {
      for (int index=0; index<properties.size(); index++) {
         Property aProperty = properties.get(index);
           log.info("/t P QueryName    [" + aProperty.getQueryName() + "]");
           log.info("/t P Value        [" + aProperty.getValueAsString() + "]");
       }
   }
                    
                    
   List<SecondaryType> aspects = object.getSecondaryTypes();
   if (aspects != null) {
      for (int index=0; index<aspects.size(); index++) {
         SecondaryType aspect = aspects.get(index);
         log.info("/t P QueryName          [" + aspect.getQueryName());
         log.info("/t P Discription        [" + aspect.getDescription());

      }
   }
                    
}




Alfresco 5.0.d. community edition (64-bit) / CMIS / Java 1.7
Libraries used
<dependency>
    <groupId>org.apache.chemistry.opencmis</groupId>
    <artifactId>chemistry-opencmis-client-api</artifactId>
    <version>0.12.0</version>
</dependency>
<dependency>
    <groupId>org.apache.chemistry.opencmis</groupId>
    <artifactId>chemistry-opencmis-client-impl</artifactId>
    <version>0.12.0</version>
</dependency>
<dependency>
    <groupId>org.alfresco.cmis.client</groupId>
    <artifactId>alfresco-opencmis-extension</artifactId>
    <version>0.3</version>
</dependency>

Outcomes