Getting site folders within st:sites using CMIS 1.1?

cancel
Showing results for 
Search instead for 
Did you mean: 
kartech11
Active Member II

Getting site folders within st:sites using CMIS 1.1?

Hi,

I am trying to get all the sites under st:sites using CMIS 1.1 but I am not getting any child folders under st:sites .

  ItemIterable<CmisObject> siteObjects = getChildren((Folder) o);

I am able to access the st:sites object, but don't see any children under the object when I convert it to a folder

Complete Code


private String SITE_TYPE_ID ="F:st:sites";
List<Object> getSites(){
Folder root = session.getRootFolder();
ItemIterable<CmisObject> children = root.getChildren();
for (CmisObject o : children) {
if(SITE_TYPE_ID.equals(o.getType().getId())){
   System.out.println(o.getName() + " which is of type " + o.getType().getDisplayName());
    ItemIterable<CmisObject> siteObjects = getChildren((Folder) o);
    for(CmisObject s: siteObjects){
       System.out.println("Site Name is " + s.getName() + " and id is " + s.getId());
       }
    }
}
return null;
}
private ItemIterable<CmisObject> getChildren(Folder f){
    ItemIterable<CmisObject> childFolders = f.getChildren();
    return childFolders;
}
4 Replies
kranthi
Active Member II

Re: Getting site folders within st:sites using CMIS 1.1?

unders st:sites it will create sites with type st:site not as a folder.Try to get like st:site.

kartech11
Active Member II

Re: Getting site folders within st:sites using CMIS 1.1?

Hi Kumar,

Not sure I get what you are saying. In my above example I am getting the st:sites node and then trying to get the folders. Please let me know what is that I am not doing right?

if(SITE_TYPE_ID.equals(o.getType().getId())){
   System.out.println(o.getName() + " which is of type " + o.getType().getDisplayName());
    ItemIterable<CmisObject> siteObjects = getChildren((Folder) o);
    for(CmisObject s: siteObjects){
       System.out.println("Site Name is " + s.getName() + " and id is " + s.getId());
       }
    }
}
kartech11
Active Member II

Re: Getting site folders within st:sites using CMIS 1.1?

Ah, I now get what you say. I can query select * from st:site directly .

kranthi
Active Member II

Re: Getting site folders within st:sites using CMIS 1.1?

You can get like this also 

if (folder.getPath().equals("/Sites")) {
for (CmisObject fldr : folder.getChildren()) {
Folder site = (Folder) fldr ;

System.out.println("name:" + site .getPath() + "\n" + site.getName());
}
}