cancel
Showing results for 
Search instead for 
Did you mean: 

Get hold of aspect properties with OpenCMIS

fmui
Champ in-the-making
Champ in-the-making
At DevCon in Paris we have been asked how aspects can be access through OpenCMIS. Here is a code snippet. Please note that this requires OpenCMIS 0.2.x.


CmisObject object = …

List<CmisExtensionElement> extensions = object.getExtensions(ExtensionLevel.PROPERTIES);

if(extensions != null && !extensions.isEmpty()) {
    List<CmisExtensionElement> alfrescoExtensions = extensions.get(0).getChildren();

    // applied aspects
    for(CmisExtensionElement extension: alfrescoExtensions) {
        if(extension.getName().equals("appliedAspects")) {
            String aspect = extension.getValue().substring(2);
           
            System.out.println(aspect);
        }
    }
   
    // aspect properties
    for(CmisExtensionElement extension: alfrescoExtensions) {
        if(extension.getName().equals("properties")) {
            for(CmisExtensionElement property: extension.getChildren()) {
                String id = property.getAttributes().get("propertyDefinitionId");
               
                List<String> values = new ArrayList();
                for(CmisExtensionElement propertyValues: property.getChildren()) {
                    values.add(propertyValues.getValue());
                }
               
                System.out.println(id + " = " + values);
            }
        }
    }
}


Florian
2 REPLIES 2

talija83
Champ in-the-making
Champ in-the-making
It's nice to know that this option will be supported in OpenCMIS 0.2. Speaking of which, when can we expect it to be released?

Thanks for your answer. Smiley Happy

fmui
Champ in-the-making
Champ in-the-making
It will be released when it is done.  :wink:
Seriously, there is no release date yet. I assume there will be another release this year.

- Florian