Logger.debug(this, "LanguageId is -1 so we will not use a language to pull contentlets");
}else{
condition.append(" and contentletvi.lang = ").append(languageId);
}
HibernateUtil hu = new HibernateUtil(com.dotmarketing.portlets.contentlet.business.Contentlet.class);
if (!UtilMethods.isSet(orderby) || orderby.equals("tree_order")) {
orderby = "multi_tree.tree_order";
}
String query = "SELECT {contentlet.*} FROM contentlet JOIN inode contentlet_1_ ON (contentlet.inode=contentlet_1_.inode) "
+ " JOIN multi_tree ON (multi_tree.child = contentlet.identifier) "
+ " JOIN contentlet_version_info contentletvi ON (contentlet.identifier=contentletvi.identifier) "
+ " where multi_tree.parent1 = ? and multi_tree.parent2 = ? and " + condition.toString() + " order by "
+ orderby;
hu.setSQLQuery(query);
hu.setParam(HTMLPageIdentifier);
hu.setParam(containerIdentifier);
List<com.dotmarketing.portlets.contentlet.business.Contentlet> fatties = hu.list();
List<Contentlet> result = new ArrayList<Contentlet>();
for (com.dotmarketing.portlets.contentlet.business.Contentlet fatty : fatties) {
Contentlet content = convertFatContentletToContentlet(fatty);
cc.add(content.getInode(), content);
result.add(content);