AnsweredAssumed Answered

Problems updating a folder Name!

Question asked by robobot on Jan 26, 2010
Latest reply on Jan 28, 2010 by derek
Hello,
strage Problem: when i use the following method to rename a folder in alfresco the new name is shown in alfresco web application. but when i try to get files in these folder, it says the new folder path does not exist. there is still the old folderpath after the update :?:
please may anybody help me.


   public void updateFolderName (String folderPath, String newFoldername){

     UpdateResult [] result = null; 
     final Reference reference = new Reference(STORE, null, folderPath);    
     final Predicate p = new Predicate(new Reference[]{reference},null,null);
     final CMLUpdate updateFolder = new CMLUpdate( new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, newFoldername),p,null);
    
     CML cml = new CML();
     cml.setUpdate(new CMLUpdate[]{updateFolder});         
 
     try {
       result = WebServiceFactory.getRepositoryService().update(cml);
       //getting the old path!!
       System.out.println("path: " + result[0].getSource().getPath());
     } catch ( RepositoryFault rf ) {
       rf.printStackTrace();
     } catch ( RemoteException re ) {
       re.printStackTrace();
     }
    }

Outcomes