The Raven
The Raven

Reputation: 525

Changing AlfrescoDocument properties doesn't have any effect

Recently I'm working on adding metadata to file in Alfresco repository. I'm using following code:

    AlfrescoDocument alfDoc = (AlfrescoDocument) doc;
    Map<String, Object> aspectProperties = new HashMap<String, Object>();
    aspectProperties.put("cm:description", "test1");
    alfDoc.removeAspect("P:cm:titled");
    alfDoc.addAspect("P:cm:titled", aspectProperties);
    System.out.println(alfDoc.getProperties());

I can't get this one to work. It's possible to clear title with this one, but I can't just set one - description is blank. What am I doing wrong?

My libraries:

I'm using scraps of this java class:

http://svn.codespot.com/a/apache-extras.org/alfresco-opencmis-extension/trunk/src/test/org/alfresco/cmis/client/test/CMISClientTest.java

Upvotes: 0

Views: 476

Answers (1)

Sujay Pillai
Sujay Pillai

Reputation: 433

You should be using the updateProperties method as shown here if using Alfresco OpenCMIS extension OR if using Apache OpenCMIS then this

Unitl you don't explicitly call the updateProperties method it will not commit those changes on the repository side.

Upvotes: 1

Related Questions