cancel
Showing results for 
Search instead for 
Did you mean: 

Help in using CMLCreateAssociation

anshul
Champ in-the-making
Champ in-the-making
Hi
I am trying to create peer association between two nodes . Following is my code

         try
         {
         Predicate predicate_epubFile=new Predicate(new Reference[]{ref_epubFile},storeRef, null);
         Predicate predicate_epubCoverImage=new Predicate(new Reference[]{ref_epubImage},storeRef,null);


         CMLCreateAssociation createAssociation=new CMLCreateAssociation(predicate_epubFile,null,predicate_epubCoverImage,null,Constants.ASSOC_CONTAINS);
         cml = new CML();
         cml.setCreateAssociation(new CMLCreateAssociation[]{createAssociation});
         WebServiceFactory.getRepositoryService().update(cml);
         }
         catch(RepositoryFault e)
         {
            e.getMessage();
            
         }

This is Giving following Exception
org.alfresco.repo.node.integrity.IntegrityException: 01010388 Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://SpacesStore/27aedefe-eeb9-45d3-a0b8-99c8cd8b7941
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}content

What i am doing wrong here.
Please help
Thank you
Anshul
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
Have you declared the peer association between these two content types?

Associations must be declared in the Content Model of Alfresco in the content type definition or in an Aspect definition:
http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Peer_.28Non-Child.29_Associations

Hope this helps.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.