-
-
Save wk-j/8a18f8e0ac3765535e4e to your computer and use it in GitHub Desktop.
Adding an aspect (known in CMIS 1.1 as a "secondary type") by modifying cmis:secondaryObjectTypeIds. This requires that you connect using the CMIS 1.1 service URL. You do not need the Alfresco OpenCMIS Extension when using this approach. Works with Alfresco 4.2.e Community Edition and higher.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Object> aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues(); | |
if (!aspects.contains("P:cm:geographic")) { | |
aspects.add("P:cm:geographic"); | |
HashMap<String, Object> props = new HashMap<String, Object>(); | |
props.put("cmis:secondaryObjectTypeIds", aspects); | |
doc.updateProperties(props); | |
System.out.println("Added aspect"); | |
} else { | |
System.out.println("Doc already had aspect"); | |
} | |
HashMap<String, Object> props = new HashMap<String, Object>(); | |
props.put("cm:latitude", 52.513871); | |
props.put("cm:longitude", 13.391106); | |
doc.updateProperties(props); | |
System.out.println("Latitude: " + doc.getProperty("cm:latitude").getValueAsString()); | |
System.out.println("Longitude: " + doc.getProperty("cm:longitude").getValueAsString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment