cancel
Showing results for 
Search instead for 
Did you mean: 

Property is read-only!

newhere
Champ in-the-making
Champ in-the-making
I'm using OpenCmis to create folders and documents. I create a document and versions of this document but I can't update any properties like 'description', 'title' or 'comment'. When I update commentary:

session.getObject(docId).setProperty(PropertyIds.CHECKIN_COMMENT, "my commentary");

I get this exception:

Exception in thread "main" java.lang.IllegalArgumentException: Property is read-only!

I don't know where to specify which properties can be writed.

Any idea?
7 REPLIES 7

fmui
Champ in-the-making
Champ in-the-making
The CMIS specification defines that the property cmis:checkinComment is read-only. It can only be set during a check-in. (There is a parameter in Document.checkIn().)

Check the enum Updatability in the property definition to find out if a property can be updated or not.

newhere
Champ in-the-making
Champ in-the-making
Thanks for your reply.

I've tried to checkout the document and then to do checkin:

Document checkout = (Document)session.getObject(document.checkOut());
checkout.checkIn(true, parameter, contentStream, comment, null, null, null);

I get this exception:
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Error Interno del Servidor
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:411)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:515)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.VersioningServiceImpl.checkIn(VersioningServiceImpl.java:164)
        at org.apache.chemistry.opencmis.client.runtime.PersistentDocumentImpl.checkIn(PersistentDocumentImpl.java:188)

I've also tried by using the VersioningService but I get the same error. Smiley Sad

gclaussn
Champ in-the-making
Champ in-the-making
Use tcpmon to get the detailed exception. (https://tcpmon.dev.java.net/)
If you use port 8080, change the port of the service url in java for example to 8888 and add a listener in tcpmon, which listens on 8888 and has an out going to port 8080.
You will get a detailed message not only RuntimeException and the http error code..

best regards, gclaussn

newhere
Champ in-the-making
Champ in-the-making
Thanks gclaussn, I've tried and I get:


Web Script Status 500 - Internal Error
The Web Script <a href="%2Falfresco%2Fservice%2Fcmis%2Fpwc%2Fs%2Fworkspace%3ASpacesStore%2Fi%2Fe6fc6d97-337f-4082-9699-693df24310f9%3FcheckinComment%3Dprimera%2Bversion!%26major%3Dtrue%26checkin%3Dtrue">/alfresco/service/cmis/pwc/s/workspace:SpacesStore/i/e6fc6d97-337f-4082-9699-693df24310f9</a> has responded with a status of 500 - Internal Error
An error inside the HTTP server which prevented it from fulfilling the request.
04250018 Wrapped Exception (with status template): 04250021 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/pwc.put.atom.js': Duplicate child name not allowed: nuevoDocumento
org.alfresco.service.cmr.repository.DuplicateChildNodeNameException - Duplicate child name not allowed: nuevoDocumento

I see my problem is that the document is duplicated, it's not updating the pwc.

I supposed that the process to upload a document was:
1º checkout the document
2º get the objectId of the pwc
3º checkin

Am I wrong?

newhere
Champ in-the-making
Champ in-the-making
Ok, I get the error. I was putting in the properties the same name of document. Now it works ok.
But, I have another doubt: it's not possible to make an upload to the document and to have the same name? I mean, I upload just a version, I don't want to modify "general" properties of the document such as name.

newhere
Champ in-the-making
Champ in-the-making
Well, I suppose they've to have different names because they're different nodes.
Thanks for your replies.
gclaussn, tcpmon was really useful to me, thanks a lot!!!

gclaussn
Champ in-the-making
Champ in-the-making
I managed versioning so:
i used the checkin method of the versioning service with the id of the old document (which shall get a new version)

Holder<String> idHolder = new Holder<String>("documentId");

Also i create a new PropertyData object, containing my new properties (for example new document name) and a new ContentStreamData object, or a use the old one.
Then i invoke the method with all parameters, and get the new version.

Got the problem that the checkin comment is not set, but i can life with that.  Smiley Very Happy
I think there are other solutions, maybe better ones. So its just a suggestion.