package org.alfresco.sample.webservice;
import org.alfresco.webservice.repository.RepositoryFault;
import org.alfresco.webservice.types.CML;
import org.alfresco.webservice.types.CMLCreateAssociation;
import org.alfresco.webservice.types.Predicate;
import org.alfresco.webservice.types.Reference;
import org.alfresco.webservice.types.Store;
import org.alfresco.webservice.util.Constants;
import org.alfresco.webservice.util.WebServiceFactory;
public class association {
protected static final Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
/**
* @param args
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
Authentication.Authenticate("admin", "alfrescoadmin");
try
{
Reference ref_epubFile = new Reference(STORE, "312c2cd4-3d90-4f15-a152-b130aea72ac1", null);
Reference ref_epubImage = new Reference(STORE, "1222cc56-9bdf-4b24-9469-71143e2ddae0", null);
Predicate predicate_epubFile=new Predicate(new Reference[]{ref_epubFile},STORE, null);
Predicate predicate_epubCoverImage=new Predicate(new Reference[]{ref_epubImage},STORE,null);
CMLCreateAssociation createAssociation=new CMLCreateAssociation(predicate_epubFile,"312c2cd4-3d90-4f15-a152-b130aea72ac1",predicate_epubCoverImage,"1222cc56-9bdf-4b24-9469-71143e2ddae0",Constants.ASSOC_CONTAINS);
CML cml = new CML();
cml.setCreateAssociation(new CMLCreateAssociation[]{createAssociation});
WebServiceFactory.getRepositoryService().update(cml);
System.out.println(createAssociation.getFrom_id());
System.out.println(createAssociation.getAssociation());
System.out.println(createAssociation.getTo_id());
}
catch(RepositoryFault e)
{
e.getMessage();
}
}
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.