AnsweredAssumed Answered

Set qshare aspect via cmis

Question asked by uwe.wolfinger@ooegkk.at on Sep 25, 2014
Latest reply on Sep 29, 2014 by kaynezhang
Hi all!

I try to create a new document via the cmis api and after successful creation to add the qshare aspect to the document.

Following code snippet is used:


Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);
AlfrescoDocument alfDoc = (AlfrescoDocument) newDoc;
Map<String, Object> qshareProperties = new HashMap<String, Object>();
qshareProperties.put("qshare:sharedBy", "Admin");
qshareProperties.put("qshare:sharedId", System.currentTimeMillis());
alfDoc.addAspect("P:qshare:shared", qshareProperties);


unfortunately the last line fails with the following error in the alfresco log:;
2014-09-25 13:59:21,853  ERROR [extensions.webscripts.AbstractRuntime] [ajp-apr-8009-exec-9] Exception from executeScript - redirecting to status template error: 08258072 Found 2 integrity violations:
Mandatory property not set:
   Node: workspace://SpacesStore/a8c04b41-3bfa-418f-9a3a-799d2abc4834
   Type: {http://www.alfresco.org/model/qshare/1.0}shared
   Property: {http://www.alfresco.org/model/qshare/1.0}sharedId
Mandatory property not set:
   Node: workspace://SpacesStore/a8c04b41-3bfa-418f-9a3a-799d2abc4834
   Type: {http://www.alfresco.org/model/qshare/1.0}shared
   Property: {http://www.alfresco.org/model/qshare/1.0}sharedBy
org.alfresco.repo.node.integrity.IntegrityException: 08258072 Found 2 integrity violations:
Mandatory property not set:
   Node: workspace://SpacesStore/a8c04b41-3bfa-418f-9a3a-799d2abc4834
   Type: {http://www.alfresco.org/model/qshare/1.0}shared
   Property: {http://www.alfresco.org/model/qshare/1.0}sharedId
Mandatory property not set:
   Node: workspace://SpacesStore/a8c04b41-3bfa-418f-9a3a-799d2abc4834
   Type: {http://www.alfresco.org/model/qshare/1.0}shared
   Property: {http://www.alfresco.org/model/qshare/1.0}sharedBy

So my question is, if it is possible to add the qshare aspect via cmis and, if yes, if there is an example on how to do this.

Thanks in advance,
Uwe

Outcomes