06-16-2011 06:18 AM
06-16-2011 10:17 AM
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();
}
}
}
06-17-2011 08:49 AM
06-17-2011 08:54 AM
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.