Hi Geert,

That is an Alfresco bug. The cmis:sourceId and cmis:targetId property 
definitions are wrong.
Both are defined with updatability = readonly and required      = true which 
doesn't make sense. The updatability should be either readwrite or oncreate.


- Florian

-----Original Message-----
From: Geert Vanheusden [mailto:[email protected]] 
Sent: Donnerstag, 29. Juli 2010 16:33
To: [email protected]
Subject: Create Relationship and Updatability problem

Dear,

I have the following problem using the OpenCMIS Client and Alfresco Enterprise 
3.3. 

If I want to create a relationship between two documents I use this code:

=======================
Map<String, Serializable> relProps = new HashMap<String, Serializable>();
relProps.put("cmis:sourceId", doc1.getId());
relProps.put("cmis:targetId", doc2.getId());
relProps.put("cmis:objectTypeId", "cmis:relationship");
session.createRelationship(relProps, null, null, null);
=======================

When I execute this code I get the following exception: 
CmisInvalidArgumentException: Source Id is not set!

When debugging this code I see the following situation.
The convertProperties in PersistentObjectFactoryImpl is called and when it 
iterates over the first property (cmis:sourceId) it skips the loop at:

=======================
// check updatability
if (updatabilityFilter != null) {
     if (!updatabilityFilter.contains(definition.getUpdatability())) {
         continue;
     }
}
=======================

If I query the property definition for cmis:sourceId I get a READONLY value 
from Alfresco which isn't available in the list.

=======================
    private static final Set<Updatability> CREATE_UPDATABILITY = new 
HashSet<Updatability>();
    static {
        CREATE_UPDATABILITY.add(Updatability.ONCREATE);
        CREATE_UPDATABILITY.add(Updatability.READWRITE);
    }
=======================

So it is impossible to create a new Releationship because the cmis:sourceId and 
cmis:targetId will never be availble after the property conversion.

Not sure if it is an Alfresco or OpenCMIS bug or just me?

Hope you guys can point me in the right direction!

Kind regards,

Geert

Reply via email to