Update of /var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/cao/impl In directory james.mmbase.org:/tmp/cvs-serv6133
Modified Files: Tag: b1_5 NewsletterCAOImpl.java Log Message: CMSC-1094, All newsletters with their subscriptions list should be ordered,check if nodeManager can order See also: http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/cao/impl See also: http://www.mmbase.org/jira/browse/CMSC-1094 Index: NewsletterCAOImpl.java =================================================================== RCS file: /var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/cao/impl/NewsletterCAOImpl.java,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -u -b -r1.23 -r1.23.2.1 --- NewsletterCAOImpl.java 23 Sep 2008 10:31:36 -0000 1.23 +++ NewsletterCAOImpl.java 22 Oct 2008 06:45:59 -0000 1.23.2.1 @@ -39,7 +39,8 @@ return MMBaseNodeMapper.convertList(list, Term.class); } - public List<Newsletter> getNewsletterByConstraint(String property, String constraintType, String value, boolean paging) { + public List<Newsletter> getNewsletterByConstraint(String property, String constraintType, String value, + boolean paging) { PagingStatusHolder pagingHolder = PagingUtils.getStatusHolder(); NodeQuery query = cloud.createNodeQuery(); NodeManager nodeManager = cloud.getNodeManager("newsletter"); @@ -50,13 +51,16 @@ SearchUtil.addLikeConstraint(query, nodeManager.getField(property), value); } } + if (pagingHolder != null && nodeManager.hasField(pagingHolder.getSort())) { + Queries.addSortOrders(query, pagingHolder.getSort(), pagingHolder.getMMBaseDirection()); + } else if (null != pagingHolder.getSort()) { + paging = false; + } if (paging) { query.setMaxNumber(pagingHolder.getPageSize()); query.setOffset(pagingHolder.getOffset()); } - if (pagingHolder != null) { - Queries.addSortOrders(query, pagingHolder.getSort(), pagingHolder.getMMBaseDirection()); - } + NodeList list = query.getList(); return MMBaseNodeMapper.convertList(list, Newsletter.class); } @@ -109,7 +113,8 @@ NodeQuery query = cloud.createNodeQuery(); Step newsletterStep = query.addStep(newsletterNodeManager); query.setNodeStep(newsletterStep); - Constraint idConstraint = SearchUtil.createEqualConstraint(query, newsletterNodeManager.getField("number"), newsletterId); + Constraint idConstraint = SearchUtil.createEqualConstraint(query, newsletterNodeManager.getField("number"), + newsletterId); SearchUtil.addConstraint(query, idConstraint); RelationStep relationStep = query.addRelationStep(termNodeManager, "posrel", "destination"); _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs