private String getBlogEntryWhereClause( WikiDocument ignoreDoc, Integer year, Integer month, Integer day, String tag) { StringBuilder clause = new StringBuilder(); clause.append("where doc2.PARENT_NODE_ID in (:directoryIDs)").append(" "); clause.append("and doc.HEADER_MACROS like '%blogEntry%'").append(" "); clause.append("and doc2.READ_ACCESS_LEVEL <= :currentAccessLevel").append(" "); if (ignoreDoc != null && ignoreDoc.getId() != null) clause.append("and doc.NODE_ID<>:ignoreDoc").append(" "); if (tag != null && tag.length() > 0) clause.append("and t.TAG = :tag").append(" "); if (year != null) clause.append("and year(doc2.CREATED_ON) = :limitYear").append(" "); if (month != null) clause.append("and month(doc2.CREATED_ON) = :limitMonth").append(" "); if (day != null) clause.append("and day(doc2.CREATED_ON) = :limitDay").append(" "); return clause.toString(); }
private void bindBlogEntryWhereClause( Query query, WikiDirectory startDir, WikiDocument ignoreDoc, Integer year, Integer month, Integer day, String tag) { query.setParameterList("directoryIDs", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir)); query.setParameter("currentAccessLevel", currentAccessLevel); if (ignoreDoc != null && ignoreDoc.getId() != null) query.setParameter("ignoreDoc", ignoreDoc); if (tag != null && tag.length() > 0) query.setParameter("tag", tag); if (year != null) query.setParameter("limitYear", year); if (month != null) query.setParameter("limitMonth", month); if (day != null) query.setParameter("limitDay", day); }