You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by John Dorman <do...@overlooked.us> on 2010/10/07 07:46:27 UTC

createRelationship issue with child-assocations in Alfresco 3.4a

Hey all,

I have a child-association on on a custom object in Alfresco 3.4a.  When I
call the code below it tells me that gc:reviews is not a objectType

Map<String,Object> relProps = new HashMap<String, Object>();
relProps.put("cmis:sourceId", document.getId());
        relProps.put("cmis:targetId", entity.getDocId());
        relProps.put("cmis:objectTypeId", "R:gc:reviews");
        session.createRelationship(relProps, null, null, null);

If I change the relationship type from child-association to just an
association it works fine.

Any thoughts?

Association in customModel.xml

BAD:
<associations>
<child-association name="gc:reviews">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>gc:course_review</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</child-association>
</associations>

GOOD:

<associations>
<association name="gc:reviews">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>gc:user_review</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>


Thanks a ton for looking into it!

Re: createRelationship issue with child-assocations in Alfresco 3.4a

Posted by David Caruana <da...@alfresco.com>.
Hi John,

The reason for your error (gc:reviews is not an object type) is that Alfresco does not map all of its child associations to the CMIS domain model, so they are unknown to the CMIS layer. In Alfresco, we only map the folder "contains" child association to the native CMIS folder/document parent/child relationship. Please note, other CMIS servers may have a different approach to mapping their notion of relationships to CMIS.

As you have seen, we map all Alfresco peer associations to CMIS relationships, and so gc:reviews becomes visible to CMIS.

I realise this doesn't necessarily resolve your issue, but at least you should know why it happens.

Regards,
Dave


On 7 Oct 2010, at 06:46, John Dorman wrote:

> Hey all,
> 
> I have a child-association on on a custom object in Alfresco 3.4a.  When I
> call the code below it tells me that gc:reviews is not a objectType
> 
> Map<String,Object> relProps = new HashMap<String, Object>();
> relProps.put("cmis:sourceId", document.getId());
>        relProps.put("cmis:targetId", entity.getDocId());
>        relProps.put("cmis:objectTypeId", "R:gc:reviews");
>        session.createRelationship(relProps, null, null, null);
> 
> If I change the relationship type from child-association to just an
> association it works fine.
> 
> Any thoughts?
> 
> Association in customModel.xml
> 
> BAD:
> <associations>
> <child-association name="gc:reviews">
> <source>
> <mandatory>false</mandatory>
> <many>false</many>
> </source>
> <target>
> <class>gc:course_review</class>
> <mandatory>false</mandatory>
> <many>true</many>
> </target>
> </child-association>
> </associations>
> 
> GOOD:
> 
> <associations>
> <association name="gc:reviews">
> <source>
> <mandatory>false</mandatory>
> <many>false</many>
> </source>
> <target>
> <class>gc:user_review</class>
> <mandatory>false</mandatory>
> <many>true</many>
> </target>
> </association>
> </associations>
> 
> 
> Thanks a ton for looking into it!