Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi
When generating the document, I can't mark it as versionable so that the versioning actually versions it and doesn't overwrite it. To solve this, the parent folder of the upload folder must have a rule in the input to set the cm:versionable aspect valid for the subfolders as well. So to test this, if you import it WITHOUT the rule and it versions it, everything would be fine. But in the SDK environment without the rule, it doesn't work.
I'm using Alfresco ECM (community) 23.2 dockerized in Ubuntu 22.04. I'm importing files into Alfresco using CMIS (openCMIIS) with an external jar and I notice that the imported document does not have the cm:versionable aspect applied so when it needs to be versioned it's substituted. I tired to apply the aspect using this suggestion
like this:
List<Object> aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues();
if (!aspects.contains("P:cm:versionable")) {
aspects.add("P:cm:versionable");
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:versionable", true);
doc.updateProperties(props);
When I create the document testing the method and try this I get:
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type 'P:cm:versionable' is unknown!
on this line doc.updateProperties(props);
The syntax of the secondary Ids seems ok because I printed this:
Doc aspect: P:sys:localized
Is something special needed for cm:versionable?
As a workaround I defined a rule on the folder to apply this aspect but I would rather have this done with CMIS to avoid managing supporting rules.
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. - ...
Labels:
- Labels:
-
Alfresco Content Services
1 ACCEPTED ANSWER
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Aspects VERSIONABLE, AUDITABLE and REFERENCEABLE are not CMIS-exposed:
Hyland Developer Evangelist
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Aspects VERSIONABLE, AUDITABLE and REFERENCEABLE are not CMIS-exposed:
Hyland Developer Evangelist
