cancel
Showing results for 
Search instead for 
Did you mean: 

Move conten in a space

pierropl
Champ in-the-making
Champ in-the-making
Hi
I want to move specified content from a space to another space.
I want use external a WebServices API.
Can you help me to do this operation?
Thanks
Luca
1 REPLY 1

wdavidw
Champ in-the-making
Champ in-the-making
I have been trying to use the CMLMove command but with no success, see this post:
http://forums.alfresco.com/viewtopic.php?t=2695&sid=f3dcbf935b95d86b7106e8dbe8c09b0b


Here the function:

public Reference moveFolder(Store store,String sourceUuid, String parentUuid,String name) throws OasisException{

       ParentReference folderParentRef = new ParentReference();
       folderParentRef.setStore(store);
       folderParentRef.setUuid(parentUuid);
       folderParentRef.setAssociationType(Constants.ASSOC_CHILDREN);
       folderParentRef.setChildName(Constants.ASSOC_CHILDREN);
      
      // Create Reference
      Reference sourceRef = new Reference();
      sourceRef.setStore(store);
      sourceRef.setUuid(sourceUuid);

      CMLMove moveFolder = new CMLMove(
            folderParentRef, // to
            parentUuid, // to_id
            Constants.TYPE_FOLDER, // associationType
            name, // childName
            new Predicate(new Reference[]{sourceRef}, null, null), // where
            null); // where_id

      // Create command
      CML cml = new CML();
      cml.setMove(new CMLMove[]{moveFolder});

      // Process command
      RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
      
      try {
         UpdateResult[] updateResult = repositoryService.update(cml);
         return null;
         //return updateResult[0].getDestination();
      } catch (RepositoryFault e) {
         throw new OasisException("Could not move folder",e);
      } catch (RemoteException e) {
         throw new OasisException("Could not move folder",e);
      }
   }