cancel
Showing results for 
Search instead for 
Did you mean: 

Set qshare aspect via cmis

uwe_wolfinger
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

kaynezhang
World-Class Innovator
World-Class Innovator
Both "qshare:sharedId" and "qshare:sharedBy" are protected which means they are not updatable in cmis.
So no, you can't add the qshare aspect via cmis.