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;
}
unders st:sites it will create sites with type st:site not as a folder.Try to get like st:site.
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());
}
}
}
Ah, I now get what you say. I can query select * from st:site directly .
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());
}
}
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.