Cannot save property using OpenCmis API

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2013 07:25 PM
hi guys,
I am using OpenCMIS api to create a document into alfresco(4.2 community version). While creating the session, I didn't initialize OBJECT_FACTORY_CLASS as AlfrescoObjectFactoryImpl, because I want to make it a common module, which can connect to other document repositories as well.
Code is something like:
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, CMISConstants.CMIS_DOCUMENT);
properties.put(PropertyIds.NAME, filename);
properties.put(PropertyIds.CHECKIN_COMMENT, "descriptino is here");
properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "txt");
properties.put(PropertyIds.CREATED_BY, "tom");
properties.put(PropertyIds.IS_IMMUTABLE, "true");
Document document = folder.createDocument(properties, contentStream, VersioningState.MAJOR);
The problem is in alfresco, except for OBJECT_TYPE_ID and NAME, all other properties are all treated as Readonly while creating the document. Therefore all these properties cannot be saved with the document.
Any way to solve this problem?
I am using OpenCMIS api to create a document into alfresco(4.2 community version). While creating the session, I didn't initialize OBJECT_FACTORY_CLASS as AlfrescoObjectFactoryImpl, because I want to make it a common module, which can connect to other document repositories as well.
Code is something like:
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, CMISConstants.CMIS_DOCUMENT);
properties.put(PropertyIds.NAME, filename);
properties.put(PropertyIds.CHECKIN_COMMENT, "descriptino is here");
properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "txt");
properties.put(PropertyIds.CREATED_BY, "tom");
properties.put(PropertyIds.IS_IMMUTABLE, "true");
Document document = folder.createDocument(properties, contentStream, VersioningState.MAJOR);
The problem is in alfresco, except for OBJECT_TYPE_ID and NAME, all other properties are all treated as Readonly while creating the document. Therefore all these properties cannot be saved with the document.
Any way to solve this problem?
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2013 03:39 PM
Check in comment can be set when you checkin the document, I believe. Mimetype is also set when you set the content stream. Created by is read-only. It uses the value of the authenticated user. I am not familiar with is immutable but it sounds like a system property to me.
You can ask CMIS for the type definition for cmis:document (through the API or even just by using the CMIS Workbench). Then you can look at every property in the model and determine whether or not that property is writable. If CMIS says it is not writable, it isn't writable and there is no workaround for that.
Jeff
You can ask CMIS for the type definition for cmis:document (through the API or even just by using the CMIS Workbench). Then you can look at every property in the model and determine whether or not that property is writable. If CMIS says it is not writable, it isn't writable and there is no workaround for that.
Jeff
