Update of /var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/repository In directory james.mmbase.org:/tmp/cvs-serv5646/contentrepository/src/java/com/finalist/cmsc/repository
Modified Files: Tag: b1_5 RepositoryUtil.java Log Message: CMSC-1189(Add age constraint to contentchannel portlets) See also: http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/repository See also: http://www.mmbase.org/jira/browse/CMSC-1189 Index: RepositoryUtil.java =================================================================== RCS file: /var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/repository/RepositoryUtil.java,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -u -b -r1.21.2.1 -r1.21.2.2 --- RepositoryUtil.java 1 Oct 2008 11:05:04 -0000 1.21.2.1 +++ RepositoryUtil.java 18 Dec 2008 09:22:31 -0000 1.21.2.2 @@ -600,7 +600,17 @@ NodeQuery query = createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, archive, offset, maxNumber, year, month, day); return Queries.count(query); } - + public static int countLinkedElements(Node channel, List<String> contenttypes, String orderby, String direction, boolean useLifecycle, String archive, int offset, int maxNumber, int year, int month, int day,int maxDays){ + NodeQuery query = createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, archive, offset, maxNumber, year, month, day); + String destinationManager = CONTENTELEMENT; + if (contenttypes != null && contenttypes.size() == 1) { + destinationManager = contenttypes.get(0); + } + if(maxDays > 0){ + SearchUtil.addDayConstraint(query, channel.getCloud().getNodeManager(destinationManager), ContentElementUtil.CREATIONDATE_FIELD, "-" + maxDays); + } + return Queries.count(query); + } public static NodeList getLinkedElements(Node channel, List<String> contenttypes, String orderby, String direction, boolean useLifecycle, int offset, int maxNumber, int year, int month, int day) { NodeQuery query = createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, null, offset, maxNumber, year, month, day); return query.getNodeManager().getList(query); @@ -617,7 +627,17 @@ NodeQuery query = createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, archive, offset, maxNumber, year, month, day, extraParameters); return query.getNodeManager().getList(query); } - + public static NodeList getLinkedElements(Node channel, List<String> contenttypes, String orderby, String direction, boolean useLifecycle, String archive, int offset, int maxNumber, int year, int month, int day, int maxDays) { + NodeQuery query = createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, archive, offset, maxNumber, year, month, day); + String destinationManager = CONTENTELEMENT; + if (contenttypes != null && contenttypes.size() == 1) { + destinationManager = contenttypes.get(0); + } + if(maxDays > 0){ + SearchUtil.addDayConstraint(query, channel.getCloud().getNodeManager(destinationManager), ContentElementUtil.CREATIONDATE_FIELD, "-" + maxDays); + } + return query.getNodeManager().getList(query); + } public static NodeQuery createLinkedContentQuery(Node channel, List<String> contenttypes, String orderby, String direction, boolean useLifecycle, String archive, int offset, int maxNumber, int year, int month, int day) { return createLinkedContentQuery(channel, contenttypes, orderby, direction, useLifecycle, archive, offset, maxNumber, year, month, day, null); _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs