public List<Contentlet> getComments(String inode, boolean descendingOrder){
try{
ContentletAPI conAPI = APILocator.getContentletAPI();
Contentlet contentlet = new Contentlet();
try{
contentlet = conAPI.find(inode, APILocator.getUserAPI().getSystemUser(), true);
}catch(DotDataException e){
Logger.debug(this, "Unable to look up contentlet with inode " + inode, e);
}
validateComments(contentlet);
if(!InodeUtils.isSet(contentlet.getInode())){
return new ArrayList<Contentlet>();
}
List<Contentlet> comments = null;
if(contentlet.getStructure().getVelocityVarName().equals(commentsVelocityStructureName)){
comments = conAPI.search("+Comments-Comments-parent:" + contentlet.getIdentifier() + " +live:true +languageid:" + contentlet.getLanguageId() + " +deleted:false", 0, -1, "Comments.datePublished " + (descendingOrder ? "desc":"asc"), APILocator.getUserAPI().getSystemUser(), true);
}else{
comments = conAPI.search("+" + getRelationshipName(contentlet) + ":" + contentlet.getIdentifier() + " +live:true +languageid:" + contentlet.getLanguageId() + " +deleted:false", 0, -1, "Comments.datePublished " + (descendingOrder ? "desc":"asc"), APILocator.getUserAPI().getSystemUser(), true);
}
// int count = 0;
// StringBuilder bob = new StringBuilder();
// for (Contentlet c : comments) {
// bob.append("Comments-Comments-child:" + c.getIdentifier() + " ");