Pollen-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
April 2010
- 3 participants
- 19 discussions
30 Apr '10
Author: fdesbois
Date: 2010-04-30 11:40:14 +0200 (Fri, 30 Apr 2010)
New Revision: 2982
Url: http://chorem.org/repositories/revision/pollen/2982
Log:
Repare pollForm from previous version 1.3
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties
trunk/pollen-ui/src/main/webapp/js/pollForm.js
trunk/pollen-ui/src/main/webapp/poll/PollForm.tml
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-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-30 09:40:14 UTC (rev 2982)
@@ -10,6 +10,7 @@
import org.chorem.pollen.entity.Comment;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.PollAccountImpl;
import org.chorem.pollen.entity.PollImpl;
import org.chorem.pollen.entity.UserAccount;
import org.nuiton.topia.TopiaContext;
@@ -51,8 +52,19 @@
}
@Override
- protected Poll executeGetNewPoll() {
- return new PollImpl();
+ protected Poll executeGetNewPoll(UserAccount user) {
+ Poll poll = new PollImpl();
+ // Initialize creator as an admin for the poll
+ PollAccount creator = new PollAccountImpl();
+ creator.setAdmin(true);
+ if (user != null) {
+ // Link the creator with the user
+ creator.setName(user.getDisplayName());
+ creator.setEmail(user.getEmail());
+ creator.setUserAccount(user);
+ }
+ poll.setCreator(creator);
+ return poll;
}
@Override
@@ -69,6 +81,9 @@
PollenDAOHelper.getPollDAO(transaction).create(poll);
+ // need to create uid for both poll and creator
+ // need to create creator (name, email, user, admin)
+
transaction.commitTransaction();
}
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-30 09:40:14 UTC (rev 2982)
@@ -59,7 +59,10 @@
*/
@Override
public UserAccount getUserConnected() {
- return user;
+ if (isUserConnected()) {
+ return user;
+ }
+ return null;
}
/**
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-30 09:40:14 UTC (rev 2982)
@@ -312,6 +312,7 @@
*/
Object onActionFromLogout() {
user = null;
+ request.getSession(false).invalidate();
return Index.class;
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-30 09:40:14 UTC (rev 2982)
@@ -7,6 +7,7 @@
import org.apache.tapestry5.upload.services.UploadedFile;
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.entity.Choice;
+import org.chorem.pollen.entity.ChoiceImpl;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.ui.services.ServiceImage;
import org.slf4j.Logger;
@@ -231,28 +232,35 @@
setName(name);
}
+ protected Choice getChoice() {
+ if (choice == null) {
+ choice = new ChoiceImpl();
+ }
+ return choice;
+ }
+
public void setName(String name) {
- choice.setName(name);
+ getChoice().setName(name);
}
public String getName() {
- return choice.getName();
+ return getChoice().getName();
}
public void setDescription(String description) {
- choice.setDescription(description);
+ getChoice().setDescription(description);
}
public String getDescription() {
- return choice.getDescription();
+ return getChoice().getDescription();
}
public void setChoiceType(ChoiceType choiceType) {
- choice.setChoiceType(choiceType);
+ getChoice().setChoiceType(choiceType);
}
public ChoiceType getChoiceType() {
- return choice.getChoiceType();
+ return getChoice().getChoiceType();
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-04-30 09:40:14 UTC (rev 2982)
@@ -26,6 +26,8 @@
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PreventRule;
+import org.chorem.pollen.entity.PreventRuleImpl;
+import org.chorem.pollen.mail.PreventRuleManager;
import org.chorem.pollen.service.ServicePoll;
import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
@@ -103,6 +105,7 @@
* the pollUID exist.
*
* @return poll existing or a new one
+ * @throws PollenBusinessException
*/
public Poll getPoll() throws PollenBusinessException {
if (poll == null) {
@@ -116,17 +119,7 @@
if (log.isDebugEnabled()) {
log.debug("Init new poll");
}
- poll = servicePoll.getNewPoll();
-
- // FIXME : manage PollAccount creator
-
-// if (userExists) {
-// String creatorName =
-// user.getFirstName() + " " + user.getLastName();
-// poll.setCreatorName(creatorName);
-// poll.setCreatorEmail(user.getEmail());
-// poll.setUserId(user.getId());
-// }
+ poll = servicePoll.getNewPoll(getUserConnected());
}
}
return poll;
@@ -136,6 +129,7 @@
* Test if the form mode is for creation : new poll.
*
* @return true if it's the create mode, false otherwise
+ * @throws PollenBusinessException
*/
public boolean isCreateMode() throws PollenBusinessException {
return StringUtils.isEmpty(getPoll().getTopiaId());
@@ -145,6 +139,7 @@
* Page title for border component.
*
* @return the page title depends on create or update mode.
+ * @throws PollenBusinessException
*/
public String getPageTitle() throws PollenBusinessException {
String title = "";
@@ -337,9 +332,12 @@
*/
public PreventRule getNotification() {
if (notification == null) {
-// notification = new PreventRuleImpl("vote", 0, true,
-// PreventRuleManager.EMAIL_ACTION);
-// notification.set
+ // FIXME-FD20100430 : move this in business module
+ notification = new PreventRuleImpl();
+ notification.setScope("vote");
+ notification.setSensibility(0);
+ notification.setRepeated(true);
+ notification.setMethod(PreventRuleManager.EMAIL_ACTION);
}
return notification;
}
@@ -364,8 +362,12 @@
*/
public PreventRule getReminder() {
if (reminder == null) {
-// reminder = new PreventRuleDTO("rappel", 0, false,
-// PreventRuleManager.EMAIL_ACTION);
+ // FIXME-FD20100430 : move this in business module
+ reminder = new PreventRuleImpl();
+ reminder.setScope("rappel");
+ reminder.setSensibility(0);
+ reminder.setRepeated(false);
+ reminder.setMethod(PreventRuleManager.EMAIL_ACTION);
}
return reminder;
}
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties 2010-04-30 09:40:14 UTC (rev 2982)
@@ -25,8 +25,8 @@
endDate-validate=La date de fin doit-\u00EAtre post\u00E9rieure \u00E0 la date de d\u00E9but.
pollType-label=Restriction des votants
pollType-help=<strong>Aucune</strong> : accessible \u00E0 tout le monde<br/><strong>Liste simple</strong> : accessible uniquement \u00E0 une liste de votants<br/><strong>Par groupes</strong> : accessible \u00E0 plusieurs listes de votants
-voteCounting-label=D\u00E9pouillement
-voteCounting-help=<strong>Normal</strong> : s\u00E9lection de 1 ou n choix parmis les choix possibles<br/><strong>Pourcentage</strong> : attribution d\'un pourcentage \u00E0 chaque choix<br/><strong>Condorcet</strong> : classement des choix par ordre de pr\u00E9f\u00E9rence<br/><strong>Nombre</strong> : R\u00E9ponse libre. Fait la somme et la moyenne des nombres.
+VoteCountingType-label=D\u00E9pouillement
+VoteCountingType-help=<strong>Normal</strong> : s\u00E9lection de 1 ou n choix parmis les choix possibles<br/><strong>Pourcentage</strong> : attribution d\'un pourcentage \u00E0 chaque choix<br/><strong>Condorcet</strong> : classement des choix par ordre de pr\u00E9f\u00E9rence<br/><strong>Nombre</strong> : R\u00E9ponse libre. Fait la somme et la moyenne des nombres.
# Labels for enums
PollType.FREE=Aucune
Modified: trunk/pollen-ui/src/main/webapp/js/pollForm.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/pollForm.js 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/webapp/js/pollForm.js 2010-04-30 09:40:14 UTC (rev 2982)
@@ -16,7 +16,7 @@
this.notificationFragmentId = 'notificationHidden';
// Attributes for voteCounting and choiceNb synchronization
- this.voteCounting = this.form.voteCounting;
+ this.voteCounting = this.form.voteCountingType;
this.voteCountingNormal = voteCountingNormal;
this.choiceNbFragmentId = 'choiceNbHidden';
this.choiceNb = this.form.choiceNb;
Modified: trunk/pollen-ui/src/main/webapp/poll/PollForm.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-04-30 08:47:02 UTC (rev 2981)
+++ trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-04-30 09:40:14 UTC (rev 2982)
@@ -1,13 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<t:border t:addressBar="addressBar" t:pageLogo="literal:Creation" t:pageBodyId="p-pollForm" t:pageTitle="prop:pageTitle"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
-<t:feedback t:id="feedback"/>
+
<h1 class="titlePoll">
<t:if t:test="createMode">
${message:mainTitle-create}
<p:else>${poll.title}</p:else>
</t:if>
</h1>
+
<t:zone t:id="mainZone" t:update="show">
<form t:type="form" t:id="mainForm" t:zone="mainZone" action="post">
<t:errors/>
1
0
Author: fdesbois
Date: 2010-04-30 10:47:02 +0200 (Fri, 30 Apr 2010)
New Revision: 2981
Url: http://chorem.org/repositories/revision/pollen/2981
Log:
Continue UserLists managment...
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/AbstractServiceTest.java
Removed:
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java
trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
trunk/pollen-business/src/main/xmi/pollen.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java
trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java
___________________________________________________________________
Modified: svn:keywords
- "Author Date Id Revision HeadURL"
+ Id
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java
___________________________________________________________________
Modified: svn:keywords
- "Author Date Id Revision HeadURL"
+ Author Date Id Revision HeadURL
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java
___________________________________________________________________
Modified: svn:keywords
- "Author Date Id Revision HeadURL"
+ Author Date Id Revision HeadURL
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -0,0 +1,24 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * FavoriteParticipantImpl
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class FavoriteParticipantImpl extends FavoriteParticipantAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getId() {
+ return getTopiaId();
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -57,7 +57,6 @@
public void setContext(PollenContext context) {
this.context = context;
- prepareFavoriteListBinder();
}
@Override
@@ -76,14 +75,6 @@
context.closeTransaction(transaction);
}
- protected void prepareFavoriteListBinder() {
- BinderBuilder builder = new BinderBuilder(PollAccount.class,
- PollAccount.LIST,
- PollAccount.NAME,
- PollAccount.USER_ACCOUNT);
- BinderProvider.registerBinder(builder, BINDER_CONTEXT_FAVORITE_LIST);
- }
-
/**
* Copy {@code source} user account to {@code destination} one.
* The email is lower cased in the {@code destination} user account.
@@ -227,7 +218,7 @@
// Execute create
UserAccount newUser = dao.create(user.getLogin());
copyUserAccount(user, newUser);
- user.setTopiaId(newUser.getTopiaId());
+// user.setTopiaId(newUser.getTopiaId());
transaction.commitTransaction();
}
@@ -318,9 +309,8 @@
// check favoriteList name exist for user
UserAccount user = list.getUserAccount();
int count = dao.createQuery().
- add(PollAccount.LIST, true).
- add(PollAccount.USER_ACCOUNT, user).
- add(PollAccount.NAME, list.getName()).
+ add(FavoriteList.USER_ACCOUNT, user).
+ add(FavoriteList.NAME, list.getName()).
executeCount();
// existing list found
if (count > 0) {
@@ -329,13 +319,10 @@
list.getName(), user.getDisplayName());
}
- // Create unique Id for the new List
- String UId = context.createPollenUrlId();
- FavoriteList newList = dao.create(UId);
- BinderProvider.getBinder(FavoriteList.class,
- BINDER_CONTEXT_FAVORITE_LIST).
- copy(list, newList);
- dao.update(newList);
+ FavoriteList newList = dao.create(
+ FavoriteList.USER_ACCOUNT, list.getUserAccount(),
+ FavoriteList.NAME, list.getName());
+// list.setTopiaId(newList.getTopiaId());
transaction.commitTransaction();
}
@@ -363,6 +350,7 @@
throws TopiaException {
FavoriteParticipant result = new FavoriteParticipantImpl();
result.setFavoriteList(list);
+ result.setWeight(1.);
return result;
}
@@ -370,7 +358,36 @@
protected void executeCreateFavoriteParticipant(TopiaContext transaction,
FavoriteParticipant participant)
throws PollenBusinessException, TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(transaction);
+
+ FavoriteList list = participant.getFavoriteList();
+// int count = dao.createQuery().
+// add(FavoriteParticipant.FAVORITE_LIST, list).
+// add(FavoriteParticipant.NAME, participant.getName()).
+// add(FavoriteParticipant.EMAIL, participant.getEmail()).
+// executeCount();
+// // existing participant found
+// if (count > 0) {
+// throw new PollenBusinessException(
+// PollenExceptionType.FAVORITE_PARTICIPANT_EXIST,
+// list.getName(), list.getName());
+// }
+
+ // Create newParticipant with naturalId
+ FavoriteParticipant newParticipant =
+ dao.create(FavoriteParticipant.FAVORITE_LIST, list,
+ FavoriteParticipant.NAME, participant.getName(),
+ FavoriteParticipant.EMAIL, participant.getEmail());
+
+ // Set other field
+ newParticipant.setWeight(participant.getWeight());
+
+ // Update input participant with new topiaId
+// participant.setTopiaId(newParticipant.getTopiaId());
+
+ transaction.commitTransaction();
}
@Override
@@ -397,9 +414,17 @@
FavoriteParticipantDAO dao =
PollenDAOHelper.getFavoriteParticipantDAO(transaction);
- Map<String, FavoriteParticipant> results = dao.findAllMappedByQuery(
- query, FavoriteParticipant.EMAIL, String.class);
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+ Map<String, FavoriteParticipant> results =
+ dao.findAllMappedByQuery(query);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Results : " + results);
+ }
+
return results;
}
Modified: trunk/pollen-business/src/main/xmi/pollen.properties
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-30 08:47:02 UTC (rev 2981)
@@ -13,4 +13,6 @@
org.chorem.pollen.entity.FavoriteList.attribute.name.tagvalue.naturalId=true
org.chorem.pollen.entity.FavoriteParticipant.attribute.favoriteList.tagvalue.naturalId=true
-org.chorem.pollen.entity.FavoriteParticipant.attribute.email.tagvalue.naturalId=true
\ No newline at end of file
+org.chorem.pollen.entity.FavoriteParticipant.attribute.name.tagvalue.naturalId=true
+org.chorem.pollen.entity.FavoriteParticipant.attribute.email.tagvalue.naturalId=true
+org.chorem.pollen.entity.FavoriteParticipant.attribute.email.tagvalue.notNull=false
\ No newline at end of file
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java
___________________________________________________________________
Modified: svn:keywords
- "Author Date Id Revision HeadURL"
+ Author Date Id Revision HeadURL
Copied: trunk/pollen-business/src/test/java/org/chorem/pollen/business/AbstractServiceTest.java (from rev 2973, trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java)
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/AbstractServiceTest.java (rev 0)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/AbstractServiceTest.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -0,0 +1,143 @@
+
+package org.chorem.pollen.business;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenBusinessException;
+import org.chorem.pollen.PollenContext;
+import org.chorem.pollen.PollenContextImpl;
+import org.chorem.pollen.PollenDAOHelper;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.entity.UserAccountDAO;
+import org.chorem.pollen.service.ServiceUserImpl;
+import org.junit.After;
+import org.junit.Ignore;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.util.ApplicationConfig;
+
+/**
+ * TestManager
+ *
+ * Created: 24 févr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+@Ignore
+public class AbstractServiceTest {
+
+ private static final Log log = LogFactory.getLog(AbstractServiceTest.class);
+
+ protected PollenContext context;
+
+ protected ServiceUserImpl serviceUser;
+
+ public void start(String dbname) throws IOException {
+ log.info("## START ## : " + dbname);
+
+ InputStream input = AbstractServiceTest.class.
+ getResourceAsStream("/PollenTest.properties");
+
+ Properties options = new Properties();
+ options.load(input);
+
+ ApplicationConfig config = new ApplicationConfig();
+ config.setOptions(options);
+ config.setOption(
+ "hibernate.connection.url",
+ "jdbc:h2:file:target/surefire-data/" + dbname
+ );
+
+ getContext().loadConfiguration(config);
+ getContext().start(getServiceUser());
+
+ // Set currentDate to 23/02/2010 for tests
+ Calendar calendar = new GregorianCalendar(2010, 1, 23, 0, 0, 0);
+ ((PollenContextImpl)getContext()).setCurrentDate(calendar.getTime());
+ }
+
+ @After
+ public void stop() throws IOException {
+ getContext().stop();
+ context = null;
+ serviceUser = null;
+ }
+
+ public PollenContext getContext() {
+ if (context == null) {
+ context = new PollenContextImpl();
+ }
+ return context;
+ }
+
+ public ServiceUserImpl getServiceUser() {
+ if (serviceUser == null) {
+ serviceUser = new ServiceUserImpl();
+ serviceUser.setContext(getContext());
+ }
+ return serviceUser;
+ }
+
+ public TopiaContext beginTransaction() throws TopiaException {
+ return getContext().beginTransaction();
+ }
+
+// public ServiceEmailImpl getServiceEmail() {
+// ServiceEmailImpl instance = new ServiceEmailImpl();
+// instance.setContext(getContext());
+// return instance;
+// }
+//
+// public ServicePollImpl getServicePoll() {
+// ServicePollImpl instance = new ServicePollImpl();
+// instance.setContext(getContext());
+// return instance;
+// }
+
+ /**
+ * Create a user :<br />
+ * <ul>
+ * <li>login : homer</li>
+ * <li>email : homer(a)simpson.us</li>
+ * <li>password : wouhou</li>
+ * </ul>
+ * You can decide if this user is an admin using {@code admin} argument.
+ *
+ * @param admin flag to create the user as an admin
+ * @return the new UserAccount created
+ * @throws TopiaException
+ * @throws PollenBusinessException
+ */
+ public UserAccount createUser(boolean admin)
+ throws TopiaException, PollenBusinessException {
+
+ UserAccount user = getServiceUser().getNewUser();
+ user.setLogin("homer");
+ user.setEmail("homer(a)simpson.us");
+ user.setNewPassword("wouhou");
+ user.setAdmin(admin);
+
+ getServiceUser().createUser(user);
+
+ TopiaContext transaction = getContext().beginTransaction();
+ try {
+ UserAccountDAO dao =
+ PollenDAOHelper.getUserAccountDAO(transaction);
+
+ UserAccount findUser = dao.findByLogin(user.getLogin());
+ return findUser;
+ } finally {
+ transaction.closeContext();
+ }
+ }
+
+}
Property changes on: trunk/pollen-business/src/test/java/org/chorem/pollen/business/AbstractServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: svn:mergeinfo
+
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -20,7 +20,7 @@
public void execute() throws Exception {
transaction = null;
try {
- transaction = TestManager.beginTransaction();
+ //transaction = beginTransaction();
test();
Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -1,99 +0,0 @@
-
-package org.chorem.pollen.business;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Properties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.pollen.PollenContext;
-import org.chorem.pollen.PollenContextImpl;
-import org.chorem.pollen.service.ServiceEmail;
-import org.chorem.pollen.service.ServiceEmailImpl;
-import org.chorem.pollen.service.ServicePoll;
-import org.chorem.pollen.service.ServicePollImpl;
-import org.chorem.pollen.service.ServiceUser;
-import org.chorem.pollen.service.ServiceUserImpl;
-import org.junit.Ignore;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.util.ApplicationConfig;
-
-/**
- * TestManager
- *
- * Created: 24 févr. 2010
- *
- * @author fdesbois
- * @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
- */
-@Ignore
-public class TestManager {
-
- private static final Log log = LogFactory.getLog(TestManager.class);
-
- private static PollenContext context;
-
- public static void start(String dbname) throws IOException {
- log.info("## START ## : " + dbname);
-
- InputStream input = TestManager.class.
- getResourceAsStream("/PollenTest.properties");
-
- Properties options = new Properties();
- options.load(input);
-
- ApplicationConfig config = new ApplicationConfig();
- config.setOptions(options);
- config.setOption(
- "hibernate.connection.url",
- "jdbc:h2:file:target/surefire-data/" + dbname
- );
-
- getContext().loadConfiguration(config);
- getContext().start(getServiceUser());
-
- // Set currentDate to 23/02/2010 for tests
- Calendar calendar = new GregorianCalendar(2010, 1, 23, 0, 0, 0);
- ((PollenContextImpl)getContext()).setCurrentDate(calendar.getTime());
- }
-
- public static void stop() throws IOException {
- getContext().stop();
- }
-
- public static PollenContext getContext() {
- if (context == null) {
- context = new PollenContextImpl();
- }
- return context;
- }
-
- public static TopiaContext beginTransaction() throws TopiaException {
- return getContext().beginTransaction();
- }
-
- public static ServiceUserImpl getServiceUser() {
- ServiceUserImpl instance = new ServiceUserImpl();
- instance.setContext(getContext());
- return instance;
- }
-
- public static ServiceEmailImpl getServiceEmail() {
- ServiceEmailImpl instance = new ServiceEmailImpl();
- instance.setContext(getContext());
- return instance;
- }
-
- public static ServicePollImpl getServicePoll() {
- ServicePollImpl instance = new ServicePollImpl();
- instance.setContext(getContext());
- return instance;
- }
-
-}
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -1,22 +1,17 @@
package org.chorem.pollen.service;
-import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenDAOHelper;
import org.chorem.pollen.PollenException;
-import org.chorem.pollen.business.TestManager;
+import org.chorem.pollen.business.AbstractServiceTest;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
-import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
@@ -24,46 +19,24 @@
*
* @author fdesbois
*/
-public class ServiceUserImplTest {
+public class ServiceUserImplTest extends AbstractServiceTest {
private static final Log log = LogFactory.getLog(ServiceUserImplTest.class);
-
- public ServiceUserImplTest() {
- }
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
-
- @Before
- public void setUp() {
- }
-
- @After
- public void tearDown() throws IOException {
- TestManager.stop();
- }
-
+
@Test
public void testCopyUserAccount() throws Exception {
- TestManager.start("testManageNewPassword");
-
- ServiceUserImpl serviceUser = TestManager.getServiceUser();
+ start("testManageNewPassword");
- UserAccount user = serviceUser.getNewUser();
+ UserAccount user = getServiceUser().getNewUser();
user.setLogin("homer");
user.setNewPassword("wouhou");
log.info("test 1 : Encode new password");
UserAccount destination = new UserAccountImpl();
- serviceUser.copyUserAccount(user, destination);
+ getServiceUser().copyUserAccount(user, destination);
Assert.assertNotNull(destination.getPassword());
- String expected = TestManager.getContext().encodePassword("wouhou");
+ String expected = getContext().encodePassword("wouhou");
Assert.assertEquals(expected, destination.getPassword());
log.info("test 2 : Do not encode new password -> newPassword empty");
@@ -75,19 +48,16 @@
@Test
public void testCheckPassword() throws Exception {
- TestManager.start("testCheckPassword");
+ start("testCheckPassword");
- ServiceUserImpl serviceUser = TestManager.getServiceUser();
-
- UserAccount user = serviceUser.getNewUser();
+ UserAccount user = getServiceUser().getNewUser();
user.setLogin("homer");
user.setNewPassword("wouhou");
- serviceUser.createUser(user);
+ getServiceUser().createUser(user);
- String encodedPassword =
- TestManager.getContext().encodePassword("wouhou");
+ String encodedPassword = getContext().encodePassword("wouhou");
- TopiaContext transaction = TestManager.beginTransaction();
+ TopiaContext transaction = beginTransaction();
try {
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
@@ -112,32 +82,28 @@
*/
@Test
public void testExecuteConnect() throws Exception {
- TestManager.start("testExecuteConnect");
+ start("testExecuteConnect");
- ServiceUser serviceUser = TestManager.getServiceUser();
+ // The password is wouhou and login is homer
+ UserAccount user = createUser(false);
- UserAccount user = serviceUser.getNewUser();
- user.setLogin("hsimpson");
- user.setEmail("hsimpson(a)springfield.us");
- user.setNewPassword("wouhou");
- serviceUser.createUser(user);
-
log.info("test 1 : Connection OK");
- UserAccount connected = serviceUser.connect("hsimpson", "wouhou");
+ UserAccount connected = getServiceUser().connect("homer", "wouhou");
Assert.assertEquals(user, connected);
log.info("test 2 : Connection problem on login -> user not exist");
try {
- serviceUser.connect("homer", "wouhou");
+ getServiceUser().connect("marge", "wouhou");
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_NOT_EXIST,
eee.getType());
}
- log.info("test 3 : Connection problem on password -> don't match with login");
+ log.info("test 3 : Connection problem on password -> " +
+ "don't match with login");
try {
- serviceUser.connect("hsimpson", "coucou");
+ getServiceUser().connect("homer", "coucou");
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
@@ -150,10 +116,9 @@
*/
@Test
public void testExecuteGetNewUser() throws Exception {
- TestManager.start("testGetNewUser");
- ServiceUser serviceUser = TestManager.getServiceUser();
+ start("testGetNewUser");
- UserAccount user = serviceUser.getNewUser();
+ UserAccount user = getServiceUser().getNewUser();
Assert.assertNotNull(user);
Assert.assertEquals(false, user.getAdmin());
}
@@ -163,31 +128,29 @@
*/
@Test
public void testExecuteCreateUser() throws Exception {
- TestManager.start("testCreateUser");
- ServiceUser serviceUser = TestManager.getServiceUser();
+ start("testCreateUser");
- UserAccount user = serviceUser.getNewUser();
+ UserAccount user = getServiceUser().getNewUser();
user.setLogin("hsimpson");
user.setEmail("hsimpson(a)springfield.us");
user.setNewPassword("wouhou");
- String encodedPassword =
- TestManager.getContext().encodePassword("wouhou");
+ String encodedPassword = getContext().encodePassword("wouhou");
log.info("test 1 : Creation OK");
- serviceUser.createUser(user);
- Assert.assertNotNull(user.getTopiaId());
+ getServiceUser().createUser(user);
+ //Assert.assertNotNull(user.getTopiaId());
Assert.assertNotSame(encodedPassword, user.getPassword());
log.info("test 2 : Creation problem on login -> user exist");
- UserAccount user2 = serviceUser.getNewUser();
+ UserAccount user2 = getServiceUser().getNewUser();
user2.setLogin("hsimpson");
// Not the same email
user2.setEmail("hsimpson(a)springfield.com");
user2.setNewPassword("troubidou");
try {
- serviceUser.createUser(user2);
+ getServiceUser().createUser(user2);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_LOGIN_EXIST,
@@ -195,13 +158,13 @@
}
log.info("test 3 : Creation problem on email -> user exist");
- UserAccount user3 = serviceUser.getNewUser();
+ UserAccount user3 = getServiceUser().getNewUser();
user3.setLogin("homer");
user3.setEmail("hsimpson(a)springfield.us");
user3.setNewPassword("troubidou");
try {
- serviceUser.createUser(user3);
+ getServiceUser().createUser(user3);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_EMAIL_EXIST,
@@ -209,11 +172,11 @@
}
log.info("test 4 : Creation OK with no email");
- UserAccount user4 = serviceUser.getNewUser();
+ UserAccount user4 = getServiceUser().getNewUser();
user4.setLogin("marge");
user4.setNewPassword("troubidou");
- serviceUser.createUser(user4);
+ getServiceUser().createUser(user4);
Assert.assertNull(user4.getEmail());
}
@@ -222,27 +185,26 @@
*/
@Test
public void testExecuteUpdateUser() throws Exception {
- TestManager.start("testUpdateUser");
- ServiceUser serviceUser = TestManager.getServiceUser();
+ start("testUpdateUser");
- UserAccount user1 = serviceUser.getNewUser();
+ UserAccount user1 = getServiceUser().getNewUser();
user1.setLogin("hsimpson");
user1.setEmail("hsimpson(a)springfield.us");
user1.setNewPassword("wouhou");
- serviceUser.createUser(user1);
+ getServiceUser().createUser(user1);
- UserAccount user2 = serviceUser.getNewUser();
+ UserAccount user2 = getServiceUser().getNewUser();
String user2Password = "wouhou";
user2.setLogin("homer");
user2.setEmail("hsimpson(a)springfield.fr");
user2.setNewPassword(user2Password);
- serviceUser.createUser(user2);
+ getServiceUser().createUser(user2);
log.info("test 1 : Can't change login -> don't match with password");
user2.setLogin("homersimpson");
user2.setPassword(user2Password);
try {
- serviceUser.updateUser(user2, false);
+ getServiceUser().updateUser(user2, false);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
@@ -253,13 +215,13 @@
log.info("test 2 : Change email OK");
user2.setEmail("homersimpson(a)springield.fr");
user2.setPassword(user2Password);
- serviceUser.updateUser(user2, false);
+ getServiceUser().updateUser(user2, false);
log.info("test 3 : Change email problem -> user exist");
user2.setEmail(user1.getEmail());
user2.setPassword(user2Password);
try {
- serviceUser.updateUser(user2, false);
+ getServiceUser().updateUser(user2, false);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_EMAIL_EXIST,
@@ -275,26 +237,25 @@
*/
@Test
public void testExecuteDeleteUser() throws Exception {
- TestManager.start("testUpdateUser");
- ServiceUser serviceUser = TestManager.getServiceUser();
+ start("testUpdateUser");
try {
- serviceUser.deleteUser("test");
+ getServiceUser().deleteUser("test");
} catch (PollenException eee) {
log.error(eee);
Assert.assertEquals(IllegalArgumentException.class,
eee.getCause().getClass());
}
- UserAccount user = serviceUser.getNewUser();
+ UserAccount user = getServiceUser().getNewUser();
user.setLogin("user");
- serviceUser.createUser(user);
+ getServiceUser().createUser(user);
- serviceUser.deleteUser("user");
+ getServiceUser().deleteUser("user");
TopiaContext transaction = null;
try {
- transaction = TestManager.beginTransaction();
+ transaction = beginTransaction();
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
UserAccount userFound = dao.findByLogin("user");
Assert.assertNull(userFound);
@@ -303,60 +264,14 @@
}
}
- /**
- * Test of executeGetUsers method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteGetUsers() throws Exception {
- System.out.println("executeGetUsers");
- }
+ @Test
+ public void testCreateFavoriteParticipant() throws Exception {
+ start("testCreateFavoriteParticipant");
+
+ UserAccount user = createUser(false);
- /**
- * Test of executeGetNewList method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteGetNewList() throws Exception {
- System.out.println("executeGetNewList");
+ // TODO : test on naturalId and nullity
+
}
- /**
- * Test of executeCreateUpdateList method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteCreateUpdateList() throws Exception {
- System.out.println("executeCreateUpdateList");
- }
-
- /**
- * Test of executeDeleteList method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteDeleteList() throws Exception {
- System.out.println("executeDeleteList");
- }
-
- /**
- * Test of executeGetFavoriteLists method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteGetFavoriteLists() throws Exception {
- System.out.println("executeGetFavoriteLists");
- }
-
- /**
- * Test of executeGetNewPerson method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteGetNewPerson() throws Exception {
- System.out.println("executeGetNewPerson");
- }
-
- /**
- * Test of executeGetPerson method, of class ServiceUserImpl.
- */
- //@Test
- public void testExecuteGetPerson() throws Exception {
- System.out.println("executeGetPerson");
- }
-
}
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -44,19 +44,20 @@
@Inject
private ServiceUser serviceUser;
+ @Persist
@Property
private FavoriteList favoriteListSelected;
private EvenOdd evenOdd;
@Persist
- private FavoriteParticipantDataSource accounts;
+ private FavoriteParticipantDataSource participants;
@Property
- private FavoriteParticipant account;
+ private FavoriteParticipant participant;
@Property
- private FavoriteParticipant newAccount;
+ private FavoriteParticipant newParticipant;
@InjectComponent
private Zone updateZone;
@@ -76,28 +77,32 @@
return favoriteListSelected != null;
}
- public FavoriteParticipantDataSource getAccounts() {
- if (accounts == null) {
+ public FavoriteParticipantDataSource getParticipants() {
+ if (participants == null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Create DATASOURCE");
+ }
Filter filter = new Filter();
filter.setReference(favoriteListSelected);
- accounts = new FavoriteParticipantDataSource(serviceUser, filter);
+ participants =
+ new FavoriteParticipantDataSource(serviceUser, filter);
}
- return accounts;
+ return participants;
}
- void onActionFromRemoveAccount(String UId) {
+ void onActionFromRemoveParticipant(String UId) {
// NEED DELETE ACCOUNT FOR LIST
}
- void onPrepareFromAddAccount() {
- if (newAccount == null) {
- newAccount =
+ void onPrepareFromAddParticipant() {
+ if (newParticipant == null) {
+ newParticipant =
serviceUser.getNewFavoriteParticipant(favoriteListSelected);
}
}
- Object onSuccessFromAddAccount() {
- // NEED CREATE ACCOUNT FOR LIST
+ Object onSuccessFromAddParticipant() {
+ serviceUser.createFavoriteParticipant(newParticipant);
return updateZone.getBody();
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -1,32 +1,7 @@
-/*
- * #%L
- * Wao :: Web Interface
- *
- * $Id$
- * $HeadURL: svn+ssh://fdesbois@labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/AbstractMappedGridDataSource.java $
- * %%
- * Copyright (C) 2009 - 2010 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
package org.chorem.pollen.ui.data;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
@@ -49,13 +24,17 @@
* @param <E> Type of the map value
* @author fdesbois <fdesbois(a)codelutin.com>
*/
-public abstract class AbstractMappedGridDataSource<K, E extends TopiaEntity> implements GridDataSource {
+public abstract class AbstractMappedGridDataSource<K, E extends TopiaEntity>
+ implements GridDataSource {
- private Logger log = LoggerFactory.getLogger(AbstractMappedGridDataSource.class);
+ private Logger log =
+ LoggerFactory.getLogger(AbstractMappedGridDataSource.class);
private Map<K, E> mapResults;
+ private List<E> listResults;
+
private int nbRows = -1;
private int nbRowsPerPage;
@@ -65,8 +44,8 @@
if (nbRows < 0) {
try {
nbRows = count();
- if (log.isTraceEnabled()) {
- log.trace("Count : " + nbRows);
+ if (log.isDebugEnabled()) {
+ log.debug("Count : " + nbRows);
}
} catch (PollenException eee) {
throw new TapestryException("", eee);
@@ -76,14 +55,15 @@
}
@Override
- public void prepare(int startIndex, int endIndex, List<SortConstraint> sortConstraints) {
- if (log.isTraceEnabled()) {
- log.trace("Prepare results : " + startIndex + ", " + endIndex);
+ public void prepare(int startIndex, int endIndex,
+ List<SortConstraint> sortConstraints) {
+ if (log.isDebugEnabled()) {
+ log.debug("Prepare results : " + startIndex + ", " + endIndex);
}
nbRowsPerPage = endIndex - startIndex + 1;
try {
mapResults = execute(startIndex, endIndex, getSortConstraint(sortConstraints));
-
+ listResults = new ArrayList<E>(mapResults.values());
} catch (PollenException eee) {
throw new TapestryException("", eee);
}
@@ -123,17 +103,17 @@
}
return filterOrder;
}
-
+
@Override
public Object getRowValue(int index) {
index = index % nbRowsPerPage;
- if (index >= mapResults.size()) {
+ if (index >= listResults.size()) {
if (log.isErrorEnabled()) {
- log.error("Size error : " + index + " / " + mapResults.size());
+ log.error("Size error : " + index + " / " + listResults.size());
}
return null;
}
- return CollectionUtils.get(mapResults, index);
+ return CollectionUtils.get(listResults, index);
}
@Override
@@ -143,8 +123,8 @@
return mapResults.get(key);
}
- public Collection<E> values() {
- return mapResults.values();
+ public List<E> values() {
+ return listResults;
}
public boolean contains(K key) {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java 2010-04-30 08:47:02 UTC (rev 2981)
@@ -8,6 +8,8 @@
import org.chorem.pollen.entity.FavoriteParticipant;
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.service.ServiceUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* UserAccountDataSource
@@ -23,6 +25,9 @@
public class FavoriteParticipantDataSource extends
AbstractMappedGridDataSource<String, FavoriteParticipant> {
+ private static final Logger logger =
+ LoggerFactory.getLogger(FavoriteParticipantDataSource.class);
+
private ServiceUser service;
private Filter filter;
@@ -39,6 +44,9 @@
filter.setStartIndex(startIndex);
filter.setEndIndex(endIndex);
filter.setOrderBy(resolveOrderBy(orderBy));
+ if (logger.isDebugEnabled()) {
+ logger.debug("LOAD DATA");
+ }
return service.getFavoriteParticipants(filter);
}
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-30 08:47:02 UTC (rev 2981)
@@ -36,7 +36,7 @@
pollen.ui.list.create.success=La liste %1$s a \u00E9t\u00E9 cr\u00E9\u00E9e avec succ\u00E8s.
pollen.ui.list.update.notSelected=Aucune liste s\u00E9lectionn\u00E9e.
pollen.ui.list.update.emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email.
-pollen.ui.list.update.addAccount=Ajouter un nouvel utilisateur \u00E0 la liste
+pollen.ui.list.update.addParticipant=Ajouter un nouvel utilisateur \u00E0 la liste
# FORM:: user
firstName-label=Pr\u00E9nom
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-29 06:05:03 UTC (rev 2980)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-30 08:47:02 UTC (rev 2981)
@@ -13,11 +13,11 @@
<t:if test="canDisplayAccounts()">
<t:zone t:id="updateZone" show="show" update="show">
<!-- Display all Accounts child of favoriteListSelected -->
- <div t:type="grid" t:source="accounts.values()" t:row="account"
+ <div t:type="grid" t:source="participants" t:row="participant"
t:include="name, email, weight" t:add="actions"
t:rowsPerPage="20" t:rowClass="prop:evenodd.next" t:inPlace="true">
<p:actionsCell>
- <a t:type="actionlink" t:id="removeAccount" t:context="account.UId">
+ <a t:type="actionlink" t:id="removeParticipant" t:context="participant.id">
<img src="${asset:context:img/delete.png}" alt="${message:pollen.ui.list.remove}"/>
</a>
</p:actionsCell>
@@ -26,22 +26,21 @@
</p:empty>
</div>
- <!-- Add a new PollAccount to favoriteListSelected -->
- <form t:type="form" t:id="addAccount" t:zone="updateZone" action="tapestry">
+ <!-- Add a new FavoriteParticipant to favoriteListSelected -->
+ <form t:type="form" t:id="addParticipant" t:zone="updateZone" action="tapestry">
<table class="t-data-grid">
<tr>
<td class="votingId">
- <input t:type="textfield" t:id="name" t:value="newAccount.name" t:validate="required" size="10"/>
+ <input t:type="textfield" t:id="name" t:value="newParticipant.name" t:validate="required" size="10"/>
</td>
<td class="email">
- <input t:type="textfield" t:id="email" t:value="newAccount.email" t:validate="email" size="15"/>
+ <input t:type="textfield" t:id="email" t:value="newParticipant.email" t:validate="regexp" size="15"/>
</td>
<td class="weight">
- <input t:type="textfield" t:id="weight" t:value="newAccount.weight" size="5"/>
+ <input t:type="textfield" t:id="weight" t:value="newParticipant.weight" size="5"/>
</td>
<td class="functions">
- <input t:type="hidden" value="newAccount.list" />
- <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.list.update.addAccount}"/>
+ <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.list.update.addParticipant}"/>
</td>
</tr>
</table>
1
0
Author: tchemit
Date: 2010-04-29 08:05:03 +0200 (Thu, 29 Apr 2010)
New Revision: 2980
Log:
use i18n 1.2.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-29 05:45:52 UTC (rev 2979)
+++ trunk/pom.xml 2010-04-29 06:05:03 UTC (rev 2980)
@@ -311,7 +311,7 @@
<!--javadoc.version>2.4</javadoc.version-->
<topia.version>2.4-SNAPSHOT</topia.version>
<eugene.version>2.0.2-SNAPSHOT</eugene.version>
- <i18n.version>1.2.1</i18n.version>
+ <i18n.version>1.2.2</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
<nuiton-utils.version>1.2.2</nuiton-utils.version>
<processor.version>1.0.2</processor.version>
1
0
Author: tchemit
Date: 2010-04-29 07:45:52 +0200 (Thu, 29 Apr 2010)
New Revision: 2979
Log:
Utilisation de mavenpom4redmine 2.1.3
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-28 14:05:02 UTC (rev 2978)
+++ trunk/pom.xml 2010-04-29 05:45:52 UTC (rev 2979)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.1.2</version>
+ <version>2.1.3</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r2978 - in trunk/pollen-business/src: main/java/org/chorem/pollen main/java/org/chorem/pollen/bean main/java/org/chorem/pollen/entity main/java/org/chorem/pollen/service test/java/org/chorem/pollen
by fdesbois@users.chorem.org 28 Apr '10
by fdesbois@users.chorem.org 28 Apr '10
28 Apr '10
Author: fdesbois
Date: 2010-04-28 16:05:02 +0200 (Wed, 28 Apr 2010)
New Revision: 2978
Log:
- Clean old PropertyNameProvider
- Add a new api for building query using QueryBuilder and EntityQueryProperty
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java
trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java
trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java
Removed:
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java (from rev 2977, trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java)
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/EntityQueryProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -0,0 +1,209 @@
+
+package org.chorem.pollen;
+
+import org.nuiton.topia.framework.*;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * EntityQueryProperty is used to simplify property concatenation in TopiaQuery.
+ * The usage is simple, the EntityQueryProperty need a mainAlias which represents
+ * the entity in a TopiaQuery. Then the {@link #nameProperty(String)}
+ * is called to retrieve the correct property name used for the query.
+ * Exemple :
+ * <pre>
+ * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext);
+ *
+ * // Property used in the query
+ * EntityQueryProperty boatProperty = new EntityQueryProperty("B");
+ *
+ * // It's better to create the query with the property name
+ * TopiaQuery query = dao.createQuery(boatProperty.name());
+ *
+ * // The property NAME of the boat need to be find equals to "ULUBERLU"
+ * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU");
+ *
+ * // It's avoid doing this :
+ * query.add("B." + Boat.NAME, "ULUBERLU");
+ * </pre>
+ * This last exemple is a simple case but for a more complex query with more
+ * than one entity, it's obvious that concatenation using + is not a good
+ * practice.<br />
+ * You can also use this class as a superclass for each entity, ex :
+ * <pre>
+ * public class BoatProperty extends EntityQueryProperty {
+ *
+ * public BoatProperty(String mainAlias) {
+ * super(mainAlias);
+ * }
+ *
+ * public String namePropertyName() {
+ * return nameProperty(Boat.NAME);
+ * }
+ * }
+ * </pre>
+ *
+ * Created: 14 avr. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class EntityQueryProperty {
+
+ /** alias of the entity **/
+ protected String mainAlias;
+
+ /** name of the property used for join in query **/
+ protected String propertyJoin;
+
+ /** class of the entity **/
+ protected Class<? extends TopiaEntity> entityClass;
+
+ /**
+ * Default constructor. mainAlias, propertyJoin and entityClass are null.
+ * You can use setters to initalize these three properties.
+ * You can use {@link #nameProperty(String)} method with a mainAlias null.
+ */
+ public EntityQueryProperty() {
+ }
+
+ /**
+ * Constructor with mainAlias.
+ *
+ * @param mainAlias of the entity corresponding to this EntityQueryProperty
+ */
+ public EntityQueryProperty(String mainAlias) {
+ setMainAlias(mainAlias);
+ }
+
+ /**
+ * Constructor with mainAlias and entityClass.
+ *
+ * @param mainAlias alias of the entity corresponding to this
+ * EntityQueryProperty
+ * @param entityClass class of the entity corresponding to this
+ * EntityQueryProperty
+ */
+ public EntityQueryProperty(String mainAlias,
+ Class<? extends TopiaEntity> entityClass) {
+ this(mainAlias);
+ setEntityClass(entityClass);
+ }
+
+ /**
+ * Setter for mainAlias.
+ *
+ * @param mainAlias of the entity corresponding to this EntityQueryProperty
+ */
+ public void setMainAlias(String mainAlias) {
+ this.mainAlias = mainAlias;
+ }
+
+ /**
+ * Setter for propertyJoin.
+ *
+ * @param propertyName name of the property used for join
+ * @see #namePropertyJoin()
+ */
+ public void setPropertyJoin(String propertyName) {
+ this.propertyJoin = propertyName;
+ }
+
+ /**
+ * Setter for entityClass.
+ *
+ * @param entityClass class of the entity corresponding to this
+ * EntityQueryProperty
+ */
+ public void setEntityClass(Class<? extends TopiaEntity> entityClass) {
+ this.entityClass = entityClass;
+ }
+
+ /**
+ * Name the entity as a property for a TopiaQuery. Careful, this name can
+ * be null if no mainAlias is properly set.
+ *
+ * @return the entity name to use in a TopiaQuery
+ */
+ public String name() {
+ return mainAlias;
+ }
+
+ /**
+ * Name a property from the Entity for a TopiaQuery. No matter if the
+ * mainAlias is null or not, the property will be correctly named.
+ *
+ * @param propertyName to named in the TopiaQuery
+ * @return the property name to use in a TopiaQuery
+ */
+ public String nameProperty(String propertyName) {
+ return TopiaQuery.getProperty(mainAlias, propertyName);
+ }
+
+ /**
+ * Name the property Id (TOPIA_ID) of the entity.
+ *
+ * @return the property name to use in a TopiaQuery
+ */
+ public String namePropertyId() {
+ return nameProperty(TopiaEntity.TOPIA_ID);
+ }
+
+ /**
+ * Name the property CreateDate (TOPIA_CREATE_DATE) of the entity.
+ *
+ * @return the property name to use in a TopiaQuery
+ */
+ public String namePropertyCreateDate() {
+ return nameProperty(TopiaEntity.TOPIA_CREATE_DATE);
+ }
+
+ /**
+ * Name the property join. The propertyJoin attribute need to be set to
+ * avoid NullPointerException.
+ *
+ * @return the property name to use in a TopiaQuery
+ */
+ public String namePropertyJoin() {
+ if (propertyJoin == null) {
+ throw new NullPointerException("propertyJoin is not set");
+ }
+ return nameProperty(propertyJoin);
+ }
+
+ /**
+ * Get the entityClass associated with this EntityQueryProperty.
+ * Can be useful in some case, to create other query for exemple or to
+ * use it in {@link TopiaQuery#addFrom(Class)} method.
+ * The entityClass need to be set before calling this method to avoid
+ * NullPointerException.
+ *
+ * @return the entity class corresponding to this EntityQueryProperty.
+ */
+ public Class<? extends TopiaEntity> getEntityClass() {
+ if (entityClass == null) {
+ throw new NullPointerException("entitClass is not set");
+ }
+ return entityClass;
+ }
+
+ /**
+ * Instanciate a new {@link TopiaQuery} based on this EntityQueryProperty.
+ * The entityClass need to be set although the TopiaQuery can't be
+ * instantiate.
+ *
+ * @return a new TopiaQuery with the main entity as the EntityQueryProperty
+ * provides it.
+ */
+ public TopiaQuery newQuery() {
+ return new TopiaQuery(getEntityClass(), name());
+ }
+
+ /**
+ * Simply the main name (mainAlias) of the EntityQueryProperty.
+ *
+ * @return the entity name associated to this EntityQueryProperty
+ */
+ @Override
+ public String toString() {
+ return name();
+ }
+}
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -0,0 +1,57 @@
+
+package org.chorem.pollen;
+
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.FavoriteList;
+import org.chorem.pollen.entity.FavoriteParticipant;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaDAO;
+
+/**
+ * PollenQueryBuilder
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class PollenQueryBuilder extends TopiaQueryBuilder {
+
+ public PollenQueryBuilder() {
+ super();
+ }
+
+ public PollenQueryBuilder(TopiaDAO<?> dao) {
+ super(dao);
+ }
+
+ public EntityQueryProperty getFavoriteListProperty(String alias) {
+ return getEntityProperty(FavoriteList.class, alias);
+ }
+
+ public EntityQueryProperty getFavoriteParticipantProperty(
+ String alias) {
+ return getEntityProperty(FavoriteParticipant.class, alias);
+ }
+
+ public TopiaQuery createQueryFindFavoriteParticipantsByFavoriteList(
+ Filter filter) {
+
+ EntityQueryProperty participantProperty =
+ getFavoriteParticipantProperty("P");
+
+ EntityQueryProperty listProperty =
+ getFavoriteListProperty("L");
+
+ listProperty.setPropertyJoin(FavoriteList.FAVORITE_PARTICIPANT);
+
+ createQueryFindElementsByCollection(
+ participantProperty, listProperty, filter);
+
+ return query;
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenQueryBuilder.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -0,0 +1,168 @@
+
+package org.chorem.pollen;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.chorem.pollen.bean.Filter;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * TopiaQueryBuilder is used to build a TopiaQuery. <br />
+ * Convention rules :
+ * <ul>
+ * <li>method with prefix {@code prepare} will modify the current query</li>
+ * <li>method with prefix {@code create} will instantiate a new query</li>
+ * </ul>
+ * <br />
+ * To use directly {@code prepare} methods, you have to set the query using
+ * {@link #setQuery(TopiaQuery)} or instantiate the builder with the entity
+ * dao using {@link #TopiaQueryBuilder(TopiaDAO)}, this will create a new query
+ * from dao.
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class TopiaQueryBuilder {
+
+ protected TopiaQuery query;
+
+ public TopiaQueryBuilder() {
+ }
+
+ /**
+ * This will create a new TopiaQuery from the {@code dao} in argument.
+ *
+ * @param dao used to create a new TopiaQuery in the builder
+ */
+ public TopiaQueryBuilder(TopiaDAO<?> dao) {
+ setQuery(dao.createQuery());
+ }
+
+ public static TopiaQueryBuilder newInstance() {
+ return new TopiaQueryBuilder();
+ }
+
+ /**
+ * This will create a new TopiaQueryBuilder with a new TopiaQuery from
+ * the {@code dao} in argument.
+ *
+ * @param dao used to create a new TopiaQuery in the builder
+ * @return a new instance of TopiaQueryBuilder
+ */
+ public static TopiaQueryBuilder newInstance(TopiaDAO<?> dao) {
+ return new TopiaQueryBuilder(dao);
+ }
+
+ public void setQuery(TopiaQuery query) {
+ this.query = query;
+ }
+
+ public TopiaQuery getQuery() {
+ return query;
+ }
+
+ public EntityQueryProperty getEntityProperty(String alias) {
+ return new EntityQueryProperty(alias);
+ }
+
+ public EntityQueryProperty getEntityProperty(
+ Class<? extends TopiaEntity> entityClass, String alias) {
+ return new EntityQueryProperty(alias, entityClass);
+ }
+
+ public EntityQueryProperty getMainProperty() {
+ return getEntityProperty(query.getMainAlias());
+ }
+
+ /**
+ * Create a TopiaQuery to find all participants of a list with
+ * {@code filter} constraints (order, limit indexes, listId).
+ *
+ * @param filter used to add constraint in the query
+ * @param element
+ * @param collection
+ * @return the TopiaQuery created
+ * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid)
+ */
+ public TopiaQuery createQueryFindElementsByCollection(
+ EntityQueryProperty element,
+ EntityQueryProperty collection,
+ Filter filter) {
+
+ // Instanciate a new query based on element
+ query = element.newQuery();
+
+ // Add the collection in the From of the query
+ query.addFrom(collection.getEntityClass(), collection.name());
+
+ // Add the link between the collection and the element
+ query.addInElements(element.name(), collection.namePropertyJoin());
+
+ if (filter != null) {
+ // Add constraints from filter, the collection is given to provide
+ // the name of its ID property.
+ prepareQuery(filter, collection);
+ }
+
+ return query;
+ }
+
+ /**
+ * Prepare a query with filter : adding startIndex and endIndex as limit
+ * and orderBy if defined. Need an existing query in builder.
+ *
+ * @param filter Filter to add in the query
+ * @see #prepareQuery(Filter filter, EntityQueryProperty)
+ */
+ public void prepareQuery(Filter filter) {
+ prepareQuery(filter, null);
+ }
+
+ /**
+ * Prepare a query with filter. The {@code reference} is used
+ * to retrieve the name of ID property in case of filter using referenceId.
+ * Need an existing query in builder.
+ *
+ * @param filter Filter to add in the query
+ * @param reference used to filter on referenceId
+ */
+ public void prepareQuery(Filter filter,
+ EntityQueryProperty reference) {
+
+ Integer startIndex = filter.getStartIndex();
+ Integer endIndex = filter.getEndIndex();
+ String orderBy = filter.getOrderBy();
+ String referenceId = filter.getReferenceId();
+
+ // Add limits. Only startIndex do nothing.
+ // startIndex + endIndex provides the limit
+ if (filter.getStartIndex() != null && endIndex != null) {
+ query.setLimit(startIndex, endIndex);
+
+ // endIndex only provides the maxResults wanted
+ } else if (endIndex != null) {
+ query.setMaxResults(endIndex);
+ }
+
+ // Add order to the main entity in the query, splitted by comma
+ if (orderBy != null) {
+ List<String> order = new ArrayList<String>();
+ for (String elmt : orderBy.split(",")) {
+ order.add(getMainProperty().nameProperty(elmt.trim()));
+ }
+ query.addOrder(order.toArray(new String[order.size()]));
+
+ // Default order by creation date
+ } else {
+ query.addOrderDesc(getMainProperty().namePropertyCreateDate());
+ }
+
+ if (StringUtils.isNotEmpty(referenceId) && reference != null) {
+ query.add(reference.namePropertyId(), referenceId);
+ }
+ }
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/TopiaQueryBuilder.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -3,10 +3,6 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import org.apache.commons.lang.StringUtils;
-import org.chorem.pollen.entity.PropertyNameProviderImpl;
-import org.chorem.pollen.entity.PropertyNameProvider;
-import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.persistence.TopiaEntity;
/**
@@ -140,49 +136,4 @@
propertyChangeSupport.removePropertyChangeListener(listener);
}
- /**
- * Prepare a query with filter : adding startIndex and endIndex as limit
- * and orderBy if defined.
- *
- * @param query
- * @see #prepareQuery(TopiaQuery, PropertyUid)
- */
- public void prepareQuery(TopiaQuery query) {
- prepareQuery(query, null);
- }
-
- /**
- * Prepare a query with filter. The {@code property} is used
- * to retrieve the name of UID property in case of filter using uid.
- *
- * @param query to prepare
- * @param property to provide UID property name (using uid filter)
- */
- public void prepareQuery(TopiaQuery query, PropertyNameProvider property) {
- // Add limits. Only startIndex do nothing.
- // startIndex + endIndex provides the limit
- if (startIndex != null && endIndex != null) {
- query.setLimit(startIndex, endIndex);
-
- // endIndex only provides the maxResults wanted
- } else if (endIndex != null) {
- query.setMaxResults(endIndex);
- }
-
- if (StringUtils.isNotEmpty(referenceId) && property != null) {
- query.add(property.namePropertyId(), referenceId);
- }
-
- // Add order to the query, splitted by comma and trimmed using
- // {@link StringUtils#stripAll(String[])}
- if (orderBy != null) {
- String[] order = StringUtils.stripAll(orderBy.split(","));
- query.addOrder(order);
-
- // Default order by creation date
- } else {
- query.addOrderDesc(TopiaEntity.TOPIA_CREATE_DATE);
- }
- }
-
}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,23 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * FavoriteListProperty
- *
- * Created: 28 avr. 2010
- *
- * @author fdesbois
- */
-public class FavoriteListProperty extends PropertyNameProviderImpl
- implements ParticipantListProperty {
-
- public FavoriteListProperty(String mainAlias) {
- super(FavoriteList.class, mainAlias);
- }
-
- @Override
- public String namePropertyParticipant() {
- return nameProperty(FavoriteList.FAVORITE_PARTICIPANT);
- }
-
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,19 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-import org.nuiton.topia.persistence.TopiaEntity;
-
-/**
- * FavoriteParticipant
- *
- * Created: 28 avr. 2010
- *
- * @author fdesbois
- */
-public class FavoriteParticipantProperty extends PropertyNameProviderImpl
- implements ParticipantProperty {
-
- public FavoriteParticipantProperty(String mainAlias) {
- super(FavoriteParticipant.class, mainAlias);
- }
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,14 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * ParticipantListProperty
- *
- * Created: 28 avr. 2010
- *
- * @author fdesbois
- */
-public interface ParticipantListProperty extends PropertyNameProvider {
-
- String namePropertyParticipant();
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,13 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * ParticipantProperty
- *
- * Created: 28 avr. 2010
- *
- * @author fdesbois
- */
-public interface ParticipantProperty extends PropertyNameProvider {
-
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,21 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * PollAccountProperty
- *
- * Created: 27 avr. 2010
- *
- * @author fdesbois
- * @since 2.0
- */
-public class PollAccountProperty extends PropertyNameProviderImpl {
-
- public PollAccountProperty(String mainAlias) {
- super(PollAccount.class, mainAlias);
- }
-
- public String namePropertyChild() {
- return nameProperty(PollAccount.CHILD);
- }
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,26 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-/**
- * PropertyUid
- *
- * Created: 27 avr. 2010
- *
- * @author fdesbois
- * @since 2.0
- */
-public interface PropertyNameProvider {
-
- String name();
-
- String namePropertyId();
-
- String nameProperty(String propertyName);
-
- Class<? extends TopiaEntity> getEntityClass();
-
- TopiaQuery newQuery();
-}
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -1,110 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-import org.nuiton.topia.framework.*;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-/**
- * EntityProperty is used to simplify property concatenation in TopiaQuery.
- * The usage is simple, the EntityProperty need a mainAlias which represents
- * the entity in a TopiaQuery. Then the {@link #nameProperty(String)}
- * is called to retrieve the correct property name used for the query.
- * Exemple :
- * <pre>
- * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext);
- *
- * // Property used in the query
- * EntityProperty boatProperty = new EntityProperty("B");
- *
- * // It's better to create the query with the property name
- * TopiaQuery query = dao.createQuery(boatProperty.name());
- *
- * // The property NAME of the boat need to be find equals to "ULUBERLU"
- * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU");
- *
- * // It's avoid doing this :
- * query.add("B." + Boat.NAME, "ULUBERLU");
- * </pre>
- * This last exemple is a simple case but for a more complex query with more
- * than one entity, it's obvious that concatenation using + is not a good
- * practice.<br />
- * You can also use this class as a superclass for each entity, ex :
- * <pre>
- * public class BoatProperty extends EntityProperty {
- *
- * public BoatProperty(String mainAlias) {
- * super(mainAlias);
- * }
- *
- * public String namePropertyName() {
- * return nameProperty(Boat.NAME);
- * }
- * }
- * </pre>
- *
- * Created: 14 avr. 2010
- *
- * @author fdesbois <fdesbois(a)codelutin.com>
- */
-public class PropertyNameProviderImpl implements PropertyNameProvider {
-
- /** alias of the entity **/
- protected String mainAlias;
-
- protected Class<? extends TopiaEntity> entityClass;
-
- public PropertyNameProviderImpl(Class<? extends TopiaEntity> entityClass,
- String mainAlias) {
- this.mainAlias = mainAlias;
- this.entityClass = entityClass;
- }
-
- public void setMainAlias(String mainAlias) {
- this.mainAlias = mainAlias;
- }
-
- public void setEntityClass(Class<? extends TopiaEntity> entityClass) {
- this.entityClass = entityClass;
- }
-
- /**
- * Name the entity as a property for a TopiaQuery.
- *
- * @return the entity name used as a TopiaQuery property
- */
- @Override
- public String name() {
- return mainAlias;
- }
-
- /**
- * Name a property from the Entity for a TopiaQuery.
- *
- * @param propertyName to named in the TopiaQuery
- * @return the property name used as a TopiaQuery property
- */
- @Override
- public String nameProperty(String propertyName) {
- return TopiaQuery.getProperty(mainAlias, propertyName);
- }
-
- @Override
- public String namePropertyId() {
- return nameProperty(TopiaEntity.TOPIA_ID);
- }
-
- @Override
- public Class<? extends TopiaEntity> getEntityClass() {
- return entityClass;
- }
-
- @Override
- public TopiaQuery newQuery() {
- return new TopiaQuery(getEntityClass(), name());
- }
-
- @Override
- public String toString() {
- return name();
- }
-}
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-04-28 08:47:44 UTC (rev 2977)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -16,14 +16,14 @@
import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.entity.FavoriteListDAO;
import org.chorem.pollen.entity.FavoriteListImpl;
-import org.chorem.pollen.entity.FavoriteListProperty;
import org.chorem.pollen.entity.FavoriteParticipant;
import org.chorem.pollen.entity.FavoriteParticipantDAO;
import org.chorem.pollen.entity.FavoriteParticipantImpl;
-import org.chorem.pollen.entity.FavoriteParticipantProperty;
-import org.chorem.pollen.entity.ParticipantListProperty;
-import org.chorem.pollen.entity.ParticipantProperty;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.EntityQueryProperty;
+import org.chorem.pollen.PollenQueryBuilder;
+import org.chorem.pollen.TopiaQueryBuilder;
+import org.chorem.pollen.entity.PollAccountDAO;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
@@ -280,12 +280,12 @@
Filter filter) throws TopiaException {
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
- TopiaQuery query = dao.createQuery();
- filter.prepareQuery(query);
+ TopiaQueryBuilder builder = new TopiaQueryBuilder(dao);
+ builder.prepareQuery(filter);
- Map<String, UserAccount> results = dao.findAllMappedByQuery(query,
- UserAccount.LOGIN, String.class);
+ Map<String, UserAccount> results = dao.findAllMappedByQuery(
+ builder.getQuery(), UserAccount.LOGIN, String.class);
return results;
}
@@ -294,46 +294,14 @@
Filter filter) throws TopiaException {
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
- TopiaQuery query = dao.createQuery();
- filter.prepareQuery(query);
+ TopiaQueryBuilder builder = new TopiaQueryBuilder(dao);
+ builder.prepareQuery(filter);
- int result = query.executeCount();
+ int result = builder.getQuery().executeCount();
return result;
}
- /**
- * Create a TopiaQuery to find all participants of a list with
- * {@code filter} constraints (order, limit indexes, listId).
- *
- * @param filter used to add constraint in the query
- * @param participantPropertyProvider
- * @param listPropertyProvider
- * @return the TopiaQuery created
- * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid)
- */
- protected TopiaQuery createQueryFindParticipantsByList(
- Filter filter,
- ParticipantProperty participantPropertyProvider,
- ParticipantListProperty listPropertyProvider) {
-
- // Instanciate a new query based on participant
- TopiaQuery query = participantPropertyProvider.newQuery();
-
- // Add the list in the From of the query
- query.addFrom(listPropertyProvider.getEntityClass(), listPropertyProvider.name());
-
- // Add the link between the list and the participant
- query.addInElements(participantPropertyProvider.name(),
- listPropertyProvider.namePropertyParticipant());
-
- // Add constraints from filter, the listProperty is given to provide
- // the name of its ID property.
- filter.prepareQuery(query, listPropertyProvider);
-
- return query;
- }
-
@Override
protected FavoriteList executeGetNewFavoriteList(UserAccount user) {
FavoriteList result = new FavoriteListImpl();
@@ -345,31 +313,31 @@
protected void executeCreateFavoriteList(TopiaContext transaction,
FavoriteList list) throws TopiaException, PollenBusinessException {
-// PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
-//
-// // check favoriteList name exist for user
-// UserAccount user = list.getUserAccount();
-// int count = dao.createQuery().
-// add(PollAccount.LIST, true).
-// add(PollAccount.USER_ACCOUNT, user).
-// add(PollAccount.NAME, list.getName()).
-// executeCount();
-// // existing list found
-// if (count > 0) {
-// throw new PollenBusinessException(
-// PollenExceptionType.FAVORITE_LIST_NAME_EXIST,
-// list.getName(), user.getDisplayName());
-// }
-//
-// // Create unique Id for the new List
-// String UId = context.createPollenUrlId();
-// PollAccount newList = dao.create(UId);
-// BinderProvider.getBinder(PollAccount.class,
-// BINDER_CONTEXT_FAVORITE_LIST).
-// copy(list, newList);
-// dao.update(newList);
-//
-// transaction.commitTransaction();
+ FavoriteListDAO dao = PollenDAOHelper.getFavoriteListDAO(transaction);
+
+ // check favoriteList name exist for user
+ UserAccount user = list.getUserAccount();
+ int count = dao.createQuery().
+ add(PollAccount.LIST, true).
+ add(PollAccount.USER_ACCOUNT, user).
+ add(PollAccount.NAME, list.getName()).
+ executeCount();
+ // existing list found
+ if (count > 0) {
+ throw new PollenBusinessException(
+ PollenExceptionType.FAVORITE_LIST_NAME_EXIST,
+ list.getName(), user.getDisplayName());
+ }
+
+ // Create unique Id for the new List
+ String UId = context.createPollenUrlId();
+ FavoriteList newList = dao.create(UId);
+ BinderProvider.getBinder(FavoriteList.class,
+ BINDER_CONTEXT_FAVORITE_LIST).
+ copy(list, newList);
+ dao.update(newList);
+
+ transaction.commitTransaction();
}
@Override
@@ -420,17 +388,14 @@
@Override
protected Map<String, FavoriteParticipant> executeGetFavoriteParticipants(
TopiaContext transaction, Filter filter) throws TopiaException {
-
- FavoriteParticipantDAO dao =
- PollenDAOHelper.getFavoriteParticipantDAO(transaction);
- ParticipantProperty participantProperty =
- new FavoriteParticipantProperty("P");
+ PollenQueryBuilder builder = new PollenQueryBuilder();
- ParticipantListProperty listProperty = new FavoriteListProperty("L");
+ TopiaQuery query =
+ builder.createQueryFindFavoriteParticipantsByFavoriteList(filter);
- TopiaQuery query = createQueryFindParticipantsByList(filter,
- participantProperty, listProperty);
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(transaction);
Map<String, FavoriteParticipant> results = dao.findAllMappedByQuery(
query, FavoriteParticipant.EMAIL, String.class);
@@ -441,14 +406,14 @@
@Override
protected int executeGetNbFavoriteParticipants(TopiaContext transaction,
Filter filter) throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
-// PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
-//
-// TopiaQuery query = createQueryFindAccountsByList(dao, filter);
-//
-// int result = query.executeCount();
-// return result;
+ PollenQueryBuilder builder = new PollenQueryBuilder();
+
+ TopiaQuery query =
+ builder.createQueryFindFavoriteParticipantsByFavoriteList(filter);
+
+ int result = query.executeCount(transaction);
+ return result;
}
}
Added: trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java (rev 0)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java 2010-04-28 14:05:02 UTC (rev 2978)
@@ -0,0 +1,121 @@
+
+package org.chorem.pollen;
+
+import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.FavoriteList;
+import org.chorem.pollen.entity.FavoriteParticipant;
+import org.chorem.pollen.entity.UserAccount;
+import org.junit.Assert;
+import org.junit.Test;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ *
+ * @author fdesbois
+ */
+public class TopiaQueryBuilderTest {
+
+ private static final Log log =
+ LogFactory.getLog(TopiaQueryBuilderTest.class);
+
+ /**
+ * Test of prepareQuery method, of class Filter.
+ */
+ @Test
+ public void testPrepareQueryForFilter() {
+ log.info("testPrepareQueryForFilter");
+
+ Filter filter = new Filter();
+ filter.setStartIndex(1);
+ filter.setEndIndex(40);
+ filter.setOrderBy(UserAccount.LOGIN);
+
+ TopiaQueryBuilder builder = new TopiaQueryBuilder();
+ builder.setQuery(new TopiaQuery(UserAccount.class));
+ builder.prepareQuery(filter);
+
+ log.debug("Query : " + builder.getQuery());
+
+ Assert.assertEquals(builder.getQuery().fullQuery(),
+ "FROM " + UserAccount.class.getName() +
+ " ORDER BY " + UserAccount.LOGIN);
+
+ filter.setOrderBy(null);
+
+ builder.setQuery(new TopiaQuery(UserAccount.class));
+ builder.prepareQuery(filter);
+
+ log.debug("Query : " + builder.getQuery());
+
+ Assert.assertEquals(builder.getQuery().fullQuery(),
+ "FROM " + UserAccount.class.getName() +
+ " ORDER BY " + TopiaEntity.TOPIA_CREATE_DATE + " DESC");
+
+ }
+
+ @Test
+ public void testCreateQueryFindElementsByCollection() throws IOException {
+
+ TopiaQueryBuilder builder = new TopiaQueryBuilder();
+
+ Filter filter = new Filter();
+ filter.setStartIndex(1);
+ filter.setEndIndex(40);
+ filter.setOrderBy(FavoriteParticipant.NAME);
+
+ EntityQueryProperty participantPropertyProvider =
+ builder.getEntityProperty(FavoriteParticipant.class, "P");
+
+ EntityQueryProperty listPropertyProvider =
+ builder.getEntityProperty(FavoriteList.class, "L");
+ listPropertyProvider.setPropertyJoin(FavoriteList.FAVORITE_PARTICIPANT);
+
+ log.info("test1 : orderBy FavoriteParticipant name");
+ TopiaQuery result = builder.createQueryFindElementsByCollection(
+ participantPropertyProvider, listPropertyProvider, filter);
+
+ log.debug("Query : " + result);
+
+ Assert.assertEquals(result.fullQuery(),
+ "SELECT P FROM " + FavoriteParticipant.class.getName() + " P, "
+ + FavoriteList.class.getName() + " L" +
+ " WHERE P IN elements (L." + FavoriteList.FAVORITE_PARTICIPANT +
+ ") ORDER BY P." + FavoriteParticipant.NAME);
+
+ log.info("test2 : orderBy not set (default to topiaCreateDate desc)");
+ filter.setOrderBy(null);
+
+ result = builder.createQueryFindElementsByCollection(
+ participantPropertyProvider, listPropertyProvider, filter);
+
+ log.debug("Query : " + result);
+
+ Assert.assertEquals(result.fullQuery(),
+ "SELECT P FROM " + FavoriteParticipant.class.getName() + " P, "
+ + FavoriteList.class.getName() + " L" +
+ " WHERE P IN elements (L." + FavoriteList.FAVORITE_PARTICIPANT +
+ ") ORDER BY P." + TopiaEntity.TOPIA_CREATE_DATE + " DESC");
+
+ log.info("test3 : orderBy name and email desc");
+ String orderBy = FavoriteParticipant.NAME + ", " + FavoriteParticipant.EMAIL + " desc";
+ filter.setOrderBy(orderBy);
+
+ result = builder.createQueryFindElementsByCollection(
+ participantPropertyProvider, listPropertyProvider, filter);
+
+ log.debug("Query : " + result);
+
+ Assert.assertEquals(result.fullQuery(),
+ "SELECT P FROM " + FavoriteParticipant.class.getName() + " P, "
+ + FavoriteList.class.getName() + " L" +
+ " WHERE P IN elements (L." + FavoriteList.FAVORITE_PARTICIPANT +
+ ") ORDER BY P." + FavoriteParticipant.NAME + ", P." +
+ FavoriteParticipant.EMAIL + " desc");
+
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/pollen-business/src/test/java/org/chorem/pollen/TopiaQueryBuilderTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
1
0
Author: fdesbois
Date: 2010-04-28 10:47:44 +0200 (Wed, 28 Apr 2010)
New Revision: 2977
Log:
- Change in model : Add two entities FavoriteList and FavoriteParticipant + add contracts to identify them as ParticipantList and Participant like PollAccount.
- Some trials on PropertyNameProvider to find the best way to use it
- Use transformers JavaInterfaceTransformer from EUGene and BinderHelperTransformer from ToPIA
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java
Removed:
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java
Modified:
trunk/pollen-business/pom.xml
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
trunk/pollen-business/src/main/xmi/pollen.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-ui/pom.xml
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
trunk/pom.xml
Modified: trunk/pollen-business/pom.xml
===================================================================
--- trunk/pollen-business/pom.xml 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/pom.xml 2010-04-28 08:47:44 UTC (rev 2977)
@@ -114,7 +114,9 @@
<templates>
org.nuiton.topia.generator.TopiaMetaTransformer,
org.nuiton.topia.generator.ServiceTransformer,
- org.nuiton.topia.generator.BeanTransformer
+ org.nuiton.eugene.java.JavaInterfaceTransformer,
+ org.nuiton.eugene.java.JavaBeanTransformer,
+ org.nuiton.topia.generator.BinderHelperTransformer
</templates>
</configuration>
<goals>
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -3,7 +3,6 @@
import java.security.NoSuchAlgorithmException;
import java.util.Date;
-import java.util.Locale;
import java.util.Properties;
import java.util.UUID;
import org.apache.commons.logging.Log;
@@ -20,7 +19,10 @@
import static org.nuiton.i18n.I18n.n_;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.util.TopiaEntityBinder;
import org.nuiton.util.StringUtil;
+import org.nuiton.util.beans.BinderBuilder;
/**
* PollenContext
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -4,8 +4,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.apache.commons.lang.StringUtils;
-import org.chorem.pollen.entity.EntityProperty;
-import org.chorem.pollen.entity.PropertyUid;
+import org.chorem.pollen.entity.PropertyNameProviderImpl;
+import org.chorem.pollen.entity.PropertyNameProvider;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.persistence.TopiaEntity;
@@ -25,7 +25,7 @@
protected String orderBy;
- protected String uid;
+ protected String referenceId;
private PropertyChangeSupport propertyChangeSupport =
new PropertyChangeSupport(this);
@@ -36,7 +36,7 @@
public static final String PROPERTY_ORDER_BY = "orderBy";
- public static final String PROP_UID = "uid";
+ public static final String PROP_REFERENCE_ID = "referenceId";
/**
* Get the value of startIndex
@@ -55,7 +55,8 @@
public void setStartIndex(Integer startIndex) {
Integer oldStartIndex = this.startIndex;
this.startIndex = startIndex;
- propertyChangeSupport.firePropertyChange(PROPERTY_START_INDEX, oldStartIndex, startIndex);
+ propertyChangeSupport.firePropertyChange(PROPERTY_START_INDEX,
+ oldStartIndex, startIndex);
}
/**
@@ -75,7 +76,8 @@
public void setOrderBy(String orderBy) {
String oldOrderBy = this.orderBy;
this.orderBy = orderBy;
- propertyChangeSupport.firePropertyChange(PROPERTY_ORDER_BY, oldOrderBy, orderBy);
+ propertyChangeSupport.firePropertyChange(PROPERTY_ORDER_BY,
+ oldOrderBy, orderBy);
}
/**
@@ -95,27 +97,29 @@
public void setEndIndex(Integer endIndex) {
Integer oldEndIndex = this.endIndex;
this.endIndex = endIndex;
- propertyChangeSupport.firePropertyChange(PROPERTY_END_INDEX, oldEndIndex, endIndex);
+ propertyChangeSupport.firePropertyChange(PROPERTY_END_INDEX,
+ oldEndIndex, endIndex);
}
/**
- * Get the value of uid
+ * Get the value of referenceId
*
- * @return the value of uid
+ * @return the value of referenceId
*/
- public String getUid() {
- return uid;
+ public String getReferenceId() {
+ return referenceId;
}
/**
- * Set the value of uid
+ * Set the value of referenceId
*
- * @param uid new value of uid
+ * @param entity
*/
- public void setUid(String uid) {
- String oldUid = this.uid;
- this.uid = uid;
- propertyChangeSupport.firePropertyChange(PROP_UID, oldUid, uid);
+ public void setReference(TopiaEntity entity) {
+ String oldReferenceId = this.referenceId;
+ this.referenceId = entity.getTopiaId();
+ propertyChangeSupport.firePropertyChange(PROP_REFERENCE_ID,
+ oldReferenceId, referenceId);
}
/**
@@ -152,10 +156,9 @@
* to retrieve the name of UID property in case of filter using uid.
*
* @param query to prepare
- * @param ordered if order is needed (using orderBy filter)
* @param property to provide UID property name (using uid filter)
*/
- public void prepareQuery(TopiaQuery query, PropertyUid property) {
+ public void prepareQuery(TopiaQuery query, PropertyNameProvider property) {
// Add limits. Only startIndex do nothing.
// startIndex + endIndex provides the limit
if (startIndex != null && endIndex != null) {
@@ -166,8 +169,8 @@
query.setMaxResults(endIndex);
}
- if (StringUtils.isNotEmpty(uid) && property != null) {
- query.add(property.namePropertyUid(), uid);
+ if (StringUtils.isNotEmpty(referenceId) && property != null) {
+ query.add(property.namePropertyId(), referenceId);
}
// Add order to the query, splitted by comma and trimmed using
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -1,80 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-import org.nuiton.topia.framework.*;
-
-/**
- * EntityProperty is used to simplify property concatenation in TopiaQuery.
- * The usage is simple, the EntityProperty need a mainAlias which represents
- * the entity in a TopiaQuery. Then the {@link #nameProperty(String)}
- * is called to retrieve the correct property name used for the query.
- * Exemple :
- * <pre>
- * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext);
- *
- * // Property used in the query
- * EntityProperty boatProperty = new EntityProperty("B");
- *
- * // It's better to create the query with the property name
- * TopiaQuery query = dao.createQuery(boatProperty.name());
- *
- * // The property NAME of the boat need to be find equals to "ULUBERLU"
- * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU");
- *
- * // It's avoid doing this :
- * query.add("B." + Boat.NAME, "ULUBERLU");
- * </pre>
- * This last exemple is a simple case but for a more complex query with more
- * than one entity, it's obvious that concatenation using + is not a good
- * practice.<br />
- * You can also use this class as a superclass for each entity, ex :
- * <pre>
- * public class BoatProperty extends EntityProperty {
- *
- * public BoatProperty(String mainAlias) {
- * super(mainAlias);
- * }
- *
- * public String namePropertyName() {
- * return nameProperty(Boat.NAME);
- * }
- * }
- * </pre>
- *
- * Created: 14 avr. 2010
- *
- * @author fdesbois <fdesbois(a)codelutin.com>
- */
-public class EntityProperty {
-
- /** alias of the entity **/
- protected String mainAlias;
-
- public EntityProperty(String mainAlias) {
- this.mainAlias = mainAlias;
- }
-
- /**
- * Name the entity as a property for a TopiaQuery.
- *
- * @return the entity name used as a TopiaQuery property
- */
- public String name() {
- return mainAlias;
- }
-
- /**
- * Name a property from the Entity for a TopiaQuery.
- *
- * @param propertyName to named in the TopiaQuery
- * @return the property name used as a TopiaQuery property
- */
- public String nameProperty(String propertyName) {
- return TopiaQuery.getProperty(mainAlias, propertyName);
- }
-
- @Override
- public String toString() {
- return name();
- }
-}
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,23 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * FavoriteListProperty
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class FavoriteListProperty extends PropertyNameProviderImpl
+ implements ParticipantListProperty {
+
+ public FavoriteListProperty(String mainAlias) {
+ super(FavoriteList.class, mainAlias);
+ }
+
+ @Override
+ public String namePropertyParticipant() {
+ return nameProperty(FavoriteList.FAVORITE_PARTICIPANT);
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteListProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,19 @@
+
+package org.chorem.pollen.entity;
+
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * FavoriteParticipant
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class FavoriteParticipantProperty extends PropertyNameProviderImpl
+ implements ParticipantProperty {
+
+ public FavoriteParticipantProperty(String mainAlias) {
+ super(FavoriteParticipant.class, mainAlias);
+ }
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/FavoriteParticipantProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,14 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * ParticipantListProperty
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ */
+public interface ParticipantListProperty extends PropertyNameProvider {
+
+ String namePropertyParticipant();
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantListProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,13 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * ParticipantProperty
+ *
+ * Created: 28 avr. 2010
+ *
+ * @author fdesbois
+ */
+public interface ParticipantProperty extends PropertyNameProvider {
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ParticipantProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -1,27 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * PollAccountImpl
- *
- * Created: 26 avr. 2010
- *
- * @author fdesbois
- */
-public class PollAccountImpl extends PollAccountAbstract {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public PollAccount getChildByUId(String UId) {
- if (child != null) {
- for (PollAccount account : child) {
- if (account.getUid().equals(UId)) {
- return account;
- }
- }
- }
- return null;
- }
-
-}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -9,19 +9,13 @@
* @author fdesbois
* @since 2.0
*/
-public class PollAccountProperty extends EntityProperty implements PropertyUid {
+public class PollAccountProperty extends PropertyNameProviderImpl {
public PollAccountProperty(String mainAlias) {
- super(mainAlias);
+ super(PollAccount.class, mainAlias);
}
- @Override
- public String namePropertyUid() {
- return nameProperty(PollAccount.UID);
- }
-
public String namePropertyChild() {
return nameProperty(PollAccount.CHILD);
}
-
}
Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java (from rev 2976, trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java)
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,26 @@
+
+package org.chorem.pollen.entity;
+
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * PropertyUid
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ * @since 2.0
+ */
+public interface PropertyNameProvider {
+
+ String name();
+
+ String namePropertyId();
+
+ String nameProperty(String propertyName);
+
+ Class<? extends TopiaEntity> getEntityClass();
+
+ TopiaQuery newQuery();
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProvider.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: svn:mergeinfo
+
Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java (from rev 2976, trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java)
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,110 @@
+
+package org.chorem.pollen.entity;
+
+import org.nuiton.topia.framework.*;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * EntityProperty is used to simplify property concatenation in TopiaQuery.
+ * The usage is simple, the EntityProperty need a mainAlias which represents
+ * the entity in a TopiaQuery. Then the {@link #nameProperty(String)}
+ * is called to retrieve the correct property name used for the query.
+ * Exemple :
+ * <pre>
+ * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext);
+ *
+ * // Property used in the query
+ * EntityProperty boatProperty = new EntityProperty("B");
+ *
+ * // It's better to create the query with the property name
+ * TopiaQuery query = dao.createQuery(boatProperty.name());
+ *
+ * // The property NAME of the boat need to be find equals to "ULUBERLU"
+ * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU");
+ *
+ * // It's avoid doing this :
+ * query.add("B." + Boat.NAME, "ULUBERLU");
+ * </pre>
+ * This last exemple is a simple case but for a more complex query with more
+ * than one entity, it's obvious that concatenation using + is not a good
+ * practice.<br />
+ * You can also use this class as a superclass for each entity, ex :
+ * <pre>
+ * public class BoatProperty extends EntityProperty {
+ *
+ * public BoatProperty(String mainAlias) {
+ * super(mainAlias);
+ * }
+ *
+ * public String namePropertyName() {
+ * return nameProperty(Boat.NAME);
+ * }
+ * }
+ * </pre>
+ *
+ * Created: 14 avr. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class PropertyNameProviderImpl implements PropertyNameProvider {
+
+ /** alias of the entity **/
+ protected String mainAlias;
+
+ protected Class<? extends TopiaEntity> entityClass;
+
+ public PropertyNameProviderImpl(Class<? extends TopiaEntity> entityClass,
+ String mainAlias) {
+ this.mainAlias = mainAlias;
+ this.entityClass = entityClass;
+ }
+
+ public void setMainAlias(String mainAlias) {
+ this.mainAlias = mainAlias;
+ }
+
+ public void setEntityClass(Class<? extends TopiaEntity> entityClass) {
+ this.entityClass = entityClass;
+ }
+
+ /**
+ * Name the entity as a property for a TopiaQuery.
+ *
+ * @return the entity name used as a TopiaQuery property
+ */
+ @Override
+ public String name() {
+ return mainAlias;
+ }
+
+ /**
+ * Name a property from the Entity for a TopiaQuery.
+ *
+ * @param propertyName to named in the TopiaQuery
+ * @return the property name used as a TopiaQuery property
+ */
+ @Override
+ public String nameProperty(String propertyName) {
+ return TopiaQuery.getProperty(mainAlias, propertyName);
+ }
+
+ @Override
+ public String namePropertyId() {
+ return nameProperty(TopiaEntity.TOPIA_ID);
+ }
+
+ @Override
+ public Class<? extends TopiaEntity> getEntityClass() {
+ return entityClass;
+ }
+
+ @Override
+ public TopiaQuery newQuery() {
+ return new TopiaQuery(getEntityClass(), name());
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyNameProviderImpl.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: svn:mergeinfo
+
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -1,15 +0,0 @@
-
-package org.chorem.pollen.entity;
-
-/**
- * PropertyUid
- *
- * Created: 27 avr. 2010
- *
- * @author fdesbois
- * @since 2.0
- */
-public interface PropertyUid {
-
- String namePropertyUid();
-}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -40,13 +40,7 @@
this.newPassword = newPassword;
}
-
@Override
- public void addFavoriteList(PollAccount list) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
public String getDisplayName() {
String name = "";
String separator = "";
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-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -6,16 +6,24 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenBinderHelper;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.FavoriteList;
+import org.chorem.pollen.entity.FavoriteListDAO;
+import org.chorem.pollen.entity.FavoriteListImpl;
+import org.chorem.pollen.entity.FavoriteListProperty;
+import org.chorem.pollen.entity.FavoriteParticipant;
+import org.chorem.pollen.entity.FavoriteParticipantDAO;
+import org.chorem.pollen.entity.FavoriteParticipantImpl;
+import org.chorem.pollen.entity.FavoriteParticipantProperty;
+import org.chorem.pollen.entity.ParticipantListProperty;
+import org.chorem.pollen.entity.ParticipantProperty;
import org.chorem.pollen.entity.PollAccount;
-import org.chorem.pollen.entity.PollAccountDAO;
-import org.chorem.pollen.entity.PollAccountImpl;
-import org.chorem.pollen.entity.PollAccountProperty;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
@@ -23,6 +31,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
+import org.nuiton.topia.persistence.util.TopiaEntityBinder;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderBuilder;
import org.nuiton.util.beans.BinderProvider;
@@ -48,7 +57,6 @@
public void setContext(PollenContext context) {
this.context = context;
- prepareUserAccountBinder();
prepareFavoriteListBinder();
}
@@ -68,14 +76,6 @@
context.closeTransaction(transaction);
}
- protected void prepareUserAccountBinder() {
- BinderBuilder builder = new BinderBuilder(UserAccount.class,
- UserAccount.ADMIN,
- UserAccount.FIRST_NAME,
- UserAccount.LAST_NAME);
- BinderProvider.registerBinder(builder);
- }
-
protected void prepareFavoriteListBinder() {
BinderBuilder builder = new BinderBuilder(PollAccount.class,
PollAccount.LIST,
@@ -93,7 +93,13 @@
* @see org.nuiton.util.beans.Binder#copy(Object, Object, String...)
*/
protected void copyUserAccount(UserAccount source, UserAccount destination) {
- BinderProvider.getBinder(UserAccount.class).copy(source, destination);
+ TopiaEntityBinder<UserAccount> binder =
+ PollenBinderHelper.getSimpleTopiaBinder(UserAccount.class);
+
+ binder.copy(source, destination, UserAccount.ADMIN,
+ UserAccount.FIRST_NAME,
+ UserAccount.LAST_NAME);
+ // Don't keep case for email
destination.setEmail(StringUtils.lowerCase(source.getEmail()));
// Manage new password if needed
String password = source.getNewPassword();
@@ -296,134 +302,153 @@
return result;
}
+ /**
+ * Create a TopiaQuery to find all participants of a list with
+ * {@code filter} constraints (order, limit indexes, listId).
+ *
+ * @param filter used to add constraint in the query
+ * @param participantPropertyProvider
+ * @param listPropertyProvider
+ * @return the TopiaQuery created
+ * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid)
+ */
+ protected TopiaQuery createQueryFindParticipantsByList(
+ Filter filter,
+ ParticipantProperty participantPropertyProvider,
+ ParticipantListProperty listPropertyProvider) {
+
+ // Instanciate a new query based on participant
+ TopiaQuery query = participantPropertyProvider.newQuery();
+
+ // Add the list in the From of the query
+ query.addFrom(listPropertyProvider.getEntityClass(), listPropertyProvider.name());
+
+ // Add the link between the list and the participant
+ query.addInElements(participantPropertyProvider.name(),
+ listPropertyProvider.namePropertyParticipant());
+
+ // Add constraints from filter, the listProperty is given to provide
+ // the name of its ID property.
+ filter.prepareQuery(query, listPropertyProvider);
+
+ return query;
+ }
+
@Override
- protected PollAccount executeGetNewList(UserAccount user) {
- PollAccount result = new PollAccountImpl();
- result.setList(true);
+ protected FavoriteList executeGetNewFavoriteList(UserAccount user) {
+ FavoriteList result = new FavoriteListImpl();
result.setUserAccount(user);
return result;
}
@Override
protected void executeCreateFavoriteList(TopiaContext transaction,
- PollAccount list) throws TopiaException, PollenBusinessException {
+ FavoriteList list) throws TopiaException, PollenBusinessException {
- PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
-
- // check favoriteList name exist for user
- UserAccount user = list.getUserAccount();
- int count = dao.createQuery().
- add(PollAccount.LIST, true).
- add(PollAccount.USER_ACCOUNT, user).
- add(PollAccount.NAME, list.getName()).
- executeCount();
- // existing list found
- if (count > 0) {
- throw new PollenBusinessException(
- PollenExceptionType.FAVORITE_LIST_NAME_EXIST,
- list.getName(), user.getDisplayName());
- }
-
- // Create unique Id for the new List
- String UId = context.createPollenUrlId();
- PollAccount newList = dao.create(UId);
- BinderProvider.getBinder(PollAccount.class,
- BINDER_CONTEXT_FAVORITE_LIST).
- copy(list, newList);
- dao.update(newList);
-
- transaction.commitTransaction();
+// PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+//
+// // check favoriteList name exist for user
+// UserAccount user = list.getUserAccount();
+// int count = dao.createQuery().
+// add(PollAccount.LIST, true).
+// add(PollAccount.USER_ACCOUNT, user).
+// add(PollAccount.NAME, list.getName()).
+// executeCount();
+// // existing list found
+// if (count > 0) {
+// throw new PollenBusinessException(
+// PollenExceptionType.FAVORITE_LIST_NAME_EXIST,
+// list.getName(), user.getDisplayName());
+// }
+//
+// // Create unique Id for the new List
+// String UId = context.createPollenUrlId();
+// PollAccount newList = dao.create(UId);
+// BinderProvider.getBinder(PollAccount.class,
+// BINDER_CONTEXT_FAVORITE_LIST).
+// copy(list, newList);
+// dao.update(newList);
+//
+// transaction.commitTransaction();
}
@Override
- protected void executeDeleteList(TopiaContext transaction,
- PollAccount list) throws TopiaException {
+ protected void executeDeleteFavoriteList(TopiaContext transaction,
+ FavoriteList list) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected List<PollAccount> executeGetFavoriteLists(
+ protected List<FavoriteList> executeGetFavoriteLists(
TopiaContext transaction, UserAccount user) throws TopiaException {
- PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+ FavoriteListDAO dao = PollenDAOHelper.getFavoriteListDAO(transaction);
- TopiaQuery query = dao.createQuery().
- add(PollAccount.LIST, true).
- add(PollAccount.USER_ACCOUNT, user);
+ List<FavoriteList> results = dao.findAllByUserAccount(user);
- List<PollAccount> results = dao.findAllByQuery(query);
-
return results;
}
@Override
- protected PollAccount executeGetNewAccount(TopiaContext transaction)
+ protected FavoriteParticipant executeGetNewFavoriteParticipant(
+ TopiaContext transaction, FavoriteList list)
throws TopiaException {
- PollAccount result = new PollAccountImpl();
+ FavoriteParticipant result = new FavoriteParticipantImpl();
+ result.setFavoriteList(list);
return result;
}
@Override
- protected PollAccount executeGetPerson(TopiaContext transaction,
- String accountUId)
+ protected void executeCreateFavoriteParticipant(TopiaContext transaction,
+ FavoriteParticipant participant)
throws PollenBusinessException, TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected Map<String, PollAccount> executeGetAccounts(
+ protected void executeDeleteFavoriteParticipant(TopiaContext transaction,
+ FavoriteParticipant participant) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ protected void executeUpdateFavoriteParticipant(TopiaContext transaction,
+ FavoriteParticipant participant) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ protected Map<String, FavoriteParticipant> executeGetFavoriteParticipants(
TopiaContext transaction, Filter filter) throws TopiaException {
+
+ FavoriteParticipantDAO dao =
+ PollenDAOHelper.getFavoriteParticipantDAO(transaction);
- PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+ ParticipantProperty participantProperty =
+ new FavoriteParticipantProperty("P");
- TopiaQuery query = createQueryFindAccountsByList(dao, filter);
+ ParticipantListProperty listProperty = new FavoriteListProperty("L");
- Map<String, PollAccount> results = dao.findAllMappedByQuery(query,
- PollAccount.UID, String.class);
+ TopiaQuery query = createQueryFindParticipantsByList(filter,
+ participantProperty, listProperty);
+ Map<String, FavoriteParticipant> results = dao.findAllMappedByQuery(
+ query, FavoriteParticipant.EMAIL, String.class);
+
return results;
}
@Override
- protected int executeGetNbAccounts(TopiaContext transaction,
+ protected int executeGetNbFavoriteParticipants(TopiaContext transaction,
Filter filter) throws TopiaException {
+ throw new UnsupportedOperationException("Not supported yet.");
- PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
-
- TopiaQuery query = createQueryFindAccountsByList(dao, filter);
-
- int result = query.executeCount();
- return result;
+// PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+//
+// TopiaQuery query = createQueryFindAccountsByList(dao, filter);
+//
+// int result = query.executeCount();
+// return result;
}
- /**
- * Create a TopiaQuery to find all the accounts of a list with
- * {@code filter} constraints (order, limit indexes, uid).
- *
- * @param dao used to create the query
- * @param filter used to add constraint in the query
- * @return the TopiaQuery created
- * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid)
- */
- protected TopiaQuery createQueryFindAccountsByList(PollAccountDAO dao,
- Filter filter) {
-
- // Property for account to find
- PollAccountProperty accountProperty = new PollAccountProperty("A");
- // Property for list reference that contains the accounts
- PollAccountProperty listProperty = new PollAccountProperty("L");
-
- TopiaQuery query = dao.createQuery(accountProperty.name());
- query.addFrom(PollAccount.class, listProperty.name());
- query.addInElements(accountProperty.name(),
- listProperty.namePropertyChild());
- // query.add("A IN elements(L." + PollAccount.CHILD + ")");
-
- // Add constraints from filter, the listProperty is given to provide
- // the name of its UID property.
- filter.prepareQuery(query, listProperty);
-
- return query;
- }
-
}
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-28 08:47:44 UTC (rev 2977)
@@ -36,22 +36,30 @@
pollen.error.serviceUser.connect=
pollen.error.serviceUser.createDefaultAdmin=
pollen.error.serviceUser.createFavoriteList=
+pollen.error.serviceUser.createFavoriteParticipant=
pollen.error.serviceUser.createList=
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=
pollen.error.serviceUser.createUser=
+pollen.error.serviceUser.deleteFavoriteList=
+pollen.error.serviceUser.deleteFavoriteParticipant=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getAccounts=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getFavoriteParticipants=
pollen.error.serviceUser.getNbAccounts=
+pollen.error.serviceUser.getNbFavoriteParticipants=
pollen.error.serviceUser.getNbUsers=
pollen.error.serviceUser.getNewAccount=
+pollen.error.serviceUser.getNewFavoriteList=
+pollen.error.serviceUser.getNewFavoriteParticipant=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=
pollen.error.serviceUser.getPerson=
pollen.error.serviceUser.getUsers=
+pollen.error.serviceUser.updateFavoriteParticipant=
pollen.error.serviceUser.updateUser=
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=Unable to load votes from poll with uid \= %1$s
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-28 08:47:44 UTC (rev 2977)
@@ -35,22 +35,30 @@
pollen.error.serviceUser.connect=Impossible d'\u00E9tablir la connexion pour l'identifiant %1$s et le mot de passe encod\u00E9 %2$s
pollen.error.serviceUser.createDefaultAdmin=Impossible de cr\u00E9er l'administrateur par d\u00E9faut \: %1$s (%2$s)
pollen.error.serviceUser.createFavoriteList=
+pollen.error.serviceUser.createFavoriteParticipant=
pollen.error.serviceUser.createList=
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=Impossible de cr\u00E9er l'utilisateur '%1$s' <%2$s> (admin \= %$3b)
pollen.error.serviceUser.createUser=
+pollen.error.serviceUser.deleteFavoriteList=
+pollen.error.serviceUser.deleteFavoriteParticipant=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getAccounts=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getFavoriteParticipants=
pollen.error.serviceUser.getNbAccounts=
+pollen.error.serviceUser.getNbFavoriteParticipants=
pollen.error.serviceUser.getNbUsers=
pollen.error.serviceUser.getNewAccount=
+pollen.error.serviceUser.getNewFavoriteList=
+pollen.error.serviceUser.getNewFavoriteParticipant=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=Impossible d'instancier un nouvel utilisateur.
pollen.error.serviceUser.getPerson=
pollen.error.serviceUser.getUsers=
+pollen.error.serviceUser.updateFavoriteParticipant=
pollen.error.serviceUser.updateUser=
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=
Modified: trunk/pollen-business/src/main/xmi/pollen.properties
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-28 08:47:44 UTC (rev 2977)
@@ -7,4 +7,10 @@
org.chorem.pollen.entity.UserAccount.attribute.login.tagvalue.naturalId=true
org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true
-org.chorem.pollen.entity.PollAccount.attribute.uid.tagvalue.naturalId=true
\ No newline at end of file
+org.chorem.pollen.entity.PollAccount.attribute.uid.tagvalue.naturalId=true
+
+org.chorem.pollen.entity.FavoriteList.attribute.userAccount.tagvalue.naturalId=true
+org.chorem.pollen.entity.FavoriteList.attribute.name.tagvalue.naturalId=true
+
+org.chorem.pollen.entity.FavoriteParticipant.attribute.favoriteList.tagvalue.naturalId=true
+org.chorem.pollen.entity.FavoriteParticipant.attribute.email.tagvalue.naturalId=true
\ No newline at end of file
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-ui/pom.xml
===================================================================
--- trunk/pollen-ui/pom.xml 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/pom.xml 2010-04-28 08:47:44 UTC (rev 2977)
@@ -174,9 +174,9 @@
</plugins>
</build>
- <repositories>
+ <!--<repositories>
- <!-- chenillekit Repository -->
+ chenillekit Repository
<repository>
<id>chenillekit</id>
<url>http://www.chenillekit.org/mvnrepo/release</url>
@@ -185,13 +185,13 @@
</snapshots>
</repository>
- <!-- Maven Java.net Repository -->
+ Maven Java.net Repository
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
- </repositories>
+ </repositories>-->
</project>
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -10,7 +10,7 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
-import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.base.PollenPage;
import org.chorem.pollen.ui.services.PollenManager;
@@ -44,7 +44,7 @@
/** Properties **/
@Property
- private PollAccount newFavoriteList;
+ private FavoriteList newFavoriteList;
/** Components injected **/
@InjectComponent
@@ -62,7 +62,8 @@
if (logger.isDebugEnabled()) {
logger.debug("User connected : " + page.getUserConnected());
}
- newFavoriteList = serviceUser.getNewList(page.getUserConnected());
+ newFavoriteList =
+ serviceUser.getNewFavoriteList(page.getUserConnected());
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -2,19 +2,20 @@
package org.chorem.pollen.ui.components;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.ValidationException;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.FavoriteList;
+import org.chorem.pollen.entity.FavoriteParticipant;
import org.chorem.pollen.entity.PollAccount;
-import org.chorem.pollen.entity.PollAccountImpl;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.data.EvenOdd;
+import org.chorem.pollen.ui.data.FavoriteParticipantDataSource;
import org.slf4j.Logger;
/**
@@ -43,17 +44,19 @@
@Inject
private ServiceUser serviceUser;
- @Persist
@Property
- private PollAccount favoriteListSelected;
+ private FavoriteList favoriteListSelected;
private EvenOdd evenOdd;
+ @Persist
+ private FavoriteParticipantDataSource accounts;
+
@Property
- private PollAccount account;
+ private FavoriteParticipant account;
@Property
- private PollAccount newAccount;
+ private FavoriteParticipant newAccount;
@InjectComponent
private Zone updateZone;
@@ -73,32 +76,28 @@
return favoriteListSelected != null;
}
+ public FavoriteParticipantDataSource getAccounts() {
+ if (accounts == null) {
+ Filter filter = new Filter();
+ filter.setReference(favoriteListSelected);
+ accounts = new FavoriteParticipantDataSource(serviceUser, filter);
+ }
+ return accounts;
+ }
+
void onActionFromRemoveAccount(String UId) {
- PollAccount child = favoriteListSelected.getChildByUId(UId);
- favoriteListSelected.removeChild(child);
+ // NEED DELETE ACCOUNT FOR LIST
}
void onPrepareFromAddAccount() {
if (newAccount == null) {
- // TEMP
- newAccount = new PollAccountImpl();
+ newAccount =
+ serviceUser.getNewFavoriteParticipant(favoriteListSelected);
}
}
-// void onValidateFromEmail(String input) throws ValidationException {
-// String test = StringUtils.lowerCase(input);
-// for (PollAccount curr : favoriteListSelected.getChild()) {
-// if (test.equals(curr.getEmail())) {
-// throw new ValidationException("NOT ALLOWED");
-// }
-// }
-// }
-
Object onSuccessFromAddAccount() {
- favoriteListSelected.addChild(newAccount);
- if (logger.isDebugEnabled()) {
- logger.debug("Add account : " + newAccount);
- }
+ // NEED CREATE ACCOUNT FOR LIST
return updateZone.getBody();
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -26,6 +26,7 @@
package org.chorem.pollen.ui.data;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
@@ -55,8 +56,6 @@
private Map<K, E> mapResults;
- private List<E> listResults;
-
private int nbRows = -1;
private int nbRowsPerPage;
@@ -84,10 +83,7 @@
nbRowsPerPage = endIndex - startIndex + 1;
try {
mapResults = execute(startIndex, endIndex, getSortConstraint(sortConstraints));
- listResults = new ArrayList<E>(mapResults.values());
- // FIXME manage sort columns in execute ???? seems obvious --> needed for Contacts, done for Boats
- //sortResults(sortConstraints);
} catch (PollenException eee) {
throw new TapestryException("", eee);
}
@@ -127,70 +123,17 @@
}
return filterOrder;
}
-
-// protected void sortResults(List<SortConstraint> sortConstraints) {
-//
-// for (SortConstraint constraint : sortConstraints)
-// {
-// final ColumnSort sort = constraint.getColumnSort();
-//
-// if (sort == ColumnSort.UNSORTED) continue;
-//
-// final PropertyConduit conduit = constraint.getPropertyModel().getConduit();
-//
-// final Comparator valueComparator = new Comparator<Comparable>()
-// {
-// public int compare(Comparable o1, Comparable o2)
-// {
-// // Simplify comparison, and handle case where both are nulls.
-//
-// if (o1 == o2) return 0;
-//
-// if (o2 == null) return 1;
-//
-// if (o1 == null) return -1;
-//
-// return o1.compareTo(o2);
-// }
-// };
-//
-// final Comparator rowComparator = new Comparator()
-// {
-// public int compare(Object row1, Object row2)
-// {
-// Comparable value1 = (Comparable) conduit.get(row1);
-// Comparable value2 = (Comparable) conduit.get(row2);
-//
-// return valueComparator.compare(value1, value2);
-// }
-// };
-//
-// final Comparator reverseComparator = new Comparator()
-// {
-// public int compare(Object o1, Object o2)
-// {
-// int modifier = sort == ColumnSort.ASCENDING ? 1 : -1;
-//
-// return modifier * rowComparator.compare(o1, o2);
-// }
-// };
-//
-// // We can freely sort this list because its just a copy.
-//
-// Collections.sort(listResults, reverseComparator);
-// }
-// }
-
+
@Override
public Object getRowValue(int index) {
index = index % nbRowsPerPage;
- if (index >= listResults.size()) {
+ if (index >= mapResults.size()) {
if (log.isErrorEnabled()) {
- log.error("Size error : " + index + " / " + listResults.size());
+ log.error("Size error : " + index + " / " + mapResults.size());
}
return null;
}
- return CollectionUtils.get(listResults, index);
+ return CollectionUtils.get(mapResults, index);
}
@Override
@@ -200,8 +143,8 @@
return mapResults.get(key);
}
- public List<E> values() {
- return listResults;
+ public Collection<E> values() {
+ return mapResults.values();
}
public boolean contains(K key) {
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -0,0 +1,55 @@
+
+package org.chorem.pollen.ui.data;
+
+import java.util.Map;
+import org.apache.tapestry5.grid.SortConstraint;
+import org.chorem.pollen.PollenException;
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.FavoriteParticipant;
+import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.service.ServiceUser;
+
+/**
+ * UserAccountDataSource
+ *
+ * Created: 23 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class FavoriteParticipantDataSource extends
+ AbstractMappedGridDataSource<String, FavoriteParticipant> {
+
+ private ServiceUser service;
+
+ private Filter filter;
+
+ public FavoriteParticipantDataSource(ServiceUser service, Filter filter) {
+ this.service = service;
+ this.filter = filter;
+ }
+
+ @Override
+ protected Map<String, FavoriteParticipant> execute(
+ int startIndex, int endIndex, SortConstraint orderBy)
+ throws PollenException {
+ filter.setStartIndex(startIndex);
+ filter.setEndIndex(endIndex);
+ filter.setOrderBy(resolveOrderBy(orderBy));
+ return service.getFavoriteParticipants(filter);
+ }
+
+ @Override
+ protected int count() throws PollenException {
+ return service.getNbFavoriteParticipants(filter);
+ }
+
+ @Override
+ public Class<?> getRowType() {
+ return PollAccount.class;
+ }
+
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/FavoriteParticipantDataSource.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -1092,12 +1092,16 @@
if (pollAccount == null) {
// Identification du votant
if (uri.getAccountUId() != null) {
- pollAccount = serviceUser.getPerson(uri.getAccountUId());
+ // pollAccount = serviceUser.getPerson(uri.getAccountUId());
+
+
// pollAccountId = pollAccount.getId();
}
if (pollAccount == null) {
// pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO();
+
+
// if (userExists) {
// if (user.getFirstName() != null && user.getLastName() != null) {
// pollAccount.setVotingId(
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-28 08:47:44 UTC (rev 2977)
@@ -22,18 +22,13 @@
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.FavoriteList;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
-import org.chorem.pollen.ui.data.EvenOdd;
-import org.chorem.pollen.ui.services.PollenManager;
-import org.slf4j.Logger;
/**
* Classe de la page d'affichage des listes de votants favorites de
@@ -59,7 +54,7 @@
@Inject
private ServiceUser serviceUser;
- private List<PollAccount> favoriteLists;
+ private List<FavoriteList> favoriteLists;
@Override
public Border getBorder() {
@@ -80,7 +75,7 @@
return AddressBar.newBar().appendCurrent(title);
}
- public List<PollAccount> getFavoriteLists() {
+ public List<FavoriteList> getFavoriteLists() {
if (favoriteLists == null) {
favoriteLists = serviceUser.getFavoriteLists(getUserConnected());
}
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-28 08:47:44 UTC (rev 2977)
@@ -1,19 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<body xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
- <t:zone t:id="updateZone" show="show" update="show">
- <form t:type="form" t:id="selectListForm" action="tapestry">
- <div>
- ${message:listSelect-label}:
- <select t:id="listSelect" t:type="ck/beanSelect" t:list="source" t:value="favoriteListSelected"
- t:labelField="literal:name" t:valueField="literal:name" />
- <input t:type="submit" value="${message:pollen.ui.button.ok}"/>
- </div>
- </form>
+ <form t:type="form" t:id="selectListForm" action="tapestry">
+ <div>
+ ${message:listSelect-label}:
+ <select t:id="listSelect" t:type="ck/beanSelect" t:list="source" t:value="favoriteListSelected"
+ t:labelField="literal:name" t:valueField="literal:name" />
+ <input t:type="submit" value="${message:pollen.ui.button.ok}"/>
+ </div>
+ </form>
- <t:if test="canDisplayAccounts()">
+ <t:if test="canDisplayAccounts()">
+ <t:zone t:id="updateZone" show="show" update="show">
<!-- Display all Accounts child of favoriteListSelected -->
- <div t:type="grid" t:source="favoriteListSelected.child" t:row="account"
+ <div t:type="grid" t:source="accounts.values()" t:row="account"
t:include="name, email, weight" t:add="actions"
t:rowsPerPage="20" t:rowClass="prop:evenodd.next" t:inPlace="true">
<p:actionsCell>
@@ -40,6 +40,7 @@
<input t:type="textfield" t:id="weight" t:value="newAccount.weight" size="5"/>
</td>
<td class="functions">
+ <input t:type="hidden" value="newAccount.list" />
<input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.list.update.addAccount}"/>
</td>
</tr>
@@ -48,16 +49,16 @@
</form>
<!-- Delete the favoriteListSelected -->
-<!-- <p>
- <a t:type="actionlink" t:id="deleteList">
- <img src="${asset:context:img/delete.png}" alt="Delete"/>${message:deleteList}
- </a>
- </p>-->
+ <!-- <p>
+ <a t:type="actionlink" t:id="deleteList">
+ <img src="${asset:context:img/delete.png}" alt="Delete"/>${message:deleteList}
+ </a>
+ </p>-->
- <p:else>
- ${message:pollen.ui.list.update.notSelected}
- </p:else>
- </t:if>
+ </t:zone>
- </t:zone>
+ <p:else>
+ ${message:pollen.ui.list.update.notSelected}
+ </p:else>
+ </t:if>
</body>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-27 16:29:41 UTC (rev 2976)
+++ trunk/pom.xml 2010-04-28 08:47:44 UTC (rev 2977)
@@ -134,7 +134,7 @@
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
- <version>1.0</version>
+ <version>0.9</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
1
0
Author: fdesbois
Date: 2010-04-27 18:29:41 +0200 (Tue, 27 Apr 2010)
New Revision: 2976
Log:
- Add FormatBinding to manage message format: in tml files
- Add EntityProperty to manage properties in TopiaQuery
- Use last ToPIA and EUGene snapshot
- Split page UserLists in two components : UserListsCreate and UserListsUpdate
- Improve filter to use EntityProperty and UID (for PollAccount or Poll)
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.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/resources/i18n/pollen-business-en_GB.properties
trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
trunk/pollen-business/src/main/xmi/pollen.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties
trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
trunk/pollen-ui/src/main/webapp/css/lists.css
trunk/pollen-ui/src/main/webapp/user/UserLists.tml
trunk/pom.xml
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -46,7 +46,10 @@
/** Exception when password is not valid for some user **/
USER_WRONG_PASSWORD(n_("pollen.exception.user_wrong_password")),
/** Exception when stmp server is not available **/
- SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available"));
+ SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available")),
+ /** Exception when favorite list name is already defined for user **/
+ FAVORITE_LIST_NAME_EXIST(
+ n_("pollen.exception.favorite_list_name_exist"));
private String message;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -4,6 +4,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.apache.commons.lang.StringUtils;
+import org.chorem.pollen.entity.EntityProperty;
+import org.chorem.pollen.entity.PropertyUid;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.persistence.TopiaEntity;
@@ -13,10 +15,7 @@
* Created: 23 avr. 2010
*
* @author fdesbois
- * @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
+ * @since 2.0
*/
public class Filter {
@@ -26,6 +25,8 @@
protected String orderBy;
+ protected String uid;
+
private PropertyChangeSupport propertyChangeSupport =
new PropertyChangeSupport(this);
@@ -35,6 +36,8 @@
public static final String PROPERTY_ORDER_BY = "orderBy";
+ public static final String PROP_UID = "uid";
+
/**
* Get the value of startIndex
*
@@ -96,6 +99,26 @@
}
/**
+ * Get the value of uid
+ *
+ * @return the value of uid
+ */
+ public String getUid() {
+ return uid;
+ }
+
+ /**
+ * Set the value of uid
+ *
+ * @param uid new value of uid
+ */
+ public void setUid(String uid) {
+ String oldUid = this.uid;
+ this.uid = uid;
+ propertyChangeSupport.firePropertyChange(PROP_UID, oldUid, uid);
+ }
+
+ /**
* Add PropertyChangeListener.
*
* @param listener
@@ -113,7 +136,26 @@
propertyChangeSupport.removePropertyChangeListener(listener);
}
+ /**
+ * Prepare a query with filter : adding startIndex and endIndex as limit
+ * and orderBy if defined.
+ *
+ * @param query
+ * @see #prepareQuery(TopiaQuery, PropertyUid)
+ */
public void prepareQuery(TopiaQuery query) {
+ prepareQuery(query, null);
+ }
+
+ /**
+ * Prepare a query with filter. The {@code property} is used
+ * to retrieve the name of UID property in case of filter using uid.
+ *
+ * @param query to prepare
+ * @param ordered if order is needed (using orderBy filter)
+ * @param property to provide UID property name (using uid filter)
+ */
+ public void prepareQuery(TopiaQuery query, PropertyUid property) {
// Add limits. Only startIndex do nothing.
// startIndex + endIndex provides the limit
if (startIndex != null && endIndex != null) {
@@ -123,9 +165,11 @@
} else if (endIndex != null) {
query.setMaxResults(endIndex);
}
- }
- public void prepareQueryWithOrder(TopiaQuery query) {
+ if (StringUtils.isNotEmpty(uid) && property != null) {
+ query.add(property.namePropertyUid(), uid);
+ }
+
// Add order to the query, splitted by comma and trimmed using
// {@link StringUtils#stripAll(String[])}
if (orderBy != null) {
@@ -136,8 +180,6 @@
} else {
query.addOrderDesc(TopiaEntity.TOPIA_CREATE_DATE);
}
-
- prepareQuery(query);
}
}
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,80 @@
+
+package org.chorem.pollen.entity;
+
+import org.nuiton.topia.framework.*;
+
+/**
+ * EntityProperty is used to simplify property concatenation in TopiaQuery.
+ * The usage is simple, the EntityProperty need a mainAlias which represents
+ * the entity in a TopiaQuery. Then the {@link #nameProperty(String)}
+ * is called to retrieve the correct property name used for the query.
+ * Exemple :
+ * <pre>
+ * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext);
+ *
+ * // Property used in the query
+ * EntityProperty boatProperty = new EntityProperty("B");
+ *
+ * // It's better to create the query with the property name
+ * TopiaQuery query = dao.createQuery(boatProperty.name());
+ *
+ * // The property NAME of the boat need to be find equals to "ULUBERLU"
+ * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU");
+ *
+ * // It's avoid doing this :
+ * query.add("B." + Boat.NAME, "ULUBERLU");
+ * </pre>
+ * This last exemple is a simple case but for a more complex query with more
+ * than one entity, it's obvious that concatenation using + is not a good
+ * practice.<br />
+ * You can also use this class as a superclass for each entity, ex :
+ * <pre>
+ * public class BoatProperty extends EntityProperty {
+ *
+ * public BoatProperty(String mainAlias) {
+ * super(mainAlias);
+ * }
+ *
+ * public String namePropertyName() {
+ * return nameProperty(Boat.NAME);
+ * }
+ * }
+ * </pre>
+ *
+ * Created: 14 avr. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class EntityProperty {
+
+ /** alias of the entity **/
+ protected String mainAlias;
+
+ public EntityProperty(String mainAlias) {
+ this.mainAlias = mainAlias;
+ }
+
+ /**
+ * Name the entity as a property for a TopiaQuery.
+ *
+ * @return the entity name used as a TopiaQuery property
+ */
+ public String name() {
+ return mainAlias;
+ }
+
+ /**
+ * Name a property from the Entity for a TopiaQuery.
+ *
+ * @param propertyName to named in the TopiaQuery
+ * @return the property name used as a TopiaQuery property
+ */
+ public String nameProperty(String propertyName) {
+ return TopiaQuery.getProperty(mainAlias, propertyName);
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,27 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * PollAccountImpl
+ *
+ * Created: 26 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class PollAccountImpl extends PollAccountAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public PollAccount getChildByUId(String UId) {
+ if (child != null) {
+ for (PollAccount account : child) {
+ if (account.getUid().equals(UId)) {
+ return account;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,27 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * PollAccountProperty
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ * @since 2.0
+ */
+public class PollAccountProperty extends EntityProperty implements PropertyUid {
+
+ public PollAccountProperty(String mainAlias) {
+ super(mainAlias);
+ }
+
+ @Override
+ public String namePropertyUid() {
+ return nameProperty(PollAccount.UID);
+ }
+
+ public String namePropertyChild() {
+ return nameProperty(PollAccount.CHILD);
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,15 @@
+
+package org.chorem.pollen.entity;
+
+/**
+ * PropertyUid
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ * @since 2.0
+ */
+public interface PropertyUid {
+
+ String namePropertyUid();
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
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-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -65,7 +65,7 @@
List<Object> errorArgs, Poll poll) throws TopiaException {
errorArgs.add(poll.getTitle());
- errorArgs.add(poll.getUId());
+ errorArgs.add(poll.getUid());
PollenDAOHelper.getPollDAO(transaction).create(poll);
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-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -2,7 +2,6 @@
package org.chorem.pollen.service;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -14,6 +13,9 @@
import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.Filter;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.PollAccountDAO;
+import org.chorem.pollen.entity.PollAccountImpl;
+import org.chorem.pollen.entity.PollAccountProperty;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
import org.chorem.pollen.entity.UserAccountImpl;
@@ -21,6 +23,7 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
+import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderBuilder;
import org.nuiton.util.beans.BinderProvider;
@@ -39,13 +42,32 @@
private Log log = LogFactory.getLog(ServiceUserImpl.class);
+ private static final String BINDER_CONTEXT_FAVORITE_LIST = "favoriteList";
+
private PollenContext context;
public void setContext(PollenContext context) {
this.context = context;
prepareUserAccountBinder();
+ prepareFavoriteListBinder();
}
+ @Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
+ protected void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException {
+ context.treateError(transaction, eee, message, args);
+ }
+
+ @Override
+ protected void closeTransaction(TopiaContext transaction) {
+ context.closeTransaction(transaction);
+ }
+
protected void prepareUserAccountBinder() {
BinderBuilder builder = new BinderBuilder(UserAccount.class,
UserAccount.ADMIN,
@@ -54,6 +76,14 @@
BinderProvider.registerBinder(builder);
}
+ protected void prepareFavoriteListBinder() {
+ BinderBuilder builder = new BinderBuilder(PollAccount.class,
+ PollAccount.LIST,
+ PollAccount.NAME,
+ PollAccount.USER_ACCOUNT);
+ BinderProvider.registerBinder(builder, BINDER_CONTEXT_FAVORITE_LIST);
+ }
+
/**
* Copy {@code source} user account to {@code destination} one.
* The email is lower cased in the {@code destination} user account.
@@ -72,22 +102,6 @@
}
}
- @Override
- protected TopiaContext beginTransaction() throws TopiaException {
- return context.beginTransaction();
- }
-
- @Override
- protected void treateError(TopiaContext transaction, Exception eee,
- String message, Object... args) throws PollenException {
- context.treateError(transaction, eee, message, args);
- }
-
- @Override
- protected void closeTransaction(TopiaContext transaction) {
- context.closeTransaction(transaction);
- }
-
/**
* Check if the {@code login} and {@code password} correspond to an
* existing user.
@@ -203,7 +217,6 @@
// Check email not exist
checkEmailNotExist(dao, user.getEmail(), null);
-
// Execute create
UserAccount newUser = dao.create(user.getLogin());
@@ -263,7 +276,7 @@
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
TopiaQuery query = dao.createQuery();
- filter.prepareQueryWithOrder(query);
+ filter.prepareQuery(query);
Map<String, UserAccount> results = dao.findAllMappedByQuery(query,
UserAccount.LOGIN, String.class);
@@ -284,15 +297,42 @@
}
@Override
- protected PollAccount executeGetNewList(TopiaContext transaction)
- throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ protected PollAccount executeGetNewList(UserAccount user) {
+ PollAccount result = new PollAccountImpl();
+ result.setList(true);
+ result.setUserAccount(user);
+ return result;
}
@Override
- protected void executeCreateUpdateList(TopiaContext transaction,
- PollAccount list) throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ protected void executeCreateFavoriteList(TopiaContext transaction,
+ PollAccount list) throws TopiaException, PollenBusinessException {
+
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+
+ // check favoriteList name exist for user
+ UserAccount user = list.getUserAccount();
+ int count = dao.createQuery().
+ add(PollAccount.LIST, true).
+ add(PollAccount.USER_ACCOUNT, user).
+ add(PollAccount.NAME, list.getName()).
+ executeCount();
+ // existing list found
+ if (count > 0) {
+ throw new PollenBusinessException(
+ PollenExceptionType.FAVORITE_LIST_NAME_EXIST,
+ list.getName(), user.getDisplayName());
+ }
+
+ // Create unique Id for the new List
+ String UId = context.createPollenUrlId();
+ PollAccount newList = dao.create(UId);
+ BinderProvider.getBinder(PollAccount.class,
+ BINDER_CONTEXT_FAVORITE_LIST).
+ copy(list, newList);
+ dao.update(newList);
+
+ transaction.commitTransaction();
}
@Override
@@ -303,14 +343,24 @@
@Override
protected List<PollAccount> executeGetFavoriteLists(
- TopiaContext transaction) throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ TopiaContext transaction, UserAccount user) throws TopiaException {
+
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+
+ TopiaQuery query = dao.createQuery().
+ add(PollAccount.LIST, true).
+ add(PollAccount.USER_ACCOUNT, user);
+
+ List<PollAccount> results = dao.findAllByQuery(query);
+
+ return results;
}
@Override
- protected PollAccount executeGetNewPerson(TopiaContext transaction,
- UserAccount user) throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ protected PollAccount executeGetNewAccount(TopiaContext transaction)
+ throws TopiaException {
+ PollAccount result = new PollAccountImpl();
+ return result;
}
@Override
@@ -320,4 +370,60 @@
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ protected Map<String, PollAccount> executeGetAccounts(
+ TopiaContext transaction, Filter filter) throws TopiaException {
+
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+
+ TopiaQuery query = createQueryFindAccountsByList(dao, filter);
+
+ Map<String, PollAccount> results = dao.findAllMappedByQuery(query,
+ PollAccount.UID, String.class);
+
+ return results;
+ }
+
+ @Override
+ protected int executeGetNbAccounts(TopiaContext transaction,
+ Filter filter) throws TopiaException {
+
+ PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction);
+
+ TopiaQuery query = createQueryFindAccountsByList(dao, filter);
+
+ int result = query.executeCount();
+ return result;
+ }
+
+ /**
+ * Create a TopiaQuery to find all the accounts of a list with
+ * {@code filter} constraints (order, limit indexes, uid).
+ *
+ * @param dao used to create the query
+ * @param filter used to add constraint in the query
+ * @return the TopiaQuery created
+ * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid)
+ */
+ protected TopiaQuery createQueryFindAccountsByList(PollAccountDAO dao,
+ Filter filter) {
+
+ // Property for account to find
+ PollAccountProperty accountProperty = new PollAccountProperty("A");
+ // Property for list reference that contains the accounts
+ PollAccountProperty listProperty = new PollAccountProperty("L");
+
+ TopiaQuery query = dao.createQuery(accountProperty.name());
+ query.addFrom(PollAccount.class, listProperty.name());
+ query.addInElements(accountProperty.name(),
+ listProperty.namePropertyChild());
+ // query.add("A IN elements(L." + PollAccount.CHILD + ")");
+
+ // Add constraints from filter, the listProperty is given to provide
+ // the name of its UID property.
+ filter.prepareQuery(query, listProperty);
+
+ return query;
+ }
+
}
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-27 16:29:41 UTC (rev 2976)
@@ -35,13 +35,18 @@
pollen.error.serviceResults.importPoll=
pollen.error.serviceUser.connect=
pollen.error.serviceUser.createDefaultAdmin=
+pollen.error.serviceUser.createFavoriteList=
+pollen.error.serviceUser.createList=
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=
pollen.error.serviceUser.createUser=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
+pollen.error.serviceUser.getAccounts=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getNbAccounts=
pollen.error.serviceUser.getNbUsers=
+pollen.error.serviceUser.getNewAccount=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=
@@ -51,6 +56,7 @@
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=Unable to load votes from poll with uid \= %1$s
pollen.error.serviceVote.hasAlreadyVoted=Unable test vote existing for account with votingId \= %1$s and poll with uid \= %2$s
+pollen.exception.favorite_list_name_exist=
pollen.exception.load_configuration=
pollen.exception.poll_not_exist=No such poll exists. Please make sure that you are using the correct link and copy it completely into your browser's address field.
pollen.exception.smtp_not_available=
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-27 16:29:41 UTC (rev 2976)
@@ -34,13 +34,18 @@
pollen.error.serviceResults.importPoll=
pollen.error.serviceUser.connect=Impossible d'\u00E9tablir la connexion pour l'identifiant %1$s et le mot de passe encod\u00E9 %2$s
pollen.error.serviceUser.createDefaultAdmin=Impossible de cr\u00E9er l'administrateur par d\u00E9faut \: %1$s (%2$s)
+pollen.error.serviceUser.createFavoriteList=
+pollen.error.serviceUser.createList=
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=Impossible de cr\u00E9er l'utilisateur '%1$s' <%2$s> (admin \= %$3b)
pollen.error.serviceUser.createUser=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
+pollen.error.serviceUser.getAccounts=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getNbAccounts=
pollen.error.serviceUser.getNbUsers=
+pollen.error.serviceUser.getNewAccount=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=Impossible d'instancier un nouvel utilisateur.
@@ -50,6 +55,7 @@
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=
pollen.error.serviceVote.hasAlreadyVoted=
+pollen.exception.favorite_list_name_exist=La liste %1$s existe d\u00E9j\u00E0 pour l'utilisateur %2$s
pollen.exception.load_configuration=La configuration n'a pas \u00E9t\u00E9 charg\u00E9e correctement \! Veuillez v\u00E9rifier le d\u00E9marrage de l'application.
pollen.exception.poll_not_exist=Il n'y a pas de sondage \u00E0 cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le compl\u00E8tement dans le champ d'adresse de votre navigateur.
pollen.exception.smtp_not_available=Impossible d'envoyer un email \u00E0 %1$s. Serveur smtp indisponible pour l'envoi d'email, veuillez contacter un administrateur.
Modified: trunk/pollen-business/src/main/xmi/pollen.properties
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-27 16:29:41 UTC (rev 2976)
@@ -5,4 +5,6 @@
model.tagvalue.exceptionClass=org.chorem.pollen.PollenException
org.chorem.pollen.entity.UserAccount.attribute.login.tagvalue.naturalId=true
-org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true
\ No newline at end of file
+org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true
+
+org.chorem.pollen.entity.PollAccount.attribute.uid.tagvalue.naturalId=true
\ No newline at end of file
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -3,7 +3,6 @@
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.ui.components.Border;
@@ -58,6 +57,7 @@
*
* @return the UserAccount corresponding to connected user
*/
+ @Override
public UserAccount getUserConnected() {
return user;
}
@@ -76,6 +76,7 @@
*
* @return true if connected user is defined.
*/
+ @Override
public boolean isUserConnected() {
return userExists;
}
@@ -85,6 +86,7 @@
*
* @return true if the connected user is an admin.
*/
+ @Override
public boolean isAdminConnected() {
return isUserConnected() && user.getAdmin();
}
@@ -94,6 +96,7 @@
*
* @param message to display
*/
+ @Override
public void addInfo(String message) {
getBorder().addInfo(message);
}
@@ -104,6 +107,7 @@
*
* @param message to display
*/
+ @Override
public void addFatal(String message) {
getBorder().addFatal(message);
}
@@ -113,6 +117,7 @@
*
* @param message to display
*/
+ @Override
public void addError(String message) {
getBorder().addError(message);
}
@@ -122,6 +127,7 @@
*
* @return the current url of the page.
*/
+ @Override
public String getUrl() {
return getBorder().getServerPath();
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -1,6 +1,8 @@
package org.chorem.pollen.ui.base;
+import org.chorem.pollen.entity.UserAccount;
+
/**
* PollenPage
*
@@ -23,4 +25,54 @@
* @return true for display allowed
*/
boolean canDisplayPage();
+
+ /**
+ * Retrieve connected user from session.
+ *
+ * @return the user currently connected.
+ */
+ public UserAccount getUserConnected();
+
+ /**
+ * Return true if a user is already connected to the application.
+ *
+ * @return true if connected user is defined.
+ */
+ public boolean isUserConnected();
+
+ /**
+ * Return true if the connected user is an admin.
+ *
+ * @return true if the connected user is an admin.
+ */
+ public boolean isAdminConnected();
+
+ /**
+ * Add an info {@code message} to display.
+ *
+ * @param message to display
+ */
+ public void addInfo(String message) ;
+
+ /**
+ * Add a fatal {@code message} to display. Only the fatal {@code message}
+ * will be displayed, not other elements in the page will be showed.
+ *
+ * @param message to display
+ */
+ public void addFatal(String message);
+
+ /**
+ * Add an error {@code message} to display.
+ *
+ * @param message to display
+ */
+ public void addError(String message);
+
+ /**
+ * Retrieve the current url of the page.
+ *
+ * @return the current url of the page.
+ */
+ public String getUrl();
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -193,10 +193,6 @@
*/
void setupRender() {
- // URL du site
-// siteURL = "http://" + request.getHeader("host") +
-// request.getContextPath() + "/";
-
errorJs.addError(messages.get("errorJs"));
// Logo
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,96 @@
+
+package org.chorem.pollen.ui.components;
+
+import org.apache.tapestry5.Field;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.InjectContainer;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.corelib.components.Form;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.PollenBusinessException;
+import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
+import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.PollenPage;
+import org.chorem.pollen.ui.services.PollenManager;
+import org.slf4j.Logger;
+
+/**
+ * UserListsCreate
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class UserListsCreate {
+
+ /** Container **/
+ @InjectContainer
+ private PollenPage page;
+
+ /** Services injected **/
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private Messages messages;
+
+ @Inject
+ private PollenManager manager;
+
+ @Inject
+ private ServiceUser serviceUser;
+
+ /** Properties **/
+ @Property
+ private PollAccount newFavoriteList;
+
+ /** Components injected **/
+ @InjectComponent
+ private Field listName;
+
+ @InjectComponent
+ private Form createList;
+
+ void setupRender() {
+ createList.clearErrors();
+ }
+
+ void onPrepareFromCreateList() {
+ if (newFavoriteList == null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("User connected : " + page.getUserConnected());
+ }
+ newFavoriteList = serviceUser.getNewList(page.getUserConnected());
+ }
+ }
+
+ void onValidateFormFromCreateList() {
+ try {
+ serviceUser.createFavoriteList(newFavoriteList);
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(message);
+ }
+ if (eee.getType().equals(
+ PollenExceptionType.FAVORITE_LIST_NAME_EXIST)) {
+ createList.recordError(listName, message);
+ } else {
+ createList.recordError(message);
+ }
+ }
+ }
+
+ Object onSuccessFromCreateList() {
+ page.addInfo(messages.format("pollen.ui.list.create.success",
+ newFavoriteList.getName()));
+ return page;
+ }
+
+ Object onFailureFromCreateList() {
+ return createList;
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,104 @@
+
+package org.chorem.pollen.ui.components;
+
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.ValidationException;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.corelib.components.Zone;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.entity.PollAccountImpl;
+import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.data.EvenOdd;
+import org.slf4j.Logger;
+
+/**
+ * UserListsUpdate
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class UserListsUpdate {
+
+ @Parameter(required = true)
+ @Property
+ private List<PollAccount> source;
+
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private ComponentResources resources;
+
+ @Inject
+ private ServiceUser serviceUser;
+
+ @Persist
+ @Property
+ private PollAccount favoriteListSelected;
+
+ private EvenOdd evenOdd;
+
+ @Property
+ private PollAccount account;
+
+ @Property
+ private PollAccount newAccount;
+
+ @InjectComponent
+ private Zone updateZone;
+
+ void setupRender() {
+ resources.discardPersistentFieldChanges();
+ }
+
+ public EvenOdd getEvenOdd() {
+ if (evenOdd == null) {
+ evenOdd = new EvenOdd();
+ }
+ return evenOdd;
+ }
+
+ public boolean canDisplayAccounts() {
+ return favoriteListSelected != null;
+ }
+
+ void onActionFromRemoveAccount(String UId) {
+ PollAccount child = favoriteListSelected.getChildByUId(UId);
+ favoriteListSelected.removeChild(child);
+ }
+
+ void onPrepareFromAddAccount() {
+ if (newAccount == null) {
+ // TEMP
+ newAccount = new PollAccountImpl();
+ }
+ }
+
+// void onValidateFromEmail(String input) throws ValidationException {
+// String test = StringUtils.lowerCase(input);
+// for (PollAccount curr : favoriteListSelected.getChild()) {
+// if (test.equals(curr.getEmail())) {
+// throw new ValidationException("NOT ALLOWED");
+// }
+// }
+// }
+
+ Object onSuccessFromAddAccount() {
+ favoriteListSelected.addChild(newAccount);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Add account : " + newAccount);
+ }
+ return updateZone.getBody();
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -64,7 +64,7 @@
setTextType();
break;
case IMAGE:
- setImageType(poll.getUId());
+ setImageType(poll.getUid());
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -117,7 +117,7 @@
* @return l'identifiant.
*/
public String getAdminId() {
- return poll.getUId() + ":" + creator.getUId();
+ return poll.getUid() + ":" + creator.getUid();
}
void onActivate() {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -113,7 +113,7 @@
* @return l'identifiant.
*/
public String getAdminId() {
- return poll.getUId() + ":" + creator.getUId();
+ return poll.getUid() + ":" + creator.getUid();
}
void onActivate() {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -115,7 +115,7 @@
public String getAdminId() {
// FIXME : user PollUri
- return poll.getUId() + ":" + creator.getUId();
+ return poll.getUid() + ":" + creator.getUid();
}
void onActivate() {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -490,7 +490,7 @@
userAllowed = true;
} else if (id.split(":", 2).length == 2) {
String creatorId = id.split(":", 2)[1];
- if (creatorId.equals(creator.getUId())) {
+ if (creatorId.equals(creator.getUid())) {
userAllowed = true;
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -1097,7 +1097,7 @@
}
if (pollAccount == null) {
- pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO();
+ // pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO();
// if (userExists) {
// if (user.getFirstName() != null && user.getLastName() != null) {
// pollAccount.setVotingId(
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -16,29 +16,24 @@
package org.chorem.pollen.ui.pages.user;
+import java.util.List;
-import org.apache.commons.fileupload.FileUploadException;
import org.apache.tapestry5.BindingConstants;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.Retain;
-import org.apache.tapestry5.beaneditor.BeanModel;
-import org.apache.tapestry5.corelib.components.Form;
-import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.apache.tapestry5.services.BeanModelSource;
-import org.apache.tapestry5.upload.services.UploadedFile;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
-import org.chorem.pollen.ui.components.FeedBack;
+import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.data.EvenOdd;
-import org.chorem.pollen.ui.data.AddressBarItem;
+import org.chorem.pollen.ui.services.PollenManager;
+import org.slf4j.Logger;
/**
* Classe de la page d'affichage des listes de votants favorites de
@@ -46,6 +41,7 @@
* de s'identifier via un formulaire.
*
* @author rannou
+ * @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
@IncludeStylesheet("context:css/lists.css")
@@ -54,129 +50,151 @@
@InjectComponent
private Border border;
+ /** Page title from Messages **/
+ @Parameter(defaultPrefix = BindingConstants.MESSAGE,
+ value = "pollen.page.UserLists.title")
+ @Property
+ private String title;
+
+ @Inject
+ private ServiceUser serviceUser;
+
+ private List<PollAccount> favoriteLists;
+
@Override
public Border getBorder() {
return border;
}
- /** Affichage des messages pour l'utilisateur */
- @Component(id = "feedback")
- private FeedBack feedback;
+ @Override
+ public boolean isNeedAuthentification() {
+ return true;
+ }
- /**
- * Listes de favoris de l'utilisateur.
- */
-// @Property
-// private List<PersonListDTO> lists;
+ @Override
+ public boolean canDisplayPage() {
+ return isUserConnected();
+ }
+
+ public AddressBar getAddressBar() {
+ return AddressBar.newBar().appendCurrent(title);
+ }
+ public List<PollAccount> getFavoriteLists() {
+ if (favoriteLists == null) {
+ favoriteLists = serviceUser.getFavoriteLists(getUserConnected());
+ }
+ return favoriteLists;
+ }
+
+
+//
// /**
// * Liste de favoris sélectionnée.
// */
// @Persist
// @Property
// private PersonListDTO selectedList;
-//
+
// /**
// * Nouvelle liste de favoris.
// */
// @Property
// private PersonListDTO newList;
-
- /**
- * Compte courant (pour l'itération des votants de la liste).
- */
- @SuppressWarnings("unused")
- @Property
- private PollAccount account;
-
- /**
- * Nouveau compte.
- */
- @Property
- private PollAccount newAccount;
-
- /**
- * Fichier CSV contenant une liste de votants.
- */
- @Property
- private UploadedFile accountsFile;
-
- /**
- * URL de recherche LDAP pour une liste de votants.
- */
- @Property
- private String accountsUrl;
-
- /**
- * Zone à rafraîchir.
- */
- @InjectComponent
- private Zone listsZone;
-
- /**
- * Formulaire de création de liste.
- */
- @Component
- private Form createListForm;
-
- /**
- * Formulaire de création de compte.
- */
- @Component
- private Form createAccountForm;
-
- /**
- * Messages.
- */
- @Inject
- private Messages messages;
-
- /**
- * Objet servant à changer la couleur à chaque ligne de la liste.
- */
- @SuppressWarnings("unused")
- @Property
- private EvenOdd evenOdd;
-
- @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
- @Property
- private String title;
-
- @SuppressWarnings("unused")
- @Property
- private AddressBarItem[] address;
-
- /**
- * Sert à créer listModel.
- */
- @Inject
- private BeanModelSource beanModelSource;
-
- /**
- * Sert à passer les messages en paramètre de la création de listModel.
- */
- @Inject
- private ComponentResources componentResources;
-
- /**
- * Modèle pour l'affichage de la liste des favoris.
- */
- @SuppressWarnings("unchecked")
- @Property
- @Retain
- private BeanModel listModel;
-
- /** Injection des services */
+//
+// /**
+// * Compte courant (pour l'itération des votants de la liste).
+// */
+// @SuppressWarnings("unused")
+// @Property
+// private PollAccountDTO account;
+//
+// /**
+// * Nouveau compte.
+// */
+// @Property
+// private PollAccountDTO newAccount;
+//
+// /**
+// * Fichier CSV contenant une liste de votants.
+// */
+// @Property
+// private UploadedFile accountsFile;
+//
+// /**
+// * URL de recherche LDAP pour une liste de votants.
+// */
+// @Property
+// private String accountsUrl;
+//
+// /**
+// * Zone à rafraîchir.
+// */
+// @InjectComponent
+// private Zone listsZone;
+//
+// /**
+// * Formulaire de création de liste.
+// */
+// @Component
+// private Form createListForm;
+//
+// /**
+// * Formulaire de création de compte.
+// */
+// @Component
+// private Form createAccountForm;
+//
+// /**
+// * Messages.
+// */
// @Inject
+// private Messages messages;
+//
+// /**
+// * Objet servant à changer la couleur à chaque ligne de la liste.
+// */
+// @SuppressWarnings("unused")
+//
+// @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
+// @Property
+// private String title;
+//
+// @SuppressWarnings("unused")
+// @Property
+// private AddressBarItem[] address;
+//
+// /**
+// * Sert à créer listModel.
+// */
+// @Inject
+// private BeanModelSource beanModelSource;
+//
+// /**
+// * Sert à passer les messages en paramètre de la création de listModel.
+// */
+// @Inject
+// private ComponentResources componentResources;
+//
+// /**
+// * Modèle pour l'affichage de la liste des favoris.
+// */
+// @SuppressWarnings("unchecked")
+// @Property
+// @Retain
+// private BeanModel listModel;
+//
+// /** Injection des services */
+// @Inject
// private ServiceList serviceList;
// @Inject
// private ServicePollAccount servicePollAccount;
-
- /**
- * Méthode appelée à la création d'une liste.
- */
- Object onSuccessFromCreateListForm() {
//
+// /**
+// * Méthode appelée à la création d'une liste.
+// */
+// Object onSuccessFromCreateListForm() {
+//
// // Contrôle du nom de la liste
// for (PersonListDTO list : lists) {
// if (list.getName().equals(newList.getName())) {
@@ -226,14 +244,14 @@
// selectedList = list;
// }
// }
-
- return this;
- }
-
- /**
- * Méthode appelée à la suppression d'une liste.
- */
- Object onActionFromDeleteList() {
+//
+// return this;
+// }
+//
+// /**
+// * Méthode appelée à la suppression d'une liste.
+// */
+// Object onActionFromDeleteList() {
// if (selectedList != null) {
// for (PersonListDTO dto : lists) {
// if (dto.getId().equals(selectedList.getId())) {
@@ -248,15 +266,15 @@
// }
// }
// selectedList = null;
- return this;
- }
-
- /**
- * Méthode appelée à la création d'un compte.
- */
- Object onSuccessFromCreateAccountForm() {
- // TODO : use onValidateForm method : test return block, may be
- // a problem between failure and success
+// return this;
+// }
+//
+// /**
+// * Méthode appelée à la création d'un compte.
+// */
+// Object onSuccessFromCreateAccountForm() {
+// // TODO : use onValidateForm method : test return block, may be
+// // a problem between failure and success
// for (PollAccountDTO dto : selectedList.getPollAccounts()) {
// if (dto.getVotingId().equals(newAccount.getVotingId())) {
// createAccountForm.recordError(messages.format("accountExists",
@@ -270,67 +288,42 @@
//// selectedList = serviceList.findPersonListById(selectedList.getId());
// serviceList.createAccountInPersonList(selectedList, account);
// }
- return listsZone.getBody();
- }
-
- /**
- * Méthode appelée à la suppression d'un compte.
- */
- Object onActionFromDeleteAccount(String accountId) {
-// Iterator<PollAccountDTO> it = selectedList.getPollAccounts()
-// .iterator();
-// while (it.hasNext()) {
-// if (accountId.equals(it.next().getId())) {
-// it.remove();
-// }
-// }
-// serviceList.updatePersonList(selectedList);
-// servicePollAccount.deletePollAccount(accountId);
-// selectedList = serviceList.findPersonListById(selectedList.getId());
+// return listsZone.getBody();
+// }
+//
+// /**
+// * Méthode appelée à la suppression d'un compte.
+// */
+// Object onActionFromDeleteAccount(String accountId) {
+//// Iterator<PollAccountDTO> it = selectedList.getPollAccounts()
+//// .iterator();
+//// while (it.hasNext()) {
+//// if (accountId.equals(it.next().getId())) {
+//// it.remove();
+//// }
+//// }
+//// serviceList.updatePersonList(selectedList);
+//// servicePollAccount.deletePollAccount(accountId);
+//// selectedList = serviceList.findPersonListById(selectedList.getId());
// serviceList.deleteAccountFromPersonList(selectedList, accountId);
- return listsZone.getBody();
- }
-
- /**
- * Récupération des exceptions du champs d'upload de fichier.
- */
- Object onUploadException(FileUploadException ex) {
- createListForm.recordError("Upload exception: " + ex.getMessage());
- return this;
- }
-
+// return listsZone.getBody();
+// }
+//
+// /**
+// * Récupération des exceptions du champs d'upload de fichier.
+// */
+// Object onUploadException(FileUploadException ex) {
+// createListForm.recordError("Upload exception: " + ex.getMessage());
+// return this;
+// }
+//
// /** Retourne vrai s'il n'existe aucune liste */
// public boolean isListsNull() {
-// return lists == null || lists.size() == 0;
+// return CollectionUtils.isEmpty(lists);
// }
//
// /** Retourne vrai si la liste sélectionnée est vide */
// public boolean isSelectedListNull() {
// return selectedList == null;
// }
-
- /**
- * Méthode d'initialisation des listes de favoris.
- */
- void onActivate() {
- evenOdd = new EvenOdd();
-// if (userExists) {
-// lists = serviceList.findPersonListByUser(user.getId());
-// }
-// newList = new PersonListDTO();
-// newAccount = new PollAccountDTO();
- }
-
- /**
- * Initialisation de l'affichage
- */
- void setupRender() {
- address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"),
- new AddressBarItem(title, null) };
-
- listModel = beanModelSource.createDisplayModel(PollAccount.class,
- componentResources.getMessages());
- listModel.add("functions", null);
- listModel.include("votingId", "email", "functions");
- }
}
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -77,7 +77,7 @@
// }
// }
// }
- return poll.getUId();
+ return poll.getUid();
}
/**
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -13,10 +13,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
package org.chorem.pollen.ui.services;
-import java.util.Locale;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -29,10 +27,11 @@
import org.apache.tapestry5.ioc.services.SymbolProvider;
import org.apache.tapestry5.services.ApplicationStateContribution;
import org.apache.tapestry5.services.ApplicationStateCreator;
+import org.apache.tapestry5.services.BindingFactory;
+import org.apache.tapestry5.services.BindingSource;
import org.apache.tapestry5.upload.services.UploadSymbols;
import org.chorem.pollen.PollenContextImpl;
import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.entity.UserAccountImpl;
import org.chorem.pollen.service.ServiceEmail;
import org.chorem.pollen.service.ServiceEmailImpl;
import org.chorem.pollen.service.ServicePoll;
@@ -103,9 +102,9 @@
public static void contributeRegistryStartup(
OrderedConfiguration<Runnable> configuration,
ServiceUser serviceUser,
- PollenManager manager,
+ PollenManager manager,
RegistryShutdownHub shutdownHub) {
-
+
if (logger.isInfoEnabled()) {
logger.info("Execute contributeRegistryStartup");
}
@@ -186,10 +185,10 @@
configuration.add(
new CoercionTuple<String, PollUri>(
- String.class, PollUri.class, coercion1));
+ String.class, PollUri.class, coercion1));
configuration.add(
new CoercionTuple<PollUri, String>(
- PollUri.class, String.class, coercion2));
+ PollUri.class, String.class, coercion2));
}
/**
@@ -204,16 +203,13 @@
// .getComponentResources().getMessages();
// return new BackgroundWorkerImpl(messages, servicePoll, context);
// }
-
-
/**
* Used to instanciate SessionState UserAccount when session expires.
*
* @param configuration to add the ApplicationStateCreator.
* @param serviceUser to instantiate user
*/
- public void contributeApplicationStateManager(MappedConfiguration<Class<?>,
- ApplicationStateContribution> configuration,
+ public void contributeApplicationStateManager(MappedConfiguration<Class<?>, ApplicationStateContribution> configuration,
final ServiceUser serviceUser) {
if (logger.isInfoEnabled()) {
logger.info("Execute contributeApplicationStateManager");
@@ -221,13 +217,20 @@
ApplicationStateCreator<UserAccount> creator =
new ApplicationStateCreator<UserAccount>() {
- @Override
- public UserAccount create() {
- return serviceUser.getNewUser();
- }
- };
+ @Override
+ public UserAccount create() {
+ return serviceUser.getNewUser();
+ }
+ };
+
configuration.add(UserAccount.class,
new ApplicationStateContribution("session", creator));
}
+
+ public static void contributeBindingSource(
+ MappedConfiguration<String, BindingFactory> configuration,
+ BindingSource bindingSource) {
+ configuration.add("format", new FormatBindingFactory(bindingSource));
+ }
}
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,72 @@
+package org.chorem.pollen.ui.services;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.tapestry5.Binding;
+import org.apache.tapestry5.internal.bindings.AbstractBinding;
+import org.apache.tapestry5.ioc.Location;
+import org.apache.tapestry5.ioc.Messages;
+
+/**
+ * From <http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix>
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class FormatBinding extends AbstractBinding {
+
+ private final Messages messages;
+ private final boolean invariant;
+ private final List<Binding> keyBindings;
+ private final List<Binding> valueBindings;
+
+ public FormatBinding(Location location, Messages messages, boolean invariant,
+ ArrayList<Binding> keyBindings, List<Binding> valueBindings) {
+ super(location);
+
+ this.messages = messages;
+ this.invariant = invariant;
+ this.keyBindings = keyBindings;
+ this.valueBindings = valueBindings;
+ }
+
+ public FormatBinding(Location location, Messages messages, boolean invariant, ArrayList<Binding> keyBindings) {
+ super(location);
+
+ this.messages = messages;
+ this.invariant = invariant;
+ this.keyBindings = keyBindings;
+ this.valueBindings = null;
+ }
+
+ @Override
+ public Object get() {
+ String key = "";
+ for (Binding keyBinding : keyBindings) {
+ key += keyBinding.get();
+ }
+
+ if (null == valueBindings) {
+ return messages.get(key);
+ }
+
+ List<Object> values = new ArrayList<Object>(valueBindings.size());
+ for (Binding valueBinding : valueBindings) {
+ values.add(valueBinding.get());
+ }
+
+ return messages.format(key, values.toArray());
+ }
+
+ @Override
+ public boolean isInvariant() {
+ return this.invariant;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<?> getBindingType() {
+ return String.class;
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,79 @@
+package org.chorem.pollen.ui.services;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.tapestry5.Binding;
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.ioc.Location;
+import org.apache.tapestry5.services.BindingFactory;
+import org.apache.tapestry5.services.BindingSource;
+
+/**
+ * From <http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix>
+ *
+ * Created: 27 avr. 2010
+ *
+ * @author fdesbois
+ */
+public class FormatBindingFactory
+ implements BindingFactory {
+
+ private static final String SEPARATOR = "=";
+ private static final String DELIMITER = ",";
+ private static final String KEY_PREFIX = BindingConstants.LITERAL;
+ private static final String VALUE_PREFIX = BindingConstants.PROP;
+ private final BindingSource bindingSource;
+
+ public FormatBindingFactory(BindingSource bindingSource) {
+ this.bindingSource = bindingSource;
+ }
+
+ @Override
+ public Binding newBinding(String description, ComponentResources container, ComponentResources component,
+ String expression, Location location) {
+ int separatorIndex = expression.indexOf(SEPARATOR);
+
+ if (-1 == separatorIndex) {
+ List<String> keys = Arrays.asList(expression.split(DELIMITER));
+
+ ArrayList<Binding> keyBindings = createBindings(description, container, component, KEY_PREFIX, keys, location);
+
+ boolean invariant = isInvariant(keyBindings);
+ return new FormatBinding(location, container.getMessages(), invariant, keyBindings);
+ }
+
+ List<String> keys = Arrays.asList(expression.substring(0, separatorIndex).split(DELIMITER));
+ ArrayList<Binding> keyBindings = createBindings(description, container, component, KEY_PREFIX, keys, location);
+
+ List<String> values = Arrays.asList(expression.substring(separatorIndex + 1).split(DELIMITER));
+ ArrayList<Binding> valueBindings = createBindings(description, container, component, VALUE_PREFIX, values,
+ location);
+
+ boolean invariant = isInvariant(keyBindings) && isInvariant(valueBindings);
+ return new FormatBinding(location, container.getMessages(), invariant, keyBindings, valueBindings);
+ }
+
+ private ArrayList<Binding> createBindings(String description, ComponentResources container,
+ ComponentResources component, String defaultPrefix,
+ List<String> expressions, Location location) {
+ ArrayList<Binding> bindings = new ArrayList<Binding>(expressions.size());
+
+ for (String expression : expressions) {
+ bindings.add(bindingSource.newBinding(description, container, component, defaultPrefix, expression, location));
+ }
+
+ return bindings;
+ }
+
+ private boolean isInvariant(ArrayList<Binding> bindings) {
+ for (Binding binding : bindings) {
+ if (!binding.isInvariant()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-27 16:29:41 UTC (rev 2976)
@@ -33,7 +33,6 @@
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
import org.chorem.pollen.service.ServiceUser;
-import org.chorem.pollen.ui.base.PollenPage;
import org.nuiton.util.ApplicationConfig;
import org.slf4j.Logger;
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-27 16:29:41 UTC (rev 2976)
@@ -1,12 +1,16 @@
############################ PAGES #############################################
pollen.page.AdminUsers.title=Gestion des utilisateurs
+pollen.page.UserLists.title=Vos listes de votants
############################ EMAIL #############################################
pollen.email.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s
pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s
############################ GLOBAL ############################################
-pollen.ui.help.title=Aide
+pollen.ui.tooltip.help=Aide
+pollen.ui.button.add=Ajouter
+pollen.ui.button.create=Cr\u00E9er
+pollen.ui.button.ok=Ok
############################ USER ##############################################
pollen.ui.user.register.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s.
@@ -15,26 +19,38 @@
pollen.ui.user.update.success=Modification enregistr\u00E9e avec succ\u00E8s.
pollen.ui.user.display.notConnected=Vous devez vous connecter pour acc\u00E9der \u00E0 cette page.
pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 cette page.
-pollen.ui.user.create=Ajouter
pollen.ui.user.create.title=Cr\u00E9er un nouvel utilisateur
pollen.ui.user.create.passwordGenerated=Le mot de passe du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9.
pollen.ui.user.create.passwordSameAsLogin=Le mot de passe du nouvel utilisateur est le m\u00EAme que son identifiant.
-pollen.ui.user.create.password.help=Si vous pr\u00E9cisez un email, un mot de passe sera g\u00E9n\u00E9r\u00E9 et envoy\u00E9 \u00E0 l'utilisateur. Sinon le mot de passe sera identique au login.
+pollen.ui.user.create.passwordHelp=Si vous pr\u00E9cisez un email, un mot de passe sera g\u00E9n\u00E9r\u00E9 et envoy\u00E9 \u00E0 l'utilisateur. Sinon le mot de passe sera identique au login.
pollen.ui.user.create.sendEmail=Un email a \u00E9t\u00E9 envoy\u00E9 au nouvel utilisateur %1$s \u00E0 l'adresse %2$s.
pollen.ui.user.create.emailFailedShowPassword=Le mot de passe g\u00E9n\u00E9r\u00E9 est le suivant : %1$s
pollen.ui.user.create.success=L'utilisateur %1$s a \u00E9t\u00E9 cr\u00E9\u00E9 avec succ\u00E8s.
+pollen.ui.user.nbUsers=%1$d utilisateurs existants.
pollen.ui.user.update.edit=Modifier cet utilisateur.
pollen.ui.user.update.save=Enregistrer les modifications.
pollen.ui.user.update.cancel=Annuler les changements.
pollen.ui.user.delete=Supprimer cet utilisateur.
pollen.ui.user.delete.confirmMessage=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer cet utilisateur ?
+pollen.ui.list.create.title=Cr\u00E9er une nouvelle liste
+pollen.ui.list.create.success=La liste %1$s a \u00E9t\u00E9 cr\u00E9\u00E9e avec succ\u00E8s.
+pollen.ui.list.update.notSelected=Aucune liste s\u00E9lectionn\u00E9e.
+pollen.ui.list.update.emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email.
+pollen.ui.list.update.addAccount=Ajouter un nouvel utilisateur \u00E0 la liste
# FORM:: user
firstName-label=Pr\u00E9nom
lastName-label=Nom
login-label=Identifiant
email-label=Email
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Adresse email invalide.
+# FORM:: favorite list
+listSelect-label= Liste
+listName-label= Nom
+name-label= Nom
+
############################ CHOICE ############################################
pollen.ui.choice.delete.confirm=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer ce choix ?
pollen.ui.choice.delete.title=Supprimer ce choix
Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<body xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+ <t:zone t:id="createZone" t:update="show">
+ <form t:type="form" t:id="createList" action="tapestry" t:zone="createZone">
+ <div id="createListFormDiv">
+ <t:errors/>
+ <fieldset>
+ <legend>${message:pollen.ui.list.create.title}</legend>
+ <div>
+ <label t:type="label" for="listName" />* :
+ <input t:type="textfield" t:id="listName" value="newFavoriteList.name" t:validate="required"/>
+ </div>
+ <!-- <div>
+ <t:label for="accountsFile" />
+ <input t:type="upload" t:id="accountsFile" />
+ <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsFile-help}" effect="appear">
+ <img src="${asset:context:img/help.png}" alt="${message:help}"/>
+ </span>
+ </div>
+ <div>
+ <t:label for="accountsUrl" />
+ <t:textfield t:id="accountsUrl" t:value="accountsUrl" />
+ <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsUrl-help}" effect="appear">
+ <img src="${asset:context:img/help.png}" alt="${message:help}"/>
+ </span>
+ </div>-->
+ <div class="buttons">
+ <input t:type="submit" value="${message:pollen.ui.button.create}"/>
+ </div>
+ </fieldset>
+ </div>
+ </form>
+ </t:zone>
+</body>
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-27 16:29:41 UTC (rev 2976)
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<body xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+ <t:zone t:id="updateZone" show="show" update="show">
+
+ <form t:type="form" t:id="selectListForm" action="tapestry">
+ <div>
+ ${message:listSelect-label}:
+ <select t:id="listSelect" t:type="ck/beanSelect" t:list="source" t:value="favoriteListSelected"
+ t:labelField="literal:name" t:valueField="literal:name" />
+ <input t:type="submit" value="${message:pollen.ui.button.ok}"/>
+ </div>
+ </form>
+
+ <t:if test="canDisplayAccounts()">
+ <!-- Display all Accounts child of favoriteListSelected -->
+ <div t:type="grid" t:source="favoriteListSelected.child" t:row="account"
+ t:include="name, email, weight" t:add="actions"
+ t:rowsPerPage="20" t:rowClass="prop:evenodd.next" t:inPlace="true">
+ <p:actionsCell>
+ <a t:type="actionlink" t:id="removeAccount" t:context="account.UId">
+ <img src="${asset:context:img/delete.png}" alt="${message:pollen.ui.list.remove}"/>
+ </a>
+ </p:actionsCell>
+ <p:empty>
+ ${message:pollen.ui.list.update.emptyList}
+ </p:empty>
+ </div>
+
+ <!-- Add a new PollAccount to favoriteListSelected -->
+ <form t:type="form" t:id="addAccount" t:zone="updateZone" action="tapestry">
+ <table class="t-data-grid">
+ <tr>
+ <td class="votingId">
+ <input t:type="textfield" t:id="name" t:value="newAccount.name" t:validate="required" size="10"/>
+ </td>
+ <td class="email">
+ <input t:type="textfield" t:id="email" t:value="newAccount.email" t:validate="email" size="15"/>
+ </td>
+ <td class="weight">
+ <input t:type="textfield" t:id="weight" t:value="newAccount.weight" size="5"/>
+ </td>
+ <td class="functions">
+ <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.list.update.addAccount}"/>
+ </td>
+ </tr>
+ </table>
+ <t:errors/>
+ </form>
+
+ <!-- Delete the favoriteListSelected -->
+<!-- <p>
+ <a t:type="actionlink" t:id="deleteList">
+ <img src="${asset:context:img/delete.png}" alt="Delete"/>${message:deleteList}
+ </a>
+ </p>-->
+
+ <p:else>
+ ${message:pollen.ui.list.update.notSelected}
+ </p:else>
+ </t:if>
+
+ </t:zone>
+</body>
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties 2010-04-27 16:29:41 UTC (rev 2976)
@@ -1,31 +1,31 @@
-title=Vos listes de votants
-accountExists=L'identifiant de vote %s existe d\u00E9j\u00E0 dans cette liste.
-listExists=La liste %s existe d\u00E9j\u00E0.
-invalidCsv=Le fichier %s n'est pas un fichier CSV.
-noAccountCsv=Le fichier %s ne contient aucune entr\u00E9e valide.
-noAccountLdap=L'URL %s ne permet pas d'obtenir d'entr\u00E9es valides.
-noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 vos listes de votants.\n Veuillez remplir le formulaire ci-dessous.
-noList=Aucune liste s\u00E9lectionn\u00E9e.
-emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email.
-listSelect-label=Liste
-listDeleted=La liste %s a \u00E9t\u00E9 supprim\u00E9e.
-listNotDeleted=Erreur lors de la suppression de la liste %s.
-
-#list
-votingId-label=Nom
-votingId-required-message=Vous devez fournir un nom.
-email-label=Em@il
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Adresse email invalide.
-email-required-message=Vous devez fournir une adresse email.
-functions-label=Fonctions
-deleteList=Supprimer la liste
-
-#new list
-createListLegend=Cr\u00E9er une nouvelle liste
-listName-label=Nom *
-listName-required-message=Vous devez fournir un nom.
-accountsFile-label=Import CSV
-accountsFile-help=Vous pouvez importer une liste \u00E0 partir d'un fichier CSV contenant un votant par ligne (nom, email)
-accountsUrl-label=Import LDAP
-accountsUrl-help=Vous pouvez importer une liste en utilisant une URL de recherche LDAP (ldap[s]://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>) Les entr\u00E9es doivent contenir les attributs cn et mail
\ No newline at end of file
+#title=Vos listes de votants
+#accountExists=L'identifiant de vote %s existe d\u00E9j\u00E0 dans cette liste.
+#listExists=La liste %s existe d\u00E9j\u00E0.
+#invalidCsv=Le fichier %s n'est pas un fichier CSV.
+#noAccountCsv=Le fichier %s ne contient aucune entr\u00E9e valide.
+#noAccountLdap=L'URL %s ne permet pas d'obtenir d'entr\u00E9es valides.
+#noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 vos listes de votants.\n Veuillez remplir le formulaire ci-dessous.
+#noList=Aucune liste s\u00E9lectionn\u00E9e.
+#emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email.
+#listSelect-label=Liste
+#listDeleted=La liste %s a \u00E9t\u00E9 supprim\u00E9e.
+#listNotDeleted=Erreur lors de la suppression de la liste %s.
+#
+##list
+#votingId-label=Nom
+#votingId-required-message=Vous devez fournir un nom.
+#email-label=Em@il
+#email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+#email-regexp-message=Adresse email invalide.
+#email-required-message=Vous devez fournir une adresse email.
+#functions-label=Fonctions
+#deleteList=Supprimer la liste
+#
+##new list
+#createListLegend=Cr\u00E9er une nouvelle liste
+#listName-label=Nom *
+#listName-required-message=Vous devez fournir un nom.
+#accountsFile-label=Import CSV
+#accountsFile-help=Vous pouvez importer une liste \u00E0 partir d'un fichier CSV contenant un votant par ligne (nom, email)
+#accountsUrl-label=Import LDAP
+#accountsUrl-help=Vous pouvez importer une liste en utilisant une URL de recherche LDAP (ldap[s]://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>) Les entr\u00E9es doivent contenir les attributs cn et mail
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-27 16:29:41 UTC (rev 2976)
@@ -3,7 +3,7 @@
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
<h1 class="titleIndex">${title}</h1>
-
+ <p class="center"><strong>${format:pollen.ui.user.nbUsers=accounts.availableRows}</strong></p>
<t:zone t:id="usersZone" t:update="show">
<t:form t:id="usersForm" t:zone="usersZone">
<t:if t:test="accountEdited">
@@ -71,10 +71,10 @@
<input t:type="textfield" t:id="newLogin" value="newUser.login" t:validate="required" />
<label t:type="label" for="newEmail">${message:email-label}</label> :
<input t:type="textfield" t:id="newEmail" value="newUser.email" t:validate="regexp" />
- <span t:type="ck/Tooltip" title="message:pollen.ui.help.title" t:value="message:pollen.ui.user.create.password.help" t:effect="appear">
+ <span t:type="ck/Tooltip" title="message:pollen.ui.tooltip.help" t:value="message:pollen.ui.user.create.passwordHelp" t:effect="appear">
<img src="${asset:context:img/help.png}" alt="message:help"/>
</span>
- <input t:type="submit" value="${message:pollen.ui.user.create}" title="${message:pollen.ui.user.create.title}" />
+ <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.user.create.title}" />
</p>
</form>
</t:zone>
Modified: trunk/pollen-ui/src/main/webapp/css/lists.css
===================================================================
--- trunk/pollen-ui/src/main/webapp/css/lists.css 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/webapp/css/lists.css 2010-04-27 16:29:41 UTC (rev 2976)
@@ -25,11 +25,11 @@
text-align: left;
}
-#createListFormDiv label {
+/*#createListFormDiv label {
display: block;
width: 80px;
float: left;
-}
+}*/
#createListForm div {
margin-bottom: 10px;
Modified: trunk/pollen-ui/src/main/webapp/user/UserLists.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/user/UserLists.tml 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pollen-ui/src/main/webapp/user/UserLists.tml 2010-04-27 16:29:41 UTC (rev 2976)
@@ -1,110 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<t:border t:addressBar="addressBar" t:pageLogo="literal:Creation" t:pageTitle="prop:title"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
-<t:border t:address="address" t:pageLogo="literal:Creation"
- xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
-
- <t:feedback t:id="feedback"/>
- <h1 class="titleCreation">${message:title}</h1>
- <t:if test="userExists">
- <div id="listsDiv">
-
- <t:unless test="listsNull">
- <t:zone t:id="listsZone" show="show" update="show">
-
-
- <!-- Sélection de la liste -->
- <t:form id="selectListForm">
- <div>
- ${message:listSelect-label}:
- <select t:id="listSelect" t:type="ck/BeanSelect" t:list="lists" t:value="selectedList"
- t:labelField="literal:name" t:valueField="literal:name" />
- <t:submit t:id="submitListsForm" t:value="${message:ok}"/>
- </div>
- </t:form>
-
- <t:if test="selectedListNull">
- ${message:noList}
- <p:else>
-
+ <h1 class="titleCreation">${title}</h1>
+ <div id="listsDiv">
- <!-- Affichage de la liste -->
- <t:grid t:source="selectedList.pollAccounts" t:row="account" model="listModel"
- t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next" t:inPlace="true">
- <p:functionsCell>
- <t:actionlink t:id="deleteAccount" context="account.id" t:zone="listsZone">
- <img src="${asset:context:img/delete.png}" alt="${message:delete}"/>
- </t:actionlink>
- </p:functionsCell>
- <p:empty>
- ${message:emptyList}
- </p:empty>
- </t:grid>
-
- <!-- Création d'un compte -->
- <t:form t:id="createAccountForm" t:zone="listsZone">
- <table class="t-data-grid">
- <tr>
- <td class="votingId">
- <t:textfield t:id="votingId" t:value="newAccount.votingId" t:validate="required" size="10"/>
- </td>
- <td class="email">
- <t:textfield t:id="email" t:value="newAccount.email" t:validate="required,regexp" size="15"/>
- </td>
- <td class="functions">
- <t:submit t:id="submitCreateAccountForm" t:value="${message:add}"/>
- </td>
- </tr>
- </table>
- <t:errors/>
- </t:form>
-
- <!-- Suppression de la liste -->
- <t:actionlink t:id="deleteList">
- <img src="${asset:context:img/delete.png}"/>${message:deleteList}
- </t:actionlink>
-
- </p:else>
- </t:if>
-
- </t:zone>
- </t:unless>
-
-
- <!-- Création d'une liste -->
- <t:form t:id="createListForm">
- <div id="createListFormDiv">
- <t:errors/>
- <FieldSet>
- <legend>${message:createListLegend}</legend>
- <div>
- <t:label for="listName" />
- <t:textfield t:id="listName" t:value="newList.name" t:validate="required"/>
- </div>
- <div>
- <t:label for="accountsFile" />
- <input t:type="upload" t:id="accountsFile" />
- <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsFile-help}" effect="appear">
- <img src="${asset:context:img/help.png}" alt="${message:help}"/>
- </span>
- </div>
- <div>
- <t:label for="accountsUrl" />
- <t:textfield t:id="accountsUrl" t:value="accountsUrl" />
- <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsUrl-help}" effect="appear">
- <img src="${asset:context:img/help.png}" alt="${message:help}"/>
- </span>
- </div>
- <div class="buttons">
- <t:submit t:id="submitCreateListForm" t:value="${message:create}"/>
- </div>
- </FieldSet>
- </div>
- </t:form>
-
+ <t:if test="favoriteLists">
+ <t:userListsUpdate t:source="favoriteLists" />
+ </t:if>
- </div>
- <p:else>
- <h4>${message:noUser}</h4>
- <t:LoginComponent />
- </p:else>
- </t:if>
+ <t:userListsCreate />
+
+ </div>
</t:border>
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-26 14:12:40 UTC (rev 2975)
+++ trunk/pom.xml 2010-04-27 16:29:41 UTC (rev 2976)
@@ -309,8 +309,8 @@
<!-- customized versions -->
<!--javadoc.version>2.4</javadoc.version-->
- <topia.version>2.3.3</topia.version>
- <eugene.version>2.0.1</eugene.version>
+ <topia.version>2.4-SNAPSHOT</topia.version>
+ <eugene.version>2.0.2-SNAPSHOT</eugene.version>
<i18n.version>1.2.1</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
<nuiton-utils.version>1.2.2</nuiton-utils.version>
2
1
r2975 - in trunk: pollen-business/src/main/java/org/chorem/pollen pollen-business/src/main/java/org/chorem/pollen/service pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin pollen-ui/src/main/resources/i18n pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin pollen-ui/src/main/webapp/admin
by fdesbois@users.chorem.org 26 Apr '10
by fdesbois@users.chorem.org 26 Apr '10
26 Apr '10
Author: fdesbois
Date: 2010-04-26 16:12:40 +0200 (Mon, 26 Apr 2010)
New Revision: 2975
Log:
- Add message when email was not sent (password is still generated)
- Add tooltip to help admin for password managment
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties
trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-26 14:12:40 UTC (rev 2975)
@@ -27,8 +27,10 @@
this.type = type;
}
- public PollenBusinessException(Throwable exception, PollenExceptionType type, Object... args) {
+ public PollenBusinessException(Throwable exception,
+ PollenExceptionType type, Object... args) {
super(type.getMessage(), exception);
+ this.args = args;
this.type = type;
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-26 14:12:40 UTC (rev 2975)
@@ -61,12 +61,12 @@
errorArgs.add(pollenEmail.getPort());
errorArgs.add(pollenEmail.getTo());
errorArgs.add(pollenEmail.getFrom());
+
try {
-
// Create the SimpleEmail to send
SimpleEmail email = pollenEmail.createSimpleEmail();
email.send();
-
+
if (log.isInfoEnabled()) {
log.info("Mail sent to : " + pollenEmail.getTo());
@@ -80,7 +80,7 @@
}
} catch (EmailException eee) {
if (log.isErrorEnabled()) {
- log.error("Error on email send", eee);
+ log.error("Error on email send to " + pollenEmail.getTo(), eee);
}
throw new PollenBusinessException(eee,
PollenExceptionType.SMTP_NOT_AVAILABLE,
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java 2010-04-26 14:12:40 UTC (rev 2975)
@@ -330,6 +330,9 @@
} catch (PollenBusinessException eee) {
String message = manager.getErrorMessage(eee, messages, logger);
addError(message);
+ addInfo(messages.format(
+ "pollen.ui.user.create.emailFailedShowPassword",
+ newPassword));
}
}
// Remove accounts to reset order and current page
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-26 14:12:40 UTC (rev 2975)
@@ -5,6 +5,9 @@
pollen.email.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s
pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s
+############################ GLOBAL ############################################
+pollen.ui.help.title=Aide
+
############################ USER ##############################################
pollen.ui.user.register.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s.
pollen.ui.user.register.sendEmail=Un email vous a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse %1$s.
@@ -14,9 +17,11 @@
pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 cette page.
pollen.ui.user.create=Ajouter
pollen.ui.user.create.title=Cr\u00E9er un nouvel utilisateur
-pollen.ui.user.create.passwordGenerated=Le password du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9.
-pollen.ui.user.create.passwordSameAsLogin=Le password du nouvel utilisateur est le m\u00EAme que son identifiant.
+pollen.ui.user.create.passwordGenerated=Le mot de passe du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9.
+pollen.ui.user.create.passwordSameAsLogin=Le mot de passe du nouvel utilisateur est le m\u00EAme que son identifiant.
+pollen.ui.user.create.password.help=Si vous pr\u00E9cisez un email, un mot de passe sera g\u00E9n\u00E9r\u00E9 et envoy\u00E9 \u00E0 l'utilisateur. Sinon le mot de passe sera identique au login.
pollen.ui.user.create.sendEmail=Un email a \u00E9t\u00E9 envoy\u00E9 au nouvel utilisateur %1$s \u00E0 l'adresse %2$s.
+pollen.ui.user.create.emailFailedShowPassword=Le mot de passe g\u00E9n\u00E9r\u00E9 est le suivant : %1$s
pollen.ui.user.create.success=L'utilisateur %1$s a \u00E9t\u00E9 cr\u00E9\u00E9 avec succ\u00E8s.
pollen.ui.user.update.edit=Modifier cet utilisateur.
pollen.ui.user.update.save=Enregistrer les modifications.
@@ -30,12 +35,6 @@
login-label=Identifiant
email-label=Email
-login-required-message=Vous devez fournir un identifiant
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Email invalide
-newEmail-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-newEmail-regexp-message=Email invalide
-
############################ CHOICE ############################################
pollen.ui.choice.delete.confirm=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer ce choix ?
pollen.ui.choice.delete.title=Supprimer ce choix
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties 2010-04-26 14:12:40 UTC (rev 2975)
@@ -22,4 +22,12 @@
#
#login-required-message=Vous devez fournir un identifiant.
#email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-#email-regexp-message=Email invalide.
\ No newline at end of file
+#email-regexp-message=Email invalide.
+
+
+
+login-required-message=Vous devez fournir un identifiant
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Email invalide
+newEmail-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+newEmail-regexp-message=Email invalide
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-23 17:12:06 UTC (rev 2974)
+++ trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-26 14:12:40 UTC (rev 2975)
@@ -70,7 +70,10 @@
<label t:type="label" for="newLogin">${message:login-label}</label>* :
<input t:type="textfield" t:id="newLogin" value="newUser.login" t:validate="required" />
<label t:type="label" for="newEmail">${message:email-label}</label> :
- <input t:type="textfield" t:id="newEmail" value="newUser.email" t:validate="regexp" />
+ <input t:type="textfield" t:id="newEmail" value="newUser.email" t:validate="regexp" />
+ <span t:type="ck/Tooltip" title="message:pollen.ui.help.title" t:value="message:pollen.ui.user.create.password.help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
<input t:type="submit" value="${message:pollen.ui.user.create}" title="${message:pollen.ui.user.create.title}" />
</p>
</form>
1
0
Author: fdesbois
Date: 2010-04-23 19:12:06 +0200 (Fri, 23 Apr 2010)
New Revision: 2974
Log:
No need to use las ToPIA snapshot
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-23 17:09:22 UTC (rev 2973)
+++ trunk/pom.xml 2010-04-23 17:12:06 UTC (rev 2974)
@@ -309,7 +309,7 @@
<!-- customized versions -->
<!--javadoc.version>2.4</javadoc.version-->
- <topia.version>2.4-SNAPSHOT</topia.version>
+ <topia.version>2.3.3</topia.version>
<eugene.version>2.0.1</eugene.version>
<i18n.version>1.2.1</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
1
0
Author: fdesbois
Date: 2010-04-23 19:09:22 +0200 (Fri, 23 Apr 2010)
New Revision: 2973
Log:
- Refactor page AdminUsers (behavior and render)
- Add AbstractMappedGridDataSource + create UserAccountDataSource to manage pagination on users list. Use Filter bean in business to prepare the TopiaQuery to retrieve userAccount list
- Add PollenPage and AbstractPollenPage to manage permissions from Border layout component + loginComponent use if necessary (using a delegate)
- Remove useless language property from model
- Add createDefaultAdmin if it's not already exist
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollsPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/UserAccountDataSource.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminPolls.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_fr.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties
trunk/pollen-ui/src/main/webapp/admin/AdminPolls.tml
trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
trunk/pollen-ui/src/main/webapp/img/save.png
trunk/pollen-ui/src/main/webapp/img/undo.png
Removed:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/PollsAdmin.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/PasswordGenerator.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_fr.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_fr.properties
trunk/pollen-ui/src/main/webapp/admin/PollsAdmin.tml
trunk/pollen-ui/src/main/webapp/admin/UsersAdmin.tml
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractUploadPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsCreated.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-en_GB.properties
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border_fr.properties
trunk/pollen-ui/src/main/webapp/css/common.css
trunk/pom.xml
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,6 +1,7 @@
package org.chorem.pollen;
import java.util.Date;
+import org.chorem.pollen.service.ServiceUser;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.util.ApplicationConfig;
@@ -17,7 +18,7 @@
* </pre>
* @param config ApplicationConfig
*/
- public void loadConfiguration(ApplicationConfig config);
+ void loadConfiguration(ApplicationConfig config);
/**
* start :
@@ -30,14 +31,15 @@
* - Initialize i18n for error messages
* - Create default admin if needed (this will load the topiaRootContext).
* </pre>
+ * @param serviceUser to manage default admin if needed
*/
- public void start();
+ void start(ServiceUser serviceUser);
/**
* stop :
* Stop the application. Close the Topia rootContext.
*/
- public void stop();
+ void stop();
/**
* getProperty :
@@ -45,7 +47,7 @@
* @param property PollenProperty
* @return String
*/
- public String getProperty(PollenProperty property);
+ String getProperty(PollenProperty property);
/**
* hasProperty :
@@ -53,7 +55,7 @@
* @param property PollenProperty
* @return boolean
*/
- public boolean hasProperty(PollenProperty property);
+ boolean hasProperty(PollenProperty property);
/**
* getConfiguration :
@@ -61,21 +63,21 @@
* if needed.
* @return ApplicationConfig
*/
- public ApplicationConfig getConfiguration();
+ ApplicationConfig getConfiguration();
/**
* getCurrentDate :
* Return the current date from context
* @return Date
*/
- public Date getCurrentDate();
+ Date getCurrentDate();
/**
* encodePassword :
* @param password
* @return String
*/
- public String encodePassword(String password);
+ String encodePassword(String password);
/**
* createPollenUrlId :
@@ -83,14 +85,14 @@
* This UId represent the entity in UI module.
* @return String
*/
- public String createPollenUrlId();
+ String createPollenUrlId();
/**
* beginTransaction :
* @return TopiaContext
* @throws TopiaException
*/
- public TopiaContext beginTransaction() throws TopiaException;
+ TopiaContext beginTransaction() throws TopiaException;
/**
* doCatch :
@@ -99,7 +101,7 @@
* @param args
* @throws PollenException
*/
- public void treateError(Exception eee, String message, Object... args)
+ void treateError(Exception eee, String message, Object... args)
throws PollenException;
/**
@@ -110,14 +112,14 @@
* @param args
* @throws PollenException
*/
- public void treateError(TopiaContext transaction, Exception eee,
+ void treateError(TopiaContext transaction, Exception eee,
String message, Object... args) throws PollenException;
/**
* doFinally :
* @param transaction
*/
- public void closeTransaction(TopiaContext transaction);
+ void closeTransaction(TopiaContext transaction);
} //PollenContext
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -3,10 +3,13 @@
import java.security.NoSuchAlgorithmException;
import java.util.Date;
+import java.util.Locale;
import java.util.Properties;
import java.util.UUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.service.ServiceUser;
import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
@@ -102,31 +105,26 @@
*
*/
@Override
- public void start() {
+ public void start(ServiceUser serviceUser) {
try {
- if (log.isInfoEnabled()) {
- log.info("Start Pollen");
-// log.info("Initialize i18n bundle");
- }
I18n.setInitializer(new DefaultI18nInitializer("pollen-business"));
I18n.init();
+ if (log.isInfoEnabled()) {
+ log.info(_("pollen.info.start"));
+ }
+
// Set context in PollenProperty enum to use easily method
// getValue() on PollenProperty
PollenProperty.setContext(this);
-
-// ServiceUserImpl serviceUser = new ServiceUserImpl(this);
-// serviceUser.createDefaultAdmin(
-// getProperty(PollenProperty.ADMIN_LOGIN),
-// getProperty(PollenProperty.ADMIN_PASSWORD),
-// getProperty(PollenProperty.ADMIN_EMAIL)
-// );
+
+ createSuperAdmin(serviceUser);
//
// sendMail = new SendMail(this);
// sendMail.start();
if (log.isInfoEnabled()) {
- log.info("pollen is started !");
+ log.info(_("pollen.info.started"));
}
} catch (Exception eee) {
@@ -135,13 +133,43 @@
}
/**
+ * Create the super admin if needed using {@code serviceUser}.
+ * The login, password and email are defined from configuration (in
+ * properties file).
+ *
+ * @param serviceUser used to create the admin user
+ * @see PollenProperty#ADMIN_EMAIL
+ * @see PollenProperty#ADMIN_LOGIN
+ * @see PollenProperty#ADMIN_PASSWORD
+ */
+ protected void createSuperAdmin(ServiceUser serviceUser) {
+ UserAccount user = serviceUser.getNewUser();
+ user.setAdmin(true);
+ String login = PollenProperty.ADMIN_LOGIN.getValue();
+ user.setLogin(login);
+ user.setEmail(PollenProperty.ADMIN_EMAIL.getValue());
+ user.setNewPassword(PollenProperty.ADMIN_PASSWORD.getValue());
+ try {
+ serviceUser.createUser(user);
+ if (log.isInfoEnabled()) {
+ log.info(_("pollen.info.admin.created", login));
+ }
+ } catch (PollenBusinessException eee) {
+ if (log.isInfoEnabled()) {
+ log.info(_("pollen.info.admin.exists") + " : " +
+ _(eee.getMessage()));
+ }
+ }
+ }
+
+ /**
* Stop the application. Close the Topia rootContext.
*/
@Override
public void stop() {
try {
if (log.isDebugEnabled()) {
- log.debug("Stop Pollen");
+ log.debug(_("pollen.info.stop"));
}
getTopiaRootContext().closeContext();
// sendMail.stopExec();
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,143 @@
+
+package org.chorem.pollen.bean;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import org.apache.commons.lang.StringUtils;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * Filter
+ *
+ * Created: 23 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class Filter {
+
+ protected Integer startIndex;
+
+ protected Integer endIndex;
+
+ protected String orderBy;
+
+ private PropertyChangeSupport propertyChangeSupport =
+ new PropertyChangeSupport(this);
+
+ public static final String PROPERTY_START_INDEX = "startIndex";
+
+ public static final String PROPERTY_END_INDEX = "endIndex";
+
+ public static final String PROPERTY_ORDER_BY = "orderBy";
+
+ /**
+ * Get the value of startIndex
+ *
+ * @return the value of startIndex
+ */
+ public Integer getStartIndex() {
+ return startIndex;
+ }
+
+ /**
+ * Set the value of startIndex
+ *
+ * @param startIndex new value of startIndex
+ */
+ public void setStartIndex(Integer startIndex) {
+ Integer oldStartIndex = this.startIndex;
+ this.startIndex = startIndex;
+ propertyChangeSupport.firePropertyChange(PROPERTY_START_INDEX, oldStartIndex, startIndex);
+ }
+
+ /**
+ * Get the value of orderBy
+ *
+ * @return the value of orderBy
+ */
+ public String getOrderBy() {
+ return orderBy;
+ }
+
+ /**
+ * Set the value of orderBy
+ *
+ * @param orderBy new value of orderBy
+ */
+ public void setOrderBy(String orderBy) {
+ String oldOrderBy = this.orderBy;
+ this.orderBy = orderBy;
+ propertyChangeSupport.firePropertyChange(PROPERTY_ORDER_BY, oldOrderBy, orderBy);
+ }
+
+ /**
+ * Get the value of endIndex
+ *
+ * @return the value of endIndex
+ */
+ public Integer getEndIndex() {
+ return endIndex;
+ }
+
+ /**
+ * Set the value of endIndex
+ *
+ * @param endIndex new value of endIndex
+ */
+ public void setEndIndex(Integer endIndex) {
+ Integer oldEndIndex = this.endIndex;
+ this.endIndex = endIndex;
+ propertyChangeSupport.firePropertyChange(PROPERTY_END_INDEX, oldEndIndex, endIndex);
+ }
+
+ /**
+ * Add PropertyChangeListener.
+ *
+ * @param listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove PropertyChangeListener.
+ *
+ * @param listener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ public void prepareQuery(TopiaQuery query) {
+ // Add limits. Only startIndex do nothing.
+ // startIndex + endIndex provides the limit
+ if (startIndex != null && endIndex != null) {
+ query.setLimit(startIndex, endIndex);
+
+ // endIndex only provides the maxResults wanted
+ } else if (endIndex != null) {
+ query.setMaxResults(endIndex);
+ }
+ }
+
+ public void prepareQueryWithOrder(TopiaQuery query) {
+ // Add order to the query, splitted by comma and trimmed using
+ // {@link StringUtils#stripAll(String[])}
+ if (orderBy != null) {
+ String[] order = StringUtils.stripAll(orderBy.split(","));
+ query.addOrder(order);
+
+ // Default order by creation date
+ } else {
+ query.addOrderDesc(TopiaEntity.TOPIA_CREATE_DATE);
+ }
+
+ prepareQuery(query);
+ }
+
+}
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -84,7 +84,7 @@
}
throw new PollenBusinessException(eee,
PollenExceptionType.SMTP_NOT_AVAILABLE,
- pollenEmail.getTo());
+ pollenEmail.getTo());
}
}
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-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -11,6 +12,7 @@
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
import org.chorem.pollen.PollenException;
+import org.chorem.pollen.bean.Filter;
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
@@ -19,6 +21,8 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.framework.TopiaQuery.Op;
+import org.nuiton.util.beans.BinderBuilder;
+import org.nuiton.util.beans.BinderProvider;
/**
* ServiceUserImpl
@@ -39,8 +43,35 @@
public void setContext(PollenContext context) {
this.context = context;
+ prepareUserAccountBinder();
}
+ protected void prepareUserAccountBinder() {
+ BinderBuilder builder = new BinderBuilder(UserAccount.class,
+ UserAccount.ADMIN,
+ UserAccount.FIRST_NAME,
+ UserAccount.LAST_NAME);
+ BinderProvider.registerBinder(builder);
+ }
+
+ /**
+ * Copy {@code source} user account to {@code destination} one.
+ * The email is lower cased in the {@code destination} user account.
+ *
+ * @param source user account to copy
+ * @param destination which receive the copy
+ * @see org.nuiton.util.beans.Binder#copy(Object, Object, String...)
+ */
+ protected void copyUserAccount(UserAccount source, UserAccount destination) {
+ BinderProvider.getBinder(UserAccount.class).copy(source, destination);
+ destination.setEmail(StringUtils.lowerCase(source.getEmail()));
+ // Manage new password if needed
+ String password = source.getNewPassword();
+ if (StringUtils.isNotEmpty(password)) {
+ destination.setPassword(context.encodePassword(password));
+ }
+ }
+
@Override
protected TopiaContext beginTransaction() throws TopiaException {
return context.beginTransaction();
@@ -58,27 +89,6 @@
}
/**
- * Used to manage the new password of the user. This newPassword will be
- * encoded then set into the real password.
- *
- * @param user to treate
- * @return true if the newPassword is encoded and set, false otherwise
- */
- protected boolean manageNewPassword(UserAccount user) {
- // Manage password encoding
- String newPassword = user.getNewPassword();
- if (StringUtils.isNotEmpty(newPassword)) {
- user.setPassword(context.encodePassword(newPassword));
- if (log.isDebugEnabled()) {
- log.debug("Reset newPassword from UserAccount");
- }
- user.setNewPassword(null);
- return true;
- }
- return false;
- }
-
- /**
* Check if the {@code login} and {@code password} correspond to an
* existing user.
*
@@ -140,7 +150,7 @@
if (query == null) {
query = dao.createQuery();
}
- int count = query.add(UserAccount.EMAIL, email).
+ int count = query.add(UserAccount.EMAIL, StringUtils.lowerCase(email)).
executeCount();
// existing user found
if (count > 0) {
@@ -172,16 +182,14 @@
}
@Override
- protected UserAccount executeGetNewUser(Locale locale) {
+ protected UserAccount executeGetNewUser() {
UserAccount user = new UserAccountImpl();
- user.setAdmin(false);
- user.setLanguage(locale.getLanguage());
return user;
}
@Override
protected void executeCreateUser(TopiaContext transaction,
- List<Object> errorArgs, UserAccount user)
+ List<Object> errorArgs, UserAccount user)
throws TopiaException, PollenBusinessException {
errorArgs.add(user.getLogin());
@@ -196,9 +204,11 @@
// Check email not exist
checkEmailNotExist(dao, user.getEmail(), null);
+
// Execute create
- manageNewPassword(user);
- dao.create(user);
+ UserAccount newUser = dao.create(user.getLogin());
+ copyUserAccount(user, newUser);
+ user.setTopiaId(newUser.getTopiaId());
transaction.commitTransaction();
}
@@ -207,7 +217,7 @@
@Override
protected void executeUpdateUser(TopiaContext transaction,
- List<Object> errorArgs, UserAccount user)
+ List<Object> errorArgs, UserAccount user, boolean byAdmin)
throws TopiaException, PollenBusinessException {
errorArgs.add(user.getLogin());
@@ -215,16 +225,12 @@
errorArgs.add(user.getAdmin());
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
-
- // Check the password
- String encodedPassword = context.encodePassword(user.getPassword());
- checkPassword(dao, user.getLogin(), encodedPassword);
- // Change password if needed
- boolean passwordChanged = manageNewPassword(user);
- // Otherwise set the encodedPassword to properly save the user
- if (!passwordChanged) {
- user.setPassword(encodedPassword);
+ // Do not manage password for an admin update
+ if (!byAdmin) {
+ // Check the password
+ String encodedPassword = context.encodePassword(user.getPassword());
+ checkPassword(dao, user.getLogin(), encodedPassword);
}
// In case of email change, check if an other user has not already
@@ -234,24 +240,50 @@
checkEmailNotExist(dao, user.getEmail(), query);
// Execute update
- dao.update(user);
+ UserAccount editedUser = dao.findByLogin(user.getLogin());
+ copyUserAccount(user, editedUser);
+ dao.update(editedUser);
transaction.commitTransaction();
}
@Override
- protected void executeDeleteUser(TopiaContext transaction, UserAccount user)
+ protected void executeDeleteUser(TopiaContext transaction, String login)
throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+ UserAccount user = dao.findByLogin(login);
+ dao.delete(user);
+ transaction.commitTransaction();
}
@Override
- protected List<UserAccount> executeGetUsers(TopiaContext transaction)
- throws TopiaException {
- throw new UnsupportedOperationException("Not supported yet.");
+ protected Map<String, UserAccount> executeGetUsers(TopiaContext transaction,
+ Filter filter) throws TopiaException {
+
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+ TopiaQuery query = dao.createQuery();
+
+ filter.prepareQueryWithOrder(query);
+
+ Map<String, UserAccount> results = dao.findAllMappedByQuery(query,
+ UserAccount.LOGIN, String.class);
+ return results;
}
@Override
+ protected int executeGetNbUsers(TopiaContext transaction,
+ Filter filter) throws TopiaException {
+
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+ TopiaQuery query = dao.createQuery();
+
+ filter.prepareQuery(query);
+
+ int result = query.executeCount();
+ return result;
+ }
+
+ @Override
protected PollAccount executeGetNewList(TopiaContext transaction)
throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -41,6 +41,7 @@
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getNbUsers=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=
@@ -57,3 +58,8 @@
pollen.exception.user_login_exist=
pollen.exception.user_not_exist=
pollen.exception.user_wrong_password=
+pollen.info.admin.created=Super admin was created with login %1$s
+pollen.info.admin.exists=Super admin already exists
+pollen.info.start=Start Pollen
+pollen.info.started=Pollen is started \!
+pollen.info.stop=Stop Pollen
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -40,6 +40,7 @@
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getFavoriteLists=
+pollen.error.serviceUser.getNbUsers=
pollen.error.serviceUser.getNewList=
pollen.error.serviceUser.getNewPerson=
pollen.error.serviceUser.getNewUser=Impossible d'instancier un nouvel utilisateur.
@@ -56,3 +57,8 @@
pollen.exception.user_login_exist=Un utilisateur est d\u00E9j\u00E0 enregistr\u00E9 avec cet identifiant.
pollen.exception.user_not_exist=L'identifiant '%1$s' ne correspond \u00E0 aucun utilisateur connu.
pollen.exception.user_wrong_password=Le mot de passe renseign\u00E9 est incorrect pour l'utilisateur '%1$s'.
+pollen.info.admin.created=Le super admin a \u00E9t\u00E9 cr\u00E9\u00E9 avec l'identifiant %1$s.
+pollen.info.admin.exists=Le super admin existe d\u00E9j\u00E0
+pollen.info.start=D\u00E9marrage de Pollen...
+pollen.info.started=Pollen a \u00E9t\u00E9 d\u00E9marr\u00E9 avec succ\u00E8s \!
+pollen.info.stop=Arr\u00EAt de Pollen
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -56,7 +56,7 @@
);
getContext().loadConfiguration(config);
- getContext().start();
+ getContext().start(getServiceUser());
// Set currentDate to 23/02/2010 for tests
Calendar calendar = new GregorianCalendar(2010, 1, 23, 0, 0, 0);
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -2,7 +2,6 @@
package org.chorem.pollen.service;
import java.io.IOException;
-import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
@@ -12,6 +11,7 @@
import org.chorem.pollen.business.TestManager;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
+import org.chorem.pollen.entity.UserAccountImpl;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -19,7 +19,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
/**
*
@@ -50,26 +49,28 @@
}
@Test
- public void testManageNewPassword() throws Exception {
+ public void testCopyUserAccount() throws Exception {
TestManager.start("testManageNewPassword");
ServiceUserImpl serviceUser = TestManager.getServiceUser();
- UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user = serviceUser.getNewUser();
user.setLogin("homer");
user.setNewPassword("wouhou");
log.info("test 1 : Encode new password");
- boolean result = serviceUser.manageNewPassword(user);
- Assert.assertTrue(result);
+ UserAccount destination = new UserAccountImpl();
+ serviceUser.copyUserAccount(user, destination);
+ Assert.assertNotNull(destination.getPassword());
String expected = TestManager.getContext().encodePassword("wouhou");
- Assert.assertEquals(expected, user.getPassword());
- Assert.assertNull(user.getNewPassword());
+ Assert.assertEquals(expected, destination.getPassword());
log.info("test 2 : Do not encode new password -> newPassword empty");
- result = serviceUser.manageNewPassword(user);
- Assert.assertFalse(result);
+ user.setPassword(expected);
+ user.setNewPassword(null);
+ serviceUser.copyUserAccount(user, destination);
+ Assert.assertEquals(expected, destination.getPassword());
}
@Test
@@ -78,7 +79,7 @@
ServiceUserImpl serviceUser = TestManager.getServiceUser();
- UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user = serviceUser.getNewUser();
user.setLogin("homer");
user.setNewPassword("wouhou");
serviceUser.createUser(user);
@@ -115,7 +116,7 @@
ServiceUser serviceUser = TestManager.getServiceUser();
- UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user = serviceUser.getNewUser();
user.setLogin("hsimpson");
user.setEmail("hsimpson(a)springfield.us");
user.setNewPassword("wouhou");
@@ -152,11 +153,9 @@
TestManager.start("testGetNewUser");
ServiceUser serviceUser = TestManager.getServiceUser();
- UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user = serviceUser.getNewUser();
Assert.assertNotNull(user);
Assert.assertEquals(false, user.getAdmin());
- Assert.assertEquals("fr", user.getLanguage());
- Assert.assertEquals(Locale.FRENCH, new Locale(user.getLanguage()));
}
/**
@@ -167,7 +166,7 @@
TestManager.start("testCreateUser");
ServiceUser serviceUser = TestManager.getServiceUser();
- UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user = serviceUser.getNewUser();
user.setLogin("hsimpson");
user.setEmail("hsimpson(a)springfield.us");
user.setNewPassword("wouhou");
@@ -181,7 +180,7 @@
Assert.assertNotSame(encodedPassword, user.getPassword());
log.info("test 2 : Creation problem on login -> user exist");
- UserAccount user2 = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user2 = serviceUser.getNewUser();
user2.setLogin("hsimpson");
// Not the same email
user2.setEmail("hsimpson(a)springfield.com");
@@ -196,7 +195,7 @@
}
log.info("test 3 : Creation problem on email -> user exist");
- UserAccount user3 = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user3 = serviceUser.getNewUser();
user3.setLogin("homer");
user3.setEmail("hsimpson(a)springfield.us");
user3.setNewPassword("troubidou");
@@ -210,7 +209,7 @@
}
log.info("test 4 : Creation OK with no email");
- UserAccount user4 = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user4 = serviceUser.getNewUser();
user4.setLogin("marge");
user4.setNewPassword("troubidou");
@@ -226,13 +225,13 @@
TestManager.start("testUpdateUser");
ServiceUser serviceUser = TestManager.getServiceUser();
- UserAccount user1 = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user1 = serviceUser.getNewUser();
user1.setLogin("hsimpson");
user1.setEmail("hsimpson(a)springfield.us");
user1.setNewPassword("wouhou");
serviceUser.createUser(user1);
- UserAccount user2 = serviceUser.getNewUser(Locale.FRENCH);
+ UserAccount user2 = serviceUser.getNewUser();
String user2Password = "wouhou";
user2.setLogin("homer");
user2.setEmail("hsimpson(a)springfield.fr");
@@ -243,7 +242,7 @@
user2.setLogin("homersimpson");
user2.setPassword(user2Password);
try {
- serviceUser.updateUser(user2);
+ serviceUser.updateUser(user2, false);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
@@ -254,26 +253,54 @@
log.info("test 2 : Change email OK");
user2.setEmail("homersimpson(a)springield.fr");
user2.setPassword(user2Password);
- serviceUser.updateUser(user2);
+ serviceUser.updateUser(user2, false);
log.info("test 3 : Change email problem -> user exist");
user2.setEmail(user1.getEmail());
user2.setPassword(user2Password);
try {
- serviceUser.updateUser(user2);
+ serviceUser.updateUser(user2, false);
} catch (PollenBusinessException eee) {
log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_EMAIL_EXIST,
eee.getType());
}
+
+ // TODO test 4 with byAdmin = true
}
/**
* Test of executeDeleteUser method, of class ServiceUserImpl.
+ * @throws Exception
*/
- //@Test
+ @Test
public void testExecuteDeleteUser() throws Exception {
- System.out.println("executeDeleteUser");
+ TestManager.start("testUpdateUser");
+ ServiceUser serviceUser = TestManager.getServiceUser();
+
+ try {
+ serviceUser.deleteUser("test");
+ } catch (PollenException eee) {
+ log.error(eee);
+ Assert.assertEquals(IllegalArgumentException.class,
+ eee.getCause().getClass());
+ }
+
+ UserAccount user = serviceUser.getNewUser();
+ user.setLogin("user");
+ serviceUser.createUser(user);
+
+ serviceUser.deleteUser("user");
+
+ TopiaContext transaction = null;
+ try {
+ transaction = TestManager.beginTransaction();
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+ UserAccount userFound = dao.findByLogin("user");
+ Assert.assertNull(userFound);
+ } finally {
+ transaction.closeContext();
+ }
}
/**
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,128 @@
+
+package org.chorem.pollen.ui.base;
+
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.SessionState;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.ui.components.Border;
+
+/**
+ * AbstractPollenPage
+ *
+ * Created: 22 avr. 2010
+ *
+ * @author fdesbois
+ */
+public abstract class AbstractPollenPage implements PollenPage {
+
+ /** Connected UserAccount from Session **/
+ @SessionState
+ @Property
+ private UserAccount user;
+
+ @Property
+ private boolean userExists;
+
+ /**
+ * Retrieve the border layout of the page.
+ *
+ * @return the Border
+ */
+ public abstract Border getBorder();
+
+ /**
+ * Default value set to false for needAuthentification.
+ *
+ * @return false
+ * @see PollenPage#isNeedAuthentification()
+ */
+ @Override
+ public boolean isNeedAuthentification() {
+ return false;
+ }
+
+ /**
+ * Default value set to true for canDisplayPage.
+ *
+ * @return true
+ * @see PollenPage#canDisplayPage()
+ */
+ @Override
+ public boolean canDisplayPage() {
+ return true;
+ }
+
+ /**
+ * Retrieve the connected user from Session.
+ *
+ * @return the UserAccount corresponding to connected user
+ */
+ public UserAccount getUserConnected() {
+ return user;
+ }
+
+ /**
+ * Change connected user in session.
+ *
+ * @param user to set in session.
+ */
+ public void setUserConnected(UserAccount user) {
+ this.user = user;
+ }
+
+ /**
+ * Return true if a user is already connected to the application.
+ *
+ * @return true if connected user is defined.
+ */
+ public boolean isUserConnected() {
+ return userExists;
+ }
+
+ /**
+ * Return true if the connected user is an admin.
+ *
+ * @return true if the connected user is an admin.
+ */
+ public boolean isAdminConnected() {
+ return isUserConnected() && user.getAdmin();
+ }
+
+ /**
+ * Add an info {@code message} to display.
+ *
+ * @param message to display
+ */
+ public void addInfo(String message) {
+ getBorder().addInfo(message);
+ }
+
+ /**
+ * Add a fatal {@code message} to display. Only the fatal {@code message}
+ * will be displayed, not other elements in the page will be showed.
+ *
+ * @param message to display
+ */
+ public void addFatal(String message) {
+ getBorder().addFatal(message);
+ }
+
+ /**
+ * Add an error {@code message} to display.
+ *
+ * @param message to display
+ */
+ public void addError(String message) {
+ getBorder().addError(message);
+ }
+
+ /**
+ * Retrieve the current url of the page.
+ *
+ * @return the current url of the page.
+ */
+ public String getUrl() {
+ return getBorder().getServerPath();
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Copied: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollsPage.java (from rev 2972, trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java)
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollsPage.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollsPage.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,202 @@
+/* *##% Pollen
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
+
+package org.chorem.pollen.ui.base;
+
+import java.util.List;
+
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.annotations.InjectPage;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.Retain;
+import org.apache.tapestry5.beaneditor.BeanModel;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.BeanModelSource;
+import org.chorem.pollen.entity.Poll;
+import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.ui.data.EvenOdd;
+import org.chorem.pollen.ui.data.AddressBarItem;
+import org.chorem.pollen.ui.data.PollAction;
+import org.chorem.pollen.ui.pages.admin.AdminPolls;
+import org.chorem.pollen.ui.pages.poll.ConfirmPoll;
+import org.chorem.pollen.ui.pages.user.UserPollsCreated;
+
+/**
+ * Classe de la page d'affichage des sondages.
+ *
+ * @author kmorin
+ * @author rannou
+ * @version $Id$
+ */
+public abstract class AbstractPollsPage extends AbstractPollenPage {
+
+ /**
+ * Liste de sondages de l'utilisateur
+ */
+ @SuppressWarnings("unused")
+ private List<Poll> polls;
+
+ /**
+ * Sondage servant à l'itération des sondages de la liste
+ */
+ @Property
+ private Poll poll;
+
+ /**
+ * Objet servant à changer la couleur à chaque ligne de la liste des
+ * sondages
+ */
+ @SuppressWarnings("unused")
+ @Property
+ private EvenOdd evenOdd;
+
+ @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
+ @Property
+ private String title;
+
+ @SuppressWarnings("unused")
+ @Property
+ private AddressBarItem[] address;
+
+ /**
+ * Sert à créer pollsModel
+ */
+ @Inject
+ private BeanModelSource beanModelSource;
+
+ /**
+ * Sert à passer les messages en paramètre de la création de pollsModel
+ */
+ @Inject
+ private ComponentResources componentResources;
+
+ /**
+ * Modèle pour l'affichage de la liste des sondages
+ */
+ @SuppressWarnings("unchecked")
+ @Property
+ @Retain
+ private BeanModel pollsModel;
+
+ /** Page de validation de la fermeture d'un sondage */
+ @InjectPage
+ private ConfirmPoll confirmPoll;
+
+ /** Injection des services */
+ @Inject
+ private ServicePoll servicePoll;
+// @Inject
+// private ServicePollAccount servicePollAccount;
+// @Inject
+// private ServiceResults serviceResults;
+
+ /**
+ * Récupération de l'identifiant de modification du sondage.
+ *
+ * @return l'identifiant.
+ */
+// public String getAdminId() {
+// PollAccount creator = servicePollAccount.findPollAccountById(poll
+// .getCreatorId());
+// return poll.getPollUId() + ":" + creator.getAccountUId();
+// }
+
+ /**
+ * Fermeture du sondage.
+ *
+ * @return la page de validation
+ */
+ public Object onActionFromClose(String id) {
+ return prepareConfirmPage(id, PollAction.CLOSE);
+ }
+
+ /**
+ * Suppression du sondage.
+ *
+ * @return la page des sondages
+ */
+ public Object onActionFromDeletePoll(String id) {
+ return prepareConfirmPage(id, PollAction.DELETE);
+ }
+
+ /**
+ * Préparation de la page de confirmation.
+ *
+ * @return la page de confirmation
+ */
+ private Object prepareConfirmPage(String pollId, PollAction pollAction) {
+ String backPage = "";
+ if (this instanceof UserPollsCreated) {
+ backPage = "user/PollsCreated";
+ } else if (this instanceof AdminPolls) {
+ backPage = "admin/PollsAdmin";
+ }
+ confirmPoll.setBackPage(backPage);
+ confirmPoll.setAction(pollAction);
+ confirmPoll.setPoll(poll);
+ return confirmPoll;
+ }
+
+ /**
+ * Export XML du sondage.
+ *
+ * @return le flux correspondant au fichier
+ */
+ public Object onActionFromExport(String id) {
+ // FIXME : create service for export
+
+// final String filename = serviceResults.exportPoll(id);
+//
+// // Retour d'un StreamResponse contenant le fichier XML
+// return new StreamResponse() {
+// public String getContentType() {
+// return "text/xml";
+// }
+//
+// public InputStream getStream() throws IOException {
+// return new FileInputStream(new File(filename));
+// }
+//
+// public void prepareResponse(Response response) {
+// }
+// };
+ return null;
+ }
+
+ /**
+ * Méthode d'initialisation des sondages
+ */
+ public void onActivate() {
+ evenOdd = new EvenOdd();
+ }
+
+ /**
+ * Initialisation de l'affichage
+ */
+ public void setupRender() {
+ address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"),
+ new AddressBarItem(title, null) };
+
+ pollsModel = beanModelSource.createDisplayModel(Poll.class,
+ componentResources.getMessages());
+ pollsModel.add("functions", null);
+ pollsModel.include("title", "description", "beginChoiceDate",
+ "beginDate", "endDate", "functions");
+ }
+
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollsPage.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Rev Revision"
Added: svn:mergeinfo
+
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractUploadPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractUploadPage.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractUploadPage.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -21,7 +21,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
-public class AbstractUploadPage {
+public abstract class AbstractUploadPage extends AbstractPollenPage {
@InjectPage
private ErrorPage errorPage;
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,26 @@
+
+package org.chorem.pollen.ui.base;
+
+/**
+ * PollenPage
+ *
+ * Created: 22 avr. 2010
+ *
+ * @author fdesbois
+ */
+public interface PollenPage {
+
+ /**
+ * Return true if the page need an authentification to be displayed.
+ *
+ * @return true for authentification needed
+ */
+ boolean isNeedAuthentification();
+
+ /**
+ * Return true if the page can be displayed, depends on user rights.
+ *
+ * @return true for display allowed
+ */
+ boolean canDisplayPage();
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,221 +0,0 @@
-/* *##% Pollen
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
-package org.chorem.pollen.ui.base;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.tapestry5.BindingConstants;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.StreamResponse;
-import org.apache.tapestry5.annotations.InjectPage;
-import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.Retain;
-import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.beaneditor.BeanModel;
-import org.apache.tapestry5.ioc.annotations.Inject;
-import org.apache.tapestry5.services.BeanModelSource;
-import org.apache.tapestry5.services.Response;
-import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.service.ServicePoll;
-import org.chorem.pollen.ui.data.EvenOdd;
-import org.chorem.pollen.ui.data.AddressBarItem;
-import org.chorem.pollen.ui.data.PollAction;
-import org.chorem.pollen.ui.pages.admin.PollsAdmin;
-import org.chorem.pollen.ui.pages.poll.ConfirmPoll;
-import org.chorem.pollen.ui.pages.user.UserPollsCreated;
-
-/**
- * Classe de la page d'affichage des sondages.
- *
- * @author kmorin
- * @author rannou
- * @version $Id$
- */
-public class Polls {
-
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SuppressWarnings("unused")
- @SessionState
- @Property
- private UserAccount user;
- @SuppressWarnings("unused")
- @Property
- private boolean userExists;
-
- /**
- * Liste de sondages de l'utilisateur
- */
- @SuppressWarnings("unused")
- private List<Poll> polls;
-
- /**
- * Sondage servant à l'itération des sondages de la liste
- */
- @Property
- private Poll poll;
-
- /**
- * Objet servant à changer la couleur à chaque ligne de la liste des
- * sondages
- */
- @SuppressWarnings("unused")
- @Property
- private EvenOdd evenOdd;
-
- @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
- @Property
- private String title;
-
- @SuppressWarnings("unused")
- @Property
- private AddressBarItem[] address;
-
- /**
- * Sert à créer pollsModel
- */
- @Inject
- private BeanModelSource beanModelSource;
-
- /**
- * Sert à passer les messages en paramètre de la création de pollsModel
- */
- @Inject
- private ComponentResources componentResources;
-
- /**
- * Modèle pour l'affichage de la liste des sondages
- */
- @SuppressWarnings("unchecked")
- @Property
- @Retain
- private BeanModel pollsModel;
-
- /** Page de validation de la fermeture d'un sondage */
- @InjectPage
- private ConfirmPoll confirmPoll;
-
- /** Injection des services */
- @Inject
- private ServicePoll servicePoll;
-// @Inject
-// private ServicePollAccount servicePollAccount;
-// @Inject
-// private ServiceResults serviceResults;
-
- /**
- * Récupération de l'identifiant de modification du sondage.
- *
- * @return l'identifiant.
- */
-// public String getAdminId() {
-// PollAccount creator = servicePollAccount.findPollAccountById(poll
-// .getCreatorId());
-// return poll.getPollUId() + ":" + creator.getAccountUId();
-// }
-
- /**
- * Fermeture du sondage.
- *
- * @return la page de validation
- */
- public Object onActionFromClose(String id) {
- return prepareConfirmPage(id, PollAction.CLOSE);
- }
-
- /**
- * Suppression du sondage.
- *
- * @return la page des sondages
- */
- public Object onActionFromDeletePoll(String id) {
- return prepareConfirmPage(id, PollAction.DELETE);
- }
-
- /**
- * Préparation de la page de confirmation.
- *
- * @return la page de confirmation
- */
- private Object prepareConfirmPage(String pollId, PollAction pollAction) {
- String backPage = "";
- if (this instanceof UserPollsCreated) {
- backPage = "user/PollsCreated";
- } else if (this instanceof PollsAdmin) {
- backPage = "admin/PollsAdmin";
- }
- confirmPoll.setBackPage(backPage);
- confirmPoll.setAction(pollAction);
- confirmPoll.setPoll(poll);
- return confirmPoll;
- }
-
- /**
- * Export XML du sondage.
- *
- * @return le flux correspondant au fichier
- */
- public Object onActionFromExport(String id) {
- // FIXME : create service for export
-
-// final String filename = serviceResults.exportPoll(id);
-//
-// // Retour d'un StreamResponse contenant le fichier XML
-// return new StreamResponse() {
-// public String getContentType() {
-// return "text/xml";
-// }
-//
-// public InputStream getStream() throws IOException {
-// return new FileInputStream(new File(filename));
-// }
-//
-// public void prepareResponse(Response response) {
-// }
-// };
- return null;
- }
-
- /**
- * Méthode d'initialisation des sondages
- */
- public void onActivate() {
- evenOdd = new EvenOdd();
- }
-
- /**
- * Initialisation de l'affichage
- */
- public void setupRender() {
- address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"),
- new AddressBarItem(title, null) };
-
- pollsModel = beanModelSource.createDisplayModel(Poll.class,
- componentResources.getMessages());
- pollsModel.add("functions", null);
- pollsModel.include("title", "description", "beginChoiceDate",
- "beginDate", "endDate", "functions");
- }
-
-}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -23,8 +23,10 @@
import java.util.Locale;
import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.Block;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
@@ -39,6 +41,7 @@
import org.chorem.pollen.ui.data.AddressBarItem;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.PollenPage;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.pages.Index;
import org.chorem.pollen.ui.services.PollenManager;
@@ -103,8 +106,8 @@
/**
* Objet de session (SSO) représentant l'adresse du site.
*/
- @SessionState
- private String siteURL;
+// @SessionState
+// private String siteURL;
/**
* Chaine definissant le logo de la page
@@ -170,16 +173,29 @@
@InjectComponent
private ContextLink feedContext;
+ @InjectContainer
+ private PollenPage page;
+
+ @Inject
+ private Block loginBlock;
+
+ @Inject
+ private Block pageBlock;
+
private boolean fatal;
+ private boolean needAuthentification;
+
+ private String serverPath;
+
/**
* Initialisation de l'affichage
*/
void setupRender() {
// URL du site
- siteURL = "http://" + request.getHeader("host") +
- request.getContextPath() + "/";
+// siteURL = "http://" + request.getHeader("host") +
+// request.getContextPath() + "/";
errorJs.addError(messages.get("errorJs"));
@@ -189,9 +205,20 @@
} else {
logo = "pollen" + pageLogo + "_en.png";
}
+
+ // Error messages for display authorization
+ if (isNeedAuthentification()) {
+ addError(messages.get("pollen.ui.user.display.notConnected"));
+ } else if (!page.canDisplayPage()) {
+ addError(messages.get("pollen.ui.user.display.notAllowed"));
+ }
}
boolean afterRender() {
+ if (needAuthentification) {
+ return false;
+ }
+
// Check if fatal errors has been added to the border
// Reload the page if feedBack hasn't been reloaded yet to display
// errors
@@ -208,6 +235,26 @@
return true;
}
+ public Object getActiveBlock() {
+ if (isNeedAuthentification()) {
+ return loginBlock;
+ } else if (canDisplayBody()) {
+ return pageBlock;
+ }
+ return null;
+ }
+
+ public String getServerPath() {
+ if (serverPath == null) {
+ serverPath = "http://" + request.getHeader("host") +
+ request.getContextPath();
+ if (logger.isDebugEnabled()) {
+ logger.debug("URL : " + serverPath);
+ }
+ }
+ return serverPath;
+ }
+
public void addInfo(String message) {
feedback.addInfo(message);
}
@@ -221,8 +268,12 @@
fatal = true;
}
+ public boolean isNeedAuthentification() {
+ return !userExists && page.isNeedAuthentification();
+ }
+
public boolean canDisplayBody() {
- return !fatal;
+ return !fatal && page.canDisplayPage();
}
public DateFormat getDateFormat() {
@@ -247,7 +298,7 @@
UserAccount current = serviceUser.connect(login, password);
user = current;
// Change locale for user
- localeService.set(new Locale(user.getLanguage()));
+ //localeService.set(new Locale(user.getLanguage()));
feedback.addInfo(messages.get("loginOk"));
} catch (PollenBusinessException eee) {
feedback.addError(
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,211 @@
+/*
+ * #%L
+ * Wao :: Web Interface
+ *
+ * $Id$
+ * $HeadURL: svn+ssh://fdesbois@labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/AbstractMappedGridDataSource.java $
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package org.chorem.pollen.ui.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.tapestry5.beaneditor.PropertyModel;
+import org.apache.tapestry5.grid.ColumnSort;
+import org.apache.tapestry5.grid.GridDataSource;
+import org.apache.tapestry5.grid.SortConstraint;
+import org.apache.tapestry5.ioc.internal.util.TapestryException;
+import org.chorem.pollen.PollenException;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ContactDataSource
+ *
+ * Created: 18 janv. 2010
+ *
+ * @param <K> Type of the map key
+ * @param <E> Type of the map value
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public abstract class AbstractMappedGridDataSource<K, E extends TopiaEntity> implements GridDataSource {
+
+
+ private Logger log = LoggerFactory.getLogger(AbstractMappedGridDataSource.class);
+
+ private Map<K, E> mapResults;
+
+ private List<E> listResults;
+
+ private int nbRows = -1;
+
+ private int nbRowsPerPage;
+
+ @Override
+ public int getAvailableRows() {
+ if (nbRows < 0) {
+ try {
+ nbRows = count();
+ if (log.isTraceEnabled()) {
+ log.trace("Count : " + nbRows);
+ }
+ } catch (PollenException eee) {
+ throw new TapestryException("", eee);
+ }
+ }
+ return nbRows;
+ }
+
+ @Override
+ public void prepare(int startIndex, int endIndex, List<SortConstraint> sortConstraints) {
+ if (log.isTraceEnabled()) {
+ log.trace("Prepare results : " + startIndex + ", " + endIndex);
+ }
+ nbRowsPerPage = endIndex - startIndex + 1;
+ try {
+ mapResults = execute(startIndex, endIndex, getSortConstraint(sortConstraints));
+ listResults = new ArrayList<E>(mapResults.values());
+
+ // FIXME manage sort columns in execute ???? seems obvious --> needed for Contacts, done for Boats
+ //sortResults(sortConstraints);
+ } catch (PollenException eee) {
+ throw new TapestryException("", eee);
+ }
+ }
+
+ protected abstract Map<K, E> execute(int startIndex, int endIndex,
+ SortConstraint orderBy) throws PollenException;
+
+ protected abstract int count() throws PollenException;
+
+ protected SortConstraint getSortConstraint(List<SortConstraint> sortConstraints) {
+ for (SortConstraint constraint : sortConstraints)
+ {
+ final ColumnSort sort = constraint.getColumnSort();
+
+ if (sort != ColumnSort.UNSORTED) {
+ return constraint;
+ }
+ }
+ return null;
+ }
+
+ protected String resolveOrderBy(SortConstraint orderBy) {
+ String filterOrder = null;
+ if (orderBy != null) {
+ PropertyModel property = orderBy.getPropertyModel();
+ filterOrder = property.getPropertyName();
+
+ ColumnSort sort = orderBy.getColumnSort();
+ if (sort.equals(ColumnSort.DESCENDING)) {
+ filterOrder += " desc";
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Order : " + filterOrder);
+ }
+ }
+ return filterOrder;
+ }
+
+// protected void sortResults(List<SortConstraint> sortConstraints) {
+//
+// for (SortConstraint constraint : sortConstraints)
+// {
+// final ColumnSort sort = constraint.getColumnSort();
+//
+// if (sort == ColumnSort.UNSORTED) continue;
+//
+// final PropertyConduit conduit = constraint.getPropertyModel().getConduit();
+//
+// final Comparator valueComparator = new Comparator<Comparable>()
+// {
+// public int compare(Comparable o1, Comparable o2)
+// {
+// // Simplify comparison, and handle case where both are nulls.
+//
+// if (o1 == o2) return 0;
+//
+// if (o2 == null) return 1;
+//
+// if (o1 == null) return -1;
+//
+// return o1.compareTo(o2);
+// }
+// };
+//
+// final Comparator rowComparator = new Comparator()
+// {
+// public int compare(Object row1, Object row2)
+// {
+// Comparable value1 = (Comparable) conduit.get(row1);
+// Comparable value2 = (Comparable) conduit.get(row2);
+//
+// return valueComparator.compare(value1, value2);
+// }
+// };
+//
+// final Comparator reverseComparator = new Comparator()
+// {
+// public int compare(Object o1, Object o2)
+// {
+// int modifier = sort == ColumnSort.ASCENDING ? 1 : -1;
+//
+// return modifier * rowComparator.compare(o1, o2);
+// }
+// };
+//
+// // We can freely sort this list because its just a copy.
+//
+// Collections.sort(listResults, reverseComparator);
+// }
+// }
+
+ @Override
+ public Object getRowValue(int index) {
+ index = index % nbRowsPerPage;
+ if (index >= listResults.size()) {
+ if (log.isErrorEnabled()) {
+ log.error("Size error : " + index + " / " + listResults.size());
+ }
+ return null;
+ }
+ return CollectionUtils.get(listResults, index);
+ }
+
+ @Override
+ public abstract Class<?> getRowType();
+
+ public E get(K key) {
+ return mapResults.get(key);
+ }
+
+ public List<E> values() {
+ return listResults;
+ }
+
+ public boolean contains(K key) {
+ return mapResults.containsKey(key);
+ }
+
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/UserAccountDataSource.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/UserAccountDataSource.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/UserAccountDataSource.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,52 @@
+
+package org.chorem.pollen.ui.data;
+
+import java.util.Map;
+import org.apache.tapestry5.grid.SortConstraint;
+import org.chorem.pollen.PollenException;
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.service.ServiceUser;
+
+/**
+ * UserAccountDataSource
+ *
+ * Created: 23 avr. 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class UserAccountDataSource extends AbstractMappedGridDataSource<String, UserAccount> {
+
+ private ServiceUser service;
+
+ private Filter filter;
+
+ public UserAccountDataSource(ServiceUser service, Filter filter) {
+ this.service = service;
+ this.filter = filter;
+ }
+
+ @Override
+ protected Map<String, UserAccount> execute(int startIndex, int endIndex,
+ SortConstraint orderBy) throws PollenException {
+ filter.setStartIndex(startIndex);
+ filter.setEndIndex(endIndex);
+ filter.setOrderBy(resolveOrderBy(orderBy));
+ return service.getUsers(filter);
+ }
+
+ @Override
+ protected int count() throws PollenException {
+ return service.getNbUsers(filter);
+ }
+
+ @Override
+ public Class<?> getRowType() {
+ return UserAccount.class;
+ }
+
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/UserAccountDataSource.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -2,6 +2,7 @@
package org.chorem.pollen.ui.pages;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.data.AddressBarItem;
@@ -17,13 +18,14 @@
* Mise a jour: $Date$
* par : $Author$
*/
-public class ErrorPage {
+public class ErrorPage extends AbstractPollenPage {
@InjectComponent
private Border border;
- public void addError(String message) {
- border.addError(message);
+ @Override
+ public Border getBorder() {
+ return border;
}
public AddressBarItem[] getAddress() {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -17,6 +17,7 @@
package org.chorem.pollen.ui.pages;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
@@ -28,20 +29,17 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
*/
-public class Index {
+public class Index extends AbstractPollenPage {
@InjectComponent
private Border border;
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
public AddressBar getAddressBar() {
return AddressBar.newEmptyBar().appendCurrent("Pollen");
}
-
- public void addInfo(String message) {
- border.addInfo(message);
- }
-
- public void addError(String message) {
- border.addError(message);
- }
}
Copied: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminPolls.java (from rev 2972, trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/PollsAdmin.java)
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminPolls.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminPolls.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,85 @@
+/* *##% Pollen
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
+
+package org.chorem.pollen.ui.pages.admin;
+
+import java.util.List;
+
+import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.IncludeStylesheet;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.entity.Poll;
+import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.ui.base.AbstractPollsPage;
+import org.chorem.pollen.ui.components.Border;
+import org.chorem.pollen.ui.components.FeedBack;
+
+/**
+ * Classe de la page d'administration des sondages. Si l'utilisateur n'est pas
+ * identifié, on lui demande d'abord de s'identifier via un formulaire.
+ *
+ * @author rannou
+ * @version $Id$
+ */
+@IncludeStylesheet("context:css/pollsAdmin.css")
+public class AdminPolls extends AbstractPollsPage {
+
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
+ /** Affichage des messages pour l'utilisateur */
+ @Component(id = "feedback")
+ private FeedBack feedback;
+
+ /**
+ * Liste de sondages de l'utilisateur
+ */
+ @SuppressWarnings("unused")
+ @Property
+ private List<Poll> polls;
+
+ /**
+ * Messages.
+ */
+ @Inject
+ private Messages messages;
+
+ /** Injection des services */
+ @Inject
+ private ServicePoll servicePoll;
+
+ /**
+ * Méthode d'initialisation des sondages
+ */
+ @Override
+ public void onActivate() {
+ super.onActivate();
+ polls = servicePoll.getAllPolls();
+
+ // Affichage des erreurs
+ if (!isAdminConnected()) {
+ feedback.addError(messages.get("userNotAllowed"));
+ }
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminPolls.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Rev Revision"
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java (from rev 2972, trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java)
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,351 @@
+/* *##% Pollen
+ * Copyright (C) 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
+
+package org.chorem.pollen.ui.pages.admin;
+
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.Field;
+import org.apache.tapestry5.annotations.IncludeStylesheet;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.corelib.components.Form;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.PollenBusinessException;
+import org.chorem.pollen.bean.Filter;
+import org.chorem.pollen.bean.PollenEmail;
+import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.service.ServiceEmail;
+import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
+import org.chorem.pollen.ui.data.AddressBar;
+import org.chorem.pollen.ui.data.UserAccountDataSource;
+import org.chorem.pollen.ui.services.PollenManager;
+import org.slf4j.Logger;
+
+/**
+ * Management of users by an admin.
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ * @version $Id$
+ */
+@IncludeStylesheet("context:css/usersAdmin.css")
+public class AdminUsers extends AbstractPollenPage {
+
+ @InjectComponent
+ private Border border;
+
+ /** Page title from Messages **/
+ @Parameter(defaultPrefix = BindingConstants.MESSAGE,
+ value = "pollen.page.AdminUsers.title")
+ @Property
+ private String title;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
+ @Override
+ public boolean isNeedAuthentification() {
+ return true;
+ }
+
+ @Override
+ public boolean canDisplayPage() {
+ return isAdminConnected();
+ }
+
+ public AddressBar getAddressBar() {
+ return AddressBar.newBar().appendCurrent(title);
+ }
+
+ /** Services used by the page **/
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private ComponentResources resources;
+
+ @Inject
+ private Messages messages;
+
+ @Inject
+ private PollenManager manager;
+
+ @Inject
+ private ServiceUser serviceUser;
+
+ @Inject
+ private ServiceEmail serviceEmail;
+
+ /***************************** USERS GRID/FORM ****************************/
+
+ /** Components of the page **/
+ @InjectComponent
+ private Form usersForm;
+
+ /**
+ * Users list : the {@link Persist} is used to keep current page and order
+ * from dataSource.
+ */
+ @Persist
+ private UserAccountDataSource accounts;
+
+ /** Current user from iteration on accounts **/
+ @Property
+ private UserAccount account;
+
+ /** Edited user **/
+ @Property
+ private UserAccount accountEdited;
+
+ /**
+ * Use the {@link UserAccountDataSource} to retrieve existing user accounts.
+ * This will manage pagination and order of the grid.
+ *
+ * @return the UserAccountDataSource which contains displayed users
+ */
+ public UserAccountDataSource getAccounts() {
+ if (accounts == null) {
+ accounts = new UserAccountDataSource(serviceUser, new Filter());
+ }
+ return accounts;
+ }
+
+ /**
+ * Test if the edited account is the current one in the Grid.
+ *
+ * @return true if the accountEdited is defined and correspond to the
+ * current account in the Grid
+ */
+ public boolean isEditionMode() {
+ // The current account in the loop is equals to the edited one
+ return accountEdited != null && account.equals(accountEdited);
+ }
+
+ /**
+ * Test if the current account in the Grid is the connected user.
+ *
+ * @return true if the current account is the user connected
+ */
+ public boolean isAccountConnected() {
+ // The current account in the loop is equals to the edited one
+ return account.equals(getUserConnected());
+ }
+
+ /**
+ * ON_ACTION :: Handler method for action on editAccount actionLink.
+ * The accountEdited will be set to the user selected in the Grid with
+ * {@code login}.
+ *
+ * @param login key of the user from the Grid
+ * @return the usersForm to display form with accountEdited
+ */
+ public Object onActionFromEditAccount(String login) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("User in edition : " + login);
+ }
+ accountEdited = accounts.get(login);
+ return usersForm;
+ }
+
+ /**
+ * ON_ACTION :: Handler method for action on deletedAccount actionLink.
+ * The selected login from the Grid will be used to delete the user.
+ *
+ * @param login used to delete the user
+ * @see ServiceUser#deleteUser(String)
+ */
+ public void onActionFromDeleteAccount(String login) {
+ serviceUser.deleteUser(login);
+ }
+
+ /**
+ * ON_PREPARE_FOR_SUBMIT :: Handler method for prepareSubmit event of the
+ * usersForm. The accountEdited will be initialized to properly be saved in
+ * {@link #onValidateFormFromUsersForm()}
+ */
+ public void onPrepareForSubmitFromUsersForm() {
+ if (accountEdited == null) {
+ accountEdited = serviceUser.getNewUser();
+ }
+ }
+
+ /**
+ * ON_VALIDATE_FORM :: Handler method for validateForm event of the
+ * usersForm. The accountEdited will be updated using serviceUser. Errors
+ * from service will be recorded into the usersForm.
+ *
+ * @see ServiceUser#updateUser(UserAccount, boolean)
+ */
+ public void onValidateFormFromUsersForm() {
+ try {
+ serviceUser.updateUser(accountEdited, true);
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ usersForm.recordError(message);
+ }
+ }
+
+ /**
+ * ON_SUCCESS :: Handler method for success event of the usersForm.
+ * No error occurs from validation, a message will be displayed to client.
+ *
+ * @return the current page to refresh
+ */
+ public Object onSuccessFromUsersForm() {
+ addInfo(messages.get("pollen.ui.user.update.success"));
+ return this;
+ }
+
+ /**
+ * ON_FAILURE :: Handler method for failure event of the usersForm.
+ * Errors were recorded into the usersForm. The usersForm will be refresh
+ * to display error messages.
+ *
+ * @return the usersForm to refresh (in the usersZone)
+ */
+ public Object onFailureFromUsersForm() {
+ return usersForm;
+ }
+
+ /***************************** NEW USER FORM ******************************/
+
+ /** newUser to create from newUserForm **/
+ @Property
+ private UserAccount newUser;
+
+ /** Components used for refresh or validations **/
+ @InjectComponent
+ private Form newUserForm;
+
+ @InjectComponent
+ private Field newLogin;
+
+ @InjectComponent
+ private Field newEmail;
+
+ /** newPassword created for the newUser **/
+ private String newPassword;
+
+ /**
+ * ON_PREPARE :: Handler method for prepare events of the newUserForm.
+ * The newUser will be initialized if needed before render and before
+ * submit.
+ */
+ public void onPrepareFromNewUserForm() {
+ if (newUser == null) {
+ newUser = serviceUser.getNewUser();
+ }
+ }
+
+ /**
+ * ON_VALIDATE_FORM :: Handler method for validateForm event of the
+ * newUserForm. The newUser will be created using serviceUser. Errors
+ * from service will be recorded into the newUserForm. The password will
+ * be generated if an email is set into the form. Otherwise the password
+ * will be the same as the newUser login.
+ *
+ * @see ServiceUser#createUser(UserAccount)
+ */
+ public void onValidateFormFromNewUserForm() {
+ try {
+ String passwordInfo;
+ if (StringUtils.isNotEmpty(newUser.getEmail())) {
+ // Generate new password
+ newPassword = RandomStringUtils.randomAlphanumeric(8);
+ passwordInfo =
+ messages.get("pollen.ui.user.create.passwordGenerated");
+ } else {
+ // Password will be the same as the login
+ newPassword = newUser.getLogin();
+ passwordInfo =
+ messages.get("pollen.ui.user.create.passwordSameAsLogin");
+ }
+
+ newUser.setNewPassword(newPassword);
+ serviceUser.createUser(newUser);
+ addInfo(passwordInfo);
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ switch (eee.getType()) {
+ case USER_EMAIL_EXIST:
+ newUserForm.recordError(newEmail, message); break;
+ case USER_LOGIN_EXIST:
+ newUserForm.recordError(newLogin, message);
+ }
+ }
+ }
+
+ /**
+ * ON_SUCCESS :: Handler method for success event of the newUserForm.
+ * No error occurs from validation, success message is displayed to client
+ * and an email is sent to the newUser created if it's defined.
+ * The persist fields of the page will be discarded to refresh the grid with
+ * no order or page filter.
+ *
+ * @return the current page to refresh
+ * @see ServiceEmail#sendEmail(PollenEmail)
+ */
+ public Object onSuccessFromNewUserForm() {
+ addInfo(messages.format("pollen.ui.user.create.success",
+ newUser.getLogin()));
+ // send email if needed
+ if (StringUtils.isNotEmpty(newUser.getEmail())) {
+ try {
+ PollenEmail email = serviceEmail.getNewEmail(newUser);
+ email.setSubject(
+ messages.format("pollen.email.userRegister.subject",
+ newUser.getLogin()));
+ email.setContent(
+ messages.format("pollen.email.userRegister.content",
+ newUser.getDisplayName(), newUser.getLogin(),
+ newPassword, getUrl()));
+
+ serviceEmail.sendEmail(email);
+ addInfo(messages.format("pollen.ui.user.create.sendEmail",
+ newUser.getLogin(), newUser.getEmail()));
+
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ addError(message);
+ }
+ }
+ // Remove accounts to reset order and current page
+ // This will display the new user created in the first row of the grid
+ resources.discardPersistentFieldChanges();
+ return this;
+ }
+
+ /**
+ * ON_FAILURE :: Handler method for failure event of the newUserForm.
+ * Errors were recorded into the newUserForm. The newUserForm will be
+ * refresh to display error messages.
+ *
+ * @return the newUserForm to refresh (in the newUserZone)
+ */
+ public Object onFailureFromNewUserForm() {
+ return newUserForm;
+ }
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Rev Revision"
Added: svn:mergeinfo
+
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/PollsAdmin.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/PollsAdmin.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/PollsAdmin.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,84 +0,0 @@
-/* *##% Pollen
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
-package org.chorem.pollen.ui.pages.admin;
-
-import java.util.List;
-
-import org.apache.tapestry5.annotations.Component;
-import org.apache.tapestry5.annotations.IncludeStylesheet;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.ioc.Messages;
-import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.service.ServicePoll;
-import org.chorem.pollen.ui.base.Polls;
-import org.chorem.pollen.ui.components.FeedBack;
-
-/**
- * Classe de la page d'administration des sondages. Si l'utilisateur n'est pas
- * identifié, on lui demande d'abord de s'identifier via un formulaire.
- *
- * @author rannou
- * @version $Id$
- */
-@IncludeStylesheet("context:css/pollsAdmin.css")
-public class PollsAdmin extends Polls {
-
- /** Affichage des messages pour l'utilisateur */
- @Component(id = "feedback")
- private FeedBack feedback;
-
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- private UserAccount user;
- private boolean userExists;
-
- /**
- * Liste de sondages de l'utilisateur
- */
- @SuppressWarnings("unused")
- @Property
- private List<Poll> polls;
-
- /**
- * Messages.
- */
- @Inject
- private Messages messages;
-
- /** Injection des services */
- @Inject
- private ServicePoll servicePoll;
-
- /**
- * Méthode d'initialisation des sondages
- */
- @Override
- public void onActivate() {
- super.onActivate();
- polls = servicePoll.getAllPolls();
-
- // Affichage des erreurs
- if (userExists && !user.getAdmin()) {
- feedback.addError(messages.get("userNotAllowed"));
- }
- }
-}
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,257 +0,0 @@
-/* *##% Pollen
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
-package org.chorem.pollen.ui.pages.admin;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tapestry5.BindingConstants;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.ValueEncoder;
-import org.apache.tapestry5.annotations.Component;
-import org.apache.tapestry5.annotations.IncludeStylesheet;
-import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.annotations.Persist;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.ioc.Messages;
-import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.PollenProperty;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.mail.PreventRuleManager;
-import org.chorem.pollen.service.ServiceUser;
-import org.chorem.pollen.ui.components.FeedBack;
-import org.chorem.pollen.ui.data.AddressBarItem;
-import org.chorem.pollen.ui.services.PollenManager;
-
-/**
- * Classe d'administration des comptes utilisateurs. Si l'utilisateur n'est pas
- * identifié, on lui demande d'abord de s'identifier via un formulaire.
- *
- * @author rannou
- * @version $Id$
- */
-@IncludeStylesheet("context:css/usersAdmin.css")
-public class UsersAdmin {
-
- /** Affichage des messages pour l'utilisateur */
- @Component(id = "feedback")
- private FeedBack feedback;
-
- /**
- * Objet de session représentant l'url du site.
- */
- @SessionState
- private String siteURL;
-
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- @Property
- private UserAccount user;
- @Property
- private boolean userExists;
-
- /**
- * Titre de la page.
- */
- @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
- @Property
- private String title;
-
- /**
- * Adresse de la page.
- */
- @SuppressWarnings("unused")
- @Property
- private AddressBarItem[] address;
-
- /**
- * Liste des utilisateurs.
- */
- @Property
- @Persist
- private List<UserAccount> accounts;
-
- /**
- * Utilisateur courant.
- */
- @Property
- private UserAccount account;
-
- /**
- * Ressources de la page.
- */
- @Inject
- private ComponentResources resources;
-
- /**
- * Messages.
- */
- @Inject
- private Messages messages;
-
- /** Injection des services */
- @Inject
- private ServiceUser serviceUser;
-// @Inject
-// private ServiceList serviceList;
-
- /**
- * Initialisation du formulaire.
- */
- public void onPrepareFromUsersForm() {
- if (accounts == null) {
- accounts = serviceUser.getUsers();
- }
- }
-
- /**
- * Méthode appelée lors de la soumission du formulaire.
- */
- public Object onSuccessFromUsersForm() {
- for (UserAccount usr : accounts) {
-// serviceUser.createUpdateUser(usr);
-
- // FIXME : test and refactor to manage errors
-
-// if (serviceUser.findUserById(usr.getId()) != null) {
-// serviceUser.createUpdateUser(usr);
-// } else {
-// String password = PasswordGenerator.generate(8);
-// if (serviceUser.createUser(usr, MD5.encode(password)) != null) {
-// feedback.addInfo(messages.format("userCreated", usr
-// .getLogin()));
-// sendMailNotification(usr, password);
-// } else {
-// feedback.addError(messages.format("userNotCreated", usr
-// .getLogin()));
-// }
-// }
- }
- feedback.addInfo(messages.get("dataSaved"));
- resources.discardPersistentFieldChanges();
- return this;
- }
-
- /**
- * Méthode appelée lors de l'ajout d'un utilisateur.
- */
-// Object onAddRowFromUsersLoop() {
-// // FIXME : wtf ?
-//
-//
-// UserAccount usr = new UserAccountImpl();
-// //usr.setId(String.valueOf(System.nanoTime()));
-// accounts.add(usr);
-// return usr;
-// }
-
- /**
- * Méthode appelée lors de la suppression d'un utilisateur.
- */
-// void onRemoveRowFromUsersLoop(UserAccount usr) {
-// if (serviceUser.findUserById(usr.getId()) != null) {
-//
-// // suppression des listes de votants de l'utilisateur
-// serviceList.deletePersonLists(usr.getId());
-//
-// // suppression de l'utilisateur
-// if (serviceUser.deleteUser(usr)) {
-// accounts.remove(usr);
-// }
-// } else {
-// accounts.remove(usr);
-// }
-// }
-
- /**
- * Encoder permettant de transformer un ID en user.
- */
- public ValueEncoder<UserAccount> getUserEncoder() {
- return new ValueEncoder<UserAccount>() {
-
- public String toClient(UserAccount value) {
- return value.getTopiaId();
- }
-
- public UserAccount toValue(String key) {
- for (UserAccount usr : accounts) {
- if (key.equals(usr.getTopiaId())) {
- return usr;
- }
- }
- throw new IllegalArgumentException("La clé \"" + key
- + "\" n'existe pas dans la collection : " + accounts);
- }
- };
- }
-
- @Inject
- private PollenManager manager;
-
- /** Envoi du mail de notification */
- private void sendMailNotification(UserAccount newUser, String password) {
- Map<String, String> data = new HashMap<String, String>();
- data.put("host", manager.getProperty(PollenProperty.EMAIL_HOST));
- data.put("port", manager.getProperty(PollenProperty.EMAIL_PORT));
- data.put("from", manager.getProperty(PollenProperty.EMAIL_FROM));
- data.put("to", newUser.getEmail());
- data.put("title", messages.format("registerEmail_subject", newUser
- .getLogin()));
- data.put("msg", messages.format("registerEmail_msg", newUser
- .getFirstName(), newUser.getLastName(), newUser.getLogin(),
- password, siteURL));
-
- // FIXME call directly MailUtil.sendMail()
- // skip fill map, get from map...
- PreventRuleManager.emailAction(data);
- }
-
- /**
- * Détermine si le compte courant est le compte de l'utilisateur.
- */
- public boolean isMyAccount() {
- if (userExists) {
- return user.equals(account);
- }
- return false;
- }
-
- /**
- * Méthode d'activation de la page.
- */
- public void onActivate() {
-
- // Affichage des erreurs
- if (userExists && !user.getAdmin()) {
- feedback.addError(messages.get("userNotAllowed"));
- }
- }
-
- /**
- * Initialisation de l'affichage.
- */
- public void setupRender() {
- accounts = serviceUser.getUsers();
-
- address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"),
- new AddressBarItem(title, null) };
- }
-}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -18,6 +18,7 @@
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
@@ -28,6 +29,8 @@
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.service.ServicePoll;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.AddressBarItem;
@@ -38,8 +41,16 @@
* @author rannou
* @version $Id$
*/
-public class CloseValidation {
+public class CloseValidation extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/** Affichage des messages pour l'utilisateur */
@Component(id = "feedback")
private FeedBack feedback;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -19,15 +19,17 @@
import java.util.Date;
import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBarItem;
import org.chorem.pollen.ui.data.PollAction;
@@ -38,8 +40,16 @@
* @author rannou
* @version $Id$
*/
-public class ConfirmPoll {
+public class ConfirmPoll extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
@Persist
private Poll poll;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -18,6 +18,7 @@
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
@@ -26,9 +27,10 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.AddressBarItem;
-import org.chorem.pollen.votecounting.dto.PollDTO;
/**
* Classe de la page de confirmation de la création d'un sondage.
@@ -37,8 +39,16 @@
* @author rannou
* @version $Id$
*/
-public class CreationValidation {
+public class CreationValidation extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/** Affichage des messages pour l'utilisateur */
@Component(id = "feedback")
private FeedBack feedback;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -18,6 +18,7 @@
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
@@ -26,6 +27,8 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.AddressBarItem;
@@ -36,8 +39,16 @@
* @author rannou
* @version $Id$
*/
-public class ModificationValidation {
+public class ModificationValidation extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/** Affichage des messages pour l'utilisateur */
@Component(id = "feedback")
private FeedBack feedback;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -16,7 +16,6 @@
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.FormFragment;
import org.apache.tapestry5.ioc.Messages;
@@ -27,9 +26,9 @@
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PreventRule;
-import org.chorem.pollen.entity.UserAccount;
-import org.chorem.pollen.mail.PreventRuleManager;
import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.data.ChoiceField;
import org.slf4j.Logger;
@@ -61,17 +60,19 @@
*/
@IncludeStylesheet("context:css/poll.css")
@IncludeJavaScriptLibrary("context:js/pollForm.js")
-public class PollForm {
+public class PollForm extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
@Inject
private Logger log;
-
- @SessionState
- private UserAccount user;
- @Property
- private boolean userExists;
-
@Inject
private Messages messages;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -22,12 +22,9 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
@@ -48,12 +45,11 @@
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.entity.Result;
import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.components.Chart;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.AddressBarItem;
-import org.chorem.pollen.votecounting.business.NumberMethod;
-import org.chorem.pollen.votecounting.dto.ChoiceDTO;
-import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO;
import org.slf4j.Logger;
/**
@@ -64,7 +60,16 @@
*/
@IncludeStylesheet({"context:css/results.css", "context:css/lightbox.css"})
@IncludeJavaScriptLibrary({"${tapestry.scriptaculous}/builder.js","context:js/lightbox.js"})
-public class Results {
+public class Results extends AbstractPollenPage {
+
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
@Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
@Property
private String title;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -36,7 +36,6 @@
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
@@ -48,7 +47,6 @@
import org.chorem.pollen.entity.CommentImpl;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
-import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.Vote;
import org.chorem.pollen.service.ServicePoll;
import org.chorem.pollen.service.ServiceUser;
@@ -73,6 +71,14 @@
@IncludeStylesheet({"context:css/vote.css", "context:css/lightbox.css"})
@IncludeJavaScriptLibrary({"${tapestry.scriptaculous}/builder.js","context:js/lightbox.js"})
public class VoteForPoll extends AbstractUploadPage {
+
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
//
// @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
// @Property
@@ -936,9 +942,6 @@
@Property
private PollUri uri;
-
- @InjectComponent
- private Border border;
/** TEMP : Affichage des messages pour l'utilisateur */
@Component(id = "feedback")
@@ -966,15 +969,6 @@
@Property
private boolean pollNull;
-
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- private UserAccount user;
-
- @Property
- private boolean userExists;
/** Compte du votant */
private PollAccount pollAccount;
@@ -1103,7 +1097,7 @@
}
if (pollAccount == null) {
- pollAccount = serviceUser.getNewPerson(user);//new PollAccountDTO();
+ pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO();
// if (userExists) {
// if (user.getFirstName() != null && user.getLastName() != null) {
// pollAccount.setVotingId(
@@ -1128,7 +1122,8 @@
* @throws PollenBusinessException
*/
public boolean isCreatorUser() throws PollenBusinessException {
- return userExists && user.equals(getPoll().getCreator().getUserAccount());
+ return isUserConnected() && getUserConnected().equals(
+ getPoll().getCreator().getUserAccount());
}
/************** PAGER *****************************************************/
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -16,7 +16,6 @@
package org.chorem.pollen.ui.pages.user;
-import java.util.List;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.tapestry5.BindingConstants;
@@ -25,10 +24,8 @@
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
-import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Retain;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.Zone;
@@ -37,12 +34,11 @@
import org.apache.tapestry5.services.BeanModelSource;
import org.apache.tapestry5.upload.services.UploadedFile;
import org.chorem.pollen.entity.PollAccount;
-import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.EvenOdd;
import org.chorem.pollen.ui.data.AddressBarItem;
-import org.chorem.pollen.ui.utils.CSVAccountUtil;
-import org.chorem.pollen.ui.utils.LDAPAccountUtil;
/**
* Classe de la page d'affichage des listes de votants favorites de
@@ -53,16 +49,16 @@
* @version $Id$
*/
@IncludeStylesheet("context:css/lists.css")
-public class UserLists {
+public class UserLists extends AbstractPollenPage {
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- private UserAccount user;
- @Property
- private boolean userExists;
+ @InjectComponent
+ private Border border;
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/** Affichage des messages pour l'utilisateur */
@Component(id = "feedback")
private FeedBack feedback;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsCreated.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsCreated.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsCreated.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -19,16 +19,16 @@
import java.util.List;
import org.apache.tapestry5.annotations.IncludeStylesheet;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.upload.services.UploadedFile;
import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServicePoll;
-import org.chorem.pollen.ui.base.Polls;
+import org.chorem.pollen.ui.base.AbstractPollsPage;
+import org.chorem.pollen.ui.components.Border;
/**
* Classe de la page d'affichage des sondages que l'utilisateur a créés. Si
@@ -39,15 +39,16 @@
* @version $Id$
*/
@IncludeStylesheet("context:css/pollsCreated.css")
-public class UserPollsCreated extends Polls {
+public class UserPollsCreated extends AbstractPollsPage {
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- private UserAccount user;
- private boolean userExists;
+ @InjectComponent
+ private Border border;
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/**
* Liste de sondages de l'utilisateur
*/
@@ -103,8 +104,8 @@
@Override
public void onActivate() {
super.onActivate();
- if (userExists) {
- polls = servicePoll.getPollsByUser(user);
+ if (isUserConnected()) {
+ polls = servicePoll.getPollsByUser(getUserConnected());
}
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -19,14 +19,13 @@
import java.util.List;
import org.apache.tapestry5.annotations.IncludeStylesheet;
+import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.entity.Poll;
-import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServicePoll;
-import org.chorem.pollen.ui.base.Polls;
-import org.chorem.pollen.votecounting.dto.PollDTO;
+import org.chorem.pollen.ui.base.AbstractPollsPage;
+import org.chorem.pollen.ui.components.Border;
/**
* Classe de la page d'affichage des sondages auxquels l'utilisateur a
@@ -37,15 +36,16 @@
* @version $Id$
*/
@IncludeStylesheet("context:css/pollsParticipated.css")
-public class UserPollsParticipated extends Polls {
+public class UserPollsParticipated extends AbstractPollsPage {
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- private UserAccount user;
- private boolean userExists;
+ @InjectComponent
+ private Border border;
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
/**
* Liste des sondages auxquels l'utilisateur a participé
*/
@@ -86,8 +86,9 @@
@Override
public void onActivate() {
super.onActivate();
- if (userExists) {
- invitedPolls = participatedPolls = servicePoll.getPollsByUser(user);
+ if (isUserConnected()) {
+ invitedPolls = participatedPolls = servicePoll.getPollsByUser(
+ getUserConnected());
// invitedPolls = servicePoll.findInvitedPolls(user.getId());
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -27,7 +27,6 @@
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.PasswordField;
import org.apache.tapestry5.corelib.components.TextField;
@@ -36,6 +35,7 @@
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.services.PollenManager;
@@ -49,26 +49,32 @@
* @version $Id$
*/
@IncludeStylesheet("context:css/account.css")
-public class UserProfile {
+public class UserProfile extends AbstractPollenPage {
+ @InjectComponent
+ private Border border;
+
+ @Override
+ public Border getBorder() {
+ return border;
+ }
+
+ @Override
+ public boolean isNeedAuthentification() {
+ return true;
+ }
+
+ @Override
+ public boolean canDisplayPage() {
+ return isUserConnected();
+ }
+
@Inject
private Logger logger;
@Inject
private PollenManager manager;
- @InjectComponent
- private Border border;
-
- /**
- * Objet de session représentant l'utilisateur identifié.
- */
- @SessionState
- @Property
- private UserAccount user;
- @Property
- private boolean userExists;
-
@Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
@Property
private String title;
@@ -127,7 +133,7 @@
public UserAccount getUserEditable() {
if (userEditable == null) {
- userEditable = user;
+ userEditable = getUserConnected();
}
return userEditable;
}
@@ -135,10 +141,10 @@
/**
* ON_VALIDATE_FORM :: <br \>
* UI validation : check if the two passwords are equals. <br \>
- * BUSINESS validation : execute {@link org.chorem.pollen.service.ServiceUser#updateUser(org.chorem.pollen.entity.UserAccount) }
+ * BUSINESS validation : execute {@link ServiceUser#updateUser(UserAccount) }
* which throws errors
- * {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD}
- * and {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
+ * {@link PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD}
+ * and {@link PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
*/
@Log
void onValidateFormFromAccountForm() {
@@ -147,19 +153,19 @@
if (StringUtils.isNotEmpty(newPassword) &&
!newPassword.equals(passwordVerify)) {
accountForm.recordError(newPasswordField,
- messages.get("pollen.ui.user.passwordsDontMatch"));
+ messages.get("pollen.ui.user.validate.passwords"));
}
// If no UI errors, call business to save the user
if (!accountForm.getHasErrors()) {
try {
// Update the user
if (logger.isDebugEnabled()) {
- logger.debug("TopiaId : " + user.getTopiaId());
- logger.debug("Login : " + user.getLogin());
- logger.debug("Password : " + user.getPassword());
- logger.debug("NewPassword : " + user.getNewPassword());
+ logger.debug("TopiaId : " + userEditable.getTopiaId());
+ logger.debug("Login : " + userEditable.getLogin());
+ logger.debug("Password : " + userEditable.getPassword());
+ logger.debug("NewPassword : " + userEditable.getNewPassword());
}
- serviceUser.updateUser(userEditable);
+ serviceUser.updateUser(userEditable, false);
} catch (PollenBusinessException eee) {
String message = manager.getErrorMessage(eee, messages, logger);
switch (eee.getType()) {
@@ -174,7 +180,7 @@
@Log
Object onSuccessFromAccountForm() {
- border.addInfo(messages.get("pollen.ui.user.updateSuccess"));
+ addInfo(messages.get("pollen.ui.user.update.success"));
return this;
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -26,7 +26,6 @@
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.PasswordField;
import org.apache.tapestry5.corelib.components.TextField;
@@ -37,6 +36,7 @@
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceEmail;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.AbstractPollenPage;
import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.pages.Index;
@@ -52,24 +52,31 @@
* @version $Id$
*/
@IncludeStylesheet("context:css/register.css")
-public class UserRegister {
+public class UserRegister extends AbstractPollenPage {
- @Inject
- private Logger logger;
-
@InjectComponent
private Border border;
- /**
- * Identified user
- */
- @SessionState
- private UserAccount user;
+ @Override
+ public Border getBorder() {
+ return border;
+ }
- @Property
- private boolean userExists;
+ @Override
+ public boolean isNeedAuthentification() {
+ return false;
+ }
+ @Override
+ public boolean canDisplayPage() {
+ addInfo("Vous devez vous déconnecter pour créer un compte");
+ return !isUserConnected();
+ }
+
@Inject
+ private Logger logger;
+
+ @Inject
private ServiceUser serviceUser;
@Inject
@@ -85,16 +92,9 @@
@Property
private String title;
- /**
- * Session property loaded from configuration to know what is the current
- * server url
- */
- @SessionState
- private String siteURL;
+// @Inject
+// private Locale currentLocale;
- @Inject
- private Locale currentLocale;
-
/**
* New user to create
*/
@@ -129,7 +129,7 @@
public UserAccount getNewUser() {
if (newUser == null) {
- newUser = serviceUser.getNewUser(currentLocale);
+ newUser = serviceUser.getNewUser();
}
return newUser;
}
@@ -137,17 +137,17 @@
/**
* ON_VALIDATE_FORM :: <br \>
* UI validation : check if the two passwords are equals. <br \>
- * BUSINESS validation : execute {@link org.chorem.pollen.service.ServiceUser#createUser(org.chorem.pollen.entity.UserAccount) }
+ * BUSINESS validation : execute {@link ServiceUser#createUser(UserAccount)}
* which throws errors
- * {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_LOGIN_EXIST}
- * and {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
+ * {@link PollenBusinessException.PollenExceptionType.USER_LOGIN_EXIST}
+ * and {@link PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
*/
void onValidateFormFromRegister() {
// Check newPassword that must be equals to passwordVerify
String password = newUser.getNewPassword();
if (!password.equals(passwordVerify)) {
register.recordError(passwordField,
- messages.get("pollen.ui.user.passwordsDontMatch"));
+ messages.get("pollen.ui.user.validate.passwords"));
}
// If no UI errors, call business to save the user
@@ -180,30 +180,30 @@
*/
Object onSuccessFromRegister() {
// Set the newUser in session : connect the new registered user
- user = newUser;
+ setUserConnected(newUser);
index.addInfo(
- messages.format("pollen.ui.user.autoConnection",
- user.getLogin()));
+ messages.format("pollen.ui.user.register.autoConnection",
+ newUser.getLogin()));
// Send an email to the new user if not empty
- if (StringUtils.isNotEmpty(user.getEmail())) {
+ if (StringUtils.isNotEmpty(newUser.getEmail())) {
try {
- PollenEmail mail = serviceEmail.getNewEmail(user);
+ PollenEmail mail = serviceEmail.getNewEmail(newUser);
mail.setSubject(
messages.format("pollen.email.userRegister.subject",
- user.getLogin()));
+ newUser.getLogin()));
mail.setContent(
messages.format("pollen.email.userRegister.content",
- user.getDisplayName(), user.getLogin(),
- passwordForEmail, siteURL));
+ newUser.getDisplayName(), newUser.getLogin(),
+ passwordForEmail, getUrl()));
serviceEmail.sendEmail(mail);
index.addInfo(
- messages.format("pollen.ui.user.sendRegisterEmail",
- user.getEmail()));
+ messages.format("pollen.ui.user.register.sendEmail",
+ newUser.getEmail()));
} catch (PollenBusinessException eee) {
String message = manager.getErrorMessage(eee, messages, logger);
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -16,6 +16,7 @@
package org.chorem.pollen.ui.services;
+import java.util.Locale;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -96,15 +97,20 @@
*
* @param configuration to add the manager to registry startup
* @param manager to launch at startup
+ * @param serviceUser used to start pollen context in manager
* @param shutdownHub to register manager for registry shutdown
*/
public static void contributeRegistryStartup(
OrderedConfiguration<Runnable> configuration,
- PollenManager manager, RegistryShutdownHub shutdownHub) {
+ ServiceUser serviceUser,
+ PollenManager manager,
+ RegistryShutdownHub shutdownHub) {
+
if (logger.isInfoEnabled()) {
logger.info("Execute contributeRegistryStartup");
}
shutdownHub.addRegistryShutdownListener(manager);
+ manager.setServiceUser(serviceUser);
configuration.add("PollenStartup", manager);
}
@@ -204,9 +210,11 @@
* Used to instanciate SessionState UserAccount when session expires.
*
* @param configuration to add the ApplicationStateCreator.
+ * @param serviceUser to instantiate user
*/
public void contributeApplicationStateManager(MappedConfiguration<Class<?>,
- ApplicationStateContribution> configuration) {
+ ApplicationStateContribution> configuration,
+ final ServiceUser serviceUser) {
if (logger.isInfoEnabled()) {
logger.info("Execute contributeApplicationStateManager");
}
@@ -215,7 +223,7 @@
new ApplicationStateCreator<UserAccount>() {
@Override
public UserAccount create() {
- return new UserAccountImpl();
+ return serviceUser.getNewUser();
}
};
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -32,6 +32,8 @@
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
+import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.base.PollenPage;
import org.nuiton.util.ApplicationConfig;
import org.slf4j.Logger;
@@ -58,6 +60,8 @@
private PollenContext context;
+ private ServiceUser serviceUser;
+
/**
* Constructor of WaoManager. It needs the WaoContext to start and stop.
*
@@ -67,12 +71,16 @@
this.context = context;
}
+ void setServiceUser(ServiceUser serviceUser) {
+ this.serviceUser = serviceUser;
+ }
+
/**
* Called to start the application.
*/
@Override
public void run() {
- context.start();
+ context.start(serviceUser);
// Copy properties to propertiesMap (insentitive) for SymbolProvider
Properties properties = getConfiguration().getOptions();
for (Object key : properties.keySet()) {
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/PasswordGenerator.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/PasswordGenerator.java 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/PasswordGenerator.java 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,56 +0,0 @@
-/* *##% Pollen
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
-package org.chorem.pollen.ui.utils;
-
-/**
- * Classe permettant de générer un mot de passe aléatoire.
- *
- * @author rannou
- * @version $Id$
- */
-public class PasswordGenerator {
-
- /**
- * Génération d'un mot de passe aléatoire.
- *
- * @param length longueur du mot de passe
- */
- public static String generate(int length) {
- char[] chars = new char[length];
- int c = '0';
-
- for (int i = 0; i < length; i++) {
- int charType = (int) (Math.random() * 3);
- switch (charType) {
- case 0:
- c = '0' + (int) (Math.random() * 10);
- break;
- case 1:
- c = 'a' + (int) (Math.random() * 26);
- break;
- case 2:
- c = 'A' + (int) (Math.random() * 26);
- break;
- default:
- break;
- }
- chars[i] = (char) c;
- }
-
- return String.copyValueOf(chars);
- }
-}
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-en_GB.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-en_GB.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-en_GB.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,6 +1,6 @@
# User registration emails
-pollen.mail.userRegister.subject=[Pollen] Confirmation of account creation %s
-pollen.mail.userRegister.content=Welcome %1$s. You had just created an account on the web application Pollen.\n\nLogin: %2$s\nPassword: %3$s\n\nYou can now manage your polls by logging on the website : \n%4$s
+pollen.email.userRegister.subject=[Pollen] Confirmation of account creation %s
+pollen.email.userRegister.content=Welcome %1$s. You had just created an account on the web application Pollen.\n\nLogin: %2$s\nPassword: %3$s\n\nYou can now manage your polls by logging on the website : \n%4$s
# Poll creation emails
creatorEmail_subject=[Pollen] Poll creation (%s)
@@ -50,6 +50,16 @@
pollen.ui.choice.add.submit=Add
pollen.ui.error.upload=An error occurred while uploading files. Maximum size allowed is %$1s per file, and %$2s total.
+pollen.ui.user.edit=Edit this user account
+pollen.ui.user.cancelEdit=Cancel changes
+pollen.ui.user.save=Save this user account
+pollen.ui.user.delete=Delete this user account
+pollen.ui.user.delete.confirmMessage=Are you sure you want to definitively delete this user ?
+
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Invalid email
+login-required-message=You must provide a username
+
# Tapestry messages for VoteForPoll.tml
# FORM:: addChoice
choiceDescription-label=Description
@@ -62,4 +72,4 @@
choiceImage-label=Image
addChoice-choiceImage-regexp=\\.(jpe?g|gif|png|JPE?G|GIF|PNG)$
addChoice-choiceImage-regexp-message=The image must be a JPG, GIF or PNG file.
-addChoice-choiceImage-required-message=You must provide a choice.
\ No newline at end of file
+addChoice-choiceImage-required-message=You must provide a choice.
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,51 +1,42 @@
-# User registration emails
+############################ PAGES #############################################
+pollen.page.AdminUsers.title=Gestion des utilisateurs
+
+############################ EMAIL #############################################
pollen.email.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s
pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s
-# Poll creation emails
-creatorEmail_subject=[Pollen] Cr\u00E9ation d'un sondage (%s)
-creatorEmail_msg=Vous venez de cr\u00E9er le sondage "%s".\nVous pouvez y acc\u00E9der en suivant les liens ci-dessous.\n\nPage de vote : \n%s\nPage de modification : \n%s
-votingEmail_subject=[Pollen] Invitation au vote (%s)
-votingEmail_msg=Un nouveau sondage a \u00E9t\u00E9 cr\u00E9\u00E9 : "%s".\nVous pouvez y participer avec l'identifiant %s \u00E0 l'adresse suivante : \n%s
+############################ USER ##############################################
+pollen.ui.user.register.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s.
+pollen.ui.user.register.sendEmail=Un email vous a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse %1$s.
+pollen.ui.user.validate.passwords=Les deux mots de passe ne correspondent pas.
+pollen.ui.user.update.success=Modification enregistr\u00E9e avec succ\u00E8s.
+pollen.ui.user.display.notConnected=Vous devez vous connecter pour acc\u00E9der \u00E0 cette page.
+pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 cette page.
+pollen.ui.user.create=Ajouter
+pollen.ui.user.create.title=Cr\u00E9er un nouvel utilisateur
+pollen.ui.user.create.passwordGenerated=Le password du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9.
+pollen.ui.user.create.passwordSameAsLogin=Le password du nouvel utilisateur est le m\u00EAme que son identifiant.
+pollen.ui.user.create.sendEmail=Un email a \u00E9t\u00E9 envoy\u00E9 au nouvel utilisateur %1$s \u00E0 l'adresse %2$s.
+pollen.ui.user.create.success=L'utilisateur %1$s a \u00E9t\u00E9 cr\u00E9\u00E9 avec succ\u00E8s.
+pollen.ui.user.update.edit=Modifier cet utilisateur.
+pollen.ui.user.update.save=Enregistrer les modifications.
+pollen.ui.user.update.cancel=Annuler les changements.
+pollen.ui.user.delete=Supprimer cet utilisateur.
+pollen.ui.user.delete.confirmMessage=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer cet utilisateur ?
-# Notification emails
-voteEmail_subject=[Pollen] Notification de vote (%s)
-voteEmail_msg=Un vote vient d'\u00EAtre enregistr\u00E9 pour le sondage "%s". Ce sondage compte d\u00E9sormais %d votes.\nVous pouvez acc\u00E9der \u00E0 ce sondage en suivant les liens ci-dessous.\n\nPage de vote : \n%s\nPage de modification : \n%s
+# FORM:: user
+firstName-label=Pr\u00E9nom
+lastName-label=Nom
+login-label=Identifiant
+email-label=Email
-# Reminder emails
-reminderEmail_subject=[Pollen] Rappel (%s)
-reminderEmail_msg=Vous n'avez pas encore vot\u00E9 pour le sondage "%s".\nVous pouvez encore y participer avec l'identifiant %s \u00E0 l'adresse suivante : \n%s
+login-required-message=Vous devez fournir un identifiant
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Email invalide
+newEmail-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+newEmail-regexp-message=Email invalide
-# Poll feed
-pollFeed_title=Pollen : %s
-pollFeed_desc=%s
-pollFeed_createTitle=Sondage cr\u00E9\u00E9 par %s
-pollFeed_createContent=
-pollFeed_voteTitle=Nouveau vote de %s
-pollFeed_voteContent=\u00C9tat du sondage : %s
-pollFeed_choiceTitle=Nouveau choix : %s
-pollFeed_choiceContent=%s
-pollFeed_commentTitle=Nouveau commentaire de %s
-pollFeed_commentContent=%s
-
-# Actions
-create=Cr\u00E9er
-edit=Modifier
-delete=Supprimer
-add=Ajouter
-save=Enregistrer
-load=Charger
-ok=Ok
-validate=Valider
-cancel=Annuler
-return=Retour
-help=Aide
-
-pollen.ui.user.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s.
-pollen.ui.user.sendRegisterEmail=Un email vous a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse %1$s.
-pollen.ui.user.passwordsDontMatch=Les deux mots de passe ne correspondent pas.
-pollen.ui.user.updateSuccess=Modification enregistr\u00E9e avec succ\u00E8s.
-
+############################ CHOICE ############################################
pollen.ui.choice.delete.confirm=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer ce choix ?
pollen.ui.choice.delete.title=Supprimer ce choix
pollen.ui.vote.noVote=Aucune personne n'a encore particip\u00E9 au sondage
@@ -68,3 +59,43 @@
addChoice-choiceImage-regexp=\\.(jpe?g|gif|png|JPE?G|GIF|PNG)$
addChoice-choiceImage-regexp-message=L'image doit-\u00EAtre au format JPG, GIF ou PNG.
addChoice-choiceImage-required-message=Vous devez saisir un choix.
+
+
+# Poll creation emails
+#creatorEmail_subject=[Pollen] Cr\u00E9ation d'un sondage (%s)
+#creatorEmail_msg=Vous venez de cr\u00E9er le sondage "%s".\nVous pouvez y acc\u00E9der en suivant les liens ci-dessous.\n\nPage de vote : \n%s\nPage de modification : \n%s
+#votingEmail_subject=[Pollen] Invitation au vote (%s)
+#votingEmail_msg=Un nouveau sondage a \u00E9t\u00E9 cr\u00E9\u00E9 : "%s".\nVous pouvez y participer avec l'identifiant %s \u00E0 l'adresse suivante : \n%s
+
+# Notification emails
+#voteEmail_subject=[Pollen] Notification de vote (%s)
+#voteEmail_msg=Un vote vient d'\u00EAtre enregistr\u00E9 pour le sondage "%s". Ce sondage compte d\u00E9sormais %d votes.\nVous pouvez acc\u00E9der \u00E0 ce sondage en suivant les liens ci-dessous.\n\nPage de vote : \n%s\nPage de modification : \n%s
+
+# Reminder emails
+#reminderEmail_subject=[Pollen] Rappel (%s)
+#reminderEmail_msg=Vous n'avez pas encore vot\u00E9 pour le sondage "%s".\nVous pouvez encore y participer avec l'identifiant %s \u00E0 l'adresse suivante : \n%s
+
+# Poll feed
+#pollFeed_title=Pollen : %s
+#pollFeed_desc=%s
+#pollFeed_createTitle=Sondage cr\u00E9\u00E9 par %s
+#pollFeed_createContent=
+#pollFeed_voteTitle=Nouveau vote de %s
+#pollFeed_voteContent=\u00C9tat du sondage : %s
+#pollFeed_choiceTitle=Nouveau choix : %s
+#pollFeed_choiceContent=%s
+#pollFeed_commentTitle=Nouveau commentaire de %s
+#pollFeed_commentContent=%s
+
+# Actions
+#create=Cr\u00E9er
+#edit=Modifier
+#delete=Supprimer
+#add=Ajouter
+#save=Enregistrer
+#load=Charger
+#ok=Ok
+#validate=Valider
+#cancel=Annuler
+#return=Retour
+#help=Aide
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -101,13 +101,13 @@
</li>
<t:if test="userExists">
<li>
- <t:pagelink t:page="user/UserPollsCreated">${message:createdPolls}</t:pagelink>
+ <t:pagelink t:page="user/pollsCreated">${message:createdPolls}</t:pagelink>
</li>
<li>
- <t:pagelink t:page="user/UserPollsParticipated">${message:participatedPolls}</t:pagelink>
+ <t:pagelink t:page="user/pollsParticipated">${message:participatedPolls}</t:pagelink>
</li>
<li>
- <t:pagelink t:page="user/UserLists">${message:votingLists}</t:pagelink>
+ <t:pagelink t:page="user/lists">${message:votingLists}</t:pagelink>
</li>
</t:if>
</ul>
@@ -122,10 +122,10 @@
<div class="top_left${pageLogo}"></div>
<ul class ="top_middle${pageLogo}">
<li>
- <t:pagelink t:page="admin/PollsAdmin">${message:pollsAdmin}</t:pagelink>
+ <t:pagelink t:page="admin/polls">${message:pollsAdmin}</t:pagelink>
</li>
<li>
- <t:pagelink t:page="admin/UsersAdmin">${message:usersAdmin}</t:pagelink>
+ <t:pagelink t:page="admin/users">${message:usersAdmin}</t:pagelink>
</li>
</ul>
</div>
@@ -159,9 +159,21 @@
<t:feedback t:id="errorJs" />
</noscript>
<t:feedback t:id="borderFeedback" t:autoClear="false"/>
- <t:if t:test="canDisplayBody()">
+ <t:delegate t:to="activeBlock" />
+ <t:block t:id="loginBlock">
+ <t:LoginComponent />
+ </t:block>
+ <t:block t:id="pageBlock">
<t:body />
- </t:if>
+ </t:block>
+ <!--<t:if t:test="needAuthentification">
+ <t:LoginComponent />
+ <p:else>
+ <t:if t:test="canDisplayBody()">
+ <t:body />
+ </t:if>
+ </p:else>
+ </t:if>-->
</div>
</div>
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border_fr.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border_fr.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -11,8 +11,8 @@
createdPolls=Sondages cr\u00E9\u00E9s
participatedPolls=Sondages particip\u00E9s
votingLists=Listes de votants
-pollsAdmin=G\u00E9rer les sondages
-usersAdmin=G\u00E9rer les utilisateurs
+pollsAdmin=Sondages
+usersAdmin=Utilisateurs
account=Mon compte
logout=D\u00E9connexion
or=ou
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_en.properties (from rev 2972, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_en.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_en.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_en.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,4 @@
+title=Polls administration
+noUser=You must be logged to access polls administration.\n Please fill the form below.
+userNotAllowed=You are not allowed to access this page.
+noPolls=No poll exists.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_en.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_fr.properties (from rev 2972, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_fr.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_fr.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_fr.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,4 @@
+title=Gestion des sondages
+noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir administrer les sondages.\n Veuillez remplir le formulaire ci-dessous.
+userNotAllowed=Vous n'\u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der \u00E0 cette page.
+noPolls=Aucun sondage existant.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminPolls_fr.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_en.properties (from rev 2972, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_en.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_en.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_en.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,23 @@
+title=Users administration
+noUser=You must be logged to access users administration.\n Please fill the form below.
+userNotAllowed=You are not allowed to access this page.
+noPolls=No user exists.
+userCreated=User %s created.
+userNotCreated=Error in creating user %s.
+userUpdated=User %s updated.
+userNotUpdated=Error in updating user %s.
+userDeleted=User %s deleted.
+userNotDeleted=Error in deleting user %s.
+dataSaved=Data saved.
+
+#grid
+login-label=Login
+firstName-label=First Name
+lastName-label=Last Name
+email-label=Email
+administrator-label=Admin
+addUser=Add user
+
+login-required-message=You must provide a username.
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Invalid email.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_en.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties (from rev 2972, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_fr.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,25 @@
+#title=Gestion des utilisateurs
+
+
+#noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir administrer les utilisateurs.\n Veuillez remplir le formulaire ci-dessous.
+#userNotAllowed=Vous n'\u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der \u00E0 cette page.
+#noPolls=Aucun utilisateur existant.
+#userCreated=L'utilisateur %s a \u00E9t\u00E9 cr\u00E9\u00E9.
+#userNotCreated=Erreur lors de la cr\u00E9ation de l'utilisateur %s.
+#userUpdated=L'utilisateur %s a \u00E9t\u00E9 mis \u00E0 jour.
+#userNotUpdated=Erreur lors de la mise \u00E0 jour de l'utilisateur %s.
+#userDeleted=L'utilisateur %s a \u00E9t\u00E9 supprim\u00E9.
+#userNotDeleted=Erreur lors de la suppression de l'utilisateur %s.
+#dataSaved=Les donn\u00E9es ont \u00E9t\u00E9 enregistr\u00E9es.
+#
+##grid
+#login-label=Identifiant
+#firstName-label=Pr\u00E9nom
+#lastName-label=Nom
+#email-label=Email
+#administrator-label=Admin
+#addUser=Ajouter un utilisateur
+#
+#login-required-message=Vous devez fournir un identifiant.
+#email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+#email-regexp-message=Email invalide.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/AdminUsers_fr.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_en.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_en.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_en.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,4 +0,0 @@
-title=Polls administration
-noUser=You must be logged to access polls administration.\n Please fill the form below.
-userNotAllowed=You are not allowed to access this page.
-noPolls=No poll exists.
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_fr.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/PollsAdmin_fr.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,4 +0,0 @@
-title=Gestion des sondages
-noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir administrer les sondages.\n Veuillez remplir le formulaire ci-dessous.
-userNotAllowed=Vous n'\u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der \u00E0 cette page.
-noPolls=Aucun sondage existant.
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_en.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_en.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_en.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,23 +0,0 @@
-title=Users administration
-noUser=You must be logged to access users administration.\n Please fill the form below.
-userNotAllowed=You are not allowed to access this page.
-noPolls=No user exists.
-userCreated=User %s created.
-userNotCreated=Error in creating user %s.
-userUpdated=User %s updated.
-userNotUpdated=Error in updating user %s.
-userDeleted=User %s deleted.
-userNotDeleted=Error in deleting user %s.
-dataSaved=Data saved.
-
-#grid
-login-label=Login
-firstName-label=First Name
-lastName-label=Last Name
-email-label=Email
-administrator-label=Admin
-addUser=Add user
-
-login-required-message=You must provide a username.
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Invalid email.
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_fr.properties 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/admin/UsersAdmin_fr.properties 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,23 +0,0 @@
-title=Gestion des utilisateurs
-noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir administrer les utilisateurs.\n Veuillez remplir le formulaire ci-dessous.
-userNotAllowed=Vous n'\u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der \u00E0 cette page.
-noPolls=Aucun utilisateur existant.
-userCreated=L'utilisateur %s a \u00E9t\u00E9 cr\u00E9\u00E9.
-userNotCreated=Erreur lors de la cr\u00E9ation de l'utilisateur %s.
-userUpdated=L'utilisateur %s a \u00E9t\u00E9 mis \u00E0 jour.
-userNotUpdated=Erreur lors de la mise \u00E0 jour de l'utilisateur %s.
-userDeleted=L'utilisateur %s a \u00E9t\u00E9 supprim\u00E9.
-userNotDeleted=Erreur lors de la suppression de l'utilisateur %s.
-dataSaved=Les donn\u00E9es ont \u00E9t\u00E9 enregistr\u00E9es.
-
-#grid
-login-label=Identifiant
-firstName-label=Pr\u00E9nom
-lastName-label=Nom
-email-label=Email
-administrator-label=Admin
-addUser=Ajouter un utilisateur
-
-login-required-message=Vous devez fournir un identifiant.
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Email invalide.
\ No newline at end of file
Copied: trunk/pollen-ui/src/main/webapp/admin/AdminPolls.tml (from rev 2972, trunk/pollen-ui/src/main/webapp/admin/PollsAdmin.tml)
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/AdminPolls.tml (rev 0)
+++ trunk/pollen-ui/src/main/webapp/admin/AdminPolls.tml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,50 @@
+
+<t:border t:address="address" t:pageLogo="literal:Index"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+
+ <t:feedback t:id="feedback"/>
+ <t:if test="userExists">
+ <t:if test="user.administrator">
+ <h1 class="titleIndex">${message:title}</h1>
+
+ <t:grid t:id="pollsGrid" t:source="polls" t:row="poll" model="pollsModel" t:inPlace="true"
+ t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next">
+ <p:functionsCell>
+ <t:PageLink t:page="poll/VoteForPoll" t:context="poll.pollId">
+ <img src="${asset:context:img/vote.png}" title="${message:vote-help}" alt="${message:vote}" />
+ </t:PageLink>
+ <t:PageLink t:page="poll/results" t:context="adminId">
+ <img src="${asset:context:img/count.png}" title="${message:count-help}" alt="${message:count}" />
+ </t:PageLink>
+
+ <t:unless test="poll.isClosed()">
+ <t:PageLink t:page="poll/modification" t:context="adminId">
+ <img src="${asset:context:img/edit.png}" title="${message:edit-help}" alt="${message:edit}" />
+ </t:PageLink>
+ <t:ActionLink t:id="close" t:context="poll.pollId">
+ <img src="${asset:context:img/close.png}" title="${message:close-help}" alt="${message:close}" />
+ </t:ActionLink>
+ </t:unless>
+
+ <t:ActionLink t:id="export" t:context="poll.pollId">
+ <img src="${asset:context:img/export.png}" title="${message:export-help}" alt="${message:export}" />
+ </t:ActionLink>
+ <t:PageLink t:page="poll/creation" t:context="poll.pollId">
+ <img src="${asset:context:img/copy.png}" title="${message:copy-help}" alt="${message:copy}" />
+ </t:PageLink>
+ <t:ActionLink t:id="deletePoll" t:context="poll.pollId">
+ <img src="${asset:context:img/delete.png}" title="${message:delete-help}" alt="${message:delete}" />
+ </t:ActionLink>
+ </p:functionsCell>
+ <p:empty>
+ ${message:noPolls}
+ </p:empty>
+ </t:grid>
+
+ </t:if>
+ <p:else>
+ <h4>${message:noUser}</h4>
+ <t:LoginComponent />
+ </p:else>
+ </t:if>
+</t:border>
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/webapp/admin/AdminPolls.tml
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml (from rev 2972, trunk/pollen-ui/src/main/webapp/admin/UsersAdmin.tml)
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml (rev 0)
+++ trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -0,0 +1,78 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<t:border t:addressBar="addressBar" t:pageLogo="literal:Index" t:pageTitle="prop:title"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+
+ <h1 class="titleIndex">${title}</h1>
+
+ <t:zone t:id="usersZone" t:update="show">
+ <t:form t:id="usersForm" t:zone="usersZone">
+ <t:if t:test="accountEdited">
+ <input t:type="hidden" value="accountEdited.login" />
+ </t:if>
+ <t:errors />
+ <div t:type="grid" t:source="accounts" t:row="account"
+ t:include="login, firstName, lastName, email, admin" t:add="actions" t:rowsPerPage="20">
+ <p:firstNameCell>
+ <t:if t:test="editionMode">
+ <input t:type="textfield" t:id="firstName" value="accountEdited.firstName" />
+ <p:else>${account.firstName}</p:else>
+ </t:if>
+ </p:firstNameCell>
+ <p:lastNameCell>
+ <t:if t:test="editionMode">
+ <input t:type="textfield" t:id="lastName" value="accountEdited.lastName" />
+ <p:else>${account.lastName}</p:else>
+ </t:if>
+ </p:lastNameCell>
+ <p:emailCell>
+ <t:if t:test="editionMode">
+ <input t:type="textfield" t:id="email" value="accountEdited.email" t:validate="regexp" />
+ <p:else>${account.email}</p:else>
+ </t:if>
+ </p:emailCell>
+ <p:adminCell>
+ <t:if t:test="editionMode">
+ <input t:type="checkbox" t:id="admin" value="accountEdited.admin" disabled="accountConnected" />
+ <!-- Keep the admin value, the disabled checkbox is not saved in form submission -->
+ <t:if t:test="accountConnected">
+ <input t:type="hidden" value="accountEdited.admin" />
+ </t:if>
+ <p:else>
+ <t:if t:test="account.admin">X</t:if>
+ </p:else>
+ </t:if>
+ </p:adminCell>
+ <p:actionsCell>
+ <t:if t:test="editionMode">
+ <a t:type="pagelink" t:page="admin/users" t:id="cancelEdition">
+ <img src="${asset:context:img/undo.png}" alt="Cancel" title="${message:pollen.ui.user.update.cancel}" />
+ </a>
+ <input t:type="submit" class="ico save" t:id="save" value="Save" title="${message:pollen.ui.user.update.save}" />
+ <p:else>
+ <a t:type="actionlink" t:id="editAccount" t:context="account.login" t:zone="usersZone">
+ <img src="${asset:context:img/editSmall.png}" alt="Edit" title="${message:pollen.ui.user.update.edit}" />
+ </a>
+ <a t:type="actionlink" t:id="deleteAccount" t:context="account.login"
+ t:mixins="confirm" t:message="pollen.ui.user.delete.confirmMessage">
+ <img src="${asset:context:img/delete.png}" alt="Delete" title="${message:pollen.ui.user.delete}"/>
+ </a>
+ </p:else>
+ </t:if>
+ </p:actionsCell>
+ </div>
+ </t:form>
+ </t:zone>
+ <t:zone t:id="newUserZone" t:update="show">
+ <h2>${message:pollen.ui.user.create.title}</h2>
+ <form t:type="form" t:id="newUserForm" action="tapestry">
+ <p><t:errors /></p>
+ <p class="center">
+ <label t:type="label" for="newLogin">${message:login-label}</label>* :
+ <input t:type="textfield" t:id="newLogin" value="newUser.login" t:validate="required" />
+ <label t:type="label" for="newEmail">${message:email-label}</label> :
+ <input t:type="textfield" t:id="newEmail" value="newUser.email" t:validate="regexp" />
+ <input t:type="submit" value="${message:pollen.ui.user.create}" title="${message:pollen.ui.user.create.title}" />
+ </p>
+ </form>
+ </t:zone>
+</t:border>
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/pollen-ui/src/main/webapp/admin/PollsAdmin.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/PollsAdmin.tml 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/webapp/admin/PollsAdmin.tml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,50 +0,0 @@
-
-<t:border t:address="address" t:pageLogo="literal:Index"
- xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
-
- <t:feedback t:id="feedback"/>
- <t:if test="userExists">
- <t:if test="user.administrator">
- <h1 class="titleIndex">${message:title}</h1>
-
- <t:grid t:id="pollsGrid" t:source="polls" t:row="poll" model="pollsModel" t:inPlace="true"
- t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next">
- <p:functionsCell>
- <t:PageLink t:page="poll/VoteForPoll" t:context="poll.pollId">
- <img src="${asset:context:img/vote.png}" title="${message:vote-help}" alt="${message:vote}" />
- </t:PageLink>
- <t:PageLink t:page="poll/results" t:context="adminId">
- <img src="${asset:context:img/count.png}" title="${message:count-help}" alt="${message:count}" />
- </t:PageLink>
-
- <t:unless test="poll.isClosed()">
- <t:PageLink t:page="poll/modification" t:context="adminId">
- <img src="${asset:context:img/edit.png}" title="${message:edit-help}" alt="${message:edit}" />
- </t:PageLink>
- <t:ActionLink t:id="close" t:context="poll.pollId">
- <img src="${asset:context:img/close.png}" title="${message:close-help}" alt="${message:close}" />
- </t:ActionLink>
- </t:unless>
-
- <t:ActionLink t:id="export" t:context="poll.pollId">
- <img src="${asset:context:img/export.png}" title="${message:export-help}" alt="${message:export}" />
- </t:ActionLink>
- <t:PageLink t:page="poll/creation" t:context="poll.pollId">
- <img src="${asset:context:img/copy.png}" title="${message:copy-help}" alt="${message:copy}" />
- </t:PageLink>
- <t:ActionLink t:id="deletePoll" t:context="poll.pollId">
- <img src="${asset:context:img/delete.png}" title="${message:delete-help}" alt="${message:delete}" />
- </t:ActionLink>
- </p:functionsCell>
- <p:empty>
- ${message:noPolls}
- </p:empty>
- </t:grid>
-
- </t:if>
- <p:else>
- <h4>${message:noUser}</h4>
- <t:LoginComponent />
- </p:else>
- </t:if>
-</t:border>
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/webapp/admin/UsersAdmin.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/admin/UsersAdmin.tml 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/webapp/admin/UsersAdmin.tml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -1,76 +0,0 @@
-
-<t:border t:address="address" t:pageLogo="literal:Index"
- xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
-
- <t:feedback t:id="feedback"/>
- <t:if test="userExists">
- <t:if test="user.administrator">
- <h1 class="titleIndex">${message:title}</h1>
-
- <t:form t:id="usersForm">
- <t:errors />
-
- <div class="t-data-grid">
- <table class="t-data-grid">
- <thead>
- <tr>
- <th>${message:login-label}</th>
- <th>${message:firstName-label}</th>
- <th>${message:lastName-label}</th>
- <th>${message:email-label}</th>
- <th>${message:administrator-label}</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr t:type="ajaxformloop" t:id="usersLoop" source="accounts" value="account" encoder="userEncoder">
- <t:unless test="account.login">
- <td>
- <t:textfield t:id="login" value="account.login" size="15" t:validate="required"/>
- </td>
- <p:else>
- <td align="left">${account.login}</td>
- </p:else>
- </t:unless>
- <td>
- <t:textfield t:id="firstName" value="account.firstName" size="15"/>
- </td>
- <td>
- <t:textfield t:id="lastName" value="account.lastName" size="15"/>
- </td>
- <td>
- <t:textfield t:id="email" value="account.email" size="20" t:validate="required, regexp"/>
- </td>
- <td>
- <t:checkbox t:id="administrator" value="account.administrator" disabled="myAccount"/>
- </td>
- <td>
- <t:unless test="myAccount">
- <t:removerowlink>
- <img src="${asset:context:img/delete.png}" alt="${message:delete}"/>
- </t:removerowlink>
- </t:unless>
- </td>
- <t:parameter name="addRow">
- <td colspan="6" style="text-align: center">
- <t:addrowlink>${message:addUser}</t:addrowlink>
- </td>
- </t:parameter>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div class="center">
- <input type="submit" value="${message:save}" style="text-align:center"/>
- </div>
-
- </t:form>
-
- </t:if>
- <p:else>
- <h4>${message:noUser}</h4>
- <t:LoginComponent />
- </p:else>
- </t:if>
-</t:border>
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/css/common.css
===================================================================
--- trunk/pollen-ui/src/main/webapp/css/common.css 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pollen-ui/src/main/webapp/css/common.css 2010-04-23 17:09:22 UTC (rev 2973)
@@ -62,3 +62,16 @@
text-align: center;
}
+input.ico {
+ border: 0 none;
+ font-size: 0;
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ vertical-align: top;
+}
+
+input.save {
+ background: url(../img/save.png) no-repeat center center;
+}
+
Added: trunk/pollen-ui/src/main/webapp/img/save.png
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/save.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui/src/main/webapp/img/undo.png
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui/src/main/webapp/img/undo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-20 14:05:44 UTC (rev 2972)
+++ trunk/pom.xml 2010-04-23 17:09:22 UTC (rev 2973)
@@ -309,11 +309,11 @@
<!-- customized versions -->
<!--javadoc.version>2.4</javadoc.version-->
- <topia.version>2.3.3-SNAPSHOT</topia.version>
- <eugene.version>2.0.1-SNAPSHOT</eugene.version>
+ <topia.version>2.4-SNAPSHOT</topia.version>
+ <eugene.version>2.0.1</eugene.version>
<i18n.version>1.2.1</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
- <nuiton-utils.version>1.2.2-SNAPSHOT</nuiton-utils.version>
+ <nuiton-utils.version>1.2.2</nuiton-utils.version>
<processor.version>1.0.2</processor.version>
<!--Multilanguage maven-site -->
1
0
Author: tchemit
Date: 2010-04-20 16:05:44 +0200 (Tue, 20 Apr 2010)
New Revision: 2972
Log:
Utilisation de mavenpom4redmine 2.1.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-11 22:04:47 UTC (rev 2971)
+++ trunk/pom.xml 2010-04-20 14:05:44 UTC (rev 2972)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.0.7</version>
+ <version>2.1.2</version>
</parent>
<groupId>org.chorem</groupId>
1
0
Author: fdesbois
Date: 2010-04-12 00:04:47 +0200 (Mon, 12 Apr 2010)
New Revision: 2971
Log:
Improve some rules for sonar + change db mode to create for tests
Added:
trunk/pollen-business/src/test/resources/PollenTest.properties
Removed:
trunk/pollen-business/src/test/resources/pollen.properties
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java
trunk/pollen-business/src/main/java/org/chorem/pollen/mail/MailUtil.java
trunk/pollen-business/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java
trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/ContextLink.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FileLink.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/HeadLink.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/GenericSelectModel.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceImageImpl.java
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -21,14 +21,14 @@
protected Object[] args;
- public PollenBusinessException(PollenExceptionType type) {
+ public PollenBusinessException(PollenExceptionType type, Object... args) {
super(type.getMessage());
+ this.args = args;
this.type = type;
}
- public PollenBusinessException(PollenExceptionType type, Object... args) {
- super(type.getMessage());
- this.args = args;
+ public PollenBusinessException(Throwable exception, PollenExceptionType type, Object... args) {
+ super(type.getMessage(), exception);
this.type = type;
}
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -5,13 +5,8 @@
import java.util.Date;
import java.util.Properties;
import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-//import org.chorem.pollen.PollenDAOHelper;
-//import org.chorem.pollen.business.services.SendMail;
-//import org.chorem.pollen.business.services.ServiceUserImpl;
import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
@@ -50,16 +45,7 @@
/** Conversion service for services **/
// private PollenConverter converter;
-
- public PollenContextImpl() {
-
- }
-
- @Override
- public void finalize() {
- stop();
- }
-
+
/**
* Default configuration file will be loaded using
* {@link org.nuiton.util.ApplicationConfig }.
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -47,9 +47,9 @@
/** Charset of Pollen **/
CHARSET("pollen.charset");
- String key;
+ private String key;
- static PollenContext context;
+ private static PollenContext context;
PollenProperty(String key) {
this.key = key;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/mail/MailUtil.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/mail/MailUtil.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/mail/MailUtil.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-package org.chorem.pollen.business.utils;
+package org.chorem.pollen.mail;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/mail/PreventRuleManager.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -22,7 +22,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.pollen.business.utils.MailUtil;
import org.chorem.pollen.entity.PreventRule;
/**
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-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -29,7 +29,6 @@
import java.util.Map;
import org.apache.commons.io.FileUtils;
-import org.chorem.pollen.business.utils.MailUtil;
import org.nuiton.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -82,7 +82,7 @@
if (log.isErrorEnabled()) {
log.error("Error on email send", eee);
}
- throw new PollenBusinessException(
+ throw new PollenBusinessException(eee,
PollenExceptionType.SMTP_NOT_AVAILABLE,
pollenEmail.getTo());
}
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -43,7 +43,7 @@
log.info("## START ## : " + dbname);
InputStream input = TestManager.class.
- getResourceAsStream("/pollen.properties");
+ getResourceAsStream("/PollenTest.properties");
Properties options = new Properties();
options.load(input);
Copied: trunk/pollen-business/src/test/resources/PollenTest.properties (from rev 2966, trunk/pollen-business/src/test/resources/pollen.properties)
===================================================================
--- trunk/pollen-business/src/test/resources/PollenTest.properties (rev 0)
+++ trunk/pollen-business/src/test/resources/PollenTest.properties 2010-04-11 22:04:47 UTC (rev 2971)
@@ -0,0 +1,12 @@
+hibernate.hbm2ddl.auto=create
+hibernate.show_sql=false
+hibernate.dialect=org.hibernate.dialect.H2Dialect
+hibernate.connection.username=sa
+hibernate.connection.password=
+hibernate.connection.driver_class=org.h2.Driver
+hibernate.connection.url=jdbc:h2:file:target/test-base/pollen
+
+adminLogin=admin
+adminPassword=admin
+
+pollen.emails.directory=target/test-emails
\ No newline at end of file
Property changes on: trunk/pollen-business/src/test/resources/PollenTest.properties
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mergeinfo
+
Deleted: trunk/pollen-business/src/test/resources/pollen.properties
===================================================================
--- trunk/pollen-business/src/test/resources/pollen.properties 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-business/src/test/resources/pollen.properties 2010-04-11 22:04:47 UTC (rev 2971)
@@ -1,17 +0,0 @@
-# Configuration de la base de donn\u00C3\u00A9es
-hibernate.hbm2ddl.auto=update
-hibernate.show_sql=false
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.connection.username=sa
-hibernate.connection.password=
-hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:target/test-base/pollen
-
-# Initialisation de la base de donn\u00C3\u00A9es
-choiceType=DATE,IMAGE,TEXT
-pollType=RESTRICTED,FREE,GROUP
-voteCounting=NORMAL,PERCENTAGE,CONDORCET
-adminLogin=admin
-adminPassword=admin
-
-pollen.emails.directory=target/test-emails
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/ContextLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/ContextLink.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/ContextLink.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -23,7 +23,7 @@
*
* @return a String contextPath
*/
- public String getContextPath() ;
+ String getContextPath() ;
/**
* Get a file from context with name defined by filename.
@@ -31,5 +31,5 @@
* @param filename name of the file to get
* @return a File with absolutePath corresponding to contextPath + filename
*/
- public File getFile(String filename) ;
+ File getFile(String filename) ;
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Chart.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -76,30 +76,30 @@
/** titre du diagramme */
@Parameter
- private String _title = "";
+ private String title = "";
/** type de représentation du diagramme */
@Parameter(required = true)
- private int _type;
+ private int type;
@Parameter(required = true)
- private int _width;
+ private int width;
@Parameter(required = true)
- private int _height;
+ private int height;
/**
* list(array) of paired values(label,value):
* [String,Number,String,Number,...]
*/
@Parameter(required = true)
- private List<Object> _values;
+ private List<Object> values;
@Parameter(required = false)
- private List<Object> _subtitles;
+ private List<Object> subtitles;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
@Inject
private TypeCoercer typeCoercer;
@@ -107,23 +107,23 @@
void beginRender(MarkupWriter writer) {
// event link params
- Object[] params = new Object[] { _title, _type, _width, _height };
+ Object[] params = new Object[] { title, type, width, height };
- if (_subtitles != null) {
- Object[] size = new Object[] { _subtitles.size() };
+ if (subtitles != null) {
+ Object[] size = new Object[] { subtitles.size() };
params = ArrayUtil.concat(params, size);
- params = ArrayUtil.concat(params, _subtitles.toArray());
+ params = ArrayUtil.concat(params, subtitles.toArray());
} else {
Object[] size = new Object[] { 0 };
params = ArrayUtil.concat(params, size);
}
- params = ArrayUtil.concat(params, _values.toArray());
+ params = ArrayUtil.concat(params, values.toArray());
// generate event link
- Link link = _resources.createEventLink("chart", params);
+ Link link = resources.createEventLink("chart", params);
Element img = writer.element("img", "src", link);
- _resources.renderInformalParameters(writer);
+ resources.renderInformalParameters(writer);
}
void afterRender(MarkupWriter writer) {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FileLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FileLink.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FileLink.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -55,27 +55,27 @@
/** Chemin du fichier */
@Parameter(required = true)
- private String _filename;
+ private String filename;
/** Type MIME du fichier */
@Parameter
- private String _type;
+ private String type;
@Inject
private Logger logger;
@Inject
- private ComponentResources _resources;
+ private ComponentResources resources;
/**
* Context to get the file
*/
@Parameter(required=true)
- private ContextLink _context;
+ private ContextLink context;
@Log
void beginRender(MarkupWriter writer) {
- Link link = _resources.createEventLink("createLink", _filename, _type);
+ Link link = resources.createEventLink("createLink", filename, type);
writeLink(writer, link);
}
@@ -92,7 +92,7 @@
}
//File file = new File(/*_context.getContextPath() + */filename/* + _context.getExtension()*/);
- File file = _context.getFile(filename);
+ File file = context.getFile(filename);
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
@@ -100,7 +100,7 @@
logger.error("Fichier inexistant : " + file.getAbsolutePath(), e);
}
- if (!_resources.isBound("type")) {
+ if (!resources.isBound("type")) {
MimetypesFileTypeMap mimes = new MimetypesFileTypeMap();
type = mimes.getContentType(file);
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/HeadLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/HeadLink.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/HeadLink.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -49,19 +49,19 @@
/** Chemin du fichier */
@Parameter(required = true)
- private ContextLink _context;
+ private ContextLink context;
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
- private String _href;
+ private String href;
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
- private String _rel;
+ private String rel;
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
- private String _type;
+ private String type;
@Parameter
- private String _title;
+ private String title;
@Inject
private Logger logger;
@@ -70,9 +70,9 @@
private ComponentResources _resources;
void beginRender(MarkupWriter writer) {
- Link link = _resources.createEventLink("fileLink", _href, _type);
- writer.element("link", "href", link, "rel", _rel, "type", _type,
- "title", _title);
+ Link link = _resources.createEventLink("fileLink", href, type);
+ writer.element("link", "href", link, "rel", rel, "type", type,
+ "title", title);
_resources.renderInformalParameters(writer);
}
@@ -95,7 +95,7 @@
return null;
}
- File file = _context.getFile(href);
+ File file = context.getFile(href);
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -86,14 +86,6 @@
case IMAGE:
setImageFileName(choice.getName());
}
-// setDescription(dto.getDescription());
-// setHidden(dto.getHidden());
-// setTopiaId(dto.getTopiaId());
-// setValidate(dto.getValidate());
-//// setPollUId(dto.getPollUId());
-// setName(dto.getName());
-// //setValue(dto.getValue());
-// //setVoteId(dto.getVoteId());
}
/**
@@ -231,24 +223,6 @@
name = String.valueOf(getDate().getTime());
break;
case IMAGE:
-// // Get directory to save the image using the context from
-// // pollen properties.
-// File dir = new File(PollenProperty.IMG_DIR.getValue(), imageDir);
-// if (!dir.exists()) {
-// dir.mkdirs();
-// }
-// // Save the image file
-// File file = new File(dir, getImageFileName());
-// image.write(file);
-// if (log.isDebugEnabled()) {
-// log.debug("Image saved: " + getImageFileName() +
-// " (size=" + image.getSize() + ")");
-// }
-// // Create image thumbnail
-// ImageUtil.createThumbnail(dir, file, 100);
-// if (log.isDebugEnabled()) {
-// log.debug("save name for image : " + file.getName());
-// }
name = serviceImage.saveImage(getImage(), getImageDir());
break;
case TEXT:
@@ -261,22 +235,22 @@
choice.setName(name);
}
- public void setDescription(String description) {
- choice.setDescription(description);
- }
-
- public void setChoiceType(ChoiceType choiceType) {
- choice.setChoiceType(choiceType);
- }
-
public String getName() {
return choice.getName();
}
+ public void setDescription(String description) {
+ choice.setDescription(description);
+ }
+
public String getDescription() {
return choice.getDescription();
}
+ public void setChoiceType(ChoiceType choiceType) {
+ choice.setChoiceType(choiceType);
+ }
+
public ChoiceType getChoiceType() {
return choice.getChoiceType();
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/GenericSelectModel.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/GenericSelectModel.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/GenericSelectModel.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -42,6 +42,7 @@
* in your page to ge the {@link PropertyAccess} service.<br>
* !Notice: you must set the created instance both as model and encoder
* parameter for the {@link Select} component.
+ * @param <T>
*/
public class GenericSelectModel<T> extends AbstractSelectModel implements
ValueEncoder<T> {
@@ -53,18 +54,22 @@
public GenericSelectModel(List<T> list, Class<T> clazz, String labelField,
String idField, PropertyAccess access) {
this.list = list;
- if (idField != null)
- this.idFieldAdapter = access.getAdapter(clazz).getPropertyAdapter(
- idField);
- if (labelField != null)
- this.labelFieldAdapter = access.getAdapter(clazz)
- .getPropertyAdapter(labelField);
+ if (idField != null) {
+ this.idFieldAdapter =
+ access.getAdapter(clazz).getPropertyAdapter(idField);
+ }
+ if (labelField != null) {
+ this.labelFieldAdapter =
+ access.getAdapter(clazz).getPropertyAdapter(labelField);
+ }
}
+ @Override
public List<OptionGroupModel> getOptionGroups() {
return null;
}
+ @Override
public List<OptionModel> getOptions() {
List<OptionModel> optionModelList = new ArrayList<OptionModel>();
if (labelFieldAdapter == null) {
@@ -86,6 +91,7 @@
// ValueEncoder methods
+ @Override
public String toClient(T obj) {
if (idFieldAdapter == null) {
return obj + "";
@@ -94,25 +100,30 @@
}
}
+ @Override
public T toValue(String string) {
if (idFieldAdapter == null) {
for (T obj : list) {
- if (nvl(obj).equals(string))
+ if (nvl(obj).equals(string)) {
return obj;
+ }
}
} else {
for (T obj : list) {
- if (nvl(idFieldAdapter.get(obj)).equals(string))
+ if (nvl(idFieldAdapter.get(obj)).equals(string)) {
return obj;
+ }
}
}
return null;
}
private String nvl(Object o) {
- if (o == null)
+ if (o == null) {
return "";
- else
+ }
+ else {
return o.toString();
+ }
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceImageImpl.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceImageImpl.java 2010-04-09 23:38:58 UTC (rev 2970)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceImageImpl.java 2010-04-11 22:04:47 UTC (rev 2971)
@@ -39,7 +39,8 @@
private static final int THUMB_WIDTH = 100;
- private static final Logger logger = LoggerFactory.getLogger(ServiceImageImpl.class);
+ private static final Logger logger =
+ LoggerFactory.getLogger(ServiceImageImpl.class);
private PollenContext context;
@@ -76,7 +77,8 @@
}
@Override
- public StreamResponse createImageStream(String filename, String filedir, boolean thumb) {
+ public StreamResponse createImageStream(String filename, String filedir,
+ boolean thumb) {
// security : src containing .. are filtered, to not access to full system
if (StringUtils.isEmpty(filename) || filename.contains("..")) {
return null;
1
0
r2970 - in trunk/pollen-business/src/main/java/org/chorem/pollen: . service
by fdesbois@users.chorem.org 09 Apr '10
by fdesbois@users.chorem.org 09 Apr '10
09 Apr '10
Author: fdesbois
Date: 2010-04-10 01:38:58 +0200 (Sat, 10 Apr 2010)
New Revision: 2970
Log:
improve javadoc
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-09 23:28:55 UTC (rev 2969)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-09 23:38:58 UTC (rev 2970)
@@ -33,12 +33,17 @@
}
public enum PollenExceptionType {
- //LOAD_CONFIGURATION(n_("pollen.exception.load_configuration")),
+ /** Exception when poll is not found in data **/
POLL_NOT_EXIST(n_("pollen.exception.poll_not_exist")),
+ /** Exception when user login exists in data **/
USER_LOGIN_EXIST(n_("pollen.exception.user_login_exist")),
+ /** Exception when user email exists in data **/
USER_EMAIL_EXIST(n_("pollen.exception.user_email_exist")),
+ /** Exception when user is not found in data **/
USER_NOT_EXIST(n_("pollen.exception.user_not_exist")),
+ /** Exception when password is not valid for some user **/
USER_WRONG_PASSWORD(n_("pollen.exception.user_wrong_password")),
+ /** Exception when stmp server is not available **/
SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available"));
private String message;
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-04-09 23:28:55 UTC (rev 2969)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-09 23:38:58 UTC (rev 2970)
@@ -86,7 +86,7 @@
* @param login to check
* @param password to check
* @throws TopiaException for ToPIA errors
- * @throws PollenBusinessException USER_WRONG_PASSWORD
+ * @throws PollenBusinessException {@link PollenExceptionType#USER_WRONG_PASSWORD}
*/
protected void checkPassword(UserAccountDAO dao, String login,
String password) throws TopiaException, PollenBusinessException {
@@ -107,7 +107,7 @@
* @param dao used to execute the query
* @param login to check
* @throws TopiaException for ToPIA errors
- * @throws PollenBusinessException USER_LOGIN_EXIST
+ * @throws PollenBusinessException {@link PollenExceptionType#USER_LOGIN_EXIST}
*/
protected void checkLoginNotExist(UserAccountDAO dao, String login)
throws PollenBusinessException, TopiaException {
@@ -129,7 +129,7 @@
* @param query existing query to execute. A new one will be created if this
* param is null.
* @throws TopiaException for ToPIA errors
- * @throws PollenBusinessException USER_EMAIL_EXIST
+ * @throws PollenBusinessException {@link PollenExceptionType#USER_EMAIL_EXIST}
*/
protected void checkEmailNotExist(UserAccountDAO dao, String email,
TopiaQuery query) throws PollenBusinessException, TopiaException {
1
0
Author: fdesbois
Date: 2010-04-10 01:28:55 +0200 (Sat, 10 Apr 2010)
New Revision: 2969
Log:
- Remove PropertiesFileSymbolProvider, PollenManager provide this service
- PollenContext is no longer a service to Inject, PollenManager contains the context and can be injected
- Change EmailException to PollenBusinessException to show correct message on smtp error
- Implements updateUser for UserProfile page + add method for validations
- Improve tests and password managment (no more encoding in UI, add newPassword getter/setter in UserAccount)
Added:
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_fr.properties
trunk/pollen-ui/src/main/webapp/user/UserProfile.tml
Removed:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PropertiesFileSymbolProvider.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/BusinessUtils.java
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_en.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_fr.properties
trunk/pollen-ui/src/main/webapp/user/Account.tml
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java
trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
trunk/pollen-business/src/main/xmi/pollen.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
trunk/pollen-business/src/test/resources/log4j.properties
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedContextLink.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
trunk/pollen-ui/src/main/resources/log4j.properties
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml
trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserRegister_fr.properties
trunk/pollen-ui/src/main/webapp/css/common.css
trunk/pollen-ui/src/main/webapp/user/UserRegister.tml
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -38,7 +38,8 @@
USER_LOGIN_EXIST(n_("pollen.exception.user_login_exist")),
USER_EMAIL_EXIST(n_("pollen.exception.user_email_exist")),
USER_NOT_EXIST(n_("pollen.exception.user_not_exist")),
- USER_WRONG_PASSWORD(n_("pollen.exception.user_wrong_password"));
+ USER_WRONG_PASSWORD(n_("pollen.exception.user_wrong_password")),
+ SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available"));
private String message;
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -120,7 +120,7 @@
try {
if (log.isInfoEnabled()) {
log.info("Start Pollen");
- log.info("Initialize i18n bundle");
+// log.info("Initialize i18n bundle");
}
I18n.setInitializer(new DefaultI18nInitializer("pollen-business"));
I18n.init();
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/UserAccountImpl.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -18,7 +18,30 @@
private static final long serialVersionUID = 1L;
+ protected String newPassword;
+
+ /**
+ * Get the value of newPassword
+ *
+ * @return the value of newPassword
+ */
@Override
+ public String getNewPassword() {
+ return newPassword;
+ }
+
+ /**
+ * Set the value of newPassword
+ *
+ * @param newPassword new value of newPassword
+ */
+ @Override
+ public void setNewPassword(String newPassword) {
+ this.newPassword = newPassword;
+ }
+
+
+ @Override
public void addFavoriteList(PollAccount list) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -26,11 +49,13 @@
@Override
public String getDisplayName() {
String name = "";
+ String separator = "";
if (StringUtils.isNotEmpty(getFirstName())) {
name += getFirstName();
+ separator = " ";
}
if (StringUtils.isNotEmpty(getLastName())) {
- name += getLastName();
+ name += separator + getLastName();
}
if (StringUtils.isEmpty(name)) {
name = getLogin();
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -6,6 +6,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
+import org.chorem.pollen.PollenBusinessException;
+import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.PollenEmail;
@@ -53,27 +55,36 @@
@Override
protected void executeSendEmail(List<Object> errorArgs,
- PollenEmail pollenEmail) throws EmailException {
+ PollenEmail pollenEmail) throws PollenBusinessException {
errorArgs.add(pollenEmail.getHost());
errorArgs.add(pollenEmail.getPort());
errorArgs.add(pollenEmail.getTo());
errorArgs.add(pollenEmail.getFrom());
+ try {
- // Create the SimpleEmail to send
- SimpleEmail email = pollenEmail.createSimpleEmail();
- email.send();
+ // Create the SimpleEmail to send
+ SimpleEmail email = pollenEmail.createSimpleEmail();
+ email.send();
- if (log.isInfoEnabled()) {
- log.info("Mail sent to : " + pollenEmail.getTo());
+ if (log.isInfoEnabled()) {
+ log.info("Mail sent to : " + pollenEmail.getTo());
- if (log.isDebugEnabled()) {
- log.debug("Email infos : " +
- "\ndate: " + email.getSentDate() +
- "\nhostname: " + email.getHostName() +
- "\nport: " + email.getSmtpPort() +
- "\nfrom: " + email.getFromAddress().toString());
+ if (log.isDebugEnabled()) {
+ log.debug("Email infos : " +
+ "\ndate: " + email.getSentDate() +
+ "\nhostname: " + email.getHostName() +
+ "\nport: " + email.getSmtpPort() +
+ "\nfrom: " + email.getFromAddress().toString());
+ }
}
+ } catch (EmailException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error on email send", eee);
+ }
+ throw new PollenBusinessException(
+ PollenExceptionType.SMTP_NOT_AVAILABLE,
+ pollenEmail.getTo());
}
}
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-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -4,6 +4,8 @@
import java.util.List;
import java.util.Locale;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
import org.chorem.pollen.PollenContext;
@@ -15,6 +17,8 @@
import org.chorem.pollen.entity.UserAccountImpl;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.framework.TopiaQuery.Op;
/**
* ServiceUserImpl
@@ -29,6 +33,8 @@
*/
public class ServiceUserImpl extends ServiceUserAbstract {
+ private Log log = LogFactory.getLog(ServiceUserImpl.class);
+
private PollenContext context;
public void setContext(PollenContext context) {
@@ -51,12 +57,107 @@
context.closeTransaction(transaction);
}
+ /**
+ * Used to manage the new password of the user. This newPassword will be
+ * encoded then set into the real password.
+ *
+ * @param user to treate
+ * @return true if the newPassword is encoded and set, false otherwise
+ */
+ protected boolean manageNewPassword(UserAccount user) {
+ // Manage password encoding
+ String newPassword = user.getNewPassword();
+ if (StringUtils.isNotEmpty(newPassword)) {
+ user.setPassword(context.encodePassword(newPassword));
+ if (log.isDebugEnabled()) {
+ log.debug("Reset newPassword from UserAccount");
+ }
+ user.setNewPassword(null);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check if the {@code login} and {@code password} correspond to an
+ * existing user.
+ *
+ * @param dao used to execute the query
+ * @param login to check
+ * @param password to check
+ * @throws TopiaException for ToPIA errors
+ * @throws PollenBusinessException USER_WRONG_PASSWORD
+ */
+ protected void checkPassword(UserAccountDAO dao, String login,
+ String password) throws TopiaException, PollenBusinessException {
+ int count = dao.createQuery().
+ add(UserAccount.LOGIN, login).
+ add(UserAccount.PASSWORD, password).
+ executeCount();
+ // no user found
+ if (count == 0) {
+ throw new PollenBusinessException(
+ PollenExceptionType.USER_WRONG_PASSWORD, login);
+ }
+ }
+
+ /**
+ * Check if the {@code login} doesn't already exist.
+ *
+ * @param dao used to execute the query
+ * @param login to check
+ * @throws TopiaException for ToPIA errors
+ * @throws PollenBusinessException USER_LOGIN_EXIST
+ */
+ protected void checkLoginNotExist(UserAccountDAO dao, String login)
+ throws PollenBusinessException, TopiaException {
+ int count = dao.createQuery().
+ add(UserAccount.LOGIN, login).
+ executeCount();
+ // existing user found
+ if (count > 0) {
+ throw new PollenBusinessException(
+ PollenExceptionType.USER_LOGIN_EXIST);
+ }
+ }
+
+ /**
+ * Check if the {@code email} doesn't already exist, only if not empty.
+ *
+ * @param dao used to execute the query
+ * @param email to check
+ * @param query existing query to execute. A new one will be created if this
+ * param is null.
+ * @throws TopiaException for ToPIA errors
+ * @throws PollenBusinessException USER_EMAIL_EXIST
+ */
+ protected void checkEmailNotExist(UserAccountDAO dao, String email,
+ TopiaQuery query) throws PollenBusinessException, TopiaException {
+ // Don't check if email is empty
+ if (StringUtils.isEmpty(email)) {
+ return;
+ }
+ if (query == null) {
+ query = dao.createQuery();
+ }
+ int count = query.add(UserAccount.EMAIL, email).
+ executeCount();
+ // existing user found
+ if (count > 0) {
+ throw new PollenBusinessException(
+ PollenExceptionType.USER_EMAIL_EXIST);
+ }
+ }
+
@Override
protected UserAccount executeConnect(TopiaContext transaction,
List<Object> errorArgs, String login, String password)
throws PollenBusinessException, TopiaException {
+
+ String encodedPassword = context.encodePassword(password);
+
errorArgs.add(login);
- errorArgs.add(password);
+ errorArgs.add(encodedPassword);
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
@@ -65,10 +166,8 @@
if (user == null) {
throw new PollenBusinessException(
PollenExceptionType.USER_NOT_EXIST, login);
- } else if (!user.getPassword().equals(password)) {
- throw new PollenBusinessException(
- PollenExceptionType.USER_WRONG_PASSWORD, login);
}
+ checkPassword(dao, login, encodedPassword);
return user;
}
@@ -81,7 +180,7 @@
}
@Override
- protected void executeCreateUpdateUser(TopiaContext transaction,
+ protected void executeCreateUser(TopiaContext transaction,
List<Object> errorArgs, UserAccount user)
throws TopiaException, PollenBusinessException {
@@ -90,27 +189,53 @@
errorArgs.add(user.getAdmin());
UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+
+ // Check login not exist
+ checkLoginNotExist(dao, user.getLogin());
- // New User
- if (StringUtils.isEmpty(user.getTopiaId())) {
- // Check login exist
- UserAccount userFound = dao.findByLogin(user.getLogin());
- if (userFound != null) {
- throw new PollenBusinessException(
- PollenExceptionType.USER_LOGIN_EXIST);
- }
- // Check email exist
- userFound = dao.findByEmail(user.getEmail());
- if (userFound != null) {
- throw new PollenBusinessException(
- PollenExceptionType.USER_EMAIL_EXIST);
- }
- dao.create(user);
- // Update existing user
- } else {
- dao.update(user);
+ // Check email not exist
+ checkEmailNotExist(dao, user.getEmail(), null);
+
+ // Execute create
+ manageNewPassword(user);
+ dao.create(user);
+
+ transaction.commitTransaction();
+ }
+
+
+
+ @Override
+ protected void executeUpdateUser(TopiaContext transaction,
+ List<Object> errorArgs, UserAccount user)
+ throws TopiaException, PollenBusinessException {
+
+ errorArgs.add(user.getLogin());
+ errorArgs.add(user.getEmail());
+ errorArgs.add(user.getAdmin());
+
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+
+ // Check the password
+ String encodedPassword = context.encodePassword(user.getPassword());
+ checkPassword(dao, user.getLogin(), encodedPassword);
+
+ // Change password if needed
+ boolean passwordChanged = manageNewPassword(user);
+ // Otherwise set the encodedPassword to properly save the user
+ if (!passwordChanged) {
+ user.setPassword(encodedPassword);
}
+ // In case of email change, check if an other user has not already
+ // the new email
+ TopiaQuery query = dao.createQuery().
+ add(UserAccount.LOGIN, Op.NEQ, user.getLogin());
+ checkEmailNotExist(dao, user.getEmail(), query);
+
+ // Execute update
+ dao.update(user);
+
transaction.commitTransaction();
}
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -37,6 +37,7 @@
pollen.error.serviceUser.createDefaultAdmin=
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=
+pollen.error.serviceUser.createUser=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getFavoriteLists=
@@ -45,11 +46,13 @@
pollen.error.serviceUser.getNewUser=
pollen.error.serviceUser.getPerson=
pollen.error.serviceUser.getUsers=
+pollen.error.serviceUser.updateUser=
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=Unable to load votes from poll with uid \= %1$s
pollen.error.serviceVote.hasAlreadyVoted=Unable test vote existing for account with votingId \= %1$s and poll with uid \= %2$s
pollen.exception.load_configuration=
pollen.exception.poll_not_exist=No such poll exists. Please make sure that you are using the correct link and copy it completely into your browser's address field.
+pollen.exception.smtp_not_available=
pollen.exception.user_email_exist=
pollen.exception.user_login_exist=
pollen.exception.user_not_exist=
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -36,6 +36,7 @@
pollen.error.serviceUser.createDefaultAdmin=Impossible de cr\u00E9er l'administrateur par d\u00E9faut \: %1$s (%2$s)
pollen.error.serviceUser.createUpdateList=
pollen.error.serviceUser.createUpdateUser=Impossible de cr\u00E9er l'utilisateur '%1$s' <%2$s> (admin \= %$3b)
+pollen.error.serviceUser.createUser=
pollen.error.serviceUser.deleteList=
pollen.error.serviceUser.deleteUser=
pollen.error.serviceUser.getFavoriteLists=
@@ -44,11 +45,13 @@
pollen.error.serviceUser.getNewUser=Impossible d'instancier un nouvel utilisateur.
pollen.error.serviceUser.getPerson=
pollen.error.serviceUser.getUsers=
+pollen.error.serviceUser.updateUser=
pollen.error.serviceVote.getVote=
pollen.error.serviceVote.getVotesByPoll=
pollen.error.serviceVote.hasAlreadyVoted=
pollen.exception.load_configuration=La configuration n'a pas \u00E9t\u00E9 charg\u00E9e correctement \! Veuillez v\u00E9rifier le d\u00E9marrage de l'application.
pollen.exception.poll_not_exist=Il n'y a pas de sondage \u00E0 cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le compl\u00E8tement dans le champ d'adresse de votre navigateur.
+pollen.exception.smtp_not_available=Impossible d'envoyer un email \u00E0 %1$s. Serveur smtp indisponible pour l'envoi d'email, veuillez contacter un administrateur.
pollen.exception.user_email_exist=Un utilisateur est d\u00E9j\u00E0 enregistr\u00E9 avec cet email.
pollen.exception.user_login_exist=Un utilisateur est d\u00E9j\u00E0 enregistr\u00E9 avec cet identifiant.
pollen.exception.user_not_exist=L'identifiant '%1$s' ne correspond \u00E0 aucun utilisateur connu.
Modified: trunk/pollen-business/src/main/xmi/pollen.properties
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -3,5 +3,6 @@
#model.tagvalue.dbSchema=Pollen
model.tagvalue.java.lang.String=text
model.tagvalue.exceptionClass=org.chorem.pollen.PollenException
-#org.chorem.pollen.business.persistence.PollAccount.attribute.accountId.tagvalue.naturalId=true
-#org.chorem.pollen.business.persistence.Poll.attribute.pollId.tagvalue.naturalId=true
\ No newline at end of file
+
+org.chorem.pollen.entity.UserAccount.attribute.login.tagvalue.naturalId=true
+org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true
\ No newline at end of file
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -78,19 +78,19 @@
return getContext().beginTransaction();
}
- public static ServiceUser getServiceUser() {
+ public static ServiceUserImpl getServiceUser() {
ServiceUserImpl instance = new ServiceUserImpl();
instance.setContext(getContext());
return instance;
}
- public static ServiceEmail getServiceEmail() {
+ public static ServiceEmailImpl getServiceEmail() {
ServiceEmailImpl instance = new ServiceEmailImpl();
instance.setContext(getContext());
return instance;
}
- public static ServicePoll getServicePoll() {
+ public static ServicePollImpl getServicePoll() {
ServicePollImpl instance = new ServicePollImpl();
instance.setContext(getContext());
return instance;
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -7,14 +7,19 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
+import org.chorem.pollen.PollenDAOHelper;
+import org.chorem.pollen.PollenException;
import org.chorem.pollen.business.TestManager;
import org.chorem.pollen.entity.UserAccount;
+import org.chorem.pollen.entity.UserAccountDAO;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
/**
*
@@ -44,12 +49,99 @@
TestManager.stop();
}
+ @Test
+ public void testManageNewPassword() throws Exception {
+ TestManager.start("testManageNewPassword");
+
+ ServiceUserImpl serviceUser = TestManager.getServiceUser();
+
+ UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ user.setLogin("homer");
+ user.setNewPassword("wouhou");
+
+ log.info("test 1 : Encode new password");
+ boolean result = serviceUser.manageNewPassword(user);
+ Assert.assertTrue(result);
+
+ String expected = TestManager.getContext().encodePassword("wouhou");
+ Assert.assertEquals(expected, user.getPassword());
+ Assert.assertNull(user.getNewPassword());
+
+ log.info("test 2 : Do not encode new password -> newPassword empty");
+ result = serviceUser.manageNewPassword(user);
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void testCheckPassword() throws Exception {
+ TestManager.start("testCheckPassword");
+
+ ServiceUserImpl serviceUser = TestManager.getServiceUser();
+
+ UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ user.setLogin("homer");
+ user.setNewPassword("wouhou");
+ serviceUser.createUser(user);
+
+ String encodedPassword =
+ TestManager.getContext().encodePassword("wouhou");
+
+ TopiaContext transaction = TestManager.beginTransaction();
+ try {
+ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction);
+
+ log.info("test 1 : Good password");
+ serviceUser.checkPassword(dao, "homer", encodedPassword);
+
+ log.info("test 2 : Wrong password");
+ try {
+ serviceUser.checkPassword(dao, "homer", "bad");
+ } catch (PollenBusinessException eee) {
+ log.error("Error : " + eee.getMessage());
+ Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
+ eee.getType());
+ }
+ } finally {
+ transaction.closeContext();
+ }
+ }
+
/**
* Test of executeConnect method, of class ServiceUserImpl.
*/
- //@Test
+ @Test
public void testExecuteConnect() throws Exception {
TestManager.start("testExecuteConnect");
+
+ ServiceUser serviceUser = TestManager.getServiceUser();
+
+ UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
+ user.setLogin("hsimpson");
+ user.setEmail("hsimpson(a)springfield.us");
+ user.setNewPassword("wouhou");
+ serviceUser.createUser(user);
+
+ log.info("test 1 : Connection OK");
+ UserAccount connected = serviceUser.connect("hsimpson", "wouhou");
+ Assert.assertEquals(user, connected);
+
+ log.info("test 2 : Connection problem on login -> user not exist");
+ try {
+ serviceUser.connect("homer", "wouhou");
+ } catch (PollenBusinessException eee) {
+ log.error("Error : " + eee.getMessage());
+ Assert.assertEquals(PollenExceptionType.USER_NOT_EXIST,
+ eee.getType());
+ }
+
+ log.info("test 3 : Connection problem on password -> don't match with login");
+ try {
+ serviceUser.connect("hsimpson", "coucou");
+ } catch (PollenBusinessException eee) {
+ log.error("Error : " + eee.getMessage());
+ Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
+ eee.getType());
+ }
}
/**
@@ -71,55 +163,114 @@
* Test of executeCreateUpdateUser method, of class ServiceUserImpl.
*/
@Test
- public void testExecuteCreateUpdateUser() throws Exception {
- TestManager.start("testCreateUpdateUser");
+ public void testExecuteCreateUser() throws Exception {
+ TestManager.start("testCreateUser");
ServiceUser serviceUser = TestManager.getServiceUser();
UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
user.setLogin("hsimpson");
user.setEmail("hsimpson(a)springfield.us");
+ user.setNewPassword("wouhou");
+
String encodedPassword =
TestManager.getContext().encodePassword("wouhou");
- user.setPassword(encodedPassword);
- serviceUser.createUpdateUser(user);
+ log.info("test 1 : Creation OK");
+ serviceUser.createUser(user);
Assert.assertNotNull(user.getTopiaId());
- Assert.assertNotSame("wouhou", user.getPassword());
+ Assert.assertNotSame(encodedPassword, user.getPassword());
- // User 2 with same login
+ log.info("test 2 : Creation problem on login -> user exist");
UserAccount user2 = serviceUser.getNewUser(Locale.FRENCH);
user2.setLogin("hsimpson");
// Not the same email
user2.setEmail("hsimpson(a)springfield.com");
- user2.setPassword("troubidou");
+ user2.setNewPassword("troubidou");
try {
- serviceUser.createUpdateUser(user2);
+ serviceUser.createUser(user2);
} catch (PollenBusinessException eee) {
- log.error("Error : " + eee.getMessage(), eee);
+ log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_LOGIN_EXIST,
eee.getType());
}
- // User 3 with same email as user
+ log.info("test 3 : Creation problem on email -> user exist");
UserAccount user3 = serviceUser.getNewUser(Locale.FRENCH);
user3.setLogin("homer");
user3.setEmail("hsimpson(a)springfield.us");
- user3.setPassword("troubidou");
+ user3.setNewPassword("troubidou");
try {
- serviceUser.createUpdateUser(user3);
+ serviceUser.createUser(user3);
} catch (PollenBusinessException eee) {
- log.error("Error : " + eee.getMessage(), eee);
+ log.error("Error : " + eee.getMessage());
Assert.assertEquals(PollenExceptionType.USER_EMAIL_EXIST,
eee.getType());
}
+ log.info("test 4 : Creation OK with no email");
+ UserAccount user4 = serviceUser.getNewUser(Locale.FRENCH);
+ user4.setLogin("marge");
+ user4.setNewPassword("troubidou");
+
+ serviceUser.createUser(user4);
+ Assert.assertNull(user4.getEmail());
}
/**
* Test of executeDeleteUser method, of class ServiceUserImpl.
*/
+ @Test
+ public void testExecuteUpdateUser() throws Exception {
+ TestManager.start("testUpdateUser");
+ ServiceUser serviceUser = TestManager.getServiceUser();
+
+ UserAccount user1 = serviceUser.getNewUser(Locale.FRENCH);
+ user1.setLogin("hsimpson");
+ user1.setEmail("hsimpson(a)springfield.us");
+ user1.setNewPassword("wouhou");
+ serviceUser.createUser(user1);
+
+ UserAccount user2 = serviceUser.getNewUser(Locale.FRENCH);
+ String user2Password = "wouhou";
+ user2.setLogin("homer");
+ user2.setEmail("hsimpson(a)springfield.fr");
+ user2.setNewPassword(user2Password);
+ serviceUser.createUser(user2);
+
+ log.info("test 1 : Can't change login -> don't match with password");
+ user2.setLogin("homersimpson");
+ user2.setPassword(user2Password);
+ try {
+ serviceUser.updateUser(user2);
+ } catch (PollenBusinessException eee) {
+ log.error("Error : " + eee.getMessage());
+ Assert.assertEquals(PollenExceptionType.USER_WRONG_PASSWORD,
+ eee.getType());
+ }
+ user2.setLogin("homer");
+
+ log.info("test 2 : Change email OK");
+ user2.setEmail("homersimpson(a)springield.fr");
+ user2.setPassword(user2Password);
+ serviceUser.updateUser(user2);
+
+ log.info("test 3 : Change email problem -> user exist");
+ user2.setEmail(user1.getEmail());
+ user2.setPassword(user2Password);
+ try {
+ serviceUser.updateUser(user2);
+ } catch (PollenBusinessException eee) {
+ log.error("Error : " + eee.getMessage());
+ Assert.assertEquals(PollenExceptionType.USER_EMAIL_EXIST,
+ eee.getType());
+ }
+ }
+
+ /**
+ * Test of executeDeleteUser method, of class ServiceUserImpl.
+ */
//@Test
public void testExecuteDeleteUser() throws Exception {
System.out.println("executeDeleteUser");
Modified: trunk/pollen-business/src/test/resources/log4j.properties
===================================================================
--- trunk/pollen-business/src/test/resources/log4j.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-business/src/test/resources/log4j.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -8,7 +8,7 @@
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%p] %c{2} %m%n
-log4j.logger.org.chorem.pollen=debug
+log4j.logger.org.chorem.pollen=info
log4j.logger.org.chorem.pollen.business.PollenContextImpl=warn
log4j.logger.org.chorem.pollen.business.services.SendMail=warn
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -33,7 +33,6 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.PersistentLocale;
import org.apache.tapestry5.services.Request;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.ui.base.ContextLink;
@@ -42,7 +41,7 @@
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.pages.Index;
-import org.chorem.pollen.ui.utils.BusinessUtils;
+import org.chorem.pollen.ui.services.PollenManager;
import org.slf4j.Logger;
/**
@@ -150,7 +149,7 @@
private PersistentLocale localeService;
@Inject
- private PollenContext pollen;
+ private PollenManager manager;
/** Injection des services */
@Inject
@@ -245,14 +244,14 @@
// No need to connect if user exists
if (!userExists) {
try {
- String encodedPassword = pollen.encodePassword(password);
- UserAccount current =
- serviceUser.connect(login, encodedPassword);
+ UserAccount current = serviceUser.connect(login, password);
user = current;
+ // Change locale for user
+ localeService.set(new Locale(user.getLanguage()));
feedback.addInfo(messages.get("loginOk"));
} catch (PollenBusinessException eee) {
feedback.addError(
- BusinessUtils.getErrorMessage(eee, messages, logger));
+ manager.getErrorMessage(eee, messages, logger));
}
}
return this;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedContextLink.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedContextLink.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/FeedContextLink.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -3,9 +3,9 @@
import java.io.File;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.ui.base.ContextLink;
import org.chorem.pollen.PollenProperty;
+import org.chorem.pollen.ui.services.PollenManager;
/**
* FeedLink
@@ -21,11 +21,11 @@
public class FeedContextLink implements ContextLink {
@Inject
- private PollenContext pollen;
+ private PollenManager manager;
@Override
public String getContextPath() {
- return pollen.getProperty(PollenProperty.FEED_DIR);
+ return manager.getProperty(PollenProperty.FEED_DIR);
}
@Override
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -55,13 +55,13 @@
* Champ login du formulaire d'identification
*/
@Property
- private String loginComp;
+ private String connectionLogin;
/**
* Champ password du formulaire d'identification
*/
@Property
- private String passwordComp;
+ private String connectionPassword;
@Inject
private Messages messages;
@@ -82,14 +82,13 @@
// Récupération de l'utilisateur identifié
UserAccount current;
try {
- current = serviceUser.connect(loginComp,
- manager.encodePassword(passwordComp));
+ current = serviceUser.connect(connectionLogin, connectionPassword);
if (current != null) {
user = current;
} else {
feedback.addError(messages.get("loginFailed"));
}
- } catch (PollenBusinessException ex) {
+ } catch (PollenBusinessException eee) {
// TODO
feedback.addError(messages.get("loginFailed"));
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -16,9 +16,9 @@
package org.chorem.pollen.ui.pages;
-import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
-import org.chorem.pollen.ui.data.AddressBarItem;
/**
* Page de départ de l'application.
@@ -30,7 +30,18 @@
*/
public class Index {
+ @InjectComponent
+ private Border border;
+
public AddressBar getAddressBar() {
return AddressBar.newEmptyBar().appendCurrent("Pollen");
}
+
+ public void addInfo(String message) {
+ border.addInfo(message);
+ }
+
+ public void addError(String message) {
+ border.addError(message);
+ }
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -31,13 +31,13 @@
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.mail.PreventRuleManager;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.components.FeedBack;
import org.chorem.pollen.ui.data.AddressBarItem;
+import org.chorem.pollen.ui.services.PollenManager;
/**
* Classe d'administration des comptes utilisateurs. Si l'utilisateur n'est pas
@@ -204,14 +204,14 @@
}
@Inject
- private PollenContext pollen;
+ private PollenManager manager;
/** Envoi du mail de notification */
private void sendMailNotification(UserAccount newUser, String password) {
Map<String, String> data = new HashMap<String, String>();
- data.put("host", pollen.getProperty(PollenProperty.EMAIL_HOST));
- data.put("port", pollen.getProperty(PollenProperty.EMAIL_PORT));
- data.put("from", pollen.getProperty(PollenProperty.EMAIL_FROM));
+ data.put("host", manager.getProperty(PollenProperty.EMAIL_HOST));
+ data.put("port", manager.getProperty(PollenProperty.EMAIL_PORT));
+ data.put("from", manager.getProperty(PollenProperty.EMAIL_FROM));
data.put("to", newUser.getEmail());
data.put("title", messages.format("registerEmail_subject", newUser
.getLogin()));
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -42,7 +42,6 @@
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Comment;
@@ -60,6 +59,7 @@
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.data.ChoiceField;
import org.chorem.pollen.ui.data.PollUri;
+import org.chorem.pollen.ui.services.PollenManager;
import org.chorem.pollen.ui.services.ServiceImage;
import org.slf4j.Logger;
@@ -932,7 +932,7 @@
private Messages messages;
@Inject
- private PollenContext pollen;
+ private PollenManager manager;
@Property
private PollUri uri;
@@ -1171,7 +1171,7 @@
public int getPagerRange() {
return Integer.parseInt(
- pollen.getProperty(PollenProperty.NB_VOTES_PER_PAGE));
+ manager.getProperty(PollenProperty.NB_VOTES_PER_PAGE));
}
public String getNoPagerText() throws PollenBusinessException {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -16,9 +16,14 @@
package org.chorem.pollen.ui.pages.user;
+import java.util.Locale;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.IncludeStylesheet;
+import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
@@ -26,12 +31,15 @@
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.PasswordField;
import org.apache.tapestry5.corelib.components.TextField;
-import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
+import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceUser;
-import org.chorem.pollen.ui.data.AddressBarItem;
+import org.chorem.pollen.ui.components.Border;
+import org.chorem.pollen.ui.data.AddressBar;
+import org.chorem.pollen.ui.services.PollenManager;
+import org.slf4j.Logger;
/**
* Classe de la page d'un utilisateur.
@@ -43,6 +51,15 @@
@IncludeStylesheet("context:css/account.css")
public class UserProfile {
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private PollenManager manager;
+
+ @InjectComponent
+ private Border border;
+
/**
* Objet de session représentant l'utilisateur identifié.
*/
@@ -52,137 +69,121 @@
@Property
private boolean userExists;
- /**
- * Utilisateur dont les données sont affichées et modifiées dans le
- * formulaire
- */
+ @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
@Property
- @Persist
- private UserAccount newUser;
+ private String title;
- /** Ancien mot de passe */
- @Persist
- private String oldEmail;
+ @Inject
+ private ServiceUser serviceUser;
- @Component
- private Zone myAccountZone;
+ @Inject
+ private Messages messages;
- @Component
- private Form myAccountForm;
+ public AddressBar getAddressBar() {
+ return AddressBar.newBar().appendCurrent(title);
+ }
- @Component(id = "password")
- private PasswordField passwordField;
+ /***************************** DISPLAY MODE *******************************/
- @Component(id = "newPassword1")
- private PasswordField newPasswordField;
-
- @Component(id = "email")
- private TextField emailField;
-
/**
- * Champ password du formulaire d'enregsitrement d'un utilisateur
+ * State of the form. is currently edited or not.
*/
+ @Persist(PersistenceConstants.FLASH)
@Property
- private String password;
+ private boolean edited;
+
+ void onActionFromEditAccount() {
+ edited = true;
+ // Don't refresh the form zone to reset border messages
+ }
+ /***************************** EDIT MODE **********************************/
+
/**
- * Champ password1 du formulaire d'enregsitrement d'un utilisateur
+ * UserAccount for form edition
*/
- @Property
- private String newPassword1;
- /**
- * Champ password2 du formulaire d'enregsitrement d'un utilisateur
- */
- @Property
- private String newPassword2;
+ private UserAccount userEditable;
@Inject
- private Messages messages;
+ private Locale currentLocale;
- @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title")
- @Property
- private String title;
+ @InjectComponent
+ private Form accountForm;
- @SuppressWarnings("unused")
- @Property
- private AddressBarItem[] address;
+ @Component(id = "password")
+ private PasswordField passwordField;
- /**
- * Vrai lorsque l'utilisateur modifie son compte.
- */
- @SuppressWarnings("unused")
- @Property
- private boolean modify = false;
+ @Component(id = "newPassword1")
+ private PasswordField newPasswordField;
- /** Injection des services */
- @Inject
- private ServiceUser serviceUser;
-// @Inject
-// private ServiceAuth serviceAuth;
+ @Component(id = "email")
+ private TextField emailField;
/**
- * Méthode appelée quand l'utilisateur modifie ses données
- *
- * @return la zone de compte mise à jour
+ * Property to check password (newPassword must be equals to passwordVerify)
*/
- Object onSuccessFromMyAccountForm() {
- modify = true;
-//
-// // L'utilisateur a renseigné le mauvais mot de passe
-// if (!serviceAuth.isLoginRight(newUser.getLogin(), MD5.encode(password))) {
-// myAccountForm.recordError(passwordField, messages
-// .get("badPassword"));
-// }
-//
-// // L'utilisateur ne s'est pas trompé en répétant son mot de passe
-// if (newPassword1 != null && !newPassword1.equals("")) {
-// if (!newPassword1.equals(newPassword2)) {
-// myAccountForm.recordError(newPasswordField, messages
-// .get("passwords-dont-match"));
-// }
-// }
-//
-// // L'email existe déjà
-// if (!oldEmail.equals(newUser.getEmail())) {
-// if (serviceUser.isUserEmailExisting(newUser.getEmail())) {
-// myAccountForm.recordError(emailField, messages
-// .get("emailAlreadyExists"));
-// }
-// }
-//
-// // Modification de l'utilisateur
-// if (!myAccountForm.getHasErrors()) {
-// if (serviceUser.updateUser(newUser)) {
-// if (newPassword1 != null && !newPassword1.equals("")) {
-// serviceUser.updatePasswordUser(newUser, MD5
-// .encode(newPassword1));
-// }
-// modify = false;
-// }
-// }
+ @Property
+ private String passwordVerify;
- return myAccountZone.getBody();
+ public UserAccount getUserEditable() {
+ if (userEditable == null) {
+ userEditable = user;
+ }
+ return userEditable;
}
/**
- * Méthode appelée quand l'utilisateur veut modifier son compte
- *
- * @return le formulaire de modification du compte
+ * ON_VALIDATE_FORM :: <br \>
+ * UI validation : check if the two passwords are equals. <br \>
+ * BUSINESS validation : execute {@link org.chorem.pollen.service.ServiceUser#updateUser(org.chorem.pollen.entity.UserAccount) }
+ * which throws errors
+ * {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD}
+ * and {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
*/
- Object onActionFromModifyButton() {
- modify = true;
- return myAccountZone.getBody();
+ @Log
+ void onValidateFormFromAccountForm() {
+ // Check newPassword that must be equals to passwordVerify
+ String newPassword = userEditable.getNewPassword();
+ if (StringUtils.isNotEmpty(newPassword) &&
+ !newPassword.equals(passwordVerify)) {
+ accountForm.recordError(newPasswordField,
+ messages.get("pollen.ui.user.passwordsDontMatch"));
+ }
+ // If no UI errors, call business to save the user
+ if (!accountForm.getHasErrors()) {
+ try {
+ // Update the user
+ if (logger.isDebugEnabled()) {
+ logger.debug("TopiaId : " + user.getTopiaId());
+ logger.debug("Login : " + user.getLogin());
+ logger.debug("Password : " + user.getPassword());
+ logger.debug("NewPassword : " + user.getNewPassword());
+ }
+ serviceUser.updateUser(userEditable);
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ switch (eee.getType()) {
+ case USER_WRONG_PASSWORD:
+ accountForm.recordError(passwordField, message); break;
+ case USER_EMAIL_EXIST:
+ accountForm.recordError(emailField, message);
+ }
+ }
+ }
}
- /**
- * Initialisation de l'affichage
- */
- void setupRender() {
- address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"),
- new AddressBarItem(title, null) };
- if (userExists) {
- newUser = user;
- oldEmail = user.getEmail();
- }
+ @Log
+ Object onSuccessFromAccountForm() {
+ border.addInfo(messages.get("pollen.ui.user.updateSuccess"));
+ return this;
}
+
+ @Log
+ Object onFailureFromAccountForm() {
+ // Stay in edited mode to show errors
+ edited = true;
+ // Reset new password
+ userEditable.setNewPassword(null);
+ return accountForm;
+ }
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -18,10 +18,12 @@
import java.util.Locale;
+import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
@@ -31,14 +33,14 @@
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceEmail;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.components.Border;
import org.chorem.pollen.ui.data.AddressBar;
import org.chorem.pollen.ui.pages.Index;
-import org.chorem.pollen.ui.utils.BusinessUtils;
+import org.chorem.pollen.ui.services.PollenManager;
import org.slf4j.Logger;
/**
@@ -55,8 +57,11 @@
@Inject
private Logger logger;
+ @InjectComponent
+ private Border border;
+
/**
- * Objet de session représentant l'utilisateur identifié.
+ * Identified user
*/
@SessionState
private UserAccount user;
@@ -64,16 +69,14 @@
@Property
private boolean userExists;
- /** Injection des services */
@Inject
private ServiceUser serviceUser;
- /** Injection des services */
@Inject
private ServiceEmail serviceEmail;
@Inject
- private PollenContext pollen;
+ private PollenManager manager;
@Inject
private Messages messages;
@@ -83,17 +86,17 @@
private String title;
/**
- * Objet de session représentant l'url du site.
+ * Session property loaded from configuration to know what is the current
+ * server url
*/
@SessionState
private String siteURL;
- /** Locale courante */
@Inject
private Locale currentLocale;
/**
- * Utilisateur créé via le formulaire
+ * New user to create
*/
private UserAccount newUser;
@@ -110,22 +113,16 @@
private PasswordField passwordField;
/**
- * Champ password1 du formulaire d'enregsitrement d'un utilisateur
+ * password2 field to verify if equals to password1
*/
@Property
- private String password1;
- /**
- * Champ password2 du formulaire d'enregsitrement d'un utilisateur
- */
- @Property
- private String password2;
+ private String passwordVerify;
- /**
- * Initialisation de l'affichage
- */
- void setupRender() {
- }
+ private String passwordForEmail;
+ @InjectPage
+ private Index index;
+
public AddressBar getAddressBar() {
return AddressBar.newBar().appendCurrent(title);
}
@@ -138,15 +135,40 @@
}
/**
- * ON_VALIDATE_FORM :: Check if two passwords are equals.
+ * ON_VALIDATE_FORM :: <br \>
+ * UI validation : check if the two passwords are equals. <br \>
+ * BUSINESS validation : execute {@link org.chorem.pollen.service.ServiceUser#createUser(org.chorem.pollen.entity.UserAccount) }
+ * which throws errors
+ * {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_LOGIN_EXIST}
+ * and {@link org.chorem.pollen.PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST}.
*/
void onValidateFormFromRegister() {
- // L'utilisateur s'est pas trompé en répétant son mot de passe
- if (!password1.equals(password2)) {
- password1 = null;
+ // Check newPassword that must be equals to passwordVerify
+ String password = newUser.getNewPassword();
+ if (!password.equals(passwordVerify)) {
register.recordError(passwordField,
- messages.get("passwords-dont-match"));
+ messages.get("pollen.ui.user.passwordsDontMatch"));
}
+
+ // If no UI errors, call business to save the user
+ if (!register.getHasErrors()) {
+ try {
+ // Set passwordForEmail, newPassword will be reset after
+ // createUser
+ passwordForEmail = newUser.getNewPassword();
+
+ // Saving new user
+ serviceUser.createUser(newUser);
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ switch (eee.getType()) {
+ case USER_EMAIL_EXIST:
+ register.recordError(emailField, message); break;
+ case USER_LOGIN_EXIST:
+ register.recordError(loginField, message);
+ }
+ }
+ }
}
/**
@@ -157,38 +179,38 @@
* @return the form if errors are recorded, or Index page otherwise
*/
Object onSuccessFromRegister() {
- try {
- // Encode the password before saving user
- getNewUser().setPassword(pollen.encodePassword(password1));
-
- // Saving new user
- serviceUser.createUpdateUser(getNewUser());
+ // Set the newUser in session : connect the new registered user
+ user = newUser;
- // Send an email to the new user
- PollenEmail mail = serviceEmail.getNewEmail(getNewUser());
+ index.addInfo(
+ messages.format("pollen.ui.user.autoConnection",
+ user.getLogin()));
- mail.setSubject(
- messages.format("pollen.mail.userRegister.subject",
- getNewUser().getLogin()));
- mail.setContent(
- messages.format("pollen.mail.userRegister.content",
- getNewUser().getDisplayName(), getNewUser().getLogin(),
- password1, siteURL));
+ // Send an email to the new user if not empty
+ if (StringUtils.isNotEmpty(user.getEmail())) {
+ try {
+ PollenEmail mail = serviceEmail.getNewEmail(user);
- serviceEmail.sendEmail(mail);
+ mail.setSubject(
+ messages.format("pollen.email.userRegister.subject",
+ user.getLogin()));
+ mail.setContent(
+ messages.format("pollen.email.userRegister.content",
+ user.getDisplayName(), user.getLogin(),
+ passwordForEmail, siteURL));
- return Index.class;
- } catch (PollenBusinessException eee) {
- String message =
- BusinessUtils.getErrorMessage(eee, messages, logger);
- switch (eee.getType()) {
- case USER_EMAIL_EXIST:
- register.recordError(emailField, message); break;
- case USER_LOGIN_EXIST:
- register.recordError(loginField, message);
+ serviceEmail.sendEmail(mail);
+
+ index.addInfo(
+ messages.format("pollen.ui.user.sendRegisterEmail",
+ user.getEmail()));
+
+ } catch (PollenBusinessException eee) {
+ String message = manager.getErrorMessage(eee, messages, logger);
+ index.addError(message);
}
}
- return register;
+ return index;
}
/**
@@ -197,6 +219,8 @@
* @return the form
*/
Object onFailureFromRegister() {
+ // Reset password from session
+ newUser.setNewPassword(null);
return register;
}
}
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -29,7 +29,6 @@
import org.apache.tapestry5.services.ApplicationStateContribution;
import org.apache.tapestry5.services.ApplicationStateCreator;
import org.apache.tapestry5.upload.services.UploadSymbols;
-import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenContextImpl;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountImpl;
@@ -40,6 +39,8 @@
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.service.ServiceUserImpl;
import org.chorem.pollen.ui.data.PollUri;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This module is automatically included as part of the Tapestry IoC Registry,
@@ -50,18 +51,18 @@
*/
public class AppModule {
+ private static Logger logger = LoggerFactory.getLogger(AppModule.class);
+
public static void bind(ServiceBinder binder) {
}
/**
* Build the application manager.
*
- * @param hub to register the manager for tapestry registry shutdown
* @return PollenManager
*/
- public static PollenManager buildPollenManager(RegistryShutdownHub hub) {
+ public static PollenManager buildPollenManager() {
PollenManager manager = new PollenManager(new PollenContextImpl());
- hub.addRegistryShutdownListener(manager);
return manager;
}
@@ -87,8 +88,31 @@
return new ServiceImageImpl(manager.getContext());
}
+ /**
+ * Execute PollenManager when registry startup.
+ * The manager will be instantiated using
+ * {@link #buildPollenManager(org.apache.tapestry5.ioc.services.RegistryShutdownHub) }.
+ * The serviceUser is needed to start the application.
+ *
+ * @param configuration to add the manager to registry startup
+ * @param manager to launch at startup
+ * @param shutdownHub to register manager for registry shutdown
+ */
+ public static void contributeRegistryStartup(
+ OrderedConfiguration<Runnable> configuration,
+ PollenManager manager, RegistryShutdownHub shutdownHub) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Execute contributeRegistryStartup");
+ }
+ shutdownHub.addRegistryShutdownListener(manager);
+ configuration.add("PollenStartup", manager);
+ }
+
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Execute contributeApplicationDefaults");
+ }
// Contributions to ApplicationDefaults will override any contributions to
// FactoryDefaults (with the same key). Here we're restricting the supported
// locales to just "en" (English). As you add localised message catalogs and other assets,
@@ -109,6 +133,24 @@
}
/**
+ * Contribution SymbolSource service to access our configuration
+ * symbols from our services, pages and components.
+ *
+ * @param configuration
+ * @param symbolProvider PollenManager
+ */
+ public static void contributeSymbolSource(
+ OrderedConfiguration<SymbolProvider> configuration,
+ @InjectService("PollenManager") SymbolProvider symbolProvider) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Execute contributeSymbolSource");
+ }
+ configuration.add(
+ "PollenManager", symbolProvider,
+ "after:SystemProperties", "before:ApplicationDefaults");
+ }
+
+ /**
* TypeCoercion for PollUri. This will convert automatically between String
* and PollUri. So pollUri can be used in activation/passivation page
* context.
@@ -116,7 +158,10 @@
* @param configuration
*/
public static void contributeTypeCoercer(
- Configuration<CoercionTuple> configuration) {
+ Configuration<CoercionTuple<?, ?>> configuration) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Execute contributeTypeCoercer");
+ }
Coercion<String, PollUri> coercion1 = new Coercion<String, PollUri>() {
@Override
@@ -154,35 +199,18 @@
// return new BackgroundWorkerImpl(messages, servicePoll, context);
// }
- /**
- * Make configuration from a Properties file available as symbols.
- * @param context
- * @return
- */
- public PropertiesFileSymbolProvider buildConfigPropertiesFileSymbolProvider(
- @InjectService("PollenContext") PollenContext context) {
- return new PropertiesFileSymbolProvider(context);
- }
/**
- * Contribution SymbolSource service so that we can access our configuration
- * symbols from our services, pages and components.
- */
- public static void contributeSymbolSource(
- OrderedConfiguration<SymbolProvider> configuration,
- @InjectService("ConfigPropertiesFileSymbolProvider") SymbolProvider configPropertiesFileSymbolProvider) {
- configuration.add("ConfigPropertiesFile",
- configPropertiesFileSymbolProvider, "after:SystemProperties",
- "before:ApplicationDefaults");
- }
-
-
- /**
- * Used to instanciate SessionState WaoUser when session expires.
+ * Used to instanciate SessionState UserAccount when session expires.
*
* @param configuration to add the ApplicationStateCreator.
*/
- public void contributeApplicationStateManager(MappedConfiguration<Class<?>, ApplicationStateContribution> configuration) {
+ public void contributeApplicationStateManager(MappedConfiguration<Class<?>,
+ ApplicationStateContribution> configuration) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Execute contributeApplicationStateManager");
+ }
+
ApplicationStateCreator<UserAccount> creator =
new ApplicationStateCreator<UserAccount>() {
@Override
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -21,13 +21,19 @@
package org.chorem.pollen.ui.services;
+import java.util.Arrays;
import java.util.Date;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
+import org.apache.tapestry5.ioc.services.SymbolProvider;
+import org.apache.tapestry5.ioc.util.CaseInsensitiveMap;
+import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
import org.nuiton.util.ApplicationConfig;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* WaoManager
@@ -40,11 +46,16 @@
* Mise a jour: $Date$
* par : $Author$
*/
-public class PollenManager implements Runnable, RegistryShutdownListener {
+public class PollenManager implements Runnable,
+ RegistryShutdownListener,
+ SymbolProvider {
- private static final Logger log =
- LoggerFactory.getLogger(PollenManager.class);
+// private static final Logger logger =
+// LoggerFactory.getLogger(PollenManager.class);
+ private final Map<String, String> propertiesMap =
+ new CaseInsensitiveMap<String>();
+
private PollenContext context;
/**
@@ -62,8 +73,19 @@
@Override
public void run() {
context.start();
+ // Copy properties to propertiesMap (insentitive) for SymbolProvider
+ Properties properties = getConfiguration().getOptions();
+ for (Object key : properties.keySet()) {
+ propertiesMap.put((String)key,
+ properties.getProperty((String) key));
+ }
}
+ @Override
+ public String valueForSymbol(String key) {
+ return propertiesMap.get(key);
+ }
+
/**
* Called to stop the application
*/
@@ -93,8 +115,19 @@
return context.getCurrentDate();
}
- public String encodePassword(String password) {
- return context.encodePassword(password);
+ public String getErrorMessage(PollenBusinessException eee,
+ Messages messages, Logger logger) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("ERROR from business : " + eee.getMessage() +
+ " _ args = " + Arrays.toString(eee.getArgs()));
+ }
+ String message = null;
+ if (eee.getArgs() != null) {
+ message = messages.format(eee.getMessage(), eee.getArgs());
+ } else {
+ message = messages.get(eee.getMessage());
+ }
+ return message;
}
}
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PropertiesFileSymbolProvider.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PropertiesFileSymbolProvider.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PropertiesFileSymbolProvider.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,138 +0,0 @@
-package org.chorem.pollen.ui.services;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.tapestry5.ioc.services.SymbolProvider;
-import org.apache.tapestry5.ioc.util.CaseInsensitiveMap;
-import org.chorem.pollen.PollenContext;
-import org.slf4j.Logger;
-
-public class PropertiesFileSymbolProvider implements SymbolProvider {
-
- private final Map<String, String> propertiesMap = new CaseInsensitiveMap<String>();
-
- private PollenContext context;
-
- /**
- * Instantiate a new PropertiesFileSymbolProvider using a given resource
- * name
- *
- * @param logger the logger to log error messages to
- * @param resourceName the name of the resource to load
- * @param classPath whether to look on the classpath or filesystem
- */
- public PropertiesFileSymbolProvider(Logger logger, String resourceName,
- boolean classPath) {
- try {
- InputStream in;
-
- if (classPath) {
- in = ClassLoader.getSystemResourceAsStream(resourceName);
-
- // ClassLoader.getSystemResourceAsStream() returns null if
- // the resource cannot be found on the classpath
- if (in == null)
- throw new FileNotFoundException();
- } else
- in = new FileInputStream(resourceName);
-
- initialize(logger, in);
-
- } catch (FileNotFoundException e) {
- String msg = "Could not find '" + resourceName + "'";
-
- logger.error(msg);
-
- throw new IllegalArgumentException(msg, e);
- }
- }
-
- /**
- * Instantiate a new PropertiesFileSymbolProvider using a given resource
- * name (looking in filesystem and classpath)
- *
- * @param context PollenContext
- */
- public PropertiesFileSymbolProvider(PollenContext context) {
- Properties conf = context.getConfiguration().getOptions();
- initializeProperties(conf);
- }
-
- /**
- * Instantiate a PropertiesFileSymbolProvider using a given InputStream
- *
- * @param logger the logger
- * @param in an InputStream representing the resource
- */
- public PropertiesFileSymbolProvider(Logger logger, InputStream in) {
- initialize(logger, in);
- }
-
- /**
- * Instantiate a PropertiesFileSymbolProvider from a given URL.
- *
- * @param logger the logger
- * @param url an URL to open
- */
- public PropertiesFileSymbolProvider(Logger logger, URL url) {
- try {
- initialize(logger, url.openStream());
- } catch (IOException e) {
- String msg = "IOException while opening URL '" + url + "': "
- + e.getMessage();
-
- logger.error(msg);
-
- throw new IllegalArgumentException(msg, e);
- }
- }
-
- /**
- * Instantiate a PropertiesFileSymbolProvider from a given Properties.
- *
- * @param logger the logger
- * @param properties a Properties object
- */
- public PropertiesFileSymbolProvider(Logger logger, Properties properties) {
- initializeProperties(properties);
- }
-
- private void initialize(Logger logger, InputStream in) {
- Properties properties = new Properties();
-
- try {
- properties.load(in);
-
- for (Object key : properties.keySet()) {
- propertiesMap.put((String) key, properties
- .getProperty((String) key));
- }
- } catch (IOException e) {
- String msg = "IOEception while loading properties: "
- + e.getMessage();
-
- logger.error(msg);
-
- throw new IllegalArgumentException(msg, e);
- }
- }
-
- private void initializeProperties(Properties properties) {
- for (Object key : properties.keySet()) {
- propertiesMap.put((String) key, properties
- .getProperty((String) key));
- }
- }
-
- @Override
- public String valueForSymbol(String arg0) {
- return propertiesMap.get(arg0);
- }
-
-}
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/BusinessUtils.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/BusinessUtils.java 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/BusinessUtils.java 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,37 +0,0 @@
-
-package org.chorem.pollen.ui.utils;
-
-import java.util.Arrays;
-import org.apache.tapestry5.ioc.Messages;
-import org.chorem.pollen.PollenBusinessException;
-import org.slf4j.Logger;
-
-/**
- * BusinessUtils
- *
- * Created: 30 mars 2010
- *
- * @author fdesbois
- * @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
- */
-public class BusinessUtils {
-
- public static String getErrorMessage(
- PollenBusinessException eee, Messages messages, Logger logger) {
- if (logger.isDebugEnabled()) {
- logger.debug("ERROR from business : " + eee.getMessage() +
- " _ args = " + Arrays.toString(eee.getArgs()));
- }
- String message = null;
- if (eee.getArgs() != null) {
- message = messages.format(eee.getMessage(), eee.getArgs());
- } else {
- message = messages.get(eee.getMessage());
- }
- return message;
- }
-
-}
Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,6 +1,6 @@
# User registration emails
-pollen.mail.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s
-pollen.mail.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s
+pollen.email.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s
+pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s
# Poll creation emails
creatorEmail_subject=[Pollen] Cr\u00E9ation d'un sondage (%s)
@@ -41,6 +41,11 @@
return=Retour
help=Aide
+pollen.ui.user.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s.
+pollen.ui.user.sendRegisterEmail=Un email vous a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse %1$s.
+pollen.ui.user.passwordsDontMatch=Les deux mots de passe ne correspondent pas.
+pollen.ui.user.updateSuccess=Modification enregistr\u00E9e avec succ\u00E8s.
+
pollen.ui.choice.delete.confirm=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer ce choix ?
pollen.ui.choice.delete.title=Supprimer ce choix
pollen.ui.vote.noVote=Aucune personne n'a encore particip\u00E9 au sondage
Modified: trunk/pollen-ui/src/main/resources/log4j.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/log4j.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/log4j.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,5 +1,5 @@
# Default to info level output; this is very handy if you eventually use Hibernate as well.
-log4j.rootCategory=warn, A1
+log4j.rootCategory=warn, A1, globalfile
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
@@ -8,6 +8,17 @@
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%p] %c{2} %m%n
+log4j.appender.globalfile=org.apache.log4j.RollingFileAppender
+# pollen.log.home must be defined when starting server
+# ex : -Dpollen.log.home=/home/user/.local/pollen
+log4j.appender.globalfile.File=${pollen.log.home}/pollen.log
+log4j.appender.globalfile.MaxFileSize=500KB
+log4j.appender.globalfile.Append=true
+log4j.appender.globalfile.MaxBackupIndex=10
+log4j.appender.globalfile.Threshold=TRACE
+log4j.appender.globalfile.layout=org.apache.log4j.PatternLayout
+log4j.appender.globalfile.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n
+
# Service category names are the name of the defining module class
# and then the service id.
log4j.category.org.chorem.test.services.AppModule.TimingFilter=info
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml 2010-04-09 23:28:55 UTC (rev 2969)
@@ -4,12 +4,12 @@
<legend>${message:connectionLegend}</legend>
<t:feedback t:id="loginCompFeedback" />
<div>
- <t:label for="loginComp" />
- <input t:type="TextField" t:id="loginComp" validate="required" />
+ <t:label for="connectionLogin" />
+ <input t:type="TextField" t:id="connectionLogin" validate="required" />
</div>
<div>
- <t:label for="passwordComp" />
- <input t:type="PasswordField" t:id="passwordComp" validate="required" />
+ <t:label for="connectionPassword" />
+ <input t:type="PasswordField" t:id="connectionPassword" validate="required" />
</div>
<div class="buttons">
<input t:id="submitLoginCompForm" t:type="Submit" t:value="${message:loginSubmit}" />
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_en.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_en.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_en.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,23 +0,0 @@
-title=My Account
-login-label=User name
-password-label=Password *
-newPassword1-label=New password
-newPassword2-label=Reenter new password
-firstName-label=First name
-lastName-label=Last name
-email-label=Em@il *
-submit-label=Submit
-modify=Modify
-connectionInfoLegend=Connection information
-userInfoLegend=User information
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Invalid email.
-login-required-message=You must provide a username.
-password1-required-message=You must provide a password.
-password1-minlength-message=Your password must be at least 6 characters long.
-password2-required-message=You must repeat your password for confirmation.
-password2-minlength-message=Your password must be at least 6 characters long.
-passwords-dont-match=Two versions of password do not match.
-noUser=You must be logged to access to your account.\n Please fill the form below.
-badPassword=Your password is invalid.
-emailAlreadyExists=A user already registered with this email.
\ No newline at end of file
Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_fr.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_fr.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,23 +0,0 @@
-title=Mon Compte
-login-label=Identifiant
-password-label=Mot de passe *
-newPassword1-label=Nouveau mot de passe
-newPassword2-label=R\u00E9p\u00E9tez votre nouveau mot de passe
-firstName-label=Pr\u00E9nom
-lastName-label=Nom
-email-label=Em@il *
-submit-label=Valider
-modify=Modifier
-connectionInfoLegend=Informations de connexion
-userInfoLegend=Informations de l'utilisateur
-email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
-email-regexp-message=Email invalide.
-login-required-message=Vous devez fournir un identifiant.
-password1-required-message=Vous devez fournir un mot de passe.
-password1-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
-password2-required-message=Vous devez r\u00E9p\u00E9ter votre mot de passe pour confirmation.
-password2-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
-passwords-dont-match=Les deux mots de passe ne correspondent pas.
-noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 votre compte.\n Veuillez remplir le formulaire ci-dessous.
-badPassword=Votre mot de passe est invalide.
-emailAlreadyExists=Un utilisateur est d\u00E9j\u00E0 enregistr\u00E9 avec cet email.
\ No newline at end of file
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_en.properties (from rev 2966, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_en.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_en.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_en.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -0,0 +1,23 @@
+title=My Account
+login-label=User name
+password-label=Password *
+newPassword1-label=New password
+newPassword2-label=Reenter new password
+firstName-label=First name
+lastName-label=Last name
+email-label=Em@il *
+submit-label=Submit
+editAccount-action=Modify
+connectionInfoLegend=Connection information
+userInfoLegend=User information
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Invalid email.
+login-required-message=You must provide a username.
+password1-required-message=You must provide a password.
+password1-minlength-message=Your password must be at least 6 characters long.
+password2-required-message=You must repeat your password for confirmation.
+password2-minlength-message=Your password must be at least 6 characters long.
+passwords-dont-match=Two versions of password do not match.
+noUser=You must be logged to access to your account.\n Please fill the form below.
+badPassword=Your password is invalid.
+emailAlreadyExists=A user already registered with this email.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_en.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_fr.properties (from rev 2966, trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/Account_fr.properties)
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_fr.properties (rev 0)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_fr.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -0,0 +1,23 @@
+title=Mon Compte
+login-label=Identifiant
+password-label=Mot de passe *
+newPassword1-label=Nouveau mot de passe
+passwordVerify-label=R\u00E9p\u00E9tez votre nouveau mot de passe
+firstName-label=Pr\u00E9nom
+lastName-label=Nom
+email-label=Em@il
+submit-label=Valider
+edit-action=Modifier
+cancel-action=Annuler
+connectionInfoLegend=Informations de connexion
+userInfoLegend=Informations de l'utilisateur
+email-regexp=^([a-zA-Z0-9_.+-])+(a)(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$
+email-regexp-message=Email invalide.
+login-required-message=Vous devez fournir un identifiant.
+password1-required-message=Vous devez fournir un mot de passe.
+password1-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
+passwordVerify-required-message=Vous devez r\u00E9p\u00E9ter votre mot de passe pour confirmation.
+passwordVerify-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
+noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 votre compte.\n Veuillez remplir le formulaire ci-dessous.
+badPassword=Votre mot de passe est invalide.
+emailAlreadyExists=Un utilisateur est d\u00E9j\u00E0 enregistr\u00E9 avec cet email.
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserProfile_fr.properties
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserRegister_fr.properties
===================================================================
--- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserRegister_fr.properties 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserRegister_fr.properties 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,10 +1,10 @@
title=S'enregistrer
login-label=Identifiant *
password1-label=Mot de passe *
-password2-label=R\u00E9p\u00E9tez votre mot de passe *
+passwordVerify-label=R\u00E9p\u00E9tez votre mot de passe *
firstName-label=Pr\u00E9nom
lastName-label=Nom
-email-label=Em@il *
+email-label=Em@il
submit-label=S'enregistrer
connectionInfoLegend=Informations de connexion
userInfoLegend=Informations de l'utilisateur
@@ -13,6 +13,6 @@
login-required-message=Vous devez fournir un identifiant.
password1-required-message=Vous devez fournir un mot de passe.
password1-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
-password2-required-message=Vous devez r\u00E9p\u00E9ter votre mot de passe pour confirmation.
-password2-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
+passwordVerify-required-message=Vous devez r\u00E9p\u00E9ter votre mot de passe pour confirmation.
+passwordVerify-minlength-message=Votre mot de passe doit comporter au moins 6 caract\u00E8res.
passwords-dont-match=Les deux mots de passe ne correspondent pas.
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/css/common.css
===================================================================
--- trunk/pollen-ui/src/main/webapp/css/common.css 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/webapp/css/common.css 2010-04-09 23:28:55 UTC (rev 2969)
@@ -44,6 +44,7 @@
border: solid;
border-color: #f00;
border-width: 2px;
+ margin-bottom: 10px;
}
.fb-info {
Deleted: trunk/pollen-ui/src/main/webapp/user/Account.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/user/Account.tml 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/webapp/user/Account.tml 2010-04-09 23:28:55 UTC (rev 2969)
@@ -1,95 +0,0 @@
-
-<t:border t:address="address" t:pageLogo="literal:Creation"
- xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
- <h1 class="titleCreation">${message:title}</h1>
- <t:if test="userExists">
-
- <t:zone t:id="myAccountZone" show="show" update="show">
- <div id="myAccountFormDiv">
- <t:form t:id="myAccountForm" zone="myAccountZone">
- <div id="myAccountError">
- <t:errors />
- </div>
-
- <FieldSet>
- <legend>${message:connectionInfoLegend}</legend>
- <div>
- <label>${message:login-label}</label>
- ${user.login}
- </div>
- <t:if test="modify">
- <div>
- <t:label for="password" />
- <t:PasswordField t:id="password" t:value="password" t:validate="required,minlength=6" />
- </div>
- <div>
- <t:label for="newPassword1" />
- <t:PasswordField t:id="newPassword1" t:value="newPassword1" t:validate="minlength=6" />
- </div>
- <div>
- <t:label for="newPassword2" />
- <t:PasswordField t:id="newPassword2" t:value="newPassword2" t:validate="minlength=6" />
- </div>
- </t:if>
- </FieldSet>
-
- <FieldSet>
- <legend>${message:userInfoLegend}</legend>
- <div>
- <t:label for="email" />
- <t:if test="modify">
- <t:TextField t:id="email" t:value="newUser.email" t:validate="required,regexp" />
- <p:else>
- <t:if test="user.email">
- ${user.email}
- <p:else>-</p:else>
- </t:if>
- </p:else>
- </t:if>
- </div>
- <div>
- <t:label for="firstName" />
- <t:if test="modify">
- <t:TextField t:id="firstName" t:value="newUser.firstName" />
- <p:else>
- <t:if test="user.firstName">
- ${user.firstName}
- <p:else>-</p:else>
- </t:if>
- </p:else>
- </t:if>
- </div>
- <div>
- <t:label for="lastName" />
- <t:if test="modify">
- <t:TextField t:id="lastName" t:value="newUser.lastName" />
- <p:else>
- <t:if test="user.lastName">
- ${user.lastName}
- <p:else>-</p:else>
- </t:if>
- </p:else>
- </t:if>
- </div>
- </FieldSet>
-
- <div class="buttons">
- <t:if test="modify">
- <input type="submit" value="${message:submit-label}" />
- <p:else>
- <t:actionLink t:id="modifyButton" t:zone="myAccountZone" style="text-decoration: none;">
- <input type="button" value="${message:modify}" />
- </t:actionLink>
- </p:else>
- </t:if>
- </div>
- </t:form>
- </div>
- </t:zone>
-
- <p:else>
- <h4>${message:noUser}</h4>
- <t:LoginComponent />
- </p:else>
- </t:if>
-</t:border>
\ No newline at end of file
Copied: trunk/pollen-ui/src/main/webapp/user/UserProfile.tml (from rev 2966, trunk/pollen-ui/src/main/webapp/user/Account.tml)
===================================================================
--- trunk/pollen-ui/src/main/webapp/user/UserProfile.tml (rev 0)
+++ trunk/pollen-ui/src/main/webapp/user/UserProfile.tml 2010-04-09 23:28:55 UTC (rev 2969)
@@ -0,0 +1,98 @@
+
+<t:border t:addressBar="addressBar" t:pageLogo="literal:Creation"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+ <h1 class="titleCreation">${message:title}</h1>
+ <t:if test="userExists">
+
+ <t:zone t:id="accountZone" show="show" update="show">
+ <t:form t:id="accountForm" zone="accountZone">
+ <div id="myAccountFormDiv">
+ <div id="myAccountError">
+ <t:errors />
+ </div>
+
+ <FieldSet>
+ <legend>${message:connectionInfoLegend}</legend>
+ <div>
+ <label>${message:login-label}</label>
+ ${user.login}
+ </div>
+ <t:if test="edited">
+ <div>
+ <t:label for="password" />
+ <t:PasswordField t:id="password" t:value="userEditable.password" t:validate="required,minlength=6" />
+ </div>
+ <div>
+ <t:label for="newPassword1" />
+ <t:PasswordField t:id="newPassword1" t:value="userEditable.newPassword" t:validate="minlength=6" />
+ </div>
+ <div>
+ <t:label for="passwordVerify" />
+ <t:PasswordField t:id="passwordVerify" t:value="passwordVerify" t:validate="minlength=6" />
+ </div>
+ </t:if>
+ </FieldSet>
+
+ <FieldSet>
+ <legend>${message:userInfoLegend}</legend>
+ <div>
+ <t:label for="email" />
+ <t:if test="edited">
+ <t:TextField t:id="email" t:value="userEditable.email" t:validate="regexp" />
+ <p:else>
+ <t:if test="user.email">
+ ${user.email}
+ <p:else>-</p:else>
+ </t:if>
+ </p:else>
+ </t:if>
+ </div>
+ <div>
+ <t:label for="firstName" />
+ <t:if test="edited">
+ <t:TextField t:id="firstName" t:value="userEditable.firstName" />
+ <p:else>
+ <t:if test="user.firstName">
+ ${user.firstName}
+ <p:else>-</p:else>
+ </t:if>
+ </p:else>
+ </t:if>
+ </div>
+ <div>
+ <t:label for="lastName" />
+ <t:if test="edited">
+ <t:TextField t:id="lastName" t:value="userEditable.lastName" />
+ <p:else>
+ <t:if test="user.lastName">
+ ${user.lastName}
+ <p:else>-</p:else>
+ </t:if>
+ </p:else>
+ </t:if>
+ </div>
+ </FieldSet>
+
+ <div class="buttons">
+ <t:if test="edited">
+ <input type="submit" value="${message:submit-label}" />
+ <a t:type="pagelink" t:page="user/profile" style="text-decoration: none;">
+ <input type="button" value="${message:cancel-action}" />
+ </a>
+ <p:else>
+ <a t:type="actionlink" t:id="editAccount" style="text-decoration: none;">
+ <input type="button" value="${message:edit-action}" />
+ </a>
+ </p:else>
+ </t:if>
+ </div>
+ </div>
+ </t:form>
+ </t:zone>
+
+ <p:else>
+ <h4>${message:noUser}</h4>
+ <t:LoginComponent />
+ </p:else>
+ </t:if>
+</t:border>
\ No newline at end of file
Property changes on: trunk/pollen-ui/src/main/webapp/user/UserProfile.tml
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/pollen-ui/src/main/webapp/user/UserRegister.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/user/UserRegister.tml 2010-04-08 10:23:22 UTC (rev 2968)
+++ trunk/pollen-ui/src/main/webapp/user/UserRegister.tml 2010-04-09 23:28:55 UTC (rev 2969)
@@ -18,11 +18,11 @@
</div>
<div>
<t:label for="password1"/>
- <t:PasswordField t:id="password1" t:value="password1" t:validate="required, minlength=6"/>
+ <t:PasswordField t:id="password1" t:value="newUser.newPassword" t:validate="required, minlength=6"/>
</div>
<div>
- <t:label for="password2"/>
- <t:PasswordField t:id="password2" t:value="password2" t:validate="required, minlength=6"/>
+ <t:label for="passwordVerify"/>
+ <t:PasswordField t:id="passwordVerify" t:value="passwordVerify" t:validate="required, minlength=6"/>
</div>
</fieldset>
@@ -30,7 +30,7 @@
<legend>${message:userInfoLegend}</legend>
<div>
<t:label for="email"/>
- <t:TextField t:id="email" t:value="newUser.email" t:validate="required,regexp"/>
+ <t:TextField t:id="email" t:value="newUser.email" t:validate="regexp"/>
</div>
<div>
<t:label for="firstName"/>
1
0
r2968 - in trunk/pollen-business/src/main/java/org/chorem/pollen: . service
by fdesbois@users.chorem.org 08 Apr '10
by fdesbois@users.chorem.org 08 Apr '10
08 Apr '10
Author: fdesbois
Date: 2010-04-08 12:23:22 +0200 (Thu, 08 Apr 2010)
New Revision: 2968
Log:
- Remove old folders
- Change service implementation cause of ServiceTransformer modification in ToPIA
Removed:
trunk/pollen-business/src/main/java/org/chorem/pollen/business/
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.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
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-08 09:42:50 UTC (rev 2967)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
@@ -36,28 +36,22 @@
}
@Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected void treateError(TopiaContext transaction, Exception eee,
String message, Object... args) throws PollenException {
context.treateError(transaction, eee, message, args);
}
@Override
- protected void treateError(Exception eee, String message,
- Object... args) throws PollenException {
- context.treateError(eee, message, args);
- }
-
- @Override
protected void closeTransaction(TopiaContext transaction) {
context.closeTransaction(transaction);
}
@Override
- protected TopiaContext beginTransaction() throws TopiaException {
- return context.beginTransaction();
- }
-
- @Override
protected void executeSendEmail(List<Object> errorArgs,
PollenEmail pollenEmail) throws EmailException {
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-04-08 09:42:50 UTC (rev 2967)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
@@ -35,28 +35,22 @@
}
@Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected void treateError(TopiaContext transaction, Exception eee,
String message, Object... args) throws PollenException {
context.treateError(transaction, eee, message, args);
}
@Override
- protected void treateError(Exception eee, String message,
- Object... args) throws PollenException {
- context.treateError(eee, message, args);
- }
-
- @Override
protected void closeTransaction(TopiaContext transaction) {
context.closeTransaction(transaction);
}
@Override
- protected TopiaContext beginTransaction() throws TopiaException {
- return context.beginTransaction();
- }
-
- @Override
protected Poll executeGetNewPoll() {
return new PollImpl();
}
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-04-08 09:42:50 UTC (rev 2967)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-08 10:23:22 UTC (rev 2968)
@@ -36,28 +36,22 @@
}
@Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected void treateError(TopiaContext transaction, Exception eee,
String message, Object... args) throws PollenException {
context.treateError(transaction, eee, message, args);
}
@Override
- protected void treateError(Exception eee, String message,
- Object... args) throws PollenException {
- context.treateError(eee, message, args);
- }
-
- @Override
protected void closeTransaction(TopiaContext transaction) {
context.closeTransaction(transaction);
}
@Override
- protected TopiaContext beginTransaction() throws TopiaException {
- return context.beginTransaction();
- }
-
- @Override
protected UserAccount executeConnect(TopiaContext transaction,
List<Object> errorArgs, String login, String password)
throws PollenBusinessException, TopiaException {
1
0
Author: fdesbois
Date: 2010-04-08 11:42:50 +0200 (Thu, 08 Apr 2010)
New Revision: 2967
Log:
- Update ServiceTransformer usage for ToPIA 2.3.3
- Use nuiton-utils snapshot 1.2.2
- Create PollenManager to manipulate context in Tapestry
- Remove MD5 class, use StringUtil.encodeMD5 instead
Added:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenException.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
Removed:
trunk/pollen-business/src/main/java/org/chorem/pollen/MD5.java
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java
trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.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/resources/i18n/pollen-business-en_GB.properties
trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
trunk/pollen-business/src/main/xmi/pollen.properties
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
trunk/pom.xml
Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/MD5.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/MD5.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/MD5.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -1,59 +0,0 @@
-/* *##% Pollen
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/
-
-package org.chorem.pollen;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * Classe utilitaire permettant d'encoder des chaîne en MD5.
- *
- * @version $Id$
- */
-public class MD5 {
-
- /**
- * Encode la chaine passé en paramètre avec l’algorithme MD5
- *
- * @param key : la chaine à encoder
- * @return la valeur (string) hexadécimale sur 32 bits
- */
- public static String encode(String key) {
-
- byte[] uniqueKey = key.getBytes();
- byte[] hash = null;
-
- try {
- // on récupère un objet qui permettra de crypter la chaine
- hash = MessageDigest.getInstance("MD5").digest(uniqueKey);
- } catch (NoSuchAlgorithmException e) {
- throw new Error("no MD5 support in this VM");
- }
-
- StringBuffer hashString = new StringBuffer();
- for (int i = 0; i < hash.length; ++i) {
- String hex = Integer.toHexString(hash[i]);
- if (hex.length() == 1) {
- hashString.append("0");
- hashString.append(hex.charAt(hex.length() - 1));
- } else {
- hashString.append(hex.substring(hex.length() - 2));
- }
- }
- return hashString.toString();
- }
-}
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -0,0 +1,123 @@
+package org.chorem.pollen;
+
+import java.util.Date;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.util.ApplicationConfig;
+
+
+public interface PollenContext {
+
+ /**
+ * loadConfiguration :
+ * Load the application configuration :
+ * <pre>
+ * - Add entities implementation classes for Topia-persistence
+ * - Add model version for Topia-migration-service
+ * </pre>
+ * @param config ApplicationConfig
+ */
+ public void loadConfiguration(ApplicationConfig config);
+
+ /**
+ * start :
+ * Start of the application. The application configuration will be loaded
+ * automatically if needed using {@link #loadDefaultConfiguration }. Also
+ * you can manually load the configuration using
+ * {@link #loadConfiguration(ApplicationConfig)}
+ * This start does :
+ * <pre>
+ * - Initialize i18n for error messages
+ * - Create default admin if needed (this will load the topiaRootContext).
+ * </pre>
+ */
+ public void start();
+
+ /**
+ * stop :
+ * Stop the application. Close the Topia rootContext.
+ */
+ public void stop();
+
+ /**
+ * getProperty :
+ * Get a property from the configuration.
+ * @param property PollenProperty
+ * @return String
+ */
+ public String getProperty(PollenProperty property);
+
+ /**
+ * hasProperty :
+ * Test if the property is defined in this context
+ * @param property PollenProperty
+ * @return boolean
+ */
+ public boolean hasProperty(PollenProperty property);
+
+ /**
+ * getConfiguration :
+ * Get the configuration of the application. Instantiate the default one
+ * if needed.
+ * @return ApplicationConfig
+ */
+ public ApplicationConfig getConfiguration();
+
+ /**
+ * getCurrentDate :
+ * Return the current date from context
+ * @return Date
+ */
+ public Date getCurrentDate();
+
+ /**
+ * encodePassword :
+ * @param password
+ * @return String
+ */
+ public String encodePassword(String password);
+
+ /**
+ * createPollenUrlId :
+ * Create a unique UId for entities which need it (PollAccount, Poll).
+ * This UId represent the entity in UI module.
+ * @return String
+ */
+ public String createPollenUrlId();
+
+ /**
+ * beginTransaction :
+ * @return TopiaContext
+ * @throws TopiaException
+ */
+ public TopiaContext beginTransaction() throws TopiaException;
+
+ /**
+ * doCatch :
+ * @param eee
+ * @param message
+ * @param args
+ * @throws PollenException
+ */
+ public void treateError(Exception eee, String message, Object... args)
+ throws PollenException;
+
+ /**
+ * doCatch :
+ * @param transaction
+ * @param eee
+ * @param message
+ * @param args
+ * @throws PollenException
+ */
+ public void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException;
+
+ /**
+ * doFinally :
+ * @param transaction
+ */
+ public void closeTransaction(TopiaContext transaction);
+
+
+} //PollenContext
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContext.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -1,16 +1,17 @@
package org.chorem.pollen;
+import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Properties;
import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
//import org.chorem.pollen.PollenDAOHelper;
//import org.chorem.pollen.business.services.SendMail;
//import org.chorem.pollen.business.services.ServiceUserImpl;
-import org.chorem.pollen.service.ServiceEmail;
-import org.chorem.pollen.service.ServiceEmailImpl;
import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
@@ -21,6 +22,7 @@
import static org.nuiton.i18n.I18n.n_;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.util.StringUtil;
/**
* PollenContext
@@ -33,7 +35,7 @@
* Mise a jour: $Date$
* par : $Author$
*/
-public class PollenContextImpl implements PollenContextImplementor {
+public class PollenContextImpl implements PollenContext {
/** log. */
private static final Log log = LogFactory.getLog(PollenContextImpl.class);
@@ -78,7 +80,7 @@
loadConfiguration(conf);
} catch (ArgumentsParserException eee) {
- doCatch(eee, n_("pollen.error.context.parse"),
+ treateError(eee, n_("pollen.error.context.parse"),
PollenContextImpl.DEFAULT_FILENAME);
}
}
@@ -142,7 +144,7 @@
}
} catch (Exception eee) {
- doCatch(eee, n_("pollen.error.context.start"));
+ treateError(eee, n_("pollen.error.context.start"));
}
}
@@ -158,7 +160,7 @@
getTopiaRootContext().closeContext();
// sendMail.stopExec();
} catch (Exception eee) {
- doCatch(eee, n_("pollen.error.context.stop"));
+ treateError(eee, n_("pollen.error.context.stop"));
}
}
@@ -172,7 +174,6 @@
*
* @param property PollenProperty
* @return value of this property
- * @throws PollenBusinessException
*/
@Override
public String getProperty(PollenProperty property) {
@@ -235,7 +236,7 @@
try {
return TopiaContextFactory.getContext(getProperties());
} catch (TopiaNotFoundException eee) {
- doCatch(eee, n_("pollen.error.context.getRootContext"));
+ treateError(eee, n_("pollen.error.context.getRootContext"));
}
return null;
}
@@ -264,9 +265,9 @@
* @throws PollenException which contains the exception as the cause
*/
@Override
- public void doCatch(Exception eee, String message, Object... args)
+ public void treateError(Exception eee, String message, Object... args)
throws PollenException {
- doCatch(null, eee, message, args);
+ treateError(null, eee, message, args);
}
/**
@@ -282,8 +283,8 @@
* @throws PollenException
*/
@Override
- public void doCatch(TopiaContext transaction, Exception eee, String message,
- Object... args) throws PollenException {
+ public void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException {
if (log.isErrorEnabled()) {
log.error(_(message, args), eee);
}
@@ -317,10 +318,11 @@
* @param transaction current TopiaContext
*/
@Override
- public void doFinally(TopiaContext transaction) {
+ public void closeTransaction(TopiaContext transaction) {
if (transaction != null) {
try {
transaction.closeContext();
+ //stop();
} catch (TopiaException eee) {
if (log.isErrorEnabled()) {
log.error(_("pollen.error.context.close"), eee);
@@ -360,19 +362,14 @@
this.currentDate = currentDate;
}
-// @Override
-// public ServiceEmail getServiceEmail() {
-// if (serviceEmail == null) {
-// ServiceEmailImpl instance = new ServiceEmailImpl();
-// instance.setContext(this);
-// serviceEmail = instance;
-// }
-// return serviceEmail;
-// }
-
@Override
public String encodePassword(String password) {
- return MD5.encode(password);
+ try {
+ return StringUtil.encodeMD5(password);
+ } catch (NoSuchAlgorithmException eee) {
+ treateError(eee, n_("pollen.error.encodePassword"));
+ }
+ return null;
}
}
Added: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenException.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenException.java (rev 0)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenException.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -0,0 +1,39 @@
+package org.chorem.pollen;
+
+
+
+public class PollenException extends RuntimeException {
+
+ protected Object[] args;
+ /**
+ * PollenException :
+ * @param eee
+ * @param message
+ * @param args
+ */
+
+ public PollenException(Throwable eee, String message, Object... args) {
+ super(message, eee);
+ this.args = args;
+ }
+
+ /**
+ * getArgs :
+ * @return Object[]
+ */
+
+ public Object[] getArgs() {
+ return args;
+ }
+
+ /**
+ * hasArgs :
+ * @return boolean
+ */
+
+ public boolean hasArgs() {
+ return args.length > 0;
+ }
+
+
+} //PollenException
Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenException.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
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-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/mail/SendMail.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -37,7 +37,7 @@
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
import org.apache.commons.io.IOUtils;
-import org.chorem.pollen.PollenContextImplementor;
+import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenProperty;
/**
@@ -64,7 +64,7 @@
/** logger. */
private static final Logger log = LoggerFactory.getLogger(SendMail.class);
- protected PollenContextImplementor context;
+ protected PollenContext context;
public static final String EXTENSION_MAIL = ".mail";
public static final String EXTENSION_INDEX = ".index";
@@ -74,7 +74,7 @@
protected volatile boolean stop;
- public SendMail(PollenContextImplementor context) {
+ public SendMail(PollenContext context) {
this.context = context;
if (log.isInfoEnabled()) {
log.info("P:[ SendMail ] init");
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceEmailImpl.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -6,9 +6,13 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
+import org.chorem.pollen.PollenContext;
+import org.chorem.pollen.PollenException;
import org.chorem.pollen.bean.PollenEmail;
import org.chorem.pollen.bean.PollenEmailImpl;
import org.chorem.pollen.entity.UserAccount;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
/**
* ServiceMailImpl
@@ -25,7 +29,35 @@
private static final Log log = LogFactory.getLog(ServiceEmailImpl.class);
+ private PollenContext context;
+
+ public void setContext(PollenContext context) {
+ this.context = context;
+ }
+
@Override
+ protected void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException {
+ context.treateError(transaction, eee, message, args);
+ }
+
+ @Override
+ protected void treateError(Exception eee, String message,
+ Object... args) throws PollenException {
+ context.treateError(eee, message, args);
+ }
+
+ @Override
+ protected void closeTransaction(TopiaContext transaction) {
+ context.closeTransaction(transaction);
+ }
+
+ @Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected void executeSendEmail(List<Object> errorArgs,
PollenEmail pollenEmail) throws EmailException {
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-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -3,16 +3,15 @@
import java.util.List;
import org.chorem.pollen.PollenBusinessException;
-import org.chorem.pollen.PollenContextImplementor;
+import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
-import org.chorem.pollen.entity.PollDAO;
+import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.Choice;
import org.chorem.pollen.entity.Comment;
import org.chorem.pollen.entity.Poll;
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.entity.PollImpl;
import org.chorem.pollen.entity.UserAccount;
-import org.nuiton.i18n.I18n;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
@@ -29,7 +28,35 @@
*/
public class ServicePollImpl extends ServicePollAbstract {
+ private PollenContext context;
+
+ public void setContext(PollenContext context) {
+ this.context = context;
+ }
+
@Override
+ protected void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException {
+ context.treateError(transaction, eee, message, args);
+ }
+
+ @Override
+ protected void treateError(Exception eee, String message,
+ Object... args) throws PollenException {
+ context.treateError(eee, message, args);
+ }
+
+ @Override
+ protected void closeTransaction(TopiaContext transaction) {
+ context.closeTransaction(transaction);
+ }
+
+ @Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected Poll executeGetNewPoll() {
return new PollImpl();
}
@@ -53,91 +80,87 @@
@Override
protected void executeUpdatePoll(TopiaContext transaction,
- List<Object> errorArgs, Poll poll) throws TopiaException {
+ Poll poll) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected void executeSavePoll(TopiaContext transaction,
- List<Object> errorArgs, Poll poll) throws TopiaException {
+ protected void executeSavePoll(TopiaContext transaction, Poll poll)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected void executeDeletePoll(TopiaContext transaction,
- List<Object> errorArgs, Poll poll) throws TopiaException {
+ protected void executeDeletePoll(TopiaContext transaction, Poll poll)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected void executeDeleteChoice(TopiaContext transaction,
- List<Object> errorArgs, Choice choice) throws TopiaException {
+ protected void executeDeleteChoice(TopiaContext transaction, Choice choice)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected void executeCreateUpdateVote(TopiaContext transaction,
- List<Object> errorArgs, PollAccount person) throws TopiaException {
+ PollAccount person) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected void executeDeleteVote(TopiaContext transaction,
- List<Object> errorArgs, Poll poll, PollAccount person)
- throws TopiaException {
+ protected void executeDeleteVote(TopiaContext transaction, Poll poll,
+ PollAccount person) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected Poll executeGetPollForUpdate(TopiaContext transaction,
- List<Object> errorArgs, String pollUId)
- throws PollenBusinessException, TopiaException {
+ protected Poll executeGetPollForUpdate(TopiaContext transaction,
+ String pollUId) throws PollenBusinessException, TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected List<Poll> executeGetAllPolls(TopiaContext transaction,
- List<Object> errorArgs) throws TopiaException {
+ protected List<Poll> executeGetAllPolls(TopiaContext transaction)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected List<Poll> executeGetRunningPolls(TopiaContext transaction,
- List<Object> errorArgs) throws TopiaException {
+ protected List<Poll> executeGetRunningPolls(TopiaContext transaction)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected List<Poll> executeGetPollsByUser(TopiaContext transaction,
- List<Object> errorArgs, UserAccount user) throws TopiaException {
+ UserAccount user) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected List<Comment> executeGetComments(TopiaContext transaction,
- List<Object> errorArgs, Poll poll, int startIndex, int endIndex)
+ Poll poll, int startIndex, int endIndex)
throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected List<PollAccount> executeGetVotes(TopiaContext transaction,
- List<Object> errorArgs, Poll poll, int startIndex, int endIndex)
+ Poll poll, int startIndex, int endIndex)
throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected Poll executeGetPollForResults(TopiaContext transaction,
- List<Object> errorArgs, String pollUId)
- throws PollenBusinessException, TopiaException {
+ protected Poll executeGetPollForResults(TopiaContext transaction,
+ String pollUId) throws PollenBusinessException, TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected Poll executeGetPollForVote(TopiaContext transaction,
- List<Object> errorArgs, String pollUId)
- throws PollenBusinessException, TopiaException {
+ protected Poll executeGetPollForVote(TopiaContext transaction,
+ String pollUId) throws PollenBusinessException, TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
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-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -6,7 +6,9 @@
import org.apache.commons.lang.StringUtils;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.PollenBusinessException.PollenExceptionType;
+import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenDAOHelper;
+import org.chorem.pollen.PollenException;
import org.chorem.pollen.entity.PollAccount;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountDAO;
@@ -27,7 +29,35 @@
*/
public class ServiceUserImpl extends ServiceUserAbstract {
+ private PollenContext context;
+
+ public void setContext(PollenContext context) {
+ this.context = context;
+ }
+
@Override
+ protected void treateError(TopiaContext transaction, Exception eee,
+ String message, Object... args) throws PollenException {
+ context.treateError(transaction, eee, message, args);
+ }
+
+ @Override
+ protected void treateError(Exception eee, String message,
+ Object... args) throws PollenException {
+ context.treateError(eee, message, args);
+ }
+
+ @Override
+ protected void closeTransaction(TopiaContext transaction) {
+ context.closeTransaction(transaction);
+ }
+
+ @Override
+ protected TopiaContext beginTransaction() throws TopiaException {
+ return context.beginTransaction();
+ }
+
+ @Override
protected UserAccount executeConnect(TopiaContext transaction,
List<Object> errorArgs, String login, String password)
throws PollenBusinessException, TopiaException {
@@ -91,51 +121,50 @@
}
@Override
- protected void executeDeleteUser(TopiaContext transaction,
- List<Object> errorArgs, UserAccount user) throws TopiaException {
+ protected void executeDeleteUser(TopiaContext transaction, UserAccount user)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected List<UserAccount> executeGetUsers(TopiaContext transaction,
- List<Object> errorArgs) throws TopiaException {
+ protected List<UserAccount> executeGetUsers(TopiaContext transaction)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- protected PollAccount executeGetNewList(TopiaContext transaction,
- List<Object> errorArgs) throws TopiaException {
+ protected PollAccount executeGetNewList(TopiaContext transaction)
+ throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected void executeCreateUpdateList(TopiaContext transaction,
- List<Object> errorArgs, PollAccount list) throws TopiaException {
+ PollAccount list) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected void executeDeleteList(TopiaContext transaction,
- List<Object> errorArgs, PollAccount list) throws TopiaException {
+ PollAccount list) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected List<PollAccount> executeGetFavoriteLists(
- TopiaContext transaction, List<Object> errorArgs)
- throws TopiaException {
+ TopiaContext transaction) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected PollAccount executeGetNewPerson(TopiaContext transaction,
- List<Object> errorArgs, UserAccount user) throws TopiaException {
+ UserAccount user) throws TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
protected PollAccount executeGetPerson(TopiaContext transaction,
- List<Object> errorArgs, String accountUId)
+ String accountUId)
throws PollenBusinessException, TopiaException {
throw new UnsupportedOperationException("Not supported yet.");
}
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-08 09:42:50 UTC (rev 2967)
@@ -4,6 +4,7 @@
pollen.error.context.rollback=
pollen.error.context.start=
pollen.error.context.stop=
+pollen.error.encodePassword=
pollen.error.serviceEmail.getNewEmail=
pollen.error.serviceEmail.sendEmail=
pollen.error.serviceList.createAccountForPersonList=
Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties
===================================================================
--- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-08 09:42:50 UTC (rev 2967)
@@ -4,6 +4,7 @@
pollen.error.context.rollback=Erreur lors de l'annulation de la transaction
pollen.error.context.start=Erreur lors du d\u00E9marrage de l'application
pollen.error.context.stop=Erreur lors de l'arr\u00EAt de l'application
+pollen.error.encodePassword=
pollen.error.serviceEmail.getNewEmail=
pollen.error.serviceEmail.sendEmail=
pollen.error.serviceList.createAccountForPersonList=
Modified: trunk/pollen-business/src/main/xmi/pollen.properties
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-08 09:42:50 UTC (rev 2967)
@@ -2,5 +2,6 @@
model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Pollen\n *##%*/
#model.tagvalue.dbSchema=Pollen
model.tagvalue.java.lang.String=text
+model.tagvalue.exceptionClass=org.chorem.pollen.PollenException
#org.chorem.pollen.business.persistence.PollAccount.attribute.accountId.tagvalue.naturalId=true
#org.chorem.pollen.business.persistence.Poll.attribute.pollId.tagvalue.naturalId=true
\ No newline at end of file
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -1,8 +1,6 @@
package org.chorem.pollen.business;
-import org.chorem.pollen.PollenContextImplementor;
-import org.chorem.pollen.PollenContextImpl;
import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
@@ -10,6 +8,12 @@
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenContext;
+import org.chorem.pollen.PollenContextImpl;
+import org.chorem.pollen.service.ServiceEmail;
+import org.chorem.pollen.service.ServiceEmailImpl;
+import org.chorem.pollen.service.ServicePoll;
+import org.chorem.pollen.service.ServicePollImpl;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.service.ServiceUserImpl;
import org.junit.Ignore;
@@ -33,7 +37,7 @@
private static final Log log = LogFactory.getLog(TestManager.class);
- private static PollenContextImplementor context;
+ private static PollenContext context;
public static void start(String dbname) throws IOException {
log.info("## START ## : " + dbname);
@@ -63,7 +67,7 @@
getContext().stop();
}
- public static PollenContextImplementor getContext() {
+ public static PollenContext getContext() {
if (context == null) {
context = new PollenContextImpl();
}
@@ -74,10 +78,22 @@
return getContext().beginTransaction();
}
- public static ServiceUser newServiceUser() {
+ public static ServiceUser getServiceUser() {
ServiceUserImpl instance = new ServiceUserImpl();
instance.setContext(getContext());
return instance;
}
+ public static ServiceEmail getServiceEmail() {
+ ServiceEmailImpl instance = new ServiceEmailImpl();
+ instance.setContext(getContext());
+ return instance;
+ }
+
+ public static ServicePoll getServicePoll() {
+ ServicePollImpl instance = new ServicePollImpl();
+ instance.setContext(getContext());
+ return instance;
+ }
+
}
Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java
===================================================================
--- trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-business/src/test/java/org/chorem/pollen/service/ServiceUserImplTest.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -58,7 +58,7 @@
@Test
public void testExecuteGetNewUser() throws Exception {
TestManager.start("testGetNewUser");
- ServiceUser serviceUser = TestManager.newServiceUser();
+ ServiceUser serviceUser = TestManager.getServiceUser();
UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
Assert.assertNotNull(user);
@@ -73,7 +73,7 @@
@Test
public void testExecuteCreateUpdateUser() throws Exception {
TestManager.start("testCreateUpdateUser");
- ServiceUser serviceUser = TestManager.newServiceUser();
+ ServiceUser serviceUser = TestManager.getServiceUser();
UserAccount user = serviceUser.getNewUser(Locale.FRENCH);
user.setLogin("hsimpson");
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -16,18 +16,16 @@
package org.chorem.pollen.ui.components;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.MD5;
import org.chorem.pollen.PollenBusinessException;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceUser;
+import org.chorem.pollen.ui.services.PollenManager;
/**
* Formulaire d'identification. Formulaire que l'utilisateur doit remplir pour
@@ -72,6 +70,9 @@
@Inject
private ServiceUser serviceUser;
+ @Inject
+ private PollenManager manager;
+
/**
* Methode appelée lorsque l'utilisateur s'identifie
*
@@ -81,7 +82,8 @@
// Récupération de l'utilisateur identifié
UserAccount current;
try {
- current = serviceUser.connect(loginComp, MD5.encode(passwordComp));
+ current = serviceUser.connect(loginComp,
+ manager.encodePassword(passwordComp));
if (current != null) {
user = current;
} else {
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -29,7 +29,6 @@
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
-import org.chorem.pollen.MD5;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.service.ServiceUser;
import org.chorem.pollen.ui.data.AddressBarItem;
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -24,13 +24,13 @@
import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.ioc.services.Coercion;
import org.apache.tapestry5.ioc.services.CoercionTuple;
+import org.apache.tapestry5.ioc.services.RegistryShutdownHub;
import org.apache.tapestry5.ioc.services.SymbolProvider;
import org.apache.tapestry5.services.ApplicationStateContribution;
import org.apache.tapestry5.services.ApplicationStateCreator;
import org.apache.tapestry5.upload.services.UploadSymbols;
import org.chorem.pollen.PollenContext;
import org.chorem.pollen.PollenContextImpl;
-import org.chorem.pollen.PollenContextImplementor;
import org.chorem.pollen.entity.UserAccount;
import org.chorem.pollen.entity.UserAccountImpl;
import org.chorem.pollen.service.ServiceEmail;
@@ -54,40 +54,37 @@
}
/**
- * Build the main application context PollenContext.
+ * Build the application manager.
*
- * @return PollenContextImplementor type to use injection in services build
+ * @param hub to register the manager for tapestry registry shutdown
+ * @return PollenManager
*/
- public static PollenContextImplementor buildPollenContext() {
- PollenContextImplementor context = new PollenContextImpl();
- context.start();
- return context;
+ public static PollenManager buildPollenManager(RegistryShutdownHub hub) {
+ PollenManager manager = new PollenManager(new PollenContextImpl());
+ hub.addRegistryShutdownListener(manager);
+ return manager;
}
- public static ServiceUser buildServiceUser(
- @InjectService("PollenContext") PollenContextImplementor context) {
+ public static ServiceUser buildServiceUser(PollenManager manager) {
ServiceUserImpl service = new ServiceUserImpl();
- service.setContext(context);
+ service.setContext(manager.getContext());
return service;
}
- public static ServicePoll buildServicePoll(
- @InjectService("PollenContext") PollenContextImplementor context) {
+ public static ServicePoll buildServicePoll(PollenManager manager) {
ServicePollImpl service = new ServicePollImpl();
- service.setContext(context);
+ service.setContext(manager.getContext());
return service;
}
- public static ServiceEmail buildServiceEmail(
- @InjectService("PollenContext") PollenContextImplementor context) {
+ public static ServiceEmail buildServiceEmail(PollenManager manager) {
ServiceEmailImpl service = new ServiceEmailImpl();
- service.setContext(context);
+ service.setContext(manager.getContext());
return service;
}
- public static ServiceImage buildServiceImage(
- @InjectService("PollenContext") PollenContextImplementor context) {
- return new ServiceImageImpl(context);
+ public static ServiceImage buildServiceImage(PollenManager manager) {
+ return new ServiceImageImpl(manager.getContext());
}
public static void contributeApplicationDefaults(
Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java (rev 0)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-08 09:42:50 UTC (rev 2967)
@@ -0,0 +1,100 @@
+/*
+ * *##%
+ * Wao :: Web Interface
+ * Copyright (C) 2009 - 2010 Ifremer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * ##%*
+ */
+
+package org.chorem.pollen.ui.services;
+
+import java.util.Date;
+import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
+import org.chorem.pollen.PollenContext;
+import org.chorem.pollen.PollenProperty;
+import org.nuiton.util.ApplicationConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * WaoManager
+ *
+ * Created: 24 nov. 2009
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class PollenManager implements Runnable, RegistryShutdownListener {
+
+ private static final Logger log =
+ LoggerFactory.getLogger(PollenManager.class);
+
+ private PollenContext context;
+
+ /**
+ * Constructor of WaoManager. It needs the WaoContext to start and stop.
+ *
+ * @param context used to manage application lifecycle
+ */
+ public PollenManager(PollenContext context) {
+ this.context = context;
+ }
+
+ /**
+ * Called to start the application.
+ */
+ @Override
+ public void run() {
+ context.start();
+ }
+
+ /**
+ * Called to stop the application
+ */
+ @Override
+ public void registryDidShutdown() {
+ context.stop();
+ }
+
+ /**
+ * Context to inject in new service instances.
+ *
+ * @return the WaoContext of the application
+ */
+ PollenContext getContext() {
+ return context;
+ }
+
+ public String getProperty(PollenProperty property) {
+ return context.getProperty(property);
+ }
+
+ public ApplicationConfig getConfiguration() {
+ return context.getConfiguration();
+ }
+
+ public Date getCurrentDate() {
+ return context.getCurrentDate();
+ }
+
+ public String encodePassword(String password) {
+ return context.encodePassword(password);
+ }
+
+}
Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-03 10:41:29 UTC (rev 2966)
+++ trunk/pom.xml 2010-04-08 09:42:50 UTC (rev 2967)
@@ -309,13 +309,12 @@
<!-- customized versions -->
<!--javadoc.version>2.4</javadoc.version-->
- <topia.version>2.3.1</topia.version>
+ <topia.version>2.3.3-SNAPSHOT</topia.version>
<eugene.version>2.0.1-SNAPSHOT</eugene.version>
<i18n.version>1.2.1</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
- <nuiton-utils.version>1.2.1-SNAPSHOT</nuiton-utils.version>
+ <nuiton-utils.version>1.2.2-SNAPSHOT</nuiton-utils.version>
<processor.version>1.0.2</processor.version>
-<!-- <chorem-commons.version>1.0.0-alpha-2-SNAPSHOT</chorem-commons.version>-->
<!--Multilanguage maven-site -->
<siteLocales>en,fr</siteLocales>
1
0
Author: tchemit
Date: 2010-04-03 12:41:29 +0200 (Sat, 03 Apr 2010)
New Revision: 2966
Log:
Evolution #151: Utilisation i18n 1.2.1 + goal tapestry-bundle pour synchoniser tapestry et i18n
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-02 14:27:47 UTC (rev 2965)
+++ trunk/pom.xml 2010-04-03 10:41:29 UTC (rev 2966)
@@ -311,7 +311,7 @@
<!--javadoc.version>2.4</javadoc.version-->
<topia.version>2.3.1</topia.version>
<eugene.version>2.0.1-SNAPSHOT</eugene.version>
- <i18n.version>1.2</i18n.version>
+ <i18n.version>1.2.1</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
<nuiton-utils.version>1.2.1-SNAPSHOT</nuiton-utils.version>
<processor.version>1.0.2</processor.version>
1
0
Author: fdesbois
Date: 2010-04-02 16:27:47 +0200 (Fri, 02 Apr 2010)
New Revision: 2965
Log:
set mime-type for binary
Modified:
trunk/pollen-business/src/main/xmi/pollen.zargo
Property changes on: trunk/pollen-business/src/main/xmi/pollen.zargo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r2964 - in trunk: . pollen-business/src/main/java/org/chorem/pollen pollen-business/src/main/xmi
by fdesbois@users.chorem.org 02 Apr '10
by fdesbois@users.chorem.org 02 Apr '10
02 Apr '10
Author: fdesbois
Date: 2010-04-02 16:21:52 +0200 (Fri, 02 Apr 2010)
New Revision: 2964
Log:
Use topia final
Modified:
trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
trunk/pollen-business/src/main/xmi/pollen.zargo
trunk/pom.xml
Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java
===================================================================
--- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-03-31 08:29:03 UTC (rev 2963)
+++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-04-02 14:21:52 UTC (rev 2964)
@@ -266,7 +266,7 @@
@Override
public void doCatch(Exception eee, String message, Object... args)
throws PollenException {
- doCatch(null, eee, message);
+ doCatch(null, eee, message, args);
}
/**
@@ -298,6 +298,7 @@
}
}
}
+ throw new PollenException(eee, message, args);
// PollenBusinessException must be managed (catch and throw) when needed
// if (! (eee instanceof PollenBusinessException)) {
// throw new PollenException(eee, message, args);
Modified: trunk/pollen-business/src/main/xmi/pollen.zargo
===================================================================
--- trunk/pollen-business/src/main/xmi/pollen.zargo 2010-03-31 08:29:03 UTC (rev 2963)
+++ trunk/pollen-business/src/main/xmi/pollen.zargo 2010-04-02 14:21:52 UTC (rev 2964)
@@ -1,148 +1,146 @@
-PKx�~<pollen.argo�TKn�0��� �AQt!kcwѢA��]�4� E�9�z�^�C��(;�"��b�{�7$gX0��d�Qv��cZ�%IQ��
-�3�:�0fM+U��E1�!?�>�|p(ﳇO٪ȧس5�Ja?�%�'�����
-
-�`�萫���k,k����-Ye����t+�{�k�]�P�K����"� �9����i-+�|�l�{EͫԸG����TXn��X]��,�
-2>0n!�/�Y�+ك2�<�����/����H�F�b8�MZ�T�\d�!�����-���i˕�+��[�a�5*��e0J��!��b��<�Ό3���M�������Ճ��`Y���cy?W�$Q%���D�Ԁh��>�I<4"LUm�L��
-�������7�v�/Oi��bOC�|�8�uJ�~@iM��}%���]Pd�����,�v�̱/���_1������JN��4r�T�&sϝ<s`3힅j���+cd3z46n��k^L��o+}��w�}�[��hx6�T{p�Q���|��F:4~u>= �HurMV�21�@y�PK�,�N0/PKx�~<pollen_Modèle.pgml�]�n�8����7X,�@�)Q�6�4mw��-f���b�X�����r�,����/vIږD�H�lZ���˒m�����>����~>y���$]�9C��$^L�(Y�ޜ}����?��������oן�����aFo���}z��䌽����^�߈��t�<d�����"\��5�����p��/VY�%����z�����:����O��p�z����]�����9?G>��w3���B�������ܷ,�U>�Z��w~,������i��;�Ͼ���_ϖ��a�·df������O�?��r�8�� ��+���fw_�Ur3��܆�U��*��q�==�_�����!^��kW���?�Y�Ln�Y,����2�}s�/J�o���n���R^x=M�����$��7����K7g������[������1�����s�x����<.�"'�7�M��˧7g�ݫ�I����������.��{wJZY��v���&��k���@D��6|�[�����TY��g�͑\%z
-�!�Wct��D$��[�bT���2+@�Pb�8�,�z����V��]L��u y���@]�u���a�c2a�~�6]�_A��<�g�,�'�7g\��o�y��d��J��@-��,�M��f�\��)vo_�q����гI���}E����}�N��ݸ}!� L��ja��;L˒j�!�A��!�k�����W�i�^d���+qm ����v��?���~�V̹�݊9��J�Yʹc�9�I�Q���.��X�sL��Q����>��Mu�s��=c�6��5i��������c��*$r0�{��bw�u��A��D������U�8�[��f���sN�j�{z{NxNw���t�m7�xOy�J�s��8BU6=�!|;�8?�@G�)��rR~�1����Fe�bVV!@��z��e+8�Έ3Ù���4RڷG���}����&
-H�*K@Z1�W�v
-u����j�j�%`Y#��0�O�4���k�k`kw��A��f�;��R��?�P�
-P{[�y���u�HO��zՂ���@ �F��<Ye0Ң-^9{�r�[�u�8$��p엖 ��M��,��ķ^N�MX���q��齊!)Jd9%f*6떗(�*/�"/=H��D2#*=��#B@��*�=O��VY�!"��,".ˀ��1B�:B��� H��/���D�W�R#@�L����\��q��Y���$�0�_��S�Q]����De2H��U۶�qO���)���p�� ���C��.�~��̋�=S�����|L��֊dd�]�2�����y�f�,��%��y����ş@okmt�����
-B�N�FF3~G5:*16IS�FϘ����x�0z�}��4<q���X��<`�|�Я�nw�`�2��}�G8F�;��!\���K�h4��2�D���-ڷ�r����F@�T�ۅ���� ��-�r�TFp����-�m����Xg��)b=�*�:���l9^*[^H�lH�:Eë:��1~�����!���w:���0�Zw��B�/�����{��B�9�,L\��(�2/Q�E^:z��Id4|W"x��wX ��r���+�#|���.��5����͛������[�Ղd��;�ٮ��a�q;.�<�d�k2nw�p�ʍ����,�(F���}ƸZ�N �D�
-'��uK�+Q;�\�T�����K��/(�҅�ӱұ�SH�F:vGoߎW�'?�N=`+��V���zӇ��]�L����m $Ŗ�x�2�'�zB6䍄�����f7|�66�%(^6�����۰�n'X'�p�����N���
-�9���n&ur�߽h�<����a��O��s���)A�����L��v2�D9
-(�3���=k��,��d3d�D |��j��a�Q:�� � �l��� ���
-�&��~O�*9�O��k3����~xh�~U�*F���*�G��짲��;��C�
-V2�d�I����yl��aΒl��-��$?h�WC��ˑ.�Q}��]J�Q{4�x�ijd���u�G`%�OA��i�e��`]�/"����5�:^Dm���ۣ�H߇�6B��v"�`�;�\��`������Ui{��&������l��l}EW�y����>�Vy�����&K̋���&��?����o�w�m麐
->�:��a}C?��x��g�0�73]��cr �|�2��2��כ�n�=�w���76Q���Y��92:����Q���a���Xz���6�'-��M�V���{�e�Q�n�)�BM��:��j�
-%��2a�6��X6� �ה�s۷�(�1n�1
-qB��n!^zUSf5e^��<WK�Dq�y R���2�XM��@�5e���5e�RS�Ř�+����Vj�<dK�P��!��e�5e�2[�)�Iቫ$C�)�N�Y�D]Y�m����7�![��<.�S��U���T���B�'ޞsZ�=��2�
-5*ru|;иE{V�m69n�Mh��ȩn797N�& ���ȳn����Um7F���M��65�VR�TnPuK�[;�L"��V
-����)9χ�A�t���ztm%ANA�\��S�}��]�ܯ��-��L�+�s}�n�j�V�4�0��K���6]/���t��*{����[��E���_�H�
-���o��m�-R��3�鞒mV ,x��c�|��Kk �H?�G����c&�?�~��g�_���8�9U\�u/͑V9�Nb��VY?S~���*f�IШP4�^���z�%T�%�ӑ�4% x���n����z����4%�s��1N��t/H�!�_7�lw�Sܟ���i��%��В�/Ȏ�ՙ��߲�+����1��hZ��٦���f�_�r��pya��(y_�dN$��l��kwݴ�>?��?��
-���hJ@�+e�*�I��f���%epbQ�_��'=�I�E6E֩�k�O�G5��,��"@LЏ�&Qb���`\��Sg�hr�k"�D�h
-�U����3?.�G��8�\�iFc�T����lu��[W��3E��Pa ؞3�I�̈́'1ZTN���h�2��X&�\o�͂�$��ǔ���ܴ۬��m6�(&��-Zn3��&Qb�2'���e��`s5M4�N%�)���{cω-���ɜ�����6���p;up�}�ƒ���A�a�o5J����CRِ���5�:�f�c�h�h��GZCᇏt��?%�m���v�x�3 ���.��^5f@!�p�fw���?��Q�����o�)������A�M}0?�sU�IL�>���R����w���ɼ��1w �RU9����'�a/��5bn#_sd��|�G��t��;�d�}[���a�9 ~d���>���{����8�� �A/��p(�~�j�F�{Kn^�s��pȋ���B�u��Y{�q�=Z���7U��hj�745�%���8KK�b���q��7��yCS��!��F��S����q��7��y}����S�r*�8@��m�w�N�+������$���l,���q��2�_Υ^%��Br�M�
-�z>5�B(<�]�������c,��L�'��J���
-rlEe�~���J��H��ڞ�Z���$W�xM��/$�Jb��:Q-F�����W����p岍 o+ۼ�Y�˶���|%�U�m��w�l�q�?�,W�
-5*���<����+��Un�:�I���ү�LWp��$X�8ɜ�2��^3~}e�B`��W������DQ�x�;U�Wƻ+���[Z��|�~��)Po=��7[Ѱ1]{�V�ug�Z%�4(&#�ܐ@��l�Ъ��*F��j�xK�Z%�5�ܠ:�q�&;.�z�
-�Rؠ��e�ci����4}��A�;P���p�� ��I�i�&���%&��hc��j��Zv�#����EBK~�n��F>��$�NT��sZ���G������NZK��~vr0̴���tfK0�̖=A�Jn���Ǩ�Ln9 ����R��X���Z�*���ϖ���x:�U��������o�?Lk�#k �݁dU��e*S������Ng��.�|�:ݑ�7��Q�����{c�ʭ0�:w$�
-�r��2���4a�b}u+�Ǟ�R�+h�\�*u/3��U)s��r�j�:]U���綣��]}��"~ʪ�W�ϵ@�+��6����>α�#��&��6�p�Ո4�s^�Gu��R�4�s������E�VXUMf�s�^�V�a��=n�A�o�O_�j�F�z���|��b��Vq�D�;5�u�u���m��[ݱs��A�.)�[-��o�0w�l״�{�:v���h�����Z��hƟ��û���{,]��^iDT�B��z�}H��-t:��Ɋ�?|⾜�ld;�����������P0w��XNċ=%߳�Q�d���%��~�`I���Ky:s��Oe�~4��@�:<i@E�7vؼy`�d�3�D1R������|I����6<_��6�lE�h�F��$�<�! $��a���"9��AU� d��Q5��j��xOm�70�:r
-|F�bA�4\|~���c��e�/���j:M��6��:ن�q�G�N�����{��3�� ��{�X��qr���rO��I�)s��Pu|��:1|��H�ݗp�fՔQ���Ƥ6T"[�r���]Ae�Zm�Y�����ݢJ~����7�>���-��z
-��{
--��]�"�_�XvKW!iǂ��J�gz~9A�E�B~/��%i�/g!���S�Z�=Y�Q�eQ���]y�1o��=�Lj��oo!Q���#N���Iإ{z�-$���qi��R�Ոn�r�뼅D�Jrė�������x��g��Bb�_ȅ�풭p3e7.�:����/���GO�=��L��/t�L�-9*�f�)���-e���IE�:�6�
-��f�z�
-~��N*e�!�In���`��q�
-U:�*7��Q�G�����<qE�7*GۮG�m��5�2�h3��5x$���b
-�۩�����O�����!.Xqֶ �E�>أ��n�X�h��J��}@��ז�Ú��7a��x
-P7r�%�͉�6�*_k1�
-z�q/7��햐&���(���m�Pz?v�xPC�vሦN_ly��ۖJ<��nD�.�;�t�#u�_e[�B/�'<��LX�8��wڣ�y����~�����o\�;�Y݈4�4�������oZ����nV�
-�g�B��/���:�r�vu�D�q̸!n�0v��£ء:g��͵��O�ۇ��q<e��2�z�]m^���̙�߸2�R�Ӈ\�h4����W�L⏈{���]�7��V����v�
-Wu�������:zjv?����PK���qB:PKx�~<pollen_Services.pgml�\io�8��_�5E��:��)�4YH4M�bQ,�v��%C�s,��/)ɺH1�-F�v"�2�rf8O>~}��[Fn�O`,$�ہ���������H�O^�������Ϥ圜p�����i@7�v�x��";t�8�Z��V8V� �r\kZ�q�-��G8\�x���_}�8��(z���HWG#�m42и��:�cb�f��Ȕe�H.�����)���.Qx��(�8!���0X-�]��\^��''Wy�c�,�աD_�%�K�|s#��Cә�E�UD�E~X�o.��ʯ�%
--z�h} �<�i�>�M�f�0h�����m��r�H�iK�!��Oav���y��m;��p:��qq~3���'*���_{����:�w/C���(�:,m&m!����=T�b��q?@u��Pܸs|3x�-7ȝ��退�n�t��W�N��j�$�0�H�v�9
-�'1����?�%�V�p�6hf�P�#�����2��)�u�
-��yP4����q}�9���nf�'��r'@�Z��2� �m� �I'$�~x��Y��OA�a/��.�<מ�),o�<�i��)�B�YE؝�����SD���~E_�z&}9'
-�u|H/'�@W���A�Ƀ��0��ҍ*�ٝ���9�� {w�u=�<��(s0�!,��$
-<>�WB��"�f^�S�����{�J3u%P7�ė�Lۮ|�"�%��̗�v?%�΄���^���8s�9�X�`�ӈ���[����<Ɏ9^�U�d��<�OOЋ3r��0l��A����%LK��7ȭ���4��s�?�;:u�!I�9��"{p@�����$o)ލqWE��,:�����*<�o�yxM<'i��O�_-�m�ׅ�+��@<>�n7��®�콇=��A���M!�:k�(=�9�7I���=�n�D���=4z�c�{����H~j�ol;X��1@� g��x��D$� � �����Dt@�J?.b:H�O?�dlĤ\�w��8t�y��S\yc����ʹ��Q��8ɽp#LWC�q!Z�)-�#��aLm�$MH��PeG����5)_V�O��N���PcG�
-M1ݝ���W
-V�PC�/���&���TuS�B�����F%ga+��}ݓ��C�;��F��nF�0M/�fk
-�~\SHc���+�y�8�����x
-b�/(Zy�`�,�.�b�l�3��Y���7�ƘيPI.n�
-ߠ�P#T*|�j�9���Q��9�Ty()�6+�(w;�S�(���3�e+���`����5z7Кޭl7- �η)<��
-0���u��� ��
-0�7���^N/z�U�sC�`$oU�5�G}g�7PҼ�g�|�
-f�n��躀H�����d�����w(ϥz���P8��C!��~V����_M�Vb��F��
-��l����
-0�7�X)�RL���ہ�v@n��Y�8\ZQt��̱����Ϯ�㪌�|����"%�*�`��Ѣ%`�r
-��4 �E,1
-I
-y[41��Gi������7,��i�TTEu1;2��[��&1�e$SK7u�u���~8Ĩ�B��G�6вFa��`r�җc��-!P清��2��[�A�&,<A3����%����9u0rJ���v5��S|���V�P�\BXLx��y���D��l�rƄ���-̒1g^`[�e_��2�GK��T�m���|���vj� �. =.�M���x�ڬ�@�ꈮ�ZH��rx+��������Rm�5|*��ufk�`���ڎ&Fٌ�\�%�i�U0%��V��؎�@� �{^��L��/[���B�
--�(�np$�rw⭔h!S�e`�<4�����a��j���[��Qg��H��la�¯&��Vic��B�zu_��sUi!S��z�E^E�ΫlU���Z���B����').H՞",�B�L�Z��XW��/Q~��N<� ��f�ȏ�-;B�*��4��'��vU+��Ii<,��-�_�J���/���PK"&�'GUPKx�~<pollen_Context.pgml�[o�8����NS'-�ɴk���v��n�4M'Ba#�]������ؐ�M{Q�L��1��y^?���7���r�IƳA�Ԏ�g^<g�����]��(o�ώ�8�t|���TI�������G��zc:�@���� ����� �C%��n@�i/�.
-�RJ��ܛ���?Gn��,���5�n����"U�Z�5�t�=D��帾ovmUU���/��<S��̝�A�8�Q��v�
-��( �<�ϼuY�������z�[�|������
-���K'_�4Ex�Q�_�P��&�_B|=P_� &.�o������y'���fu�.�]���oB�=��U��|�PцF��{q�A�z��fp�W�.J�ʣ��~�S���QB�+����w�(#أ�,�p��^AƯA�_�xS=��t2��˒ � �G���ZXMQ-�R��zL��*��;��5�g�.E��Y����^iv4�D�P-#��a^��\ =���xTR_#�F�,�)P� 7,��)�" &*|��⃰$A�� ��
-B]'Ea/?�\:��Q��!u��t2 +�Gq4
-Y�i��!Z!��<��zc������};�RI�PߣW����d=0?��_ܫ���Z=��f�eHKq��,ø��yEx������%g��O�puO��)�?S6��T6]�iS����6�]ڜJoo�6�R�P�Pj���QT�v��8CB�ԥ��g��{Ŵ�^�:G��
-ӸNOF�\���ݴV_��5�zOk�� �Z�L�렩O�->`�F�;���`�И/;R��I�-j��«8WENʆ��BH��2�l06`D���8�8kb�[�=���d}���0b:k�l��A�L� [mӛ�$��/�L�3��J�Y�� �� �bF��ʒ11q����q���J*�V*,I���=ʢS�#��`����[�Ȑ���&�
-��������Jĝ6�5U��}�,S3v�����n�^�d|��?
-��)!]Xn��T��m��|����2W6c���R�Ufq���Bs\?.��*sq��T��VkY�ʕ�2����#��hc�8�5r�+<o�;�w�pxQ�+���{ ������-�L�2$Q�������y)�h��2�ϦI��Y�6�m�+τ!'W:m[���r$��u�p֓:�~Rw/�=5��c��F�_nV�֍���H0̅l�$__�~��ŌG0����}&�������-_�?�|��K��-��{<����3P7��8��:��s����S�� ����Y\e��_ֱ��'�k�=2��uS`h
-�%�=I_~<��kQ��sh��=�г�A��zm��bx��l�WSk�5�� N�O�{��V�2����b�]�zX*k��Ƒ-������7��
-�n%�F�FU�oT���ѡ�����
-E���mä�`����=� ��Ҏ��ōzb�:�L�r�ņ���X�{v �V:gP�O�LG�8ZZ�H&�.0TE��ٷ2VH�gc.E-yZ��w!{�]
-]p)���'�,
-���vjQ�
-��R<�)g�K1��������������
-�6OB߬'�dM��\��-�G��Dz$t���ɚ.y�)���ӑП�#asǂ��
-|���%���.B.�[�5U��[Cuܞ�� �#.B�f"��#���qBP��x{�d~[���
-��V�p��s
-g���ɲZ�p�S���T8c'��qK��/Y�pF��i�8������
-S�8���d0�m0sT�0��mQ�IL�lSI��J��V��$��[�3�}O�O�~+̺��&���`�^d�d����7xg ��������Պ�)���|���O��H�|�X�?����U#L��i4|�PK�M\@k<APKx�~<pollen.todoeO�j�0<�_��.YnkW6�M��{��Xk#P�ERL?�5%Ѕeg��aV�/�,`�ƙ�H�3��Tz���ٝ�HɾI����Н?�ģBҞ���J�H��*%a%�u�|��
+PKT<pollen.argo�TKn�0���@�AQt!kcwѢA��]�4� E�9�z�^��H��g�Mh1�=�<�3,��D6�T(�u�1�lDm8�j�:�b��^ȁr��" R8Ev�}��P��'�Ȫ,N�gP��1V�2O�.��
+�ơS!� <����A���[�"���T/{��U��)(�%�FAg�1�B��K0f�J��z>��&佢� >�F4J�aG���x�G9����2�|�G�(�R��D4J�q\l�ǑW$�&�R8ۛ4��d��~Cp꣖Z\���6��V���P/ﱁ=6(�v�AmZi+�j��؝��<[{��+�3y��Z=xn�Vϧ0!���vI�)�N&h�v���Q4��2�t �c���*�~���z �:������ͯ���S����ۙ�|������z��0��s۴���?삂��>�e�g��sǾ�n�8{�x8r-'R3;q�\Ȏ���pF�X�ܫP�Z � �o�ƭ�z͋i��P�m�����N�O��f~c��;y�oXע���L��/�η/��B]��̎��@u�PK(�:K/.PKT<pollen_Modèle.pgml�]���8�����X,�@�G�D��$��t��ff��$�b�X�-�[�n�a˝�����^�HږD�$Q6�����%���X�XU�z��o���c�\%������&�b�F�b��������ϗ߽��w������'3z�o�����'g��E�Eg�
+�F����!㟖.g�r���E�O���ex���,��k�-��l��/��������ջ�5�s�:�����9���톯�om/oo�W�eY�����rϾ��c��o�~N����y|��%=�z�L��w>$3kw��?�~
+���@�����_N���_��χ0������y��6���VY�����!���_�X?��2d_��]H?=�!̲er��b�t�{��훳}Q�~��t���T���i:O�oξ�%Y��A���;._�9���fN���o�~X&�ao_}/�ܜ[��,\��qI �H��o���^>�9���^}M��^`�?�.Nfw=ػS�Ȫ��%���5�|���D"���ћ�r]X��}��B�?K�lN��k� ����%��ت@��B
+E�UR��:x�9e��c�\5�\/�`��[&��㰥q�8p��4Kg� ���;���
+j���8�d�<��9㶭8}��#�$��U�jI���^e�m2
+7�:^�I�{�������M��?��+�����v��������c��V��aږTc
+!
+��a\����t>��N��"@U,\Ik�X�������!\f��۷f�E���a�Wf�R����Mf�b�g�pi��2��c�FG��Z����*6�6%��{.�\m��Ac�2ݗ�5����8KU1H�(`��̓�����C��b�.e�9�M���8�S�������9��Z��ޜ���O:�D&�G�I'�S�tIp.p�F�d���h�q}�G�)��rQ~�1����Fm�bV� �v=�IJ��>e���@;
+@#U�}� ��}����&
+H۪JdD�!����B�k�<j��m�r Xֈ5�:����&M�q�h��k�����fP?�Y���Q�6��j�jPk=�����>]�Z�vЀw���`tzpϓU#-�e��W����V�e�3�'*��!ȋ�B�&�D��r�[/'�&,J��8JT��^E��%���2�u�KgU�\Q��$B�D�������! Fd��=O��VU�!"��,"ð�a���"$E�C�zQmH� ����"d:@�L��sp�l\W�j�$��h�Ҍ��W�� *�AG��ڶ}�{j}�H�W�(�(��a�eE��tIG�]ʼخgJQ�?ї�iծ"�dW�,(����S\F���]�z��O�PH_� ���FG���({� �852���;z��QI�)H��=cJ^t�������#����Q���F`u��y�B���~w�k���.ϳ<�1��9��j�5]jF�$��&�^�hoѾM����4"�2�.���7�{�E[��hα1X�E�M��R���1��c=�t�Zh�/�W^H�l(��^չ-��;$���t�+�9<|�YֺC�_��=�}(ޫ��w��qg�`�J�Dq�u��.����w�X�NR �Ồ�{��J���:���B?�wX ������P���`��y����w�!���t�!z��y���v�l�6�;�暌�nܺr�b%n'7���qs�1n���� ���j�R�C�J�NQW7U�W��p�%��TuV�B
+��ұ�SDੋt����O�!��z9�T�ǩ����2���4�>%H�(|��(��((��jedN���"l��1���l�D��<��xو�W�;o�#��W�������i� �zA@�8g��sA� ��N��������8�Ǹ>�|U��a����j�ꗉ>��NƘ(��{�.�f��d1��_>�,ك' �����Dž���(�dM�ڄ?l6�o���Q�]��~�'G���x��UBY��tT
+,ݯ�Q����Q%����TuP�2c%~�WB�J��3)?�v)�c}s�ds�l�$�)@c�� G�dF��w)GU�q!���&�%���Y�~V2�ā0��VYF�
+���"���Ps��E��z�!�=���}�mcD~��h'��]�zG�k6�U� ��y��#mO������{6W�(���ӯ�`���xL����Yb^�=��_R���c}+ �6xׯ-]�࣪s��7���W�y�
+��e��AV}L.�OS�^S%�����n�<��Ny��&�_mz���^��h2sT������d�r��M�I��զg�J
+��=��CycET���aaO��}@��)+H��{�<�Y�<fmX�'�w���۾=E��yp3�Q��
+n~p�ҫ=e����+���jcI�(β.��
+t���6��LV��=e� ��{�leO�W6c�"@�Џ=e����C�4���Z,k�S���Sf{�$CRx�
+����]��,M�n[�mv[7o�C�歹]X�歫d[�U&�7
+��y{�na��6� R��Q���ہ�-ڽ�l��q6��t#�:���8�M@�%h��g�nK���nL-��xKmj���ƩڠrKot5��c��Bd+�q�C����q� z��f�][I�S�ƪV����}_�:�K���S�ח wEw��Bc�P��*�&���C�D�=��D�M��i�1]f���$:Ƭ�V�x��>z�4������Dwq��+�̡B��b��!�2�����?����~�G:��ل��߬����}�*�}N��~]�Ks�U>��FL��ϔ_q{���au����?��Y�@MY�=x�)I�ۈ��w�������Et�X��h��K�qե{!�U����`㸓���L��,�`-�_4��V����0���_�-���/��y����W�6�^���ZV��5\^,tkH^����7��ǥ0k?�ڝE7�s���m�Ə,tõ/��(�P�JY���m!��S#�Ii�Xl�/j�I���$�"�����5�uϣ�D�j������#�I��f
+h����#�&"���(F��c��̏�����u-� Wm�ј&�i��n
+[]D�s��U��(�LѰ�.�1�=>cx�-� wb���27&oюe��L�\o;͂�$��ǔ���S�iV.Z��4X�fL-��xKm�(1LYT&�ۗ�q����U'�`��콱���xA��ɜ�\�������e#�N��>B����A�a�9�jl�"J���!U��ju8͒Ǹ�n�Тi5�>��"��ܷ�ګ��t�֧�qgw)\��1��;5��(&���:8�������o�)��t�q{�"'����@�U'1����SH]�.�U~#�n��F�܁�>(U�8Zփ;����0��|̑��Af< ���p��A�m
+���sp���p$�������@�[�����
+:x�V�CA�
+�8�u!���ܼ��|�("�Yׅ���Y{Ѹ�� �
+���-U�8��F�Zb����YZV������4��F��!������q�i���y�q�
+�8��<N=�,��ǡ�lm{��vį�������v^N���������Xx]8�z���ɭn �*R{�yB� ��o,�UVc �eq�<��W\�@,��3�TE�G��������
+��9��U�oLr��$��B��dF���fd�i��*}u���Wn��ͫ�߹m�*��Wr\e�F��~ڶr-������e�
+R��Q��T%�!�<_i�j��1v�����~}������&y`{ĝ�.v������+��8�ꏵ�7"����$���ݮ���]�t�k�p�W9�w���֭K}�;6KF��Ҫ��l�U�e�)7D���6�?�]
+U��I�%�oi�U�UT�?>Z�q�`����+�=`︵at�v����A�;P���p�Op��CcZ�/�%�pGw��\L>����҈#&��>GNiɗ-Z�{v��6�$��p�*G�ӢW�G?�'�e_�u�Z-�����a��O�3[��d�� �Vr�VV>F-`dr��D`8�%�}淐�|`5,]���R��l������DeT��,�U~#�aZ�Y!v�U9���L��t
+Ng��.�|���H��&t��0�} o,W�惤sG��0�CV��R���U�խ�{nK:W���*U/3N���>T�ݞ3�N��!�\4��vt����b���2�C����hyEQ������k-`D��$�Sfs7���s�k�H�Z�A-�N�C��s�byZa�n2���z��C��q�6b(}�~|�oT3@���u�������"�[�؉Awj,��)�h=E���[�عA��q��-��F�;̝#�5�bpo�c�J�,��N)
+���"�G3�L<�5��.�c�F�{҈H�B�Xz�}H�0�-8'r2���Oܗ��l�^�r�� 8P�zU}�B�
+����ɍx���{M�;�>�lsݵD݁�liz]{�a)w� b����Sՠ��8�4O�#��l�<����[�)|��fd����Ym�d��M�G��
+�ƴu�G��d�<� d��a���Mr|��%'�AGU����?�=���8��A!Ԗk�3�7M��燈N>f�^PZ�\t�2��N��"�؛]�;ن�q�G���ۃo���g���9d��qs0�i�=���=�&���=SB����S�{���} �k��2J�7R�Ԧ
+������nCeIZM�Y�����ݢJ~N����|��^~�VOj=�N�=���?�?\���w,�����S��j���3^�_N�mѿ��Kga���YHg�㔻VaO6ecٔ���WW�Bb�[(k��%���ﷷ�(�B���a`v�^x��-t�@ФkD���:o!����eo!`G��-�5^��Y�����r�f�dk�L��7n�����/���Gϸ=뺙�_�@�[qT�����Tn)/��TĬ�j3��N6����'��R&R�T�d{�
+v|�1�P���r�!}Q|T�>h��N����_�h�F�h��hc�,7��V�m��f�d1SK��p;�p;�rc��}��%'Ç�`�^�&��`��n�%�(��q�+�s�������0���{V9�Wep-�[�ޜ�l#��k-z5�A��6.��M�t�%��A��|�Aw�6���
+(�o�M<���m�pD��/����m�J<�nD�*�+�T�#u����q���� w�.V9�G�N�U7"o5��G�ت�
+����i��F���y�7��n��i���f�l�*��H��/��%�k�|��#Q��A3m�'�����(vH笽�\�
+x����>bU��9�dN��u�y2��̙��8��I��!�X4's��ɜI�q/��Q3K������;���T����\ŭw��S����w�PK��z�nB:PKT<pollen_Services.pgml�\io�8��_�5E��:��.�4YH4M�bQ,�v��%C�s,��/)ɺH1������nD]�{���'o�t���
+�q垄|;p\6�]=�=�������N�~�|&-f䄫�W_�>H=�1t��#G�;١���Ղp6��Y�$ѷ�Z�К#la��;�����
+������gE�����:��h�����ƍ���1h�#k:5��,��r��N�{R��9��Px��(�LH��,��t;�W����U.|�©e���ڗ�[���@�ca��on��xh<����ȱ(����E�c�u�@�E��$�G5����
+є��<��m�*��c�dZ���H��S�]c�z�Fi�� ��o]�ߌt8����&-��7�e���&��E��Y�[G�ͤ-D6����
+T32�=��6����o�=����[<��WM�n��j�)��P�$����0����$�r�Y@�'�d�j~.�
+�Y�T�Ȯ�f�R��!=���x�S_!�B?��&��1=��0��u��l���\�(wB+wB�tBf;��:!7�$�/��3
+|�-���Y��b�s�q/vay�M�9L#�v��K-��2��Ե�d��"�3W�'�<���ݕ'}5#
+�}rD/'�@W���A��Ƀ��(vz�F��NU��eA��a��_�#�Ù�2c�|'���s�y%D�(��E>e��`��B<'w�C�a���ƞ��i�U,Qı�0����]BL�4�܋�ݞag1g2W,���tƁbc ��(@N�cN���A��29������G�;���66(��P��c ��YM!�Al�DS�q8C�#������X��0.؊�;��ց]{A>R�㮊p2��u�����!"Q��]�:O� ��$-�ŧ�/�&��B���k�_������a7��k<{�`�aw��6�wS���;�rܶz�D�Ў�#�'ۍ� �7Y����[`�co�-��d!Q���ֶ������qƁ9��Z�P�;��ftpƅ�ttHɌ�"~��؈I��p�W8t�Y��?���Ƅ�!��Ή����(�Q��^����t����͇����]�8��6X�&�Sa��#C<G�NR�,}���#̕�Ǝv3�11#��#.����]�[dJ�\C�S4�X�b�4�ӕߨ�#l���w�iq}�G�S�l�_z�f
+����lEa�0�QH�j��0�kơ0�W�n��`��EK/��M���C�`�,�kY���7�Ƙ���\��A��F�T���Zs��mG���f_R徤�ڬ���|O�n�$w#H�(������O(;�O������ne�ْ��|c��K �#x+�_�[*��~(��x��Q��ӋN}��\S��[uM�Pߙ�
+�4oe��P��n�荮�Do`���8���4�c;����K���z����Pv��
+u�7���J,�٨ѽ���՝"�F��+EW��5m^��'�����<�����>˙ca��]U�U���A�7>�HI��,X|~�h �C�!
+�U��hbx���0C�"ް(V �ARQ�1�h��o����|D���L-�4,b�
+NXP���^1��XC��C��1�g���4$aaSFB�� ��(!�x�s�.݄�gh&��8���3s2;�!��G,���;='f��k�
+�44ޓ��"��J��U!N���*G}A+� c"�&���<�˾��d�O�fA�4������fsܶS��oI�q�mԗF���fU�7PGt��B����[af�@�Um�j� ��S��nV�H͟�[���(���k�pk�ي݈���0���Y�gA����l`?�����R�G�*7���P���,dʳ��:����R}��U�:�x�h��+�Y��
+mUTӨ��KTy�
+-d*�ը��¶(���E��*��W�ЖX��Q��$�Ũ�S�%ZȔhYkPk��{r��&�"��f�ȏ�-9B�"����<hrVQڛ�'��vE+��Y)<,��[Ƚv�>�{���PK�{"CUPKT<pollen_Context.pgml�[o�8��"��NZ2�]�i�vS��V�ݤi�N��FbN�N���5!��!�M{Q�L���<��Oܣ7�fa�
+�I@��.�+���d��a��廞���=;���������N��
+_/.O?v��?��.�H/Lp��AD��H����'��>���cg�O�C�����.b�_��?�N��,���3�^ϲzh��!E홪9v5�9D{�i;�g�,EQ���bt�u�c���{L����g#(>�c���+�_Yս��C+g���s\�m`�찏�ԗd��#�N�I0��s��N�.&�&�_|=T^��{n������}�1��/��)=�z�=�T�<�"k<(��%� ���
+/Ch�;wIH�a�z��a0���U�%Y�q�?٥Qz�(��+����w�,��K������_�� g�|rL�t�xW%S�S
+�f�E���Z��:�WY ���p�̟e�\���gMV��{��M�,�@���zhFY�r���:�QA}��
+��(�@Q&D\�$p�\�H���A >��H��+�M�{y��r��_�� w�M%�(�p"����7C�DҏEB/p�e9�L3W�G�C��}���>��>G�Xs+%I{`vR�?VU=Lm�z�&�Xː��,AY�q£s�x�
+����ig��O�puLf��<?U6{�R6M�iS����6�Y��Roo�6�T�P�Ph���Q��v��8�@B�ԥ����B�{��J�Gy���TI��(0��`�ݠ��; 1���A뫍� r�mJ2A��'���GsC�L@���_,5��M�:���Qf7-k���+L�"'eCkb!$�a{6���Ak��F�U1����%�$j�f]Lg�l5�|�8����l�Mo�����2��0.h���L�LH3��W������cbLH���Z*�F*LI�P��"�:?⾐
+�k � �ľ�)ծ��c�1��Z#��}Y��݄��HR~ oU�{���7>w��ē�(���|�M �0�m��TʧM��j|���W��"6c���c)��/����v���U�8��q�.g��T�+�U��G2����q>k6䎗x�rw �n�n�.���8�q���qK���K����w����R0Q/ ;e��͢3���M^9ڬW�
+Bv�t�(�c��H0˫Jഓ:�~Rw/�=5��c��F�_n��ֵ�4�H0̅lP%�~1�#7��떪�9�&w\� n�r����-_
+�n���9t�0�������F� P�,b�)�euM���^��}P�7,n�e��|!�g�#3�Y7�f��_�ۗ���Ჭ\˪
+x�C�g��9�����
+۵����.�-_u��k`y�
+G�{Rs�<� ���C��!%���PYUT�ly6��W@߿y���kv�(�4Z�˂_�E�ZS���v�>^cQ��YL�t�b1ø�?�PP��b��VOtMUƪ�Y�9Xw4ÙHs�*`�*�B���-���g+� ���P��BۘCQI��y�]��r�B��� K��p(4����J��CE{�by1w(�ؙ�֜�8s�#G�^<vÜ8�9A��Gh��#��i���Z���Xv�&�Y�$?_Je��t#���FX¼1'�n��ь�3B�q{��H��q0W5��Q�����$��|>^U8�23���S8}��M��2���jV?���;�p��[*��ӛN��I|��瞾�MIB��d0kM0sTf0[�?�A�#3�ن�kq�qF�t�o�Oq�b2k�F�51����f��� � K�{�)��b�f>�6�6�t�!���|�wb.Gz�����_،}�P?3�$ʟ��g�PK�f/�X8APKT<pollen.todoeO�j�0<�_��.YnkW6�M��{��Xk#P�ERL?�5%Ѕeg��aV�/�,`�ƙ�H�3��Tz���ٝ�HɾI����Н?�ģBҞ���J�H��*%a%�u�|��
���,���\�l�v�
-l�:�L�A;��Nx�{�i7�����D�7��=�l5�^8�0�@h�@���h^PZ���ˢ����CYV�j*8�5���ӓ��LB�l�)�?�~�$?PKP����KPKx�~<pollen_profile.profile�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��qq��e��q��ÙPK7Rp:BPKx�~<
-pollen.xmi�}뗣8����+8�s:�v'��6��9��6ϩ���G�|�#@v0�/����3��J8p���<�-wwu�-�r���}��_����Ny�a����6R�(�w�����_�w�7ʿ���/���{���7�
-�ߠ�v~�����o�p;
-��#<�O0��Џo��C��i��}9@�w*cU�շ��ְ��������y�E��=B��𝢼���� �1�x���}�1;�&�C����m�H�����CCN/����_�sW�n��q�;u��F�O���>{tt�Z��Ed��;ռ�tE��M���}��������?�a?+��䟚> y��'&4=A����;%��?�����ٙ��_�����w�;��0��1���-ѥo?��s���M�����N3��4U���S�O�%�O-������TU}�f?����0]�V���o/�������}�O�� ��SĹ/~�`�����hnGq����d��b���i�l����0�2���/�W�,�ֆ�ۖ�q�j�6��4�Jxa}��ߜ��_�]f�9#��H�>R���\v���>7�u�n<�K�9�n7�o�X����()�'���i���LZ�N0|��2�l^?�O��Ω�#�D����FWmw���ƴ-��@Hx9M5�ә�a�h�c§�>Y�#�t/����s�$��KWvm�.v �+�A�����U5;ekl��c�Dy�X��������s�=��!F�o�{�9�,����{ϐ̩r�*B����F>
-ȋ����l�D����:s�1Q<4�T��AY�t�^����
-�!�Q>��г1y��MT03+Y��rU0%�m�Χ#;���������{x>��}�0���<����/v�61�0.ާȑ�l����Gލ����#r��I���&3�R~ZD�����ei� |��/%pN�����!% ���r���/����,/UM��{�ɤ����.Ȣ&q��3� �)A�nZ@3�I ��ق�(�Q��>'�m��C���0rBo��[�[���R�@����
-/�1p� �|���T�]�$)}�6��`Sx�����q���H�!�?{��_(v��83Cn�X�u�D`}�w'���fd���`���X��E�Y�mhX��`NˤI�����2x��:��G�Z'�CB�I����9`��{��(��s�}����2S�!bI�UH��c:��)!�e�i !"�����给���t��DPN�W��)��
-����I�v_����t d���%'1k[Ku�H�abXp��OK�b�؞��u$�M�Ո�k����ͅ��;��� QM�h&��s]تsB�af:�[�ÇJK�fį�0���u,~"7��L���y|��� ���U!�̨ւ�k��6�A���08� ��81�����w�$����㢌�Z`~�68/ʇN�v��B�y�ۯHH�>���l��<���._2�~�tI��m���:��>�����^ꧧn�y����Wu�}�6_<�L�f�y�.���E%�8����Z/�dz�G��#�XWȅ���3���~�_!PLD
-���?D���Y�`O{�'
-c�JHa$����w[6�{�8�����Re�Y�G>cE7t�c��2�����9�_������.�@yi�����.� �b�S��s�O�gm����#�����m���v���<�Ҡ䥑�K? �.uQ����#�x-8��љ�^%l�\3�$c�����V��!�"Z�D��)5;m�r�G��x���J�F��گ�w���Po9)C=�>y7����S�AoIM�����^��Oa���i�2�b�+�H`ᩮ���>���
-���0@/=����" LL��.���.�i5@/u��Hz>��)z>�.}���%�m�w�g�<����2sF�̙�5>v]�S=��f��%SM��v�`+}Fl���O^���v��@�j fO�ҿG���7�8�����Z$�*虥������L�cej�&##��d�]p� P�:�x#1�����P6e�|��Ā1���$���\�uf�fcV=��#���3(Cǹ��7�%��v
-L�Zp�c��m@̟^�J��'����~�>}R�s\��_5�Vm��3<��uB}�d�������5�jxU��5xp���x�G�� �eu ��*�u�nu�� �p�,�X1���!����9&ZuP#��2S�`�$�Dc���>I�`h���SU,!�?���K/���.���C�)�js�C�,�eP�R�:�T��>#��t��&��f�� �aӆ�������RM�OS���0�ޮ���.�Ar)�B�.�A�`-�T������DVΚ�W�1�;A��xpX�����5�-�`�]C�ðg�N;�Y!�#z�
-g�r�uݟ~P�H�h%d.hR?�V
-o��ҐHL4 �L�2��K��}�.�P@ne�BA��/�-��r�?��6�K��.�Z,��Z.�� �Uh�X�؞f�R0x��c �v�vٿ��ȱD��Cs"
-ULa]�ŔmC"cO�ƞx��J�N7�|�����d$PF�rm�hZ��VD*�����4h���b��pk@4Rpa��˷�&���{/K À��@#06c�ʼnH�1�;u��ß
-l���c�t�j܄[�r�ņn�vY���HY�7w�U��MG*�����mW���k��yi�5sH40J�.BߕX���.K/��(�/�.�",�(�9-�W��-���bW�o[�F�l[�����Ks�уTZy���-���p���k� ���r\a��U�楙N���]w��� ��_��۞��(�r\
-��0:�U��v;����J9�\�Hp���GÛGnw�[�M��/�]p5���MȲ��eL����'� �����0�N�qB�f�kA�\��X�N��Y�#��N�v �$J0�]p5`�s ML@/��ԝ����Ұ�����B�Wc"p1���#��>8 ���=\���;�A���>�Qtq�*_����o;p��^��_B�_��Z��t4�l �ذ��|f������+�F�bl�u���E�r\e�ĝ15� �x�dc���'��@N�M��9��7,����&���� �8����2(Cij5�PJ??�ia�@�̧�]p��_�J�)<Z���O{eu�Ab@3ݫ4��
-|�.Ѧ�_ԥ�P�����t��4jmM����5K��d���'����((���&C���r�!(�K�#(��F�|��$�L����Ê�L�����z�!<�Z�!n��i"2�ɯ��_�9���HH����P�j ���CxH,���UDǁQ$u��d�&:=+;=K@�L��&��-�64,r����[��/-G���R�z�ĕxʯ�*2�)�ߞ<���pR�w#�bؽN����4��L$̈́av*}�NFb:PO$0���0�:��~�m5 �
-���F�pB)<�����mI!�\o�k2Xݤ�mr���i&SNLK�� ���.p�!6�����Ʃ.���=h")�� ce���T(#��j�A�aj,���m�t��Ƴ������� Ԁ�z��p�,]#�� 7&�]]E�����M�M����&�¥�ԉ�Br+�U��~��k9Y���.�s)��.���nH�����Ԍ107�I<s��奚�;�mW��l���yi���s\e���rmsl%�O7�ƙ��Mi�p���va����T�O�,:��`h�@v�<��;���[��%����5v�>#'�}蔸)3�W����E�݀���-F��"HC�����$�]ҳ�v���~���g)�R+϶�J9��kM6���妚�&�㜦�ݷ�a"P]SC��sBV5��w�@+�T���]�~̇�<.��:�䑮�+��.ĊT�ʀ���������g����x_���fmt�(L��6��H+-q���Ț5h:
-c�*IadmU��
-Cy��q�:1�M�n��i�}��$f�� ��6�⁸<�9�,JLւ�=/�9�� ���u���`QPK��1�:Q��������V�^P�>}Ԥ5�!���b�U�bl0�$�EWŮ%��U�V�(c� ��c����SB�Ա���c�6Ա����|^u��E`�dQ����6�b%�.̶E?��k౧:H������ڄߊ6VQ�9-���C���n}���δ����.��Y8�sH��B��Ԫ��#���EkZ���r�uf���
-_�2y���Q���T���܆]�i�
-�Lj�V��:�v�Vp�x�Xz��FMѳn�zY�(���V�ғ��)���-x�:����:X����[p1u!8���Dz��^/�����K�Z8���w��Q��TԺ3�T=r����UAdw�z��o��s�^��Y����ЬIT,�I��U�e�<XB��ԇ�TR������v����4J���Q�>��qv&��k�e=�����~��}��<x��7�qtb�5�q�ǯap�K�&K�9�@ щ�~�Q0��Ф���B���hm�z{H`�k?V&��t��#Q�(�y�F���f�(~2���V�c�䶭�G��ر���vsS(x$���D�Z��3W5YV��^����7����<Jb:!q��(7{�>�Db��#����
-���? l����#lM�/���qi"��'�N/������Е�N2�\��e�Z�Ᵹ��<*��~���MU�V�?���|�㿀�n<�;ӭ���
-[�-}�-
-�A�4�������0��� TE�Jd�}��a��&��J�奉X{�.����rl=�ZgZ#���{G�o;e����gЩ�WA_oNMD��o���p�����~��|(u
->���!ʹ�'�� �{�!�g)G>�!W�d�!VlJ�����b���y��p�l��8RO�|YP;OLm��E4���!H&&��䍫�����`_�r�7/������ۑ���i�v;菎��#�k�88���m�w
-�h֓M|Dw|��f.��m3� ���5��\������8���m�����!>�x�4ƺj�����L�M�N �>ۀ�v�ϱ�Ca�����r�`r�;
-5�:"�b�4}�ä��jH�8�Q����t��~��:���a��}Z�-�S�iA��"ݝߺf)'���_ʩ3YB��!�
-�"jV��lK���B����;���~�o�u����x���@z������]�/� .��y���s��/�:<�w�����4�B^P�=~>�=�t�s��2o�#��%��j��)ܤ.�ǥ�)F����o��Z�)7[1�
-����(Q����"+��eo��4�
-�4Չ�����6r�_$��2AP��5���}�fMm��Wx��C_:�\j�9� �'�����{I7uA=�,@I�.R�_'N�*b���䆼rw�iw�:%%�w��M��+w�:XMuf�ݹzd�C��N5W��t`W���jǥ [��AN_�Pu�~���$6V�`1$.��Ͳ�#�p�XHTfO��I-~��݉�����L�ԏ��+�BM-���g���5�P�ՙ%V��`r*� ����h�wPj�]j��3��)�XHف���>Sb�5`����A��'Ѱ�R�$RFv09�<���8/��/6�Ƿ��
-��6�1vrAO½)y"�#����~��V�e��,;xK�.5D�ϸ;��l�+ѐ2�}����|r��ܡ�T���4�I�Js��0�n�uuv��w���O5�Vx��{�o\䨾*a1��G��,�w;�����;��1�ģ����c){GFw���}:���o��Oj$\sR��+�4r��W���bD?p]ի?%:�[T�9x`����:dg�H��\&����U��K�dit#o���&�0��1M4;3ҙ��lTf � ����w2'���}B*݈�w�tXS(m�4��jBG�F��z-j��3H��&E����$RM�6%�2�]� "� M�K{�&a|��a��W��ک��0-�g���d�b��Zɂ2c��X3?M�&�P�dz��X�(���.q��sUS��SÍ�s�]xj��Wt�
-�d3���q�ˏa�.I�c'�(�"��d�@��S��[��3.��
-�Fe����[J�E0����&fk\e��������7~*V]˔�kFDM�QO�� �;�t�zz�b!������zz[c �IS%��\K���jJ3��17$x�*��~�͋�۰�u+Q6Y�%U;K�e�"\b(�"\�"���k��N�]")C�$"��o���_D�$݉��G(n+OQH,0�k��e̳5xB��2G���L�Љe��|�Lt\U����}|)�*Ց.<$�r>��=�Y�d,#5���V��hءq�,Tskh�W�V�q���s�A�1�U[�$'o4Z�.q��UF�o+�'wJ"�-t��m �K����p6�����+C��18�Hr�q��Խe
-�E×p��^f�L;$��F�LH�MS�X�VY�Bl�W���R����&�kv8��Q�ޚ�T
-�w#�����<T*L����ZE�R%�
-�'us~�6'�u�ί�����\`m�k��--�A��`�GsL5F�Z���CT��R����&��|:<B�`ԬYW!�;ꡪ��M����^�G-�檜\鏪�"gWlcnxf*=�q���T�=�tYs�E���?��D"0�P8�C ��z_%�(�#T�؈+_��K8��h�=����%�u݈OZ@O������4ª��2s���ws����$���^�P�B�s���0i�$����]^���s�:�U�p;r�>�p�KX�u^�^��3������v2�������!�|E����7o� ~Ox�r�}�-h��w]�9�9���o�{^�C�
-�5l\ģ��=v;�Z��kO�щ����D���.����m����]��.��>���O��S殫���=)���Ȭ���u�����%�{���ȋb4�0�'�i���.|����ɸ����,1�/���-������� b� �����(@�ɩ�AD0�>�vj��_����J˶l���-�*=��ڴ
-��Ċʹ�a2�ԅʩS�M����~���9R����N�����z 8�������mB���
-ح���u��*�
-_�vqΔQ�k��wQ���GpP�+O�?$7ܥ�q�����Eه���S�����/�^�$k[q�#�k��14�����i������ Y�`�ױ����_W��g�S���0��r1ֵ��~��I5�j�ըٕԛU����tj������P�
-��p�hY$�aMaׅ�E�R�I��Iό^�.�
-!i��t'�[���Y]:����.�`�u�DU�WtI%�*�8Y���@�\*%[J#D`�?$�w�����Mb��)���ef�M<Uw��W���kW�m����4m�?''F:2/S ��c���-�!��i*+��OZ�@���s���4
-��>J�1�o�_����&�Ϭ�XZGF�v�~��*:�*�����*��(�vlI�l�����x�Q+r��#i^\�y�q���j��V,��[%bgv�T?����~4��|誛\�xAݚ����ְ�izܮ�K�#ˍ�L��^v[�H���niMG5� H�����!����v�$��CA�L!�N;��k!ĂL�q; �<�2(eD�DiV
-!nyY5$Qbd�A��t��P���TB>%{�Q9�&s,���5
-�{����4�Q�D��
-Q6^@�;���{?��A�SN�q}��G��oA�ގ�o�����b�K��d���S��O�"��
-�t�e��/?#1_��cuԉ9g��je��C�V�>���7�+�`C�.��}����Z���e���kn�偕%�� ��ԑ����\������qE|
-w�oH����I���C�@9�b����{<-��Y���9�I�C�b�'���f����?^�7$����!܇0��z.���x��=.�v�A1�N�F�{�oP���o���a�'$l?K�G��krxHݾ�}�BH^�}iӷF:B�'�7�����܅�}|9��c_��מw �:-a��F#D0Y\�N���3~��9cYY���g�����/��!.m_�c��,t��z)�V��#e�K'��ak�G�/�7K�Zr�p��\�_U�l�t�����b�=��o1�4!�<aK�y�?�q�Ct�oHFwT�(�������=�����"�3��gˍ����k�������0r��[c3��� Im$Z��C��յĞ�A�И* ht�B�a����3&���Pa���f�[R�on�!,��`K�x`f�K�T
-7]Ws,��|�=2�,2O��S� �� ����0������V}n��)G�2��q�>�Zͽ�4�5��������b���y��v����Ke�^��㴞��*�t㛥�e�����r��f7y��g#��&7��㺠(��Jp�Ij2�[�jb�e>��9i��7��
-���6��q�L�xE�����b��8��C|��c�6�{�V��8�XQ�7O�ء�� �¸x��|�Ã����e�E���Ҳ���qE���E��niէ�Z
-N�Vnq�(�ey�G��}*)+�Dx;�v�^���焻e�/-i���,t}�_t�P�ԋ�S������R�'��E%��>)�,�~� ���c;?1�|
-�R�Y��\�KO�Jѿ1�/o�t��:R�g��Zl�����)��%�sb��L_��R��8�.��fk�#�_t�g9�p�1�D��"�%DI�q�F��I�O��r
-~}F�i�M�#|���Fǘ������v�U�%eE^}w�"��������>���%ﶲ�J���4����E���1p��ƴ�lé���i�>�v��̒�X���+����e6��
-���6�5u��k��k�1
-7j�w�廤tϴT�Bt�l՞�������[���VW�&/
-���v&��t��]���wX��T�n<;� �j@�D�zҤ��Sa��CLfS�8�=��İ�D��-�]}�\^b�f��4���E��z�;�֪*�&{��n�Om�G��Z`�!y/�J7o
-�X��*�VP�����Sѳ^�Mx�?��y��/D���a9��xhc�`�b1нc�hҋ�Oٕ"�ޱX,�`�b��o)����%�O��o�(�V��[iB9YX(7���x�{�j*�fC�^!��{Y|��5ط�n���N�d��k#��N�e5� a���j���Л�d�m.�V���T�����TE�{��x��'�-Ձz]���O����B�O���D0ܖ�@
-��&�����[��[�}"�L��P}�K���4*�NL�\��C��u�"d,���WP�B��Y��0D-�j��}��#��ķ<!�F��TT���0��w1Dp�.�j����3��źF,�!4��P�.!�o2T��L�x�r6�x�r&��Άz����gU{�e�k�F�%��ZMvY΅��P�w.B��rN�y�Su1�'��e^��+(��p�����|"��@N����:�ju,���/��_��.z�c�"T���;�B(.��"i��o%�z>��S�Gk����xhn4/����4�ɀW�*A�A�U�ڰ*XiĦ`-�׆/��A��5����XiD�c%[�B�kA*�Vu�uku���(唐�k�+
-��Z���F�+
-��Y0��Jr7+
-�ĺFM N�iM��m�xXi$'��l���6+
-��Y�n#'��r�e�Y'�6as�0�&&�l����,�O� .f�rX��o�Nx{�,T��Bx{�X� o_g�(7��^s��ۊ��N� Z{'��R�Y��#�L����g,T��Bx{yd,T�G�Bx{�<,T�|��5>?v]����f3c��5Umr��y~ϻ-�Mj�<��Y?�!�ɀ��{Vp��5�h<��9+���v��?_����$�Mjm<���%�=K�><�l�/����i���x�?<-�Q��������ܤ׃��}� 䡹�s<ϯ�3���d��{�~� yҳnF �fES�e=���WY�`6���dL��ii�=�y��L��KJ/��q�&#}��͜�e�p�V�'s36
-�tPOS�d�E@��]�hnG<ƩQ��F�.r ��y7�������T�]�$cJ�'"�Z´��c?1�ҡ���z�䢹o�"����1@����b��o���)͚ڒ�Q���&���ZK!;��j=n'��@�0���47���a�v�i6{�?5S�0�=�Zg�_;E����|��]�(�^���O�{�ѓ�(^�yo�9 �����_>A����
-��76�qs;�C���/��{��_�g^q�N���{�!�"�~��>�����O�9��3L��B�˲
-
-�ȌYV��>>�vc�qf�܄�@����3>�o�4�7�k�Z[�dum�dkh$#�F������$?$z`<A�!�ߒ�����NPt��@������~����������/�PK[�n�)�PKx�~<�,�N0/pollen.argoPKx�~<���qB:ipollen_Modèle.pgmlPKx�~<"&�'GUpollen_Services.pgmlPKx�~<�M\@k<A� pollen_Context.pgmlPKx�~<P����K0(pollen.todoPKx�~<7Rp:BM)pollen_profile.profilePKx�~<[�n�)�
-�)pollen.xmiPK��S
\ No newline at end of file
+l�:�L�A;��Nx�{�i7�����D�7��=�l5�^8�0�@h�@���h^PZ���ˢ����CYV�j*8�5���ӓ��LB�l�)�?�~�$?PKP����KPKT<pollen_profile.profile�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��qq��e��q��ÙPK7Rp:BPKT<
+pollen.xmi�}뗣8����+8�s:�v'�m��s��Gm�S������6G��`�^����g���p�#�y[���
+[��J���ҽ���������|��e"������o�_���fo�y��_������'o���A����������v<m'x��`����H��������7�J��P�I��j�[E���_$UV�7��"I�y�G\�������9<A?1��:���0Fc��6���t��;|��
+�I��=4����m��>w5����'�l��d�,��ً��{����-"[���Ɲ�J��m�_���[�� �g }�;���Y�')����Ï?^4�� ".�I)���W�����?��L��;�酅)G����}_n�.}���v��������f�;Ÿ�Sd�n�NmG3�[E�mj��f��n&��[9�y��7/��t�[}v;近���:��s���?m�.���OA��
+���/w����!p2cO�uz��b�Mb��B��;�t�˰/��^ٲ�[�j[��}���̴h����R�ޜ�.���̠s"&.���Pu"�r_�s�M��܀�!K��|/����!ܰ��b�zs���@p����9�o2i�[|8�H�͇���y��?�6;����G��U��Z�ötg!��Y�Ng��1�9�A�&�d9O�ӽ�ͪέ����\ٍyp�("�l���N��++v"ʖf��c�Dy�X��������s�=��!F�o�{�9�,i���{ϐ̩r�*B����F>
+ȋ����l�@�� S�9�FE6�x���r�^����
+�!,�|ǡgb�3e0�u+Y��n�2��ɶf�ӑ�q�����i�� ��=<���S�v�q�������;t��[�S��i6Ã�xv�#�&O�]��������E�v)?-"}�GMB��e� |��/%pN�����!% ���t���/����4/UM��{��,Yd�?]�EM�yg8�A�)R�Tհ�bL-����Qe/TL�9��Z���߅�z{,��غ���\(x9h��L��"�������AR�e�V����埒�Z��OI�.�?{��_J��Y�qf�܄�@�jD`}��'���fd���`���X��E�Y���[��`L��I�����1x��>��G�Z'�CB�I����9`�{�����s�}����2S�!bI�UH��c:��)!�e�i !"�����给���t��BPN�W��)��
+�B�%�<��)mg#�%�jZ���Ĭk1���#!��a�v>-�ak{�b֓�=;�FL^sm䞿l.$���$�D55���/�ua�� ���0nj-���J� �׳��lܼ6bZu���"-=�#ӟ�B��Q���Fam��ѯap�sZ�'pbE���*�I�=��EC����mp^����43x����_���~�? Q�b/yvg
+]�d���/���nO7u��}yq�ǽ�O_�e�7�/^V9����8|�3I�}�1�`�3�rU�h3k��OC銞cI\!F��9Z���@a���7����f��>��G�(�)UB
+#)�Tj�|(�۲��s� ~̍�*@�2?�+��:�x�p��:`f�P�������V����J�H�]pu`T��"����a�?�G�@�!�#~F�F�-R�O���.��O���Fb�/�$10��Ee�������Gg|{���r�p��Ir�
+g��.X}߇0�ʲ'�GNK��v�!|d9�wف��teR�j�C'�?���f��ɻ��o��rz��T�=�
+(�%l�X�e]%��Aq��4<Ue�@QGu����'`��?��C$@�����U�1��7���.Н �?yϧQ��3w������n�̙��?�Pd�p�9��5l`:�jm6���L59pr�-�����s?ys���M.et���=�J���[�p�K8��Z�#`�@WAϨ�7^�D�-S�7) &c�[���y���<彄�!2�s\'hp�;��,[quי�$��Ye�X$�P3��?tLI��.�߸����
+0�Zp��k�6 �O/+�?��@���0�ߜ>!���r�o�*�����~�:�9}�sBJu���y5�*��<���o,�#�[� �eu �a*�u�nu��I��VQ&�fd�Cԗ��sL��Fb�e��іIl���ʶj&U0��K̩*����L���w��_T�!Ӕ�\���!y�2�Q�R��T��>#��t؉&��f�� �nÆ����*�9�d���T��#���5c����1Hf"�Q��#5h[��W�p�S�@�Y���0:q'H?.���T�PWx�B��@͂6��:t{��e:+!�{D/��lWf���������m��Ja-Z���&����}ƽXi���
+ȭLR(|�Ż��WV��4�q)Ԃ�W�wS˅��D�m��SbbT
+O0~��@��>�1� 4�^06'"W�օZL�6$"��a�)76�-tK
+�&ÿ�� �b�:д��
+Rۚf�S�&o�*䜢�bp�>
+|l��!MnX#�h�n���m�-�ި�i�)��V6-H�NcU�}=Y�q
+VGŌ�Ud��լ2,yӽi���]VJE02w���şhd��{1K*�M��;�p��D�2FN���|�b��;з:008�C}��.�S�gntsJ�
+��^�I���[�_<��V��p��r�မ�}�jf&R�k�]pEE�Y��*�p&�p��X��g9NVEI��
+�ʲ��w�p��ʜ�4�ꜹ�j�N+�Y?��GK�}�X�����Z��'�Z�.h�.ל�� U�rvAt�'X8:T]����\���._�"����'���;��uA�W�/d��@i� i�� �l�2��;���@Y.9�^�Hpj��GÛGf��[�L��/�]p5���MȢ��eL�����������MM]K�V�v-X�y^,x�?�V^���b�
+#k��F�.�0�9�LC�������n��H��V�
+���=��V8�����G( ����IH&� %�+=��r���>�Qtq��R���1���Hv�&+�
+7�����������(:�YG��nO76�He�7��W^�&���>˾1(j��.���;}j(&�����U{
+5���i�)<1\�~���8@�ׁp�9�r\Y�b�L��
+��g�)�L�|���-���Ԙ£5 0���}�R3(�s��in�(��P��t�.���&>��N��������^堉O�^��I�M�:����v�CU���d��fYn��j��s�s�睭<��C� )-8)�fd�SzL_�a���+�C����a4)����������H����������X�
+����H����M4+ �6��% ���8LO[���[���a�0>��_:�$^?"RLI��
+�+��_y����ߴ�ߞ<���Ьl� 1�_��S��ak��bƓfB1;��E'#1=�'s�h
++�XH?������gV�Bh�aN�v[BX�6���.�7�5�nR�69���4�)'���j�f�G�8��Ĕ���[Ʃ*���=h"!�� cm���TJF�1;�-|H ǩ��$�?w��W��f��MMbf*@�X��,5K��"xIE����^��5��;M����RUw�T�Rf��ː��gUy�8����ZN1�����D�3ƹ���Rk�/59]��2�g���T�q���#����P3+��Vs�=2�Y�mhVr�tcm���+�T��1oX:LՁ���Ʀ�aGΣ(p�s_�5Y�QR��1�\c��3q߇N��23x廭�?Q��
+����b�K,����4ta��[�M���%=l�!ܞ��~zVbn�`���^)
+���1��/7UT�5H�E���4T�?'d�3�z7�RN%i�� ��{��l��Ⲫ�SIA����x.�B�H��X��p�,�}y1ߘq�+O]���2�wk���E�@a�õ�hN�HZi�'D�%Q�n��0�T%)�l��1�a( �(�4�W'� ��\բ�6��/��l��#�vD`�Z<��0��E s�9J����0�r0A�=^��S#�s,
+jɈ52�W'
+װو`�q2��e��W���?D��Y��
+U�&�D�H�ؕ�D���je�9���X�G(cݔP�-uly��زu�vp�1�W}�1�,YT��p��X ���m1L�C�x��%��)�1R��[��j�=�e�]�c�0<b�m�w�s�Lфvvv���r��a�C��
�;\�V=����-:��Ώ���3�p�8�U����䍏�����ȝ���
+P�kW�b�o����i��'�Ǎ�ǰmm��=��h�u+��>�n��<y:�2�}Qւ7L�C,l�����n��S�#��,Id�����~]/m������{ �{k@UZw暪G��;XiU���|[1�ܣ�ih�(�'o&4kKq�4sU{Y0/�a$��x0ho��BI;F��j%���hN�H�8��L�5�m�]�Bx?U�>�M���ZÛ�8:1ޚθ���08�C������ ���J?�(��sh����B���hm�z{���0V&��t��#P�J:�r����0Q�Dl�����6�m[ӏ�c���f*�P�H����Չ���g�j���0�(I3��oӃ�|yT�tB�,�Qn�$fs�?��2��GG'9\;��?~@��'ؚr_�ɯ��D�O��^�������+E+�d��H��ܵN�;{��
+"xTl���5��F7�4�mr��1g���K��|�L����mն�
+�(�m;� �_]�W$�?�0�'P骐�*�e{��\l��xk��&b홦X�c����k�i!�<[t/P�;�y�)����<�^����x��D��n�v ��p\�ϙ��N�� �A�T1��v���0ao�#D�,���8d
+���!ĊM)C��!���C,�q��!��n!�m�G����#j物-Bri�C��n���'ycj�́�18�ו��͋����v�<!|�������2����;m�m���kDV���&>�?>�r3��������P,������8���m���5�!>�x��5U�U3q���D�$1�ܤ������-ho��[<�۞� (7&wp��P�� rw! ��Oۧ9��T�I�8
+�~�Np4���Gy�#<�ѝ�Ok�t�9�y!_���[�,��ҙ�Kyi�L���uy���ڕ�fۊ`-)��u�($��N=�݅_�y�9�u<?�<�^�}qt��6E�*��,�ˬhF0|���˽���8�}��
+����?�{��9�H��xБ�Q֒�d�Ã��n�����#����6�c�ڔ��i��MNxT�E_^G�`˲7�f�̆m�iA��lu�2�M\���I.<�L4�e��B�d��YӘ?��ħ�^���З�'��~��܄?F��K@�Y����(=��AI�>R�_'��*b���䆼bwhw.uJ
+��\z6IL�؝�`u�3S���#{��R��Ts5�IGVqU�J�v\����d�U�UW�X)U�8����,f�����Yvr����)5<��/��?q+-)%��fd�SZ�G`�`�"WV���@��_ȥՙ�arj� G����h�wPh�}j��3��)XX2�oai�L��׀����G,\<Iv�@�>��Z�hX2���!�!d'�y��a�>����h�������:x�]���!"�O�6�,lenQ^��ʢ��1����QC����ږ�
+KFv�{��O���{��p�؛F�7)Je���؍�£�.��^@P�9�I���4
+o}}����W,&5��3����n��1:{/���x�Y^Q�wdq���ާ��{��M��F�4'�i�B�H#G)�)�/&A���U�:�s�y�H�3�G&�-���Cvf���eb
+|L�W��O^
+%۠yӯ_7����i�ٙ��g�6�M��]���9�<�R�F��+�cĚBe{/�)ਿPz���ίע&��=��Aqn��٨=L"Ԅ~Sbj�م����@є��'�k�'v~ޝ��*�R{V�/��Jv*� j�,(�0��
+���i��N��q����r \��?�5e8�:5�8�1�ۅ���q0E��O4��Ǻ���p<�r�b����Qf�<?�a�]��?���^��l�f�����P^83�Oqe�a�F�U�r�K�Ox�b�H)�fDT����2���L����-��Xx�X�U�����H��)��Zz-�V�4�OsC�'��Bm�H�
+���W�e�XR���NX�/�$��/�4)�Z���\��%�26[@ ���V�8�E�Jҟ��|��汰����c��&
+_�<[�� �(r�{
+��
+_Fχ�x�U�)���Ǘr�B��Cr+�3z���H4��f@T��H�@��3ud��[CC�v���X���uM�m�LN���L]�$��4�#�V"O�D�[��v��%�/��:���(�?�&^�&.���E����<��-�,����2K�`�!�7�f�@�m�i���5bی���^&�4IKLn2�F��K8U#�)L���|7�,���C�´��U$�+�.�zR?�Ws�X����� x����N�6���"��]� z4�d���U�w=z��V}A
+�8P2��ɩ=��P;5k��D��z�+@�~�ho���E/������檘\�j�<gW�lcnyfj=�q���T�=�tY{�UZG�߉D`�p҇�;�=��R���G(%:&�V�����p*�ђ{$��WK�"��4����O��=�i�Ui�e�^ǥ��� ���I&+����*������?���I���ٻ����Uҫ�v�<!|�����r���r3�d�O?{[�.d@�?�c�����a��;p�k'�=�E�}�́��i��u��|g8ԙ�%�ys7�װp�6��p|�����o<)z/�ohr�
+����Nv���ǻ�w�o�����m�=��N�����#�`$yO�#�^��1�z�җ`�;�^#/��d��-�0��g�3����'o{$�.:��ܿP3J�J��f�9��&���J��'�6
+p�l���۫�;��N+,۪�Z�,l��prkӶ�~+*�ڇ��S*�Z�lS���'4��e�Ή��R���v�
+%l�@7��!���v?$o#���%l�n���?w������5��a�L�&�|��~����Cr�]��iI�^�}H��?p���J/���ER��%7@:r���C3�y�J�2;*�0�?����0z�H*�H��u%�>y~�1?��� 3O/c]/�[��P���^��][A�]5{h�N-���Oۚ];`�����-�d� �-���S*4�.4����+ӕ��#$-B���}[�jW��ŭe�"�|�8Q��'B��J%N���%�'�Jɖ�X�����`}i��6��W�bi�2��&��������w���UC�zix �6ҟ�#���� ˱j�Ж��Ѵ� ���'-`�A��s���6
+��>
+�o0~h�_����&��,MVő�]�A$��^���F�mZ_`c;�$N�҂\�FЕ<��9G��0/�Ҽ�����Ei��V,��['bgv�P?���~���|諛\�xQ�5]��QZ���q��/L�,7�2=*{�ma, �o�vKk;�QL@"%L�O�1>>ƶ�$��?
+:e
+�0�u�)=wW\!dJ?��)H��I�Q)#�$J�jq�˪!�"#�
+%�%�4[�M%�S����K�o�1�Bx>�Y�(�a�T�(=�?mk #�BT��P�`N���ޏ�{E�S}\�A����[���G۾���;_��#�����������fgc)]W�2g�����/���>�D�3�s�2�`����O+-���
+/XÐ��~�h�g<����ֲ=}Y����ty`eY�ń��_�H�i`[���s|NrN��"����7�E��C��!h |1V���=��Nˬ}{���$�!y��^�c3������C����Ca�FR=��N<���^;절�\��烁��7J���o���a�'$l?�G��krxݾ�}�BH^�}iӷF:B�'�������܅�}l9��c_��מw �z-a��FD0Y\�N���3~��9cYU���������/��!�l_5`��,t��zK��F��N�=����_�o������T����H��鰋=<'�����{���b^҄4�I�m�͛� ����3p|C�0���F:���'�O��5�GY�� �<[nD��_#.MV����������Ij�� ъT2�G��4 ��Ҡ�ƐI@��ӏz�f�/�1�5��
+3m.6��ؒb}�p�a���-5⁙�.�J5�p]ű`b�!�����<!�N�&<'xzbn@C�k�S�k#[Q�O�Y<Ȑ��͆k���fedk��7-l'����p�����=/���Ľy/�i3i�!�T�ˍo����^.���m4�"���4럍���肏�f�_+�e\NR�a��T�-�a��I�$��mw�d�Yi��d0�W��:Y�Y.�<�C�>�n<Ves�� 괹��u�z���M�-���)��qxpw_�\nQ�.�����S� 7��J/(����WZ
+N�Rmq�(ldy��.��,Y��S���J���pw,��%��A����O��n��'
+"��uI�G��o���ʢ�l�~vZ�� ��c;?1�|
+�B�i���\�+O�
+ѿ1ѯn�t��:B���o�����!��%�sb��L_��B��8�r.�����G�?��Os�,c��wM&>M��㦍hw��������Z�%4���%�'�c�<f|��>�]�VԖ�I0x�݁������bZ�v�
+�p�z�D���vh+i���L���͒5�Z�ư�lé���a/?�v��L����+����e6��
+�l�m�k�r1,���C-�xcn�6�R�wI�i�^��Vٲ=se�����Y��ȖW�6+
+��&�&��t�8�]���wX�Wd�N�i�45�B��(_�mJ,;?;�9����Y��h
+��nM�Dk�]s�\�^b����ԉ�Sy��z=8�ֲ��&{��n�Nm�G��Z`�!y/�J7��h��jŖS�u���S1�^�Lx�;��y��/x���a9��x�b砦b1ҽc�hӋ�Nٕ��ޱX,�`�b��oɃ��%�N8�o�)�V*�[)\9Yh(��6ҽc5�}��J/{G�{���ط����GO�9V�uݠ��������c���\��k��6�U'�zz*�v��[�<�˒x����-�z]�
+�O��S4.���s�]*<nKe���R�AyY*#u�-U�����>|�Ku�>ӥ�]b
+C'��S�������?�
+�j���)�t.tg����}�<���z=�q�>���CF�[:~��m�+�qaz�c���<�M�z�۔O�\l��H#�K��������̱�]f<�˗���˗3.�w6�#N?��k�)��xXc5z-.��i��r΅���*�s�L�s�Λ=����>.\.��,]N�Dž�e>�L���r�=�������0V�c���~1Vo����w1��%��%'��� �BqY�I�}+.�7�|��=J���D����Bs�yL�p��mԘJUq��ՅUAK'6mI�.|y�4p↧��Յ>GK'�-��\sR!�����[�#eE�JN �κNθ���I�-�]$Z���I�%ٝ$w��0N�kՔ`�a���Z�"�CK'9��d]��ii�$�MKv9)�4��-s�:� c�ۄ��6ar�MP��o��<;��� �����=����P�U.
+��U좡�,�C������Bz��Jo':=�h-��h�KA����5���P�U<
+����P�U
+��e��P1�����準
+L���f���qeɊ,���<�ݖ��6�d������f����+HV�D4�����Br7 b͟�M~Xc��6�6��]ᒅ�%S�d��cy����V}q,���Ѫ����C{�Xhn������������������h3���g?0�l���Q��)�Ʋ�W�9�U60���y>����3,ŵ�@�4���g.)�@���
+MJ�n�9 4�K7�止�c��M:��ȭv�d"`��.L4w#�p��hNs�]���Ӏk!bmD�t6UT�5Ș��7&�ȴ�0�9��ODwt(�1����hZ>�j�n�h��0�(hZ<�ny�@�"w�s4'���3w;��QȎ��,��Dk݄�)�&�ޜ�VC0�Mܮ9�����bp���y��S����b��Bb�SҜ� ���ً<���@�6z�ɋ>��m<�^��6`A�˧ �_�x����&7nnGq�8��{������+��� �~��#^��������+�鑢#'B�9c�ẊcA��aY��n�1�2��}|\ٍǙ�
+p&��������47���6�F2ڿx!Y�T�V�da�E4=��0�T$7��%w�0,^��|a�y!�2�g�u��[@9�r��$���$����PK�JDJW*�PKT<(�:K/.pollen.argoPKT<��z�nB:hpollen_Modèle.pgmlPKT<�{"CUpollen_Services.pgmlPKT<�f/�X8A{ pollen_Context.pgmlPKT<P����K(pollen.todoPKT<7Rp:B1)pollen_profile.profilePKT<�JDJW*�
+�)pollen.xmiPK�>T
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-31 08:29:03 UTC (rev 2963)
+++ trunk/pom.xml 2010-04-02 14:21:52 UTC (rev 2964)
@@ -309,7 +309,7 @@
<!-- customized versions -->
<!--javadoc.version>2.4</javadoc.version-->
- <topia.version>2.3.1-SNAPSHOT</topia.version>
+ <topia.version>2.3.1</topia.version>
<eugene.version>2.0.1-SNAPSHOT</eugene.version>
<i18n.version>1.2</i18n.version>
<tapestry.version>5.1.0.5</tapestry.version>
@@ -368,26 +368,6 @@
<artifactId>maven-i18n-plugin</artifactId>
<version>${i18n.version}</version>
</plugin>
- <plugin>
- <groupId>org.nuiton.processor</groupId>
- <artifactId>maven-processor-plugin</artifactId>
- <version>${processor.version}</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>process</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <includes>**/*.java</includes>
- <filters>
- org.nuiton.processor.filters.GeneratorTemplatesFilter,
- org.nuiton.processor.filters.ActiveLogsCodeFilter
- </filters>
- </configuration>
- </plugin>
</plugins>
</pluginManagement>
1
0