AnsweredAssumed Answered

Issues while using CMIS getFolderTree

Question asked by balta on Jun 13, 2013
Latest reply on Jun 25, 2013 by sujaypillai
Hi im currently using chemistry-opencmis version 0.9.0 against an alfresco 4.2.c my code used to work when i was using a previous version of apache chemistry yet after upgrading I found a curious issue with the getFolderTree command. Seems that when I run the command I get back a folder list including the default subfolders that where setup by alfresco yet whatever folder I created by code are not returned by the getFolderTree command.

for example I have this piece of code that looks within a folder tree for a particular folder and in case of not finding it, creates it:

private Folder getChildFolder(Folder parentFolder, String folderName) {
      log.info("Getting child folder");
      log.info("Parent folder: "+parentFolder.getName());
      log.info("Folder Name:"+folderName);
      for (Tree<FileableCmisObject> t : parentFolder.getFolderTree(-1)) {
         log.info("Comparando "+t.getItem().getName()+" con "+folderName);
         if (t.getItem().getName().equals(folderName)) {
            log.info("Folder Encontrado");
            return (Folder) t.getItem();
         }
      }
      log.info("Folder No Encontrado, creandolo");
      // If we get here no folder existed thus we create it
      return buildChildFolder(parentFolder, folderName);
   }

the issue pops up as the command fails for whenever i want to find a folder that was previously created, the traversal through the folderTree finds no matches (as a matter of fact it isn't even listed) yet when the buildChildFolder fires off it fails stating that the folder already existed.

Ive been banging my head against a wall with this and havent found similar cases googling around. I would appreciate any ideas on this.

Outcomes