cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to read aspect properties using CMIS?

sepgs2004
Star Contributor
Star Contributor
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>
Gnanasekaran Sakthivel
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
Can you confirm you are using the proper CMIS 1.1 service URL and that you do not have the alfresco opencmis extension anywhere on your classpath?

Jeff

sepgs2004
Star Contributor
Star Contributor
Also my URL is :
http://dev-alfresco:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

I went ahead and used CMIS query approach instead to pull the aspect specific properties. It works fine.


String cmisQuery = "SELECT doc.*, salo.* FROM cmis:document AS doc JOIN salo:documentProperties AS salo ON doc.cmis:objectId = salo.cmis:objectId ";
String cmisQueryWhereClause = "WHERE";
// add where clause
cmisQueryWhereClause += "(salo.salo:lo_id = 1867) AND (salo.salo:lo_category = 'Type1')"

ItemIterable<QueryResult> queryResults = cmisSession.query(cmisQuery, false);
for (QueryResult queryResult:queryResults) {
  PropertyData<?> abcProperty = queryResult.getPropertyByOd("abc");
  String abcValue = abcProperty.getFirstValue().toString()
  //…
}

Gnanasekaran Sakthivel