Author: fdesbois Date: 2010-05-27 11:15:16 +0200 (Thu, 27 May 2010) New Revision: 3016 Url: http://chorem.org/repositories/revision/pollen/3016 Log: Refactor TopiaQuery method name from last change in ToPIA Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenUtils.java trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceFavoriteImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java trunk/pollen-business/src/main/xmi/pollen.zargo trunk/pollen-business/src/test/java/org/chorem/pollen/test/AbstractServiceTest.java Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenUtils.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenUtils.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenUtils.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -137,7 +137,7 @@ } if (StringUtils.isNotEmpty(referenceId) && reference != null) { - query.add(reference.namePropertyId(), referenceId); + query.addEquals(reference.namePropertyId(), referenceId); } } } Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -48,7 +48,7 @@ * * For a mass mail sending to start, following files must be present: * <ul> - * <li>xxx.emails : CSV file ("email", "subject", "body")</li> + * <li>xxx.mail : CSV file ("email", "subject", "body")</li> * <li>xxx.index : next index to manage ( inited at 0)</li> * </ul> * @@ -182,7 +182,7 @@ // index contains next index to treat FileUtils.writeStringToFile(indexFile, String.valueOf(currentIndex + 1)); - // wait 2 secondes between each mail to not + // wait 1 second between each mail to not // load smtp server try { Thread.sleep(1000); Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceFavoriteImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceFavoriteImpl.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceFavoriteImpl.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -130,13 +130,13 @@ FavoriteList list = participant.getFavoriteList(); TopiaQuery query = dao.createQuery(). - add(FavoriteParticipant.FAVORITE_LIST, list). - add(FavoriteParticipant.NAME, participant.getName()). - add(FavoriteParticipant.EMAIL, participant.getEmail()); + addEquals(FavoriteParticipant.FAVORITE_LIST, list). + addEquals(FavoriteParticipant.NAME, participant.getName()). + addEquals(FavoriteParticipant.EMAIL, participant.getEmail()); // Check only on entities different from the one in argument if (StringUtils.isNotEmpty(participant.getId())) { - query.add(TopiaEntity.TOPIA_ID, Op.NEQ, participant.getId()); + query.addWhere(TopiaEntity.TOPIA_ID, Op.NEQ, participant.getId()); } // existing participant found Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -332,15 +332,18 @@ String creatorUidProperty = TopiaQuery.getProperty(Poll.CREATOR, PollAccount.UID); - int count = dao.createQuery(). - add(Poll.UID, pollUid). - add(creatorUidProperty, accountUid). - executeCount(); + TopiaQuery query = dao.createQuery(). + addEquals(Poll.UID, pollUid). + addEquals(creatorUidProperty, accountUid); + + // Note a boolean admin exist in PollAccount, maybe // find the account in lists + + boolean result = dao.existByQuery(query); - return count > 0; + return result; } @Override @@ -351,7 +354,7 @@ PollDAO dao = PollenDAOHelper.getPollDAO(transaction); TopiaQuery query = dao.createQuery(). - add(Poll.UID, pollUid). + addEquals(Poll.UID, pollUid). addLoad(properties); Poll result = dao.findByQuery(query); Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -155,7 +155,7 @@ if (query == null) { query = dao.createQuery(); } - query.add(UserAccount.EMAIL, StringUtils.lowerCase(email)); + query.addEquals(UserAccount.EMAIL, StringUtils.lowerCase(email)); // existing user found if (dao.existByQuery(query)) { @@ -241,7 +241,7 @@ // the new email // FIXME-fdesbois-20100510 : replace by using id directly TopiaQuery query = dao.createQuery(). - add(UserAccount.LOGIN, Op.NEQ, user.getLogin()); + addWhere(UserAccount.LOGIN, Op.NEQ, user.getLogin()); checkEmailNotExist(dao, user.getEmail(), query); // Execute update @@ -284,7 +284,7 @@ TopiaQuery query = dao.createQuery(); PollenUtils.prepareQuery(query, filter); - int result = query.executeCount(); + int result = dao.countByQuery(query); return result; } Modified: trunk/pollen-business/src/main/xmi/pollen.zargo =================================================================== (Binary files differ) Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/test/AbstractServiceTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/test/AbstractServiceTest.java 2010-05-26 10:08:22 UTC (rev 3015) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/test/AbstractServiceTest.java 2010-05-27 09:15:16 UTC (rev 3016) @@ -232,7 +232,7 @@ PollenDAOHelper.getFavoriteListDAO(transaction); TopiaQuery query = dao.createQuery(). - add(TopiaEntity.TOPIA_ID, id). + addEquals(TopiaEntity.TOPIA_ID, id). addLoad(propertiesLoad); FavoriteList result = dao.findByQuery(query);