07-24-2018 08:05 AM
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;
}
07-24-2018 09:45 AM
unders st:sites it will create sites with type st:site not as a folder.Try to get like st:site.
07-24-2018 09:48 AM
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());
}
}
}
07-24-2018 09:54 AM
Ah, I now get what you say. I can query select * from st:site directly .
07-24-2018 10:21 AM
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());
}
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.