r3097 - in branches/pollen-2.0-beta-1: . pollen-persistence/src/main/java/org/chorem/pollen pollen-persistence/src/main/java/org/chorem/pollen/entity pollen-persistence/src/main/java/org/chorem/pollen/service pollen-persistence/src/main/java/org/chorem/pollen/service/legacy pollen-persistence/src/main/xmi pollen-services/src/main/java/org/chorem/pollen pollen-services/src/main/java/org/chorem/pollen/bean pollen-services/src/main/java/org/chorem/pollen/service/legacy pollen-services/src/main
Author: tchemit Date: 2012-01-20 17:48:46 +0100 (Fri, 20 Jan 2012) New Revision: 3097 Url: http://chorem.org/repositories/revision/pollen/3097 Log: commit for friends... Added: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java branches/pollen-2.0-beta-1/pollen-ui-struts2/ branches/pollen-2.0-beta-1/pollen-ui-struts2/LICENSE.txt branches/pollen-2.0-beta-1/pollen-ui-struts2/README.txt branches/pollen-2.0-beta-1/pollen-ui-struts2/changelog.txt branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenTopiaTransactionFilter.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UserPreferences.java branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/log4j.properties branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/Login-validation.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/RegisterUser-validation.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/pollen.properties branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/validators.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/footer.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/header.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/i18n.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/metas.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/userPreferences.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/web.xml branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/pollen.css branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/screen.css branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigCreation.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVote.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVoteCounting.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/contact.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/en.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/fr.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollen.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_en.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_fr.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_en.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_fr.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_en.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_fr.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_en.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_fr.png branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/index.jsp branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/js/ branches/pollen-2.0-beta-1/pollen-ui-tapestry/ branches/pollen-2.0-beta-1/pollen-ui-webmotion/ Removed: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContext.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenProperty.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenUtils.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java branches/pollen-2.0-beta-1/pollen-services/src/main/resources/pollen.properties branches/pollen-2.0-beta-1/pollen-ui/ branches/pollen-2.0-beta-1/pollen-wm/ Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfigurationOption.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTechnicalException.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.zargo branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/EmailService.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenService.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContext.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContextImpl.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceFactory.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/AbstractPollenServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/EmailServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FavoriteServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/PollServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/UserServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/VoteServiceTest.java branches/pollen-2.0-beta-1/pollen-services/src/test/resources/pollen-fake.properties branches/pollen-2.0-beta-1/pollen-ui-tapestry/pom.xml branches/pollen-2.0-beta-1/pollen-ui-webmotion/pom.xml branches/pollen-2.0-beta-1/pom.xml Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenBusinessException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -59,6 +59,7 @@ public enum PollenExceptionType { + /** Exception when poll is not found in data * */ POLL_NOT_EXIST(n_("pollen.exception.poll_not_exist")), /** Exception when user login exists in data * */ Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Persistence * - * $Id: EchoBaseConfiguration.java 282 2012-01-15 21:30:41Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-entities/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfigurationOption.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfigurationOption.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfigurationOption.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Entities + * Pollen :: Persistence * - * $Id: EchoBaseConfigurationOption.java 116 2011-11-24 23:06:43Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-entities/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -27,7 +27,6 @@ import org.nuiton.util.Version; import java.io.File; -import java.net.URL; /** * All EchoBase configuration options. @@ -38,6 +37,8 @@ public enum PollenConfigurationOption implements ApplicationConfig.OptionDef { /** login for default admin. */ + DATA_DIR("pollen.dataDirectory", "Default directory where to put datas", "${HOME}/.pollen", File.class), + /** login for default admin. */ ADMIN_LOGIN("adminLogin", "login for default admin", "admin", String.class), /** password for default admin. */ ADMIN_PASSWORD("adminPassword", "password for default admin", "pollen", String.class), @@ -52,11 +53,11 @@ /** from for email sending configuration. */ EMAIL_FROM("email_from", "from for email sending configuration", "bot@pollen.org", String.class), /** directory to store emails before sending them. */ - EMAIL_DIR("pollen.emails.directory", "directory to store emails before sending them", "${HOME}/.pollen/emails", File.class), + EMAIL_DIR("pollen.emails.directory", "directory to store emails before sending them", "${pollen.dataDirectory}/emails", File.class), /** path for feed directory. */ - FEED_DIR("feedDir", "path for feed directory", "${HOME}/.pollen/feeds", File.class), + FEED_DIR("feedDir", "path for feed directory", "${pollen.dataDirectory}/feeds", File.class), /** path for uploaded images directory. */ - IMG_DIR("upImgDir", "path for uploaded images directory", "${HOME}/.pollen/uploadedImages", File.class), + IMG_DIR("upImgDir", "path for uploaded images directory", "${pollen.dataDirectory}/uploadedImages", File.class), /** nb votes to display per page. */ NB_VOTES_PER_PAGE("pollen.ui.nbVotesPerPage", "nb votes to display per page", "25", int.class), /** Charset of Pollen. */ Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfigurationOption.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java (from rev 3096, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContext.java) =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,150 @@ +/* + * #%L + * Pollen :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen; + +import java.util.Date; +import org.chorem.pollen.service.legacy.ServiceUser; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.EntityFilter; +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 + */ + 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> + * @param serviceUser to manage default admin if needed + */ + void start(ServiceUser serviceUser); + + /** + * stop : + * Stop the application. Close the Topia rootContext. + */ + void stop(); + + /** + * getProperty : + * Get a property from the configuration. + * @param property PollenProperty + * @return String + */ + String getProperty(PollenProperty property); + + /** + * hasProperty : + * Test if the property is defined in this context + * @param property PollenProperty + * @return boolean + */ + boolean hasProperty(PollenProperty property); + + /** + * getConfiguration : + * Get the configuration of the application. Instantiate the default one + * if needed. + * @return ApplicationConfig + */ + ApplicationConfig getConfiguration(); + + /** + * getCurrentDate : + * Return the current date from context + * @return Date + */ + Date getCurrentDate(); + + /** + * encodePassword : + * @param password + * @return String + */ + 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 + */ + String createPollenUrlId(); + + /** + * beginTransaction : + * @return TopiaContext + * @throws TopiaException + */ + TopiaContext beginTransaction() throws TopiaException; + + /** + * doCatch : + * @param eee + * @param message + * @param args + * @throws PollenException + */ + void treateError(Exception eee, String message, Object... args) + throws PollenException; + + /** + * doCatch : + * @param transaction + * @param eee + * @param message + * @param args + * @throws PollenException + */ + void treateError(TopiaContext transaction, Exception eee, + String message, Object... args) throws PollenException; + + /** + * doFinally : + * @param transaction + */ + void closeTransaction(TopiaContext transaction); + + public EntityFilter getNewFilter(); + +} //PollenContext Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenContext.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java (from rev 3096, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenProperty.java) =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,96 @@ +/* + * #%L + * Pollen :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +package org.chorem.pollen; + +/** + * PollenProp + * + * Created: 25 févr. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public enum PollenProperty { + /** version of the application **/ + APP_VERSION("version"), + /** + * url of the server + * @deprecated don't need to use it from properties file. Will be analysing + * from url in ui module. + */ + @Deprecated + SERVER_URL("siteUrl"), + /** login for default admin **/ + ADMIN_LOGIN("adminLogin"), + /** password for default admin **/ + ADMIN_PASSWORD("adminPassword"), + /** email for default admin **/ + ADMIN_EMAIL("adminEmail"), + /** email for contact link **/ + CONTACT_EMAIL(ADMIN_EMAIL.getKey()), + /** host for email sending configuration **/ + EMAIL_HOST("email_host"), + /** port for email sending configuration **/ + EMAIL_PORT("email_port"), + /** from for email sending configuration **/ + EMAIL_FROM("email_from"), + /** directory to store emails before sending them **/ + EMAIL_DIR("pollen.emails.directory"), + /** path for feed directory **/ + FEED_DIR("feedDir"), + /** path for uploaded images directory **/ + IMG_DIR("upImgDir"), + /** nb votes to display per page **/ + NB_VOTES_PER_PAGE("pollen.ui.nbVotesPerPage"), + /** Charset of Pollen **/ + CHARSET("pollen.charset"); + + private String key; + + private static PollenContext context; + + PollenProperty(String key) { + this.key = key; + } + + public String getKey() { + return key; + } + + static void setContext(PollenContext cx) { + context = cx; + } + + public String getValue() { + return context.getProperty(this); + } + + public boolean hasValue() { + return !getValue().equals(""); + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenProperty.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTechnicalException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTechnicalException.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTechnicalException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Entities + * Pollen :: Persistence * - * $Id: EchoBaseTechnicalException.java 19 2011-11-08 08:56:23Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-entities/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTechnicalException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * Extranet NF-Logement :: Entities + * Pollen :: Persistence * - * $Id: EchoBaseTopiaRootContextSupplierFactory.java 114 2011-11-24 13:31:55Z sletellier $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-entities/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Cerqual + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -49,22 +49,8 @@ private static final Log log = LogFactory.getLog(PollenTopiaRootContextSupplierFactory.class); - protected static class PollenTopiaRootContextSupplier implements Supplier<TopiaContext> { + public TopiaContext newEmbeddedDatabase(File dir, String configPath) { - protected TopiaContext rootContext; - - public PollenTopiaRootContextSupplier(TopiaContext rootContext) { - this.rootContext = rootContext; - } - - @Override - public TopiaContext get() { - return rootContext; - } - } - - public Supplier<TopiaContext> newEmbeddedDatabase(File dir, String configPath) { - File databaseFile = new File(dir, "db"); String databaseAbsolutePath = databaseFile.getAbsolutePath(); @@ -100,17 +86,17 @@ log.debug("will output database in " + databaseAbsolutePath); } - return new PollenTopiaRootContextSupplier(rootContext); + return rootContext; } - public Supplier<TopiaContext> newDatabaseFromConfig(PollenConfiguration config) { + public TopiaContext newDatabaseFromConfig(PollenConfiguration config) { Properties properties = config.getProperties(); return newDatabaseFromProperties(properties); } - public Supplier<TopiaContext> newDatabaseFromProperties(Properties properties) { + public TopiaContext newDatabaseFromProperties(Properties properties) { if (log.isDebugEnabled()) { log.debug("Database settings are :"); @@ -136,6 +122,6 @@ throw new TopiaRuntimeException(e); } - return new PollenTopiaRootContextSupplier(rootContext); + return rootContext; } } Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenTopiaRootContextSupplierFactory.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java (from rev 3096, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenUtils.java) =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,45 @@ +/* + * #%L + * Pollen :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen; + +import java.util.Date; + +/** + * Created: 21 mai 2010 + * + * @author fdesbois <fdesbois@codelutin.com> + * @version $Id$ + */ +public class PollenUtils { + + private static PollenContext context; + + public static void setContext(PollenContext context) { + PollenUtils.context = context; + } + + public static Date getCurrentDate() { + return context.getCurrentDate(); + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/PollenUtils.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/entity/PollImpl.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -24,18 +24,20 @@ package org.chorem.pollen.entity; +import org.chorem.pollen.PollenUtils; + import java.util.Date; /** * PollImpl - * + * <p/> * Created: 23 mars 2010 * * @author fdesbois * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ + * <p/> + * Mise a jour: $Date$ + * par : $Author$ */ public class PollImpl extends PollAbstract { @@ -54,22 +56,34 @@ @Override public boolean isStarted() { - //FIXME : tc-2012-01-19 See if this does cause problem... -// Date now = PollenUtils.getCurrentDate(); - Date now = new Date(); - return getBeginDate() == null || getBeginDate().before(now); + Date now = PollenUtils.getCurrentDate(); + return isStarted(now); } @Override public boolean isFinished() { - //FIXME : tc-2012-01-19 See if this does cause problem... -// Date now = PollenUtils.getCurrentDate(); - Date now = new Date(); - return getEndDate() != null && getEndDate().before(now); + Date now = PollenUtils.getCurrentDate(); + return isFinished(now); } @Override public boolean isRunning() { - return isStarted() && !isFinished() && !isClosed(); + Date now = PollenUtils.getCurrentDate(); + return isRunning(now); } + + @Override + public boolean isStarted(Date currentDate) { + return getBeginDate() == null || getBeginDate().before(currentDate); + } + + @Override + public boolean isFinished(Date currentDate) { + return getEndDate() != null && getEndDate().before(currentDate); + } + + @Override + public boolean isRunning(Date currentDate) { + return isStarted(currentDate) && !isFinished(currentDate) && !isClosed(); + } } Copied: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java (from rev 3096, branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java) =================================================================== --- branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,48 @@ +/* + * #%L + * Pollen :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.service.legacy; + +import java.util.Map; +import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.PollenException; +import org.chorem.pollen.entity.UserAccount; +import org.nuiton.topia.framework.EntityFilter; + +public interface ServiceUser { + + UserAccount connect(String login, String password) throws PollenException, PollenBusinessException; + + UserAccount getNewUser() throws PollenException; + + void createUser(UserAccount user) throws PollenException, PollenBusinessException; + + void updateUser(UserAccount user, boolean byAdmin) throws PollenException, PollenBusinessException; + + void deleteUser(String login) throws PollenException; + + Map<String, UserAccount> getUsers(EntityFilter filter) throws PollenException; + + int getNbUsers() throws PollenException; + +} //ServiceUser Property changes on: branches/pollen-2.0-beta-1/pollen-persistence/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-persistence/src/main/xmi/pollen.zargo =================================================================== (Binary files differ) Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContext.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenContext.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,150 +0,0 @@ -/* - * #%L - * Pollen :: Services - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package org.chorem.pollen; - -import java.util.Date; -import org.chorem.pollen.service.legacy.ServiceUser; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.EntityFilter; -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 - */ - 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> - * @param serviceUser to manage default admin if needed - */ - void start(ServiceUser serviceUser); - - /** - * stop : - * Stop the application. Close the Topia rootContext. - */ - void stop(); - - /** - * getProperty : - * Get a property from the configuration. - * @param property PollenProperty - * @return String - */ - String getProperty(PollenProperty property); - - /** - * hasProperty : - * Test if the property is defined in this context - * @param property PollenProperty - * @return boolean - */ - boolean hasProperty(PollenProperty property); - - /** - * getConfiguration : - * Get the configuration of the application. Instantiate the default one - * if needed. - * @return ApplicationConfig - */ - ApplicationConfig getConfiguration(); - - /** - * getCurrentDate : - * Return the current date from context - * @return Date - */ - Date getCurrentDate(); - - /** - * encodePassword : - * @param password - * @return String - */ - 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 - */ - String createPollenUrlId(); - - /** - * beginTransaction : - * @return TopiaContext - * @throws TopiaException - */ - TopiaContext beginTransaction() throws TopiaException; - - /** - * doCatch : - * @param eee - * @param message - * @param args - * @throws PollenException - */ - void treateError(Exception eee, String message, Object... args) - throws PollenException; - - /** - * doCatch : - * @param transaction - * @param eee - * @param message - * @param args - * @throws PollenException - */ - void treateError(TopiaContext transaction, Exception eee, - String message, Object... args) throws PollenException; - - /** - * doFinally : - * @param transaction - */ - void closeTransaction(TopiaContext transaction); - - public EntityFilter getNewFilter(); - -} //PollenContext Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenProperty.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenProperty.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenProperty.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,96 +0,0 @@ -/* - * #%L - * Pollen :: Services - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -package org.chorem.pollen; - -/** - * PollenProp - * - * Created: 25 févr. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public enum PollenProperty { - /** version of the application **/ - APP_VERSION("version"), - /** - * url of the server - * @deprecated don't need to use it from properties file. Will be analysing - * from url in ui module. - */ - @Deprecated - SERVER_URL("siteUrl"), - /** login for default admin **/ - ADMIN_LOGIN("adminLogin"), - /** password for default admin **/ - ADMIN_PASSWORD("adminPassword"), - /** email for default admin **/ - ADMIN_EMAIL("adminEmail"), - /** email for contact link **/ - CONTACT_EMAIL(ADMIN_EMAIL.getKey()), - /** host for email sending configuration **/ - EMAIL_HOST("email_host"), - /** port for email sending configuration **/ - EMAIL_PORT("email_port"), - /** from for email sending configuration **/ - EMAIL_FROM("email_from"), - /** directory to store emails before sending them **/ - EMAIL_DIR("pollen.emails.directory"), - /** path for feed directory **/ - FEED_DIR("feedDir"), - /** path for uploaded images directory **/ - IMG_DIR("upImgDir"), - /** nb votes to display per page **/ - NB_VOTES_PER_PAGE("pollen.ui.nbVotesPerPage"), - /** Charset of Pollen **/ - CHARSET("pollen.charset"); - - private String key; - - private static PollenContext context; - - PollenProperty(String key) { - this.key = key; - } - - public String getKey() { - return key; - } - - static void setContext(PollenContext cx) { - context = cx; - } - - public String getValue() { - return context.getProperty(this); - } - - public boolean hasValue() { - return !getValue().equals(""); - } -} Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenUtils.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenUtils.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/PollenUtils.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,45 +0,0 @@ -/* - * #%L - * Pollen :: Services - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package org.chorem.pollen; - -import java.util.Date; - -/** - * Created: 21 mai 2010 - * - * @author fdesbois <fdesbois@codelutin.com> - * @version $Id$ - */ -public class PollenUtils { - - private static PollenContext context; - - public static void setContext(PollenContext context) { - PollenUtils.context = context; - } - - public static Date getCurrentDate() { - return context.getCurrentDate(); - } -} Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/bean/PollenEmail.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -26,7 +26,6 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.mail.EmailException; import org.apache.commons.mail.SimpleEmail; -import org.chorem.pollen.PollenProperty; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/service/legacy/ServiceUser.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,48 +0,0 @@ -/* - * #%L - * Pollen :: Services - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package org.chorem.pollen.service.legacy; - -import java.util.Map; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.PollenException; -import org.chorem.pollen.entity.UserAccount; -import org.nuiton.topia.framework.EntityFilter; - -public interface ServiceUser { - - UserAccount connect(String login, String password) throws PollenException, PollenBusinessException; - - UserAccount getNewUser() throws PollenException; - - void createUser(UserAccount user) throws PollenException, PollenBusinessException; - - void updateUser(UserAccount user, boolean byAdmin) throws PollenException, PollenBusinessException; - - void deleteUser(String login) throws PollenException; - - Map<String, UserAccount> getUsers(EntityFilter filter) throws PollenException; - - int getNbUsers() throws PollenException; - -} //ServiceUser Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/EmailService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/FavoriteService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenService.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenService.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenService.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Services * - * $Id: EchoBaseService.java 20 2011-11-08 09:01:17Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-services/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContext.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContext.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContext.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Services * - * $Id: EchoBaseServiceContext.java 54 2011-11-13 22:20:37Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-services/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContext.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContextImpl.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContextImpl.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContextImpl.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Services * - * $Id: EchoBaseServiceContextImpl.java 148 2011-12-05 22:55:34Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-services/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -24,10 +24,8 @@ package org.chorem.pollen.services; import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; import org.chorem.pollen.PollenConfiguration; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; import java.util.Date; import java.util.Locale; @@ -61,17 +59,6 @@ public static PollenServiceContext newContext( Locale locale, - Supplier<TopiaContext> topiaContextSupplier, - PollenConfiguration configuration, - PollenServiceFactory serviceFactory) throws TopiaException { - return newContext(locale, - topiaContextSupplier.get().beginTransaction(), - configuration, - serviceFactory); - } - - public static PollenServiceContext newContext( - Locale locale, TopiaContext transaction, PollenConfiguration configuration, PollenServiceFactory serviceFactory) { Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceContextImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceFactory.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceFactory.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceFactory.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Services * - * $Id: EchoBaseServiceFactory.java 20 2011-11-08 09:01:17Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-services/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceFactory.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,11 +1,11 @@ /* * #%L - * EchoBase :: Services + * Pollen :: Services * - * $Id: EchoBaseServiceSupport.java 213 2011-12-26 10:10:04Z tchemit $ - * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-services/src/main... $ + * $Id$ + * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin + * Copyright (C) 2009 - 2012 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,36 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.services; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class UserEmailAlreadyUsedException extends Exception { + + private static final long serialVersionUID = 1L; + +} Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserEmailAlreadyUsedException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,36 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.services; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class UserInvalidPasswordException extends Exception { + + private static final long serialVersionUID = 1L; + +} Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserInvalidPasswordException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,36 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.services; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class UserLoginAlreadyUsedException extends Exception { + + private static final long serialVersionUID = 1L; + +} Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserLoginAlreadyUsedException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,36 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.services; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class UserNotFoundException extends Exception { + + private static final long serialVersionUID = 1L; + +} Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserNotFoundException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -24,52 +24,132 @@ package org.chorem.pollen.services; import com.google.common.collect.Lists; +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.PollenDAOHelper; import org.chorem.pollen.PollenException; import org.chorem.pollen.PollenTechnicalException; import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.entity.UserAccountDAO; import org.chorem.pollen.service.legacy.ServiceUserImpl; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.EntityFilter; +import org.nuiton.topia.framework.TopiaQuery; +import org.nuiton.topia.persistence.util.TopiaEntityBinder; +import org.nuiton.util.StringUtil; +import org.nuiton.util.beans.Binder; import java.util.Map; +import static org.nuiton.i18n.I18n._; + public class UserService extends PollenServiceSupport { - public UserAccount connect(String login, String password) throws PollenBusinessException { - ServiceUserImpl service = new ServiceUserImpl(); + /** Logger. */ + private static final Log log = LogFactory.getLog(UserService.class); + + public UserAccount connect(String login, String password) throws UserNotFoundException, UserInvalidPasswordException { try { - UserAccount result = service.executeConnect(getTransaction(), Lists.newArrayList(), login, password); - return result; + UserAccountDAO dao = + PollenDAOHelper.getUserAccountDAO(getTransaction()); + + UserAccount user = dao.findByLogin(login); + + if (user == null) { + throw new UserNotFoundException(); + } + + String encodedPassword = encodePassword(password); + if (!encodedPassword.equals(user.getPassword())) { + throw new UserInvalidPasswordException(); + } + + return user; } catch (TopiaException e) { throw new PollenTechnicalException(e); } } - public UserAccount getNewUser() throws PollenException { - ServiceUserImpl service = new ServiceUserImpl(); - UserAccount result = service.executeGetNewUser(); - return result; - } + public void createUser(UserAccount user) throws UserLoginAlreadyUsedException, UserEmailAlreadyUsedException { - public void createUser(UserAccount user) throws PollenBusinessException { - ServiceUserImpl service = new ServiceUserImpl(); try { - service.executeCreateUser(getTransaction(), Lists.newArrayList(), user); + UserAccountDAO dao = + PollenDAOHelper.getUserAccountDAO(getTransaction()); + + UserAccount userByLogin = dao.findByLogin(user.getLogin()); + if (userByLogin != null) { + throw new UserLoginAlreadyUsedException(); + } + UserAccount userByEmail = dao.findByEmail(user.getEmail()); + if (userByEmail != null) { + throw new UserEmailAlreadyUsedException(); + } + String password = encodePassword(user.getPassword()); + UserAccount userAccount = dao.create( + UserAccount.PROPERTY_LOGIN, user.getLogin(), + UserAccount.PROPERTY_PASSWORD, password + ); + user.setTopiaId(userAccount.getTopiaId()); + copyUserAccount(user, userAccount); + + } catch (TopiaException e) { throw new PollenTechnicalException(e); } } - public void updateUser(UserAccount user, boolean byAdmin) throws PollenBusinessException { + public void updateUser(UserAccount user, + String newPassword, + boolean byAdmin) throws PollenBusinessException, UserEmailAlreadyUsedException { + ServiceUserImpl service = new ServiceUserImpl(); try { + + UserAccountDAO dao = + PollenDAOHelper.getUserAccountDAO(getTransaction()); + + // Do not manage password for an admin update + // neither if password was not asked to change + if (!byAdmin && StringUtils.isNotEmpty(newPassword)) { + + // Check the password +// String encodedPassword = context.encodePassword(user.getPassword()); + String encodedPassword = encodePassword(user.getPassword()); + +// checkPassword(dao, user.getLogin(), encodedPassword); + + + + } + + // In case of email change, check if an other user has not already + // the new email + // FIXME-fdesbois-20100510 : replace by using id directly + TopiaQuery query = dao.createQuery(). + addWhere(UserAccount.PROPERTY_LOGIN, + TopiaQuery.Op.NEQ, user.getLogin()); + query.addEquals(UserAccount.PROPERTY_EMAIL, StringUtils.lowerCase(user.getEmail())); + + // existing user found + if (dao.existByQuery(query)) { + throw new UserEmailAlreadyUsedException(); + } + service.executeUpdateUser(getTransaction(), Lists.newArrayList(), user, byAdmin); } catch (TopiaException e) { throw new PollenTechnicalException(e); } } + public UserAccount getNewUser() throws PollenException { + ServiceUserImpl service = new ServiceUserImpl(); + UserAccount result = service.executeGetNewUser(); + return result; + } + public void deleteUser(String login) { ServiceUserImpl service = new ServiceUserImpl(); try { @@ -100,9 +180,54 @@ } public String encodePassword(String password) { - ServiceUserImpl service = new ServiceUserImpl(); - String result = service.encodePassword(password); - return result; + return StringUtil.encodeMD5(password); } -} //ServiceUser + public void createDefaultUsers() { + UserAccount user = getNewUser(); + user.setAdmin(true); + String login = getConfiguration().getAdminLogin(); + user.setLogin(login); + user.setEmail(getConfiguration().getAdminEmail()); + user.setNewPassword(getConfiguration().getAdminPassword()); + try { + createUser(user); + if (log.isInfoEnabled()) { + log.info(_("pollen.info.admin.created", login)); + } + } catch (Exception eee) { + if (log.isInfoEnabled()) { + log.info(_("pollen.info.admin.exists") + " : " + + _(eee.getMessage())); + } + } + } + + /** + * 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 Binder#copy(Object, Object, String...) + */ + protected void copyUserAccount(UserAccount source, UserAccount destination) { + TopiaEntityBinder<UserAccount> binder = + PollenBinderHelper.getSimpleTopiaBinder(UserAccount.class); + + binder.copy(source, destination, + UserAccount.PROPERTY_ADMIN, + UserAccount.PROPERTY_FIRST_NAME, + UserAccount.PROPERTY_LAST_NAME); + + // Don't keep case for email + destination.setEmail(StringUtils.lowerCase(source.getEmail())); + +// // Manage new password if needed +// String password = source.getNewPassword(); +// if (StringUtils.isNotEmpty(password)) { +//// destination.setPassword(context.encodePassword(password)); +// destination.setPassword(encodePassword(password)); +// } + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/UserService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/main/java/org/chorem/pollen/services/VoteService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: branches/pollen-2.0-beta-1/pollen-services/src/main/resources/pollen.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/main/resources/pollen.properties 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/main/resources/pollen.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,83 +0,0 @@ -### -# #%L -# Pollen :: Services -# -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2009 - 2012 CodeLutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero 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 Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# #L% -### -## Configuration de la base de donn\u00C3\u00A9es -#hibernate.hbm2ddl.auto=update -hibernate.show_sql=false -hibernate.hbm2ddl.auto=update -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:~/.pollen/pollendb - -#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -#hibernate.connection.username=pollen -#hibernate.connection.password=pollen -#hibernate.connection.driver_class=org.postgresql.Driver -#hibernate.connection.url=jdbc:postgresql://intranet/pollen -#hibernate.default_schema=public - -## Configuration de topia-migration -#topia.service.migration=org.nuiton.topia.migration.TopiaMigrationServiceImpl -#topia.service.migration.callbackhandlers=org.chorem.pollen.business.migration.PollenMigrationCallbackHandler -#topia.service.migration.mappingsdir=oldmappings -#topia.service.migration.modelnames=pollen - -## Initialisation de la base de donn\u00E9es -#choiceType=DATE,IMAGE,TEXT -#pollType=RESTRICTED,FREE,GROUP -#voteCounting=NORMAL,PERCENTAGE,CONDORCET,NUMBER - -## Utilisateur par d\u00C3\u00A9faut -adminLogin=admin -adminPassword=pollen -adminEmail=admin@domain.com - -## R\u00C3\u00A9pertoire des images transf\u00C3\u00A9r\u00C3\u00A9es -upImgDir=${HOME}/.pollen/uploadedImages - -## Taille maximal des images transf\u00C3\u00A9r\u00C3\u00A9es (en octets) -upload.filesize-max=1048576 -upload.requestsize-max=10485760 - -## Configuration de l'envoi d'emails automatiques -email_host=smtp -email_port=25 -email_from=bot@pollen.org - -## R\u00E9pertoire des flux de syndication (Atom) -feedDir=${HOME}/.pollen/feeds - -## Repertoire de stockage des mails a envoyer -pollen.emails.directory=${HOME}/.pollen/emails -pollen.charset=UTF-8 - -## Nombre de votes a afficher par page -pollen.ui.nbVotesPerPage=25 - -## Adresse du site (utilis\u00C3\u00A9e pour les emails de rappel) -##siteUrl= - -## Version de l'application -version=${project.version} Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/AbstractPollenServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/AbstractPollenServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/AbstractPollenServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,31 +1,31 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.PollenDAOHelper; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.entity.Choice; -import org.chorem.pollen.entity.ChoiceDAO; -import org.chorem.pollen.entity.FavoriteList; -import org.chorem.pollen.entity.FavoriteListDAO; -import org.chorem.pollen.entity.FavoriteParticipant; -import org.chorem.pollen.entity.FavoriteParticipantDAO; -import org.chorem.pollen.entity.Poll; -import org.chorem.pollen.entity.PollAccount; -import org.chorem.pollen.entity.PollAccountDAO; -import org.chorem.pollen.entity.PollDAO; -import org.chorem.pollen.entity.UserAccount; -import org.chorem.pollen.entity.UserAccountDAO; import org.junit.Before; import org.junit.Rule; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaQuery; -import org.nuiton.topia.persistence.TopiaEntity; -import java.util.List; - /** * For each test, create an isolated transaction context, in a H2 database. * The H2 file is stored in a directory depending on the test class name, the @@ -46,227 +46,4 @@ setServiceContext(serviceContext); } - - /** - * Create a user :<br /> <ul> <li>login : homer</li> <li>email : - * homer@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 { - - UserService userService = newService(UserService.class); - - UserAccount user = userService.getNewUser(); - user.setLogin("homer"); - user.setEmail("homer@simpson.us"); - user.setNewPassword("wouhou"); - user.setAdmin(admin); - - userService.createUser(user); - - TopiaContext transaction = serviceContext.newTransaction(); - try { - UserAccountDAO dao = - PollenDAOHelper.getUserAccountDAO(transaction); - - UserAccount findUser = dao.findByLogin(user.getLogin()); - return findUser; - } finally { - transaction.closeContext(); - } - } - - public FavoriteList createFavoriteList(String name, UserAccount user) - throws TopiaException { - - TopiaContext transaction = serviceContext.newTransaction(); - try { - FavoriteListDAO dao = - PollenDAOHelper.getFavoriteListDAO(transaction); - - FavoriteList list = dao.create(name, user); - transaction.commitTransaction(); - return list; - } finally { - transaction.closeContext(); - } - } - - public FavoriteParticipant createFavoriteParticipant(String name, - String email, FavoriteList list) throws TopiaException { - TopiaContext transaction = serviceContext.newTransaction(); - try { - FavoriteParticipantDAO dao = - PollenDAOHelper.getFavoriteParticipantDAO(transaction); - - FavoriteParticipant participant = dao.create(name, email, list); - transaction.commitTransaction(); - return participant; - } finally { - transaction.closeContext(); - } - } - - public FavoriteList findFavoriteList(String id, String... propertiesLoad) - throws TopiaException { - TopiaContext transaction = serviceContext.newTransaction(); - try { - FavoriteListDAO dao = - PollenDAOHelper.getFavoriteListDAO(transaction); - - TopiaQuery query = dao.createQuery(). - addEquals(TopiaEntity.TOPIA_ID, id). - addLoad(propertiesLoad); - - FavoriteList result = dao.findByQuery(query); - - return result; - } finally { - transaction.closeContext(); - } - } - - protected Poll createPoll(TopiaContext transaction, - String title, UserAccount user, - PollType type, VoteCountingType voteCounting) - throws TopiaException { - - PollAccountDAO accountDAO = - PollenDAOHelper.getPollAccountDAO(transaction); - - PollAccount creator = accountDAO.create(serviceContext.createPollenUrlId()); - creator.setName(user.getDisplayName()); - creator.setEmail(user.getEmail()); - creator.setUserAccount(user); - creator.setAdmin(true); - - PollDAO pollDAO = PollenDAOHelper.getPollDAO(transaction); - - Poll poll = pollDAO.create(serviceContext.createPollenUrlId()); - poll.setCreator(creator); - poll.setTitle(title); - poll.setType(type); - if (voteCounting == null) { - voteCounting = VoteCountingType.NORMAL; - } - poll.setVoteCounting(voteCounting); - - return poll; - } - - public Poll createFreePoll(String title, UserAccount user, VoteCountingType voteCounting) - throws TopiaException { - TopiaContext transaction = serviceContext.newTransaction(); - try { - Poll poll = createPoll(transaction, title, user, PollType.FREE, voteCounting); - - transaction.commitTransaction(); - - return poll; - } finally { - transaction.closeContext(); - } - } - - public List<Choice> addChoicesToPoll(Poll poll, ChoiceType choiceType, String... choices) - throws TopiaException { - - TopiaContext transaction = serviceContext.newTransaction(); - try { - ChoiceDAO dao = PollenDAOHelper.getChoiceDAO(transaction); - - poll.setChoiceType(choiceType); - - for (String choice : choices) { - Choice newChoice = dao.create(); - newChoice.setName(choice); - newChoice.setType(choiceType); - poll.addChoice(newChoice); - } - - transaction.commitTransaction(); - - return poll.getChoice(); - } finally { - transaction.closeContext(); - } - } - - public Poll createGroupPoll(String title, - UserAccount user, VoteCountingType voteCounting, - int nbParticipantsByGroup, - String... groupNames) - throws TopiaException { - - TopiaContext transaction = serviceContext.newTransaction(); - try { - - Poll poll = createPoll(transaction, title, user, PollType.GROUP, voteCounting); - - PollAccountDAO accountDAO = - PollenDAOHelper.getPollAccountDAO(transaction); - - for (String groupName : groupNames) { - PollAccount group = accountDAO.create(serviceContext.createPollenUrlId()); - group.setName(groupName); - group.setList(true); - - for (int i = 1; i <= nbParticipantsByGroup; i++) { - PollAccount participant = - accountDAO.create(serviceContext.createPollenUrlId()); - participant.setName(groupName + "_participant" + i); - participant.setEmail(groupName + "_email" + i + "@domain.org"); - participant.setWeight(1.); - if (i == 1) { - participant.setUserAccount(user); - } - group.addChild(participant); - } - - poll.addPollAccount(group); - } - - transaction.commitTransaction(); - - return poll; - - } finally { - transaction.closeContext(); - } - } - - public <E extends TopiaEntity> E loadEntity(E source, - String... propertiesToLoad) - throws Exception { - - TopiaContext transaction = serviceContext.newTransaction(); - try { - TopiaQuery query = new TopiaQuery(source.getClass()); - - query.addFetch(propertiesToLoad); - - String mainIdProperty = - TopiaQuery.getProperty(query.getMainAlias(), TopiaEntity.TOPIA_ID); - - query.addEquals(mainIdProperty, source.getTopiaId()). - setMaxResults(1); - - E result = (E) query.executeToEntity(transaction, source.getClass()); - - if (result != null) { - return result; - } - - throw new NullPointerException("nothing to find... from id = " + - source.getTopiaId()); - } finally { - transaction.closeContext(); - } - } - } Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/AbstractPollenServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/EmailServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/EmailServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/EmailServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,3 +1,26 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; import org.junit.Before; Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/EmailServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,3 +1,26 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; @@ -77,9 +100,8 @@ if (log.isInfoEnabled()) { log.info("Test dir = " + testDir); } - rootContextSupplier = factory.newEmbeddedDatabase( + rootContext = factory.newEmbeddedDatabase( testDir, "/" + CONFIGURATION_PATH); - rootContext = rootContextSupplier.get(); } @Override Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FakeServiceContext.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FavoriteServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FavoriteServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FavoriteServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,3 +1,26 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; import org.apache.commons.logging.Log; @@ -2,13 +25,5 @@ import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.PollenDAOHelper; -import org.chorem.pollen.entity.FavoriteList; -import org.chorem.pollen.entity.FavoriteParticipant; -import org.chorem.pollen.entity.FavoriteParticipantDAO; -import org.chorem.pollen.entity.UserAccount; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.nuiton.topia.TopiaContext; @@ -20,6 +35,7 @@ * @author tchemit <chemit@codelutin.com> * @since 2.0 */ +@Ignore public class FavoriteServiceTest extends AbstractPollenServiceTest { /** Logger. */ @@ -36,137 +52,55 @@ @Test public void testCreateFavoriteParticipant() throws Exception { - //start("testCreateFavoriteParticipant"); - FavoriteService service = newService(FavoriteService.class); - - UserAccount user = createUser(false); - - final FavoriteList list = createFavoriteList("LIST", user); - - log.info("test 1 : no problem on creation"); - FavoriteParticipant participant = - service.getNewFavoriteParticipant(list); - - participant.setName("participant"); - participant.setEmail("email"); - - service.createFavoriteParticipant(participant); - - log.info("test 2 : problem on naturalId : participant already" + - " set with same email"); - - participant = - service.getNewFavoriteParticipant(list); - - participant.setName("participant"); - participant.setEmail("email"); - - try { - service.createFavoriteParticipant(participant); - } catch (PollenBusinessException eee) { - Assert.assertEquals(PollenBusinessException.PollenExceptionType.PARTICIPANT_EXIST, - eee.getType()); - } - - log.info("test 3 : email in naturalId can be null"); - - participant = - service.getNewFavoriteParticipant(list); - - participant.setName("participant2"); - participant.setEmail(null); - - service.createFavoriteParticipant(participant); - - TopiaContext transaction = serviceContext.newTransaction(); - try { - FavoriteParticipantDAO dao = - PollenDAOHelper.getFavoriteParticipantDAO(transaction); - String email = null; - - FavoriteParticipant result = dao.findByProperties( - FavoriteParticipant.PROPERTY_NAME, "participant2", - FavoriteParticipant.PROPERTY_EMAIL, email, - FavoriteParticipant.PROPERTY_FAVORITE_LIST, list); - - Assert.assertNotNull(result); - } finally { - transaction.closeContext(); - } } @Test public void testUpdateFavoriteParticipant() throws Exception { - //start("testUpdateFavoriteParticipant"); - FavoriteService service = newService(FavoriteService.class); - - /** PREPARE DATA **/ - UserAccount user = createUser(false); - - FavoriteList list = createFavoriteList("LIST", user); - FavoriteParticipant participant = - createFavoriteParticipant("participant", null, list); - - /** EXEC METHOD **/ - log.info("test 1 : update ok : add email"); - participant.setEmail("email"); - participant.setWeight(1.); - - service.updateFavoriteParticipant(participant); } @Test - @Ignore public void testDeleteFavoriteParticipant() throws Exception { } @Test - @Ignore public void testGetFavoriteParticipant() throws Exception { } @Test - @Ignore public void testGetFavoriteParticipants() throws Exception { } @Test - @Ignore public void testGetFavoriteLists() throws Exception { } @Test - @Ignore public void testDeleteFavoriteList() throws Exception { } @Test - @Ignore public void testCreateFavoriteList() throws Exception { } @Test - @Ignore public void testGetNbFavoriteParticipants() throws Exception { } @Test - @Ignore public void testGetNewFavoriteParticipant() throws Exception { } @Test - @Ignore public void testGetNewFavoriteList() throws Exception { } Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/FavoriteServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/PollServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/PollServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/PollServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,40 +1,33 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; -import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.PollenDAOHelper; -import org.chorem.pollen.bean.UserPoll; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.entity.Choice; -import org.chorem.pollen.entity.ChoiceDAO; -import org.chorem.pollen.entity.FavoriteList; -import org.chorem.pollen.entity.Participant; -import org.chorem.pollen.entity.ParticipantList; -import org.chorem.pollen.entity.Poll; -import org.chorem.pollen.entity.PollAccount; -import org.chorem.pollen.entity.PollAccountImpl; -import org.chorem.pollen.entity.PollDAO; -import org.chorem.pollen.entity.PollImpl; -import org.chorem.pollen.entity.UserAccount; -import org.chorem.pollen.entity.Vote; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.EntityFilter; -import org.nuiton.topia.framework.TopiaFilter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; - /** * Tests the {@link PollService}. * @@ -44,19 +37,6 @@ @Ignore public class PollServiceTest extends AbstractPollenServiceTest { - /** Logger. */ - private static final Log log = LogFactory.getLog(PollServiceTest.class); - - private UserAccount user; - - private PollAccount creator; - - private PollAccount list1; - - private FavoriteList list2; - - private Poll poll; - @Override @Before public void setUp() throws Exception { @@ -65,437 +45,24 @@ super.setUp(); - user = createUser(false); - - // Poll creator - creator = new PollAccountImpl(); - creator.setName(user.getDisplayName()); - creator.setEmail(user.getEmail()); - creator.setUserAccount(user); - creator.setAdmin(true); - - // Poll - poll = new PollImpl(); - poll.setCreator(creator); - poll.setTitle("Poll"); - poll.setUid(serviceContext.createPollenUrlId()); - poll.setChoice(new ArrayList<Choice>()); - - // Participant Lists - // First list : new list specific for poll restriction - list1 = new PollAccountImpl(); - list1.setName("List1"); - list1.setList(true); - - Collection<Participant> participants = new ArrayList<Participant>(); - Participant participant1_1 = new PollAccountImpl(); - participant1_1.setName("participant1_1"); - participant1_1.setEmail("email1_1@domain.org"); - participants.add(participant1_1); - - Participant participant1_2 = new PollAccountImpl(); - participant1_2.setName("participant1_2"); - participants.add(participant1_2); - list1.setParticipants(participants); - - // Second list : existing list from user favorites - list2 = createFavoriteList("list2", user); - Participant participant2_1 = createFavoriteParticipant( - "participant2_1", "email2_1@domain.org", list2); - Participant participant2_2 = createFavoriteParticipant( - "participant2_2", "email2_2@domain.org", list2); - Participant participant2_3 = createFavoriteParticipant( - "participant2_3", null, list2); - - list2 = findFavoriteList(list2.getId(), FavoriteList.PROPERTY_FAVORITE_PARTICIPANT); - } @Test - public void testUpdatePollNotStartedWithChoice() throws PollenBusinessException, TopiaException { + public void testUpdatePollNotStartedWithChoice() throws TopiaException { - // ---- PREPARE DATA ---- // - - PollService servicePoll = newService(PollService.class); - - // Prepare restricted Poll with 3 choices - poll.setType(PollType.RESTRICTED); - List<ParticipantList> participantLists = new ArrayList<ParticipantList>(); - participantLists.add(list1); - // begin in 3 days - Date beginDate = DateUtils.addDays(serviceContext.getCurrentTime(), 3); - poll.setBeginDate(beginDate); - poll.setChoiceType(ChoiceType.TEXT); - poll.addNewChoice("choice1", null); - poll.addNewChoice("choice2", "desc2"); - poll.addNewChoice("choice3", "desc3"); - - Poll pollCreated = servicePoll.createPoll(poll, participantLists); - // Ensure not started and not closed - Assert.assertFalse(pollCreated.isStarted()); - Assert.assertFalse(pollCreated.isClosed()); - - // Update Choices - pollCreated.setChoiceType(ChoiceType.DATE); - // Reset previous List - pollCreated.setChoice(null); - pollCreated.addNewChoice("choiceDate1", null); - pollCreated.addNewChoice("choiceDate2", null); - pollCreated.addNewChoice("choiceDate3", null); - - // ---- EXECUTE #1 : override choices ---- // - - Poll result = servicePoll.updatePoll(pollCreated); - // Changing type is efficient - Assert.assertEquals(ChoiceType.DATE, result.getChoiceType()); - - // ---- CHECK RESULT ---- // - - TopiaContext transaction = serviceContext.newTransaction(); - try { - ChoiceDAO choiceDAO = PollenDAOHelper.getChoiceDAO(transaction); - - // This assume that only 3 choices exist, previous ones have been deleted - long nbChoices = choiceDAO.count(); - Assert.assertEquals(3, nbChoices); - } finally { - transaction.closeContext(); - } - - // ---- EXECUTE #2 : update existing choice name ---- // - - Choice choiceDate1 = result.getChoice().get(0); - choiceDate1.setName("changeChoice"); - result = servicePoll.updatePoll(result); - - // ---- CHECK RESULT ---- // - - Assert.assertEquals("changeChoice", result.getChoice().get(0).getName()); } @Test - public void testInternalCreateBasicPoll() throws Exception { - //start("testInternalCreateBasicPoll"); + public void testGetPollsByUser() throws TopiaException { - PollService servicePoll = newService(PollService.class); - - // ---- PREPARE DATA ---- // - // done in init() method - - // ---- EXECUTE ---- // - - log.info("test 1 : create poll with creator from existing user"); - - - Poll newPoll; - { - newPoll = servicePoll.createBasicPoll(poll); - Assert.assertNotNull(newPoll); - Assert.assertNotNull(newPoll.getTopiaId()); - Assert.assertNotNull(newPoll.getUid()); - Assert.assertEquals("Poll", newPoll.getTitle()); - - PollAccount newCreatorAccount = newPoll.getCreator(); - Assert.assertNotNull(newCreatorAccount); - Assert.assertNotNull(newCreatorAccount.getUid()); - Assert.assertEquals(user, newCreatorAccount.getUserAccount()); - Assert.assertTrue(newCreatorAccount.getAdmin()); - - // Will save the poll and its creator - getTransaction().commitTransaction(); - } - - // Verification - TopiaContext transaction = serviceContext.newTransaction(); - try { - PollDAO dao = PollenDAOHelper.getPollDAO(transaction); - - Poll pollFound = dao.findByTopiaId(newPoll.getTopiaId()); - Assert.assertNotNull(pollFound); - Assert.assertNotNull(pollFound.getCreator()); - Assert.assertEquals(user, pollFound.getCreator().getUserAccount()); - - } finally { - transaction.closeContext(); - } - - log.info("test 2 : create poll with new creator"); - poll.getCreator().setUserAccount(null); - - newPoll = servicePoll.createBasicPoll(poll); - PollAccount newCreatorAccount = newPoll.getCreator(); - Assert.assertNull(newCreatorAccount.getUserAccount()); - } -// @Test -// public void testInternalCreatePollAccounts() throws Exception { -// //start("testInternalCreatePollAccounts"); -// -// // ---- PREPARE DATA ---- // -// PollService servicePoll = newService(PollService.class); -// // list initializations in init() method -// -// Collection<ParticipantList> lists = new ArrayList<ParticipantList>(); -// // First list : new list specific for poll restriction -// lists.add(list1); -// // Second list : existing list from user favorites -// lists.add(list2); -// -// // ---- EXECUTE ---- // -// -// log.info("test 1 : createPollAccounts from one new list : RESTRICTED"); -// -// -// TopiaContext transaction = serviceContext.newTransaction(); -// try { -// // Only the first list of the collection will be considered : list1 -// // Create only person accounts -// List<PollAccount> accounts = servicePoll.createPollAccounts( -// transaction, PollType.RESTRICTED, lists); -// -// Assert.assertEquals(2, accounts.size()); -// for (PollAccount account : accounts) { -// Assert.assertFalse(account.getList()); -// Assert.assertNotNull(account.getId()); -// Assert.assertNotNull(account.getUid()); -// // No link with user -// Assert.assertNull(account.getUserAccount()); -// } -// -// } finally { -// transaction.closeContext(); -// } -// -// log.info("test 2 : createPollAccounts from two lists : GROUP." + -// " One of the list is an existing favorite one"); -// -// transaction = serviceContext.newTransaction(); -// try { -// // Create only list accounts -// List<PollAccount> accounts = servicePoll.createPollAccounts( -// transaction, PollType.GROUP, lists); -// -// Assert.assertEquals(2, accounts.size()); -// for (PollAccount account : accounts) { -// Assert.assertTrue(account.getList()); -// Assert.assertNotNull(account.getId()); -// Assert.assertNotNull(account.getUid()); -// Assert.assertNotNull(account.getName()); -// // No link with user -// Assert.assertNull(account.getUserAccount()); -// // Check on list1 -// if (account.getName().equals(list1.getName())) { -// Assert.assertEquals(2, account.getChild().size()); -// // Check on list2 -// } else if (account.getName().equals(list2.getName())) { -// Assert.assertEquals(3, account.getChild().size()); -// // Child are person accounts -// for (PollAccount person : account.getChild()) { -// Assert.assertFalse(person.getList()); -// Assert.assertNotNull(person.getId()); -// Assert.assertNotNull(person.getUid()); -// // No link with user -// Assert.assertNull(person.getUserAccount()); -// } -// } -// } -// -// } finally { -// transaction.closeContext(); -// } -// } - @Test - public void integrationCreatePollFree() throws Exception { + public void testFetchOnGetter() throws Exception { - // ---- PREPARE DATA ---- // - PollService servicePoll = newService(PollService.class); - - user = null; - poll = servicePoll.getNewPoll(user); - poll.getCreator().setName("homer"); - poll.setType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.addNewChoice("choice1", null); - poll.addNewChoice("choice2", "desc2"); - poll.addNewChoice("choice3", "desc3"); - - // ---- EXECUTE ---- // - servicePoll.createPoll(poll, null); - - /** VERIFICATION RESULT **/ - TopiaContext transaction = serviceContext.newTransaction(); - try { - // No accounts + type = FREE + 3 TEXT choices - PollDAO dao = PollenDAOHelper.getPollDAO(transaction); - Assert.assertTrue(dao.existByNaturalId(poll.getUid())); - Poll pollFound = dao.findByNaturalId(poll.getUid()); - - // Check pollType and accounts - Assert.assertEquals(PollType.FREE, pollFound.getType()); - Assert.assertEquals(0, pollFound.getPollAccount().size()); - - // Check choices - Assert.assertEquals(ChoiceType.TEXT, pollFound.getChoiceType()); - Assert.assertEquals(3, pollFound.getChoice().size()); - - // Check creator - Assert.assertNotNull(pollFound.getCreator()); - Assert.assertNull(pollFound.getCreator().getUserAccount()); - Assert.assertNotNull(pollFound.getCreator().getName()); - - } finally { - transaction.closeContext(); - } } @Test - public void integrationCreatePollRestrictedFromNewList() throws Exception { - /** PREPARE DATA **/ - PollService servicePoll = newService(PollService.class); - poll = servicePoll.getNewPoll(user); - poll.setType(PollType.RESTRICTED); - poll.setChoiceType(ChoiceType.DATE); - poll.addNewChoice("date1", null); - poll.addNewChoice("date2", "desc2"); - poll.addNewChoice("date3", "desc3"); - - Collection<ParticipantList> lists = new ArrayList<ParticipantList>(); - ParticipantList list = servicePoll.getNewPollList(); - lists.add(list); - - Collection<Participant> participants = new ArrayList<Participant>(); - Participant participant1 = servicePoll.getNewPollParticipant(); - participant1.setName("participant1"); - participant1.setEmail("email1"); - participant1.setWeight(1.); - participants.add(participant1); - - Participant participant2 = servicePoll.getNewPollParticipant(); - participant2.setName("participant2"); - participant2.setEmail(null); - participant2.setWeight(1.); - participants.add(participant2); - list.setParticipants(participants); - - /** EXEC METHOD **/ - servicePoll.createPoll(poll, lists); - - /** VERIFICATION RESULT **/ - TopiaContext transaction = serviceContext.newTransaction(); - try { - // Two person accounts + type = RESTRICTED + 3 DATE choices - PollDAO dao = PollenDAOHelper.getPollDAO(transaction); - Assert.assertTrue(dao.existByNaturalId(poll.getUid())); - Poll pollFound = dao.findByNaturalId(poll.getUid()); - - // Check pollType and accounts - Assert.assertEquals(PollType.RESTRICTED, pollFound.getType()); - Assert.assertEquals(2, pollFound.getPollAccount().size()); - - // Check choices - Assert.assertEquals(ChoiceType.DATE, pollFound.getChoiceType()); - Assert.assertEquals(3, pollFound.getChoice().size()); - - // Check creator - Assert.assertEquals(user, pollFound.getCreator().getUserAccount()); - - } finally { - transaction.closeContext(); - } - } - - @Test - public void testGetPollsByUser() throws PollenBusinessException, TopiaException { - - PollService servicePoll = newService(PollService.class); - VoteService voteService = newService(VoteService.class); - - createGroupPoll("POLL", user, null, 3, "group1", "group2"); - - Poll freePoll = createFreePoll("POLL2", user, null); - - PollAccount participant = voteService.getNewPollAccount(user); - participant.setChoiceVote(new ArrayList<Vote>()); - - voteService.saveVote(freePoll, participant); - - - /** EXEC METHOD **/ -// EntityFilter filter = context.getNewFilter(); - EntityFilter filter = new TopiaFilter(); - filter.setReference(user); - List<UserPoll> polls = servicePoll.getPolls(filter); - - // POLL 2 : user both creator and participant (+2 accounts) - // POLL : user creator + added in each group (+3 accounts) - - Assert.assertEquals(2, polls.size()); - - UserPoll userPoll2 = polls.get(0); - Assert.assertEquals("POLL2", userPoll2.getPoll().getTitle()); - Assert.assertTrue(userPoll2.isCreator()); - Assert.assertEquals(2, userPoll2.getAccounts().size()); - - UserPoll userPoll1 = polls.get(1); - Assert.assertEquals("POLL", userPoll1.getPoll().getTitle()); - Assert.assertTrue(userPoll1.isCreator()); - Assert.assertEquals(3, userPoll1.getAccounts().size()); - } - - @Test - public void testFetchOnGetter() throws Exception, PollenBusinessException { - - PollService servicePoll = newService(PollService.class); - VoteService voteService = newService(VoteService.class); - - poll = createFreePoll("POLL2", user, VoteCountingType.NORMAL); - List<Choice> choices = - addChoicesToPoll(poll, ChoiceType.TEXT, "choice1", "choice2", "choice3"); - - PollAccount participant = voteService.getNewPollAccount(user); - Vote voteImpl = voteService.getNewVote(choices.get(0)); - voteImpl.setVoteValue(1.); - participant.addChoiceVote(voteImpl); - voteImpl = voteService.getNewVote(choices.get(1)); - voteImpl.setVoteValue(1.); - participant.addChoiceVote(voteImpl); - voteImpl = voteService.getNewVote(choices.get(2)); - voteImpl.setVoteValue(1.); - participant.addChoiceVote(voteImpl); - - voteService.saveVote(poll, participant); - - poll = loadEntity(poll); - - /** EXEC METHOD **/ - - Poll pollFound = servicePoll.getPoll(poll.getUid(), Poll.PROPERTY_CHOICE); - -// Assert.assertEquals(3, pollFound.getChoice().size()); - -// EntityFilter filter = context.getNewFilter(); - EntityFilter filter = new TopiaFilter(); - filter.setReference(pollFound); - List<PollAccount> accounts = voteService.getVotes(filter); - - for (PollAccount account : accounts) { - log.debug("Account : " + account.getUid()); - } - Assert.assertEquals(1, accounts.size()); - - Assert.assertNotNull(accounts.get(0).getChoiceVote()); - Assert.assertEquals(3, accounts.get(0).getChoiceVote().size()); - - for (Vote vote : accounts.get(0).getChoiceVote()) { - log.debug("Vote choice : " + vote.getChoice().getName() + - " value=" + vote.getVoteValue()); - } - - } - - @Test public void testGetNewPoll() throws Exception { } Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/PollServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/UserServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/UserServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/UserServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,16 +1,31 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.PollenDAOHelper; -import org.chorem.pollen.entity.UserAccount; -import org.chorem.pollen.entity.UserAccountDAO; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.nuiton.topia.TopiaContext; /** * Tests the {@link UserService}. @@ -18,69 +33,9 @@ * @author tchemit <chemit@codelutin.com> * @since 2.0 */ +@Ignore public class UserServiceTest extends AbstractPollenServiceTest { - /** Logger. */ - private static final Log log = LogFactory.getLog(UserServiceTest.class); - -// @Test -// public void testCopyUserAccount() throws Exception { -// //start("testManageNewPassword"); -// -// UserService service = newService(UserService.class); -// -// UserAccount user = service.getNewUser(); -// user.setLogin("homer"); -// user.setNewPassword("wouhou"); -// -// log.info("test 1 : Encode new password"); -// UserAccount destination = new UserAccountImpl(); -// service.copyUserAccount(user, destination); -// Assert.assertNotNull(destination.getPassword()); -// -// String expected = service.encodePassword("wouhou"); -// Assert.assertEquals(expected, destination.getPassword()); -// -// log.info("test 2 : Do not encode new password -> newPassword empty"); -// user.setPassword(expected); -// user.setNewPassword(null); -// service.copyUserAccount(user, destination); -// Assert.assertEquals(expected, destination.getPassword()); -// } -// -// @Test -// public void testCheckPassword() throws Exception { -// //start("testCheckPassword"); -// -// UserService service = newService(UserService.class); -// -// UserAccount user = service.getNewUser(); -// user.setLogin("homer"); -// user.setNewPassword("wouhou"); -// service.createUser(user); -// -// String encodedPassword = service.encodePassword("wouhou"); -// -// TopiaContext transaction = beginTransaction(); -// try { -// UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction); -// -// log.info("test 1 : Good password"); -// service.checkPassword(dao, "homer", encodedPassword); -// -// log.info("test 2 : Wrong password"); -// try { -// service.checkPassword(dao, "homer", "bad"); -// } catch (PollenBusinessException eee) { -// log.error("Error : " + eee.getMessage()); -// Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD, -// eee.getType()); -// } -// } finally { -// transaction.closeContext(); -// } -// } - @Override @Before public void setUp() throws Exception { @@ -92,190 +47,34 @@ @Test public void testConnect() throws Exception { - //start("testExecuteConnect"); - UserService service = newService(UserService.class); - - // The password is wouhou and login is homer - UserAccount user = createUser(false); - - log.info("test 1 : Connection OK"); - UserAccount connected = service.connect("homer", "wouhou"); - Assert.assertEquals(user, connected); - - log.info("test 2 : Connection problem on login -> user not exist"); - try { - service.connect("marge", "wouhou"); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_NOT_EXIST, - eee.getType()); - } - - log.info("test 3 : Connection problem on password -> " + - "don't match with login"); - try { - service.connect("homer", "coucou"); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD, - eee.getType()); - } } @Test public void testGetNewUser() throws Exception { - //start("testGetNewUser"); - UserService service = newService(UserService.class); - - UserAccount user = service.getNewUser(); - Assert.assertNotNull(user); - Assert.assertEquals(false, user.getAdmin()); } @Test public void testCreateUser() throws Exception { - //start("testCreateUser"); - UserService service = newService(UserService.class); - - UserAccount user = service.getNewUser(); - user.setLogin("hsimpson"); - user.setEmail("hsimpson@springfield.us"); - user.setNewPassword("wouhou"); - - String encodedPassword = service.encodePassword("wouhou"); - - log.info("test 1 : Creation OK"); - service.createUser(user); - //Assert.assertNotNull(user.getTopiaId()); - Assert.assertNotSame(encodedPassword, user.getPassword()); - - log.info("test 2 : Creation problem on login -> user exist"); - UserAccount user2 = service.getNewUser(); - user2.setLogin("hsimpson"); - // Not the same email - user2.setEmail("hsimpson@springfield.com"); - user2.setNewPassword("troubidou"); - - try { - service.createUser(user2); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_LOGIN_EXIST, - eee.getType()); - } - - log.info("test 3 : Creation problem on email -> user exist"); - UserAccount user3 = service.getNewUser(); - user3.setLogin("homer"); - user3.setEmail("hsimpson@springfield.us"); - user3.setNewPassword("troubidou"); - - try { - service.createUser(user3); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST, - eee.getType()); - } - - log.info("test 4 : Creation OK with no email"); - UserAccount user4 = service.getNewUser(); - user4.setLogin("marge"); - user4.setNewPassword("troubidou"); - - service.createUser(user4); - Assert.assertNull(user4.getEmail()); } @Test public void testUpdateUser() throws Exception { - //start("testUpdateUser"); - UserService service = newService(UserService.class); - - UserAccount user1 = service.getNewUser(); - user1.setLogin("hsimpson"); - user1.setEmail("hsimpson@springfield.us"); - user1.setNewPassword("wouhou"); - service.createUser(user1); - - UserAccount user2 = service.getNewUser(); - String user2Password = "wouhou"; - user2.setLogin("homer"); - user2.setEmail("hsimpson@springfield.fr"); - user2.setNewPassword(user2Password); - service.createUser(user2); - - log.info("test 1 : Can't change login -> don't match with password"); - user2.setLogin("homersimpson"); - user2.setPassword(user2Password); - try { - service.updateUser(user2, false); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_WRONG_PASSWORD, - eee.getType()); - } - user2.setLogin("homer"); - - log.info("test 2 : Change email OK"); - user2.setEmail("homersimpson@springield.fr"); - user2.setPassword(user2Password); - service.updateUser(user2, false); - - log.info("test 3 : Change email problem -> user exist"); - user2.setEmail(user1.getEmail()); - user2.setPassword(user2Password); - try { - service.updateUser(user2, false); - } catch (PollenBusinessException eee) { - log.error("Error : " + eee.getMessage()); - Assert.assertEquals(PollenBusinessException.PollenExceptionType.USER_EMAIL_EXIST, - eee.getType()); - } - - // TODO test 4 with byAdmin = true } @Test public void testDeleteUser() throws Exception { - UserService service = newService(UserService.class); - - try { - service.deleteUser("test"); - } catch (Exception eee) { - log.error(eee); - Assert.assertEquals(IllegalArgumentException.class, - eee.getClass()); - } - - UserAccount user = service.getNewUser(); - user.setLogin("user"); - service.createUser(user); - - service.deleteUser("user"); - - TopiaContext transaction = serviceContext.newTransaction(); - try { - UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction); - UserAccount userFound = dao.findByLogin("user"); - Assert.assertNull(userFound); - } finally { - transaction.closeContext(); - } } - @Ignore @Test public void testGetUsers() throws Exception { } - @Ignore @Test public void testGetNbUsers() throws Exception { Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/UserServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/VoteServiceTest.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/VoteServiceTest.java 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/VoteServiceTest.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,3 +1,26 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ package org.chorem.pollen.services; import org.junit.Before; Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/java/org/chorem/pollen/services/VoteServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-services/src/test/resources/pollen-fake.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-services/src/test/resources/pollen-fake.properties 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-services/src/test/resources/pollen-fake.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -1,3 +1,26 @@ +### +# #%L +# Pollen :: Services +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2012 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### hibernate.show_sql=false hibernate.hbm2ddl.auto=update Property changes on: branches/pollen-2.0-beta-1/pollen-services/src/test/resources/pollen-fake.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2 ___________________________________________________________________ Added: svn:ignore + target *.ipr *.iws *.iml *.log Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.chorem</groupId> + <artifactId>pollen</artifactId> + <version>2.0-SNAPSHOT</version> + </parent> + + <groupId>org.chorem.pollen</groupId> + <artifactId>pollen-ui-struts2</artifactId> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>pollen-domain</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>pollen-persistence</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>pollen-services</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-struts2</artifactId> + </dependency> + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-web</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.struts.xwork</groupId> + <artifactId>xwork-core</artifactId> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-plugin</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-grid-plugin</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-json-plugin</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-sitemesh-plugin</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-runner</artifactId> + </dependency> + + <!-- Provided dependencies --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Runtime dependencies --> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- base h2 --> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>Pollen :: UI (strust2)</name> + <description>Interface Graphique Struts2 pour Pollen</description> + + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>war</packaging> + + <properties> + <i18n.silent>true</i18n.silent> + <i18n.bundleOutputName>pollen-i18n</i18n.bundleOutputName> + + <redmine.releaseFiles> + target/${project.build.finalName}.war + </redmine.releaseFiles> + </properties> + + <build> + + <!-- call result war : pollen-xxx.war --> + <finalName>pollen-${project.version}</finalName> + + <!-- Add main class into war to make it executable --> + <plugins> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>maven-i18n-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>parserValidation</goal> + <goal>parserJava</goal> + <goal>gen</goal> + <goal>bundle</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <configuration> + <stopKey>A</stopKey> + <stopPort>1269</stopPort> + <webAppConfig> + <contextPath>/pollen</contextPath> + </webAppConfig> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>org.nuiton.web.war.JettyLauncher</mainClass> + </manifest> + </archive> + <overlays> + <overlay> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-web</artifactId> + <type>jar</type> + <includes> + <include>**/war/Jetty*</include> + </includes> + </overlay> + <overlay> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-runner</artifactId> + <type>jar</type> + </overlay> + </overlays> + </configuration> + </plugin> + + </plugins> + </pluginManagement> + </build> + +</project> + Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,55 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui; + +import org.chorem.pollen.PollenConfiguration; +import org.nuiton.topia.TopiaContext; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class PollenApplicationContext { + + protected PollenConfiguration configuration; + + protected TopiaContext rootContext; + + public PollenConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(PollenConfiguration configuration) { + this.configuration = configuration; + } + + public TopiaContext getRootContext() { + return rootContext; + } + + public void setRootContext(TopiaContext rootContext) { + this.rootContext = rootContext; + } + +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,202 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui; + +import org.apache.commons.collections.MapUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.PollenConfiguration; +import org.chorem.pollen.PollenTechnicalException; +import org.chorem.pollen.PollenTopiaRootContextSupplierFactory; +import org.chorem.pollen.entity.Poll; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.services.PollenServiceContext; +import org.chorem.pollen.services.PollenServiceContextImpl; +import org.chorem.pollen.services.PollenServiceFactory; +import org.chorem.pollen.services.UserService; +import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.nuiton.i18n.I18n; +import org.nuiton.i18n.init.DefaultI18nInitializer; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.framework.TopiaFilter; +import org.nuiton.topia.framework.TopiaUtil; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import java.util.Date; +import java.util.Locale; +import java.util.Map; + +/** + * To listen start or end of the application. + * <p/> + * On start we will load the configuration and check connection to internal + * database, creates schema and create an admin user in none found in database. + * <p/> + * On stop, just release the application configuration. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class PollenApplicationListener implements ServletContextListener { + + /** Logger. */ + protected static final Log log = + LogFactory.getLog(PollenApplicationListener.class); + + private TopiaContext rootContext; + + @Override + public void contextInitialized(ServletContextEvent sce) { + + if (log.isInfoEnabled()) { + log.info("Application starting at " + new Date() + "..."); + } + + // init I18n + DefaultI18nInitializer i18nInitializer = + new DefaultI18nInitializer("pollen-i18n"); + i18nInitializer.setMissingKeyReturnNull(true); + I18n.init(i18nInitializer, Locale.getDefault()); + + PollenApplicationContext applicationContext = new PollenApplicationContext(); + sce.getServletContext().setAttribute(PollenActionSupport.APPLICATION_CONTEXT_PARAMETER, applicationContext); + + // initialize configuration + PollenConfiguration configuration = new PollenConfiguration(); + applicationContext.setConfiguration(configuration); + + if (log.isInfoEnabled()) { + log.info("Initializing RootContextSupplier..."); + } + PollenTopiaRootContextSupplierFactory factory = + new PollenTopiaRootContextSupplierFactory(); + rootContext = factory.newDatabaseFromConfig(configuration); + applicationContext.setRootContext(rootContext); + + // init database (and create minimal admin user if required) + try { + createAdminUser(applicationContext); + } catch (TopiaException e) { + throw new PollenTechnicalException("Could not init db", e); + } + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + + if (log.isInfoEnabled()) { + log.info("Application is ending at " + new Date() + "..."); + } + if (rootContext != null) { + if (log.isInfoEnabled()) { + log.info("Shuting down RootContextSupplier..."); + } + if (!rootContext.isClosed()) { + try { + rootContext.closeContext(); + } catch (TopiaException te) { + if (log.isErrorEnabled()) { + log.error("Could not close rootContext", te); + } + } + } + } + } + + + /** + * Creates the adminsitrator ({@code admin/admin}) on the database. + * + * @param applicationContext application context + * @throws TopiaException if could not create the user. + */ + protected void createAdminUser(PollenApplicationContext applicationContext) throws TopiaException { + + PollenConfiguration configuration = + applicationContext.getConfiguration(); + + PollenServiceFactory serviceFactory = + new PollenServiceFactory(); + TopiaContext transaction = rootContext.beginTransaction(); + + try { + PollenServiceContext serviceContext = PollenServiceContextImpl.newContext( + Locale.getDefault(), + transaction, + configuration, + serviceFactory + ); + + UserService service = + serviceFactory.newService(UserService.class, serviceContext); + + Map<String, UserAccount> users = service.getUsers(new TopiaFilter()); + + if (MapUtils.isEmpty(users)) { + + // no users in database create the admin user + if (log.isInfoEnabled()) { + log.info("No user in database, will create default " + + "admin user (password admin)."); + } + + service.createDefaultUsers(); + } + } finally { + transaction.closeContext(); + } + } + + protected boolean isSchemaCreated() throws TopiaException { + + TopiaContextImplementor tx = (TopiaContextImplementor) rootContext; + try { + boolean schemaFound = TopiaUtil.isSchemaExist( + tx, + Poll.class.getName() + ); + + return schemaFound; + + } finally { + closeTransaction(tx); + } + } + + /** + * Try to close the given transaction. + * + * @param tx the transaction to close + * @throws TopiaException if could not close the transaction + */ + protected void closeTransaction(TopiaContext tx) throws TopiaException { + if (tx != null && !tx.isClosed()) { + tx.closeContext(); + } + } + +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,51 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.entity.UserAccount; + +/** + * User session to put in servlet session. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class PollenSession { + + /** Logger. */ + private static final Log log = LogFactory.getLog(PollenSession.class); + + /** User loggued account (if anonymous, then userAccount is null). */ + private UserAccount userAccount; + + public UserAccount getUserAccount() { + return userAccount; + } + + public void setUserAccount(UserAccount userAccount) { + this.userAccount = userAccount; + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenTopiaTransactionFilter.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenTopiaTransactionFilter.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenTopiaTransactionFilter.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,62 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaRuntimeException; +import org.nuiton.web.filter.TopiaTransactionFilter; + +/** + * EchoBase implementation of the {@link TopiaTransactionFilter}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class PollenTopiaTransactionFilter extends TopiaTransactionFilter { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(PollenTopiaTransactionFilter.class); + + @Override + protected TopiaContext beginTransaction() throws TopiaRuntimeException { + PollenApplicationContext applicationContext = + PollenActionSupport.getEchoBaseApplicationContext(); + + TopiaContext rootContext = applicationContext.getRootContext(); + try { + TopiaContext transaction = rootContext.beginTransaction(); + if (log.isDebugEnabled()) { + log.debug("Starts a new echo transaction " + transaction); + } + return transaction; + } catch (TopiaException eee) { + throw new TopiaRuntimeException("Could not start transaction", eee); + } + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenTopiaTransactionFilter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Creates a new poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class CreatePoll extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/CreatePoll.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Display list of created polls. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class DisplayCreatedPolls extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayCreatedPolls.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Display list of participated polls. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class DisplayParticipatedPolls extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayParticipatedPolls.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Display a poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class DisplayPoll extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPoll.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Display results of a poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class DisplayPollResult extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/DisplayPollResult.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,81 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.services.UserInvalidPasswordException; +import org.chorem.pollen.services.UserNotFoundException; +import org.chorem.pollen.services.UserService; + +/** + * Login user to pollen. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class Login extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + protected String login; + + protected String password; + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @InputConfig(methodName = "input") + @Override + public String execute() throws Exception { + + UserService service = newService(UserService.class); + + try { + UserAccount userAccount = service.connect(login, password); + getPollenSession().setUserAccount(userAccount); + return SUCCESS; + } catch (UserNotFoundException e) { + addFieldError("login", _("pollen.error.user.login.not.found")); + } catch (UserInvalidPasswordException e) { + addFieldError("password", _("pollen.error.user.invalid.password")); + } + + // if error go back to input + return INPUT; + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Login.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,43 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Logout from pollen. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class Logout extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + @Override + public String execute() throws Exception { + + getPollenSession().setUserAccount(null); + + return SUCCESS; + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/Logout.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,208 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +import com.opensymphony.xwork2.ActionContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.StrutsStatics; +import org.chorem.pollen.PollenConfiguration; +import org.chorem.pollen.services.PollenService; +import org.chorem.pollen.services.PollenServiceContext; +import org.chorem.pollen.services.PollenServiceContextImpl; +import org.chorem.pollen.services.PollenServiceFactory; +import org.chorem.pollen.ui.PollenApplicationContext; +import org.chorem.pollen.ui.PollenSession; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.framework.TopiaTransactionAware; +import org.nuiton.web.filter.TopiaTransactionFilter; +import org.nuiton.web.struts2.BaseAction; + +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Map; + +/** + * Pollen action support. + * <p/> + * <b>Note :</b> All actions must implement this class to have a better i18n + * support, when a i18n key is not translated it has a empty translation and + * we do NOT want this behaviour in gui, prefer to return the marked + * untranslated key. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class PollenActionSupport extends BaseAction implements TopiaTransactionAware { + + private static final long serialVersionUID = 1L; + + /** Key to store the {@link PollenSession} instance in the session's map. */ + protected static final String SESSION_PARAMETER = "pollenSession"; + + /** Key to store the single instance of the application context */ + public static final String APPLICATION_CONTEXT_PARAMETER = "pollenApplicationContext"; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(PollenActionSupport.class); + + private SimpleDateFormat dateFormat; + + private SimpleDateFormat monthFormat; + + public static PollenApplicationContext getEchoBaseApplicationContext() { + Map<String, Object> application = getActionContext().getApplication(); + PollenApplicationContext applicationContext = + (PollenApplicationContext) application.get(APPLICATION_CONTEXT_PARAMETER); + return applicationContext; + } + + protected PollenConfiguration getConfiguration() { + return getEchoBaseApplicationContext().getConfiguration(); + } + + /** Pollen User session. */ + private transient PollenSession pollenSession; + + /** + * Provides a way to get a service. + * <p/> + * Actions may <strong>not</strong> call it directly by use + * {@link #newService(Class)} instead. + */ + protected transient PollenServiceFactory serviceFactory; + + protected transient PollenServiceContext serviceContext; + + protected transient TopiaContext transaction; + + public PollenSession getPollenSession() { + if (pollenSession == null) { + + // load it from session + Map<String, Object> strutsSession = + getActionContext().getSession(); + PollenSession session = (PollenSession) + strutsSession.get(SESSION_PARAMETER); + + if (session == null) { + + // create an empty session + session = new PollenSession(); + + // and store it in the struts session + strutsSession.put(SESSION_PARAMETER, session); + } + pollenSession = session; + } + return pollenSession; + } + + public static String getApplicationVersion() { + return getEchoBaseApplicationContext().getConfiguration().getVersion().toString(); + } + + /** + * Fabrique pour récupérer le ServiceContext tel qu'il devrait être fourni + * à la fabrication d'un service. + * + * @return service context + */ + protected PollenServiceContext getServiceContext() { + if (serviceContext == null) { + serviceContext = PollenServiceContextImpl.newContext( + getLocale(), + getTransaction(), + getConfiguration(), + getServiceFactory() + ); + } + return serviceContext; + } + + public PollenServiceFactory getServiceFactory() { + if (serviceFactory == null) { + serviceFactory = new PollenServiceFactory(); + } + return serviceFactory; + } + + /** + * Sub-classes should use this method to easily get a service instance. + * + * @param serviceClass The type of service to instantiate + * @return A newly created service of the expected type with necessary data set + */ + public <E extends PollenService> E newService(Class<E> serviceClass) { + E service = getServiceFactory().newService(serviceClass, + getServiceContext()); + return service; + } + + @Override + public TopiaContext getTransaction() { + if (transaction == null) { + HttpServletRequest request = (HttpServletRequest) + getActionContext().get(StrutsStatics.HTTP_REQUEST); + transaction = TopiaTransactionFilter.getTransaction(request); + } + return transaction; + } + + @Override + public void setTransaction(TopiaContext transaction) { + this.transaction = transaction; + } + + public String formatDate(Date date) { + String result = getDateFormat().format(date); + return result; + } + + public String formatMonth(Date date) { + String result = getMonthFormat().format(date); + return result; + } + + protected SimpleDateFormat getDateFormat() { + if (dateFormat == null) { + dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + } + return dateFormat; + } + + protected SimpleDateFormat getMonthFormat() { + if (monthFormat == null) { + monthFormat = new SimpleDateFormat("mm-yyyy"); + } + return monthFormat; + } + + protected static ActionContext getActionContext() { + return ActionContext.getContext(); + } + +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,87 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.entity.UserAccountImpl; +import org.chorem.pollen.services.UserEmailAlreadyUsedException; +import org.chorem.pollen.services.UserLoginAlreadyUsedException; +import org.chorem.pollen.services.UserService; + +/** + * Register a new user. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class RegisterUser extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + protected UserAccount user; + + protected String password2; + + public UserAccount getUser() { + if (user == null) { + user = new UserAccountImpl(); + } + return user; + } + + public String getPassword2() { + return password2; + } + + public void setPassword2(String password2) { + this.password2 = password2; + } + + @InputConfig(methodName = "input") + @Override + public String execute() throws Exception { + + UserService service = newService(UserService.class); + + try { + service.createUser(user); + getTransaction().commitTransaction(); + + getPollenSession().setUserAccount(user); + return SUCCESS; + } catch (UserLoginAlreadyUsedException e) { + addFieldError("user.login", _("pollen.error.user.login.already.used")); + } catch (UserEmailAlreadyUsedException e) { + addFieldError("user.email", _("pollen.error.user.email.already.used")); + } + + // if error go back to input + + // reset password + user.setPassword(null); + + return INPUT; + } +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/RegisterUser.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UserPreferences.java =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UserPreferences.java (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UserPreferences.java 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,35 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions; + +/** + * Register a new user. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class UserPreferences extends PollenActionSupport { + + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/UserPreferences.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,16 @@ +pollen.action.login=Log me In +pollen.action.register=Register +pollen.error.email.required=You must provide a email +pollen.error.login.required=You must provide a login +pollen.error.password.required=Your must provide a password +pollen.error.password2.required=You must repeat your password for confirmation +pollen.error.passwords.not.equals=Les deux mots de passe saisis non identiques +pollen.error.user.email.already.used=This email is already used +pollen.error.user.invalid.password=Invalid password +pollen.error.user.login.already.used=This login is already used +pollen.error.user.login.not.found=User login not found +pollen.fieldset.connexionInformation=Information de connexion +pollen.fieldset.userInformation=Informations de l'utilisateur +pollen.legend.login=Login +pollen.title.login=Page de login +pollen.title.register=Register Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,16 @@ +pollen.action.login=M'identifier +pollen.action.register=S'enregistrer +pollen.error.email.required=Courriel obligatoire +pollen.error.login.required=Login obligatoire +pollen.error.password.required=Mot de passe obligatoire +pollen.error.password2.required=Mot de passe répété obligatoire +pollen.error.passwords.not.equals=Les deux mots de passe saisis non identiques +pollen.error.user.email.already.used=Le courriel saisi est déjà utilisé par un autre utilisateur +pollen.error.user.invalid.password=Mot de passe non valide +pollen.error.user.login.already.used=Le login saisie est déjà utilisé par un autre utilisateur +pollen.error.user.login.not.found=Utilisateur non trouvé +pollen.fieldset.connexionInformation=Information de connexion +pollen.fieldset.userInformation=Informations de l'utilisateur +pollen.legend.login=Login +pollen.title.login=Page de login +pollen.title.register=Enregistrement Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/log4j.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/log4j.properties (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/log4j.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,30 @@ +### +# #%L +# Pollen :: UI (strust2) +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2012 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +log4j.rootCategory=ERROR, console + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d [%p] %c{2} %m%n + +log4j.logger.org.chorem.pollen=INFO Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/Login-validation.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/Login-validation.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/Login-validation.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,44 @@ +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + + <field name="login"> + + <field-validator type="requiredstring"> + <message key="pollen.error.login.required"/> + </field-validator> + </field> + + <field name="password"> + + <field-validator type="requiredstring"> + <message key="pollen.error.password.required"/> + </field-validator> + + </field> + +</validators> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/Login-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/RegisterUser-validation.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/RegisterUser-validation.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/RegisterUser-validation.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,65 @@ +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + + <field name="user.login"> + + <field-validator type="requiredstring"> + <message key="pollen.error.login.required"/> + </field-validator> + </field> + + <field name="user.password"> + + <field-validator type="requiredstring"> + <message key="pollen.error.password.required"/> + </field-validator> + + </field> + + <field name="password2"> + + <field-validator type="requiredstring"> + <message key="pollen.error.password2.required"/> + </field-validator> + + <field-validator type="fieldexpression"> + <param name="expression">password2.equals(user.password)</param> + <message key="pollen.error.passwords.not.equals"/> + </field-validator> + + </field> + + <field name="user.email"> + + <field-validator type="requiredstring"> + <message key="pollen.error.email.required"/> + </field-validator> + + </field> + +</validators> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/RegisterUser-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/pollen.properties =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/pollen.properties (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/pollen.properties 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,33 @@ +### +# #%L +# Pollen :: UI (strust2) +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2012 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +hibernate.show_sql=false +hibernate.hbm2ddl.auto=update +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:${pollen.dataDirectory}/db/pollendb + +## Version de l'application +pollen.version=${project.version} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/pollen.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + + +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" + "http://struts.apache.org/dtds/struts-2.1.7.dtd"> + +<struts> + + <bean class="org.nuiton.web.struts2.I18nTextProvider" + name="i18nTextProvider" + type="com.opensymphony.xwork2.TextProvider"/> + <constant name="struts.xworkTextProvider" value="i18nTextProvider"/> + + <constant name="struts.ognl.allowStaticMethodAccess" value="true"/> + <constant name="struts.action.extension" value=",,"/> + <constant name="struts.locale" value="fr_FR"/> + <constant name="struts.i18n.reload" value="false"/> + <constant name="struts.configuration.xml.reload" value="false"/> + <constant name="struts.ui.theme" value="css_xhtml"/> + <constant name="struts.multipart.maxSize" value="209715200"/> + + <!--Performance tuning--> + <!--see http://struts.apache.org/2.2.3/docs/performance-tuning.html--> + <constant name="struts.freemarker.templatesCache" value="true"/> + + <package name="default" extends="json-default" abstract="true" namespace="/"> + + <interceptors> + + <!-- to remove parameter from context --> + <interceptor name="paramRemover" + class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/> + + + <!-- basic stack --> + <interceptor-stack name="pollenBasicStack"> + <interceptor-ref name="i18n"/> + <interceptor-ref name="basicStack"/> + </interceptor-stack> + + <!-- params stack with params--> + <interceptor-stack name="pollenParamsPrepareParamsStack"> + <interceptor-ref name="i18n"/> + <interceptor-ref name="paramsPrepareParamsStack"/> + </interceptor-stack> + + + </interceptors> + + <!-- must be authenticated to perform any actions --> + <default-interceptor-ref name="pollenBasicStack"/> + + <!-- default action to use everywhere (fix i18n when not translated) --> + <default-class-ref + class="org.chorem.pollen.ui.actions.PollenActionSupport"/> + + </package> + + <package name="applicationDefault" extends="default" namespace="/"> + + <default-interceptor-ref name="pollenParamsPrepareParamsStack"/> + + <default-action-ref name="home"/> + + + <!-- go to home --> + <action name="home" + class="org.chorem.pollen.ui.actions.PollenActionSupport"> + + <result>/WEB-INF/jsp/home.jsp</result> + + <interceptor-ref name="i18nStack"/> + <!-- remove the request_locale parameter from request --> + <interceptor-ref name="paramRemover"> + <param name="paramNames">request_locale</param> + </interceptor-ref> + </action> + + <!-- login --> + <action name="login" class="org.chorem.pollen.ui.actions.Login"> + <result name="input">/WEB-INF/jsp/login.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- register user --> + <action name="registerUser" + class="org.chorem.pollen.ui.actions.RegisterUser"> + <result name="input">/WEB-INF/jsp/registerUser.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- user preferences --> + <action name="userPreferences" + class="org.chorem.pollen.ui.actions.UserPreferences"> + <result name="input">/WEB-INF/jsp/userPreferences.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- logout --> + <action name="logout" class="org.chorem.pollen.ui.actions.Logout"> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- create poll --> + <action name="createPoll" + class="org.chorem.pollen.ui.actions.CreatePoll"> + <result name="input">/WEB-INF/jsp/createPoll.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- display poll --> + <action name="displayPoll" + class="org.chorem.pollen.ui.actions.DisplayPoll"> + <result name="input">/WEB-INF/jsp/poll.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- display poll result --> + <action name="displayPollResult" + class="org.chorem.pollen.ui.actions.DisplayPollResult"> + <result name="input">/WEB-INF/jsp/pollResult.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- display createds polls --> + <action name="displayCreatedPolls" + class="org.chorem.pollen.ui.actions.DisplayCreatedPolls"> + <result name="input">/WEB-INF/jsp/createdPolls.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + <!-- display participated polls --> + <action name="displayParticipatedPolls" + class="org.chorem.pollen.ui.actions.DisplayParticipatedPolls"> + <result name="input">/WEB-INF/jsp/participatedPolls.jsp</result> + <result>/WEB-INF/jsp/home.jsp</result> + </action> + + </package> + + +</struts> + Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/struts.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/validators.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/validators.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/validators.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator Config 1.0//EN" + "http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd"> +<validators> + <!-- default validators from XWork framework --> + <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> + <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> + <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> + <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> + <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> + <validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/> + <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> + <validator name="conversion" class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/> + <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> + <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> + <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> + + <!-- default nuiton-validator validators --> + <validator name="nfieldexpression" class="org.nuiton.validator.xwork2.field.NuitonFieldExpressionValidator"/> + <validator name="nrequired" class="org.nuiton.validator.xwork2.field.SkipableRequiredFieldValidator"/> + <validator name="nrequiredstring" class="org.nuiton.validator.xwork2.field.SkipableRequiredStringFieldValidator"/> + + <!-- Pollen validators --> + +</validators> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/resources/validators.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,53 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html; charset=utf-8" + pageEncoding="utf-8" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="d" uri="http://www.opensymphony.com/sitemesh/decorator" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + +<%-- metas in head --%> +<%@ include file="/WEB-INF/includes/metas.jsp" %> + +<body> + +<%-- header --%> +<%@ include file="/WEB-INF/includes/header.jsp" %> + +<%-- body --%> +<h2><d:title default="Pollen"/></h2> + +<div id="body"> + + <d:body/> + +</div> + +<%-- footer --%> +<%@ include file="/WEB-INF/includes/footer.jsp" %> + +</body> +</html> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,37 @@ +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> +<decorators defaultdir="/WEB-INF/decorators"> + + <excludes> + <pattern>/css/*</pattern> + <pattern>/js/*</pattern> + <pattern>/images/*</pattern> + <pattern>/config-browser/*</pattern> + </excludes> + + <decorator name="layout-default" page="layout-default.jsp"> + <pattern>/*</pattern> + </decorator> + +</decorators> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/footer.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/footer.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/footer.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,40 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page import="org.chorem.pollen.ui.actions.PollenActionSupport" %> + +<%@ taglib prefix="s" uri="/struts-tags" %> + +<hr/> + +<!-- Pied de page --> +<div id="po-footer"> + <a href="">Pollen - <%=PollenActionSupport.getApplicationVersion()%></a> + <a href="http://www.chorem.org/projects/pollen/files">version</a> - + <a href="http://www.gnu.org/licenses/gpl.html">License</a> - + <span title="Copyright">© 2009 - 2012</span> + <a href="http://www.codelutin.com">Code Lutin</a> - + <a href="http://www.chorem.org/projects/pollen/issues">Bug report</a> - + <a href="http://list.chorem.org/cgi-bin/mailman/listinfo/pollen-users">Support</a> +</div> + Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/footer.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/header.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/header.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/header.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,144 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="d" uri="http://www.opensymphony.com/sitemesh/decorator" %> + +<s:set var="userIsIn" value="%{#session.pollenSession.userAccount !=null}"/> +<%--<s:set var="userIsAdmin" value="%{userIsIn && #session.pollenSession.userAccount.admin}"/>--%> + +<div class='displayBlock'> + + <div class='floatLeft'> + <s:a action="home" namespace="/">Pollen</s:a> + </div> + + <div id='headerRight'> + <div> + <s:if test="userIsIn"> + <s:text name="pollen.label.user.login"> + <s:param> + <s:property value="#session.pollenSession.userAccount.email"/> + </s:param> + </s:text> + <ul> + <li> + <s:a action="userPreferences" method="input"> + <s:text name="pollen.menu.preferences"/></s:a> + </li> + <li> + <s:a action="logout"> + <s:text name="pollen.menu.logout"/></s:a> + </li> + </ul> + </s:if> + <s:else> + <ul> + <li> + <s:a action="registerUser" method="input"> + <s:text name="pollen.menu.register"/></s:a> + </li> + <li> + <s:a action="login" method="input"> + <s:text name="pollen.menu.login"/></s:a> + </li> + </ul> + </s:else> + </div> + <br/> + + <div class="cleanBoth"> + <s:text name="pollen.label.language"/> + <ul> + <li> + <s:if + test="%{#session['WW_TRANS_I18N_LOCALE'] != null && #session['WW_TRANS_I18N_LOCALE'].language == 'en'}"> + <s:text name="pollen.label.locale.english"/> + </s:if> + <s:else> + <s:a action="home" namespace="/"> + <s:param name="request_locale">en_GB</s:param> + <s:text name="pollen.action.locale.english"/> + </s:a> + </s:else> + </li> + <li> + <s:if + test="%{#session['WW_TRANS_I18N_LOCALE'] == null || #session['WW_TRANS_I18N_LOCALE'].language == 'fr'}"> + <s:text name="pollen.label.locale.french"/> + </s:if> + <s:else> + <s:a action="home" namespace="/"> + <s:param name="request_locale">fr_FR</s:param> + <s:text name="pollen.action.locale.french"/> + </s:a> + </s:else> + </li> + </ul> + </div> + <br/> + </div> + + + <div class="cleanBoth"> + <ul> + <s:if test="userIsIn"> + <li> + <s:a action="createPoll" method="input"> + <s:text name="echobase.menu.createPoll"/> + </s:a> + </li> + <li> + <s:a action="displayCreatedPolls" method="input"> + <s:text name="echobase.menu.displayCreatedPolls"/> + </s:a> + </li> + <li> + <s:a action="displayParticipatedPolls" method="input"> + <s:text name="echobase.menu.displayParticipatedPolls"/> + </s:a> + </li> + <li> + <s:a action="displayParticipatedPolls" method="input"> + <s:text name="echobase.menu.displayParticipatedPolls"/> + </s:a> + </li> + <li> + <s:a action="displayVotingLists" method="input"> + <s:text name="echobase.menu.displayVotingLists"/> + </s:a> + </li> + </s:if> + <s:else> + <li> + <s:a action="createPoll" method="input"> + <s:text name="echobase.menu.createPoll"/> + </s:a> + </li> + </s:else> + </ul> + </div> + +</div> +<hr/> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/header.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/i18n.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/i18n.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/i18n.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,24 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ taglib prefix="s" uri="/struts-tags" %> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/i18n.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/metas.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/metas.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/metas.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,36 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="d" uri="http://www.opensymphony.com/sitemesh/decorator" %> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <title>Pollen - <d:title default="Pollen"/></title> + <d:head/> + <link rel="stylesheet" type="text/css" href="<s:url value='/css/pollen.css' />"/> + <link rel="stylesheet" type="text/css" href="<s:url value='/css/screen.css' />"/> + <%--<link rel="icon" type="image/png"--%> + <%--href="<s:url value='/images/logo_codelutin.png' />"/>--%> + <sj:head jqueryui="true" jquerytheme="cupertino"/> +</head> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/includes/metas.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,28 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> + +<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<h2><s:text name="pollen.title.welcome"/></h2> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,40 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<title><s:text name="pollen.title.login"/></title> + +<s:form method="POST"> + <fieldset> + <legend> + <s:text name="pollen.legend.login"/> + </legend> + <s:hidden key="redirectAction" label=""/> + <s:textfield name="login" key="pollen.common.login" required="true"/> + <s:password name="password" key="pollen.common.password" required="true"/> + </fieldset> + <br/> + <s:submit action="login" key="pollen.action.login" align="right"/> +</s:form> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/login.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,49 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<title><s:text name="pollen.title.register"/></title> + +<s:form method="POST"> + + <fieldset> + <legend><s:text name="pollen.fieldset.connexionInformation"/></legend> + + <s:textfield name="user.login" key="pollen.common.login" required="true"/> + <s:password name="user.password" key="pollen.common.password" required="true"/> + <s:password name="password2" key="pollen.common.password2" required="true"/> + </fieldset> + + <fieldset> + <legend><s:text name="pollen.fieldset.userInformation"/></legend> + + <s:textfield name="user.email" key="pollen.common.email" required="true"/> + <s:textfield name="user.lastname" key="pollen.common.lastname" required="true"/> + <s:textfield name="user.firstname" key="pollen.common.firstname" + required="true"/> + </fieldset> + <br/> + <s:submit action="registerUser" key="pollen.action.register" align="right"/> +</s:form> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/registerUser.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/userPreferences.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/userPreferences.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/userPreferences.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,51 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<title><s:text name="pollen.title.preferences"/></title> + +<s:form method="POST"> + + <fieldset> + <legend><s:text name="pollen.fieldset.connexionInformation"/></legend> + + <s:textfield name="login" key="pollen.common.login" required="true"/> + <s:password name="oldPassword" key="pollen.common.oldPassword" + required="true"/> + <s:password name="password" key="pollen.common.password"/> + <s:password name="password2" key="pollen.common.password2"/> + </fieldset> + + <fieldset> + <legend><s:text name="pollen.fieldset.userInformation"/></legend> + + <s:textfield name="email" key="pollen.common.email" required="true"/> + <s:textfield name="lastname" key="pollen.common.lastname" required="true"/> + <s:textfield name="firstname" key="pollen.common.firstname" + required="true"/> + </fieldset> + <br/> + <s:submit action="registerUser" key="pollen.action.register" align="right"/> +</s:form> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/userPreferences.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/web.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/web.xml (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/web.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + +<web-app id="Pollen" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> + + <display-name>EchoBase</display-name> + + <filter> + <filter-name>topiaTransaction</filter-name> + <filter-class>org.chorem.pollen.ui.PollenTopiaTransactionFilter</filter-class> + </filter> + + <filter> + <filter-name>struts-prepare</filter-name> + <filter-class> + org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter + </filter-class> + </filter> + + <filter> + <filter-name>sitemesh</filter-name> + <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> + </filter> + + <filter> + <filter-name>struts-execute</filter-name> + <filter-class> + org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter + </filter-class> + </filter> + + <filter-mapping> + <filter-name>topiaTransaction</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>struts-prepare</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>struts-execute</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <listener> + <description>Init</description> + <listener-class>org.chorem.pollen.ui.PollenApplicationListener</listener-class> + </listener> + + <welcome-file-list> + <welcome-file>/</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>home</welcome-file> + </welcome-file-list> +</web-app> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/WEB-INF/web.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/pollen.css =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/pollen.css (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/pollen.css 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,158 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +/* global */ +body { + font-family: "Trebuchet MS",Arial,sans-serif; + width: 1000px; + margin: auto; + font-size: small; +} + +/* header */ +#po-header-localization{ + text-align:right; + margin-top: 10px; +} +#po-header-localization .po-contactlink { + width:20px; + background:url("../WEB-INF/img/contact.png") no-repeat center; +} +#po-header-localization .po-localelink { + width:20px; + background:url("../WEB-INF/img/en.png") no-repeat center; +} +#po-header-localization .po-localelink:lang(fr){ + background-image:url("../WEB-INF/img/fr.png") +} + +#po-header-logo{ + float: left; + margin-right: 10px; + margin-top: -100px; + width:350px; + height:153px; + background:url("../WEB-INF/img/pollenIndex_en.png") no-repeat; +} +html:lang(fr) #po-header-logo { + background-image:url("../WEB-INF/img/pollenIndex_fr.png") +} + +#po-header-menu{ + padding: 7px; + background-color: #FFFF00; +} +#po-header-menu #po-header-connection { + float:right; +} +#po-header-menu #po-header-connection #po-header-login-box{ + display:none; +} +#po-header-menu #po-header-connection-menu{ + margin:0; + padding:0; +} +#po-header-menu #po-header-connection-menu li{ + display:inline +} +#po-header-menu #po-header-connection span{ + cursor:pointer; + padding: 1px 5px; +} +#po-header-menu #po-header-connection span:hover{ + background-color: #000000; + border-radius: 10px 10px 10px 10px; + color: white; +} +#po-header-menu #po-header-connection a{ + color: black; + text-decoration:none; +} +#po-header-menu #po-header-connection a:hover{ + color: white; +} + +/* footer */ +#po-footer { + background-color: #FFFF00; + font-size: small; + margin-top: 20px; + padding: 5px; + text-align: center; + color: #727A7E; +} +#po-footer a{ + color: #727A7E; +} + +/* page content */ +.page #po-placebar { + background-color: #FFFFAA; + margin-left: 350px; + padding: 5px; +} +.page #po-placebar .pbitem { + font-weight:bold; +} +.page #po-placebar .pbitem:before{ + content:"> "; +} +.page .content { + padding: 15px; +} + +/* page : home page */ +#po-homelogo { + width:20px; + background:url("../WEB-INF/img/pollen.png") no-repeat center; + margin:auto; + width:260px; + height:200px; +} +#po-homeactions { + text-align:center; +} +#po-homeactions .createpoll{ + background:url("../WEB-INF/img/smallCreation_en.png") no-repeat center; + width:250px; + height:100px; +} +html:lang(fr) #po-homeactions .createpoll { + background-image:url("../WEB-INF/img/smallCreation_fr.png") +} +#po-homeactions .mypoll{ + background:url("../WEB-INF/img/smallVote_en.png") no-repeat center; + width:200px; + height:100px; +} +html:lang(fr) #po-homeactions .mypoll { + background-image:url("../WEB-INF/img/smallVote_fr.png") +} +#po-homeactions .votecounting{ + background:url("../WEB-INF/img/smallVoteCounting_en.png") no-repeat center; + width:250px; + height:100px; +} +html:lang(fr) #po-homeactions .votecounting { + background-image:url("../WEB-INF/img/smallVoteCounting_fr.png") +} \ No newline at end of file Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/pollen.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/screen.css =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/screen.css (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/screen.css 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,249 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +* { + font-family: sans-serif; +} + +.inline { + display:inline; +} + +.fontsize11 { + font-size: 11px; +} + +.ui-tabs-panel { + font-family: monospace; + font-size: 9pt; +} + +.ui-tabs .ui-tabs-nav li a { + float: left; + padding: .5em .1em; + text-decoration: none; + font-size: 11px; +} + +#body { + /*min-height: 500px;*/ + float: left; + /*left: 275px;*/ + padding: 10px; + width: 99%; +} + +.clearBoth { + clear: both; +} + +#footer { + /*margin-top: 120px;*/ + clear: both; + text-align: center; +} + +.hidden { + display:none; +} + +.displayBlock { + display:block; +} + +.floatLeft { + float:left; +} + +.floatRight { + float:right; +} + +.info_success { + background: no-repeat scroll 8px 5px #DFFFDF; + border: 2px solid #9FCF9F; + width: 800px; + margin-bottom: 5px; +} +.info_success ul{ + margin: 5px; + padding-left: 5px; +} +.info_success li{ + background: url("../images/true.png") no-repeat ; + list-style: none; + font-style: italic; + padding-left: 25px; + color: #005F00; + margin-left:0px; +} + +.info_error { + background: no-repeat scroll 8px 5px #FFE3E3; + border: 2px solid #DD0000; + width: 800px; + margin-bottom: 5px; +} +.info_error ul{ + margin: 5px; + padding-left: 5px; +} +.info_error li{ + background: url("../images/exclamation.png") no-repeat ; + list-style: none; + font-style: italic; + padding-left: 25px; + color: #880000; + margin-left:0px; +} + +.errorMessage li{ + background: url("../images/exclamation.png") no-repeat ; + list-style: none; + font-style: italic; + padding-left: 25px; + color: #880000; + margin-left:0px; +} + +.verticalAlignTop { + vertical-align: top; +} +fieldset, hr , .cleanBoth{ + clear: both +} +.wwlbl { + float: left; + clear: both; + width: 300px; +/*# text-align: right;*/ +} +.wwctrl { + float: left; +} + +.wwerr { + clear: both; + float: left; +} + +div.errorMessage{ + clear: both; + float: left; +} +.errorMessage { + background: url("../images/exclamation.png") no-repeat ; + list-style: none; + font-style: italic; + padding-left: 25px; + color: #880000; + margin-left:0px; +} + +.required { + color: #880000; + font-style: italic; +} + +.clearfix { + display: inline-block; +} + +/* Hide from IE Mac \*/ +.clearfix { + display: block; +} + +#footer { + /*background: url(../images/footer.png) repeat-x;*/ + /*height: 45px;*/ + /*padding: 10px 20px 15px 20px;*/ + /*margin: 30px 0;*/ + position: relative; + /*text-transform: uppercase;*/ + text-align:center; + /*color: #fff;*/ + /*font-size: 140%;*/ +} + +#footer ul { + width: 1000px; + margin: 0 auto; +} + +div#headerRight { + float:right; +} + +div#headerRight div { + float: right; +} + +#headerRight ul { + display:inline; + line-height: 20px; + padding: 0 5px; +} + +#headerRight li { + display:inline; + padding: 0 5px; +} + +ul.toolbar { + display:inline; + /*line-height: 20px;*/ + /*padding: 0 5px;*/ +} + +ul.toolbar li { + display:inline; + padding: 0 5px; +} + +#footer ul li { + display:inline; + list-style: none; + margin: 0 10px; + line-height: 30px; + padding: 0 5px; +} + +#footer ul li a { + /*color: #fff;*/ + text-decoration: none; +} + +#footer ul li a:hover { + /*color: #ffe600;*/ +} + +ul#mode_ul { + margin: 5px; + padding-left: 5px; +} +ul#mode_ul li{ + list-style: none; + padding-left: 25px; + margin-left:0px; +} Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/css/screen.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigCreation.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigCreation.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVote.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVote.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVoteCounting.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/bigVoteCounting.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/contact.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/contact.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/en.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/en.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/fr.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/fr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollen.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollen.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_en.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_en.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_fr.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/pollenIndex_fr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_en.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_en.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_fr.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallCreation_fr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_en.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_en.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_fr.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVoteCounting_fr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_en.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_en.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_fr.png =================================================================== (Binary files differ) Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/img/smallVote_fr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/index.jsp =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/index.jsp (rev 0) +++ branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/index.jsp 2012-01-20 16:48:46 UTC (rev 3097) @@ -0,0 +1,25 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero 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 Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% response.sendRedirect("home");%> Property changes on: branches/pollen-2.0-beta-1/pollen-ui-struts2/src/main/webapp/index.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-2.0-beta-1/pollen-ui-tapestry/pom.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-ui/pom.xml 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-ui-tapestry/pom.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -16,7 +16,7 @@ </parent> <groupId>org.chorem.pollen</groupId> - <artifactId>pollen-ui</artifactId> + <artifactId>pollen-ui-tapestry</artifactId> <dependencies> <dependency> @@ -67,7 +67,7 @@ </dependency> <dependency> <groupId>org.nuiton.web</groupId> - <artifactId>nuiton-tapestry-extra</artifactId> + <artifactId>nuiton-tapestry</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> Modified: branches/pollen-2.0-beta-1/pollen-ui-webmotion/pom.xml =================================================================== --- branches/pollen-2.0-beta-1/pollen-wm/pom.xml 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pollen-ui-webmotion/pom.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -16,7 +16,7 @@ </parent> <groupId>org.chorem.pollen</groupId> - <artifactId>pollen-wm</artifactId> + <artifactId>pollen-ui-webmotion</artifactId> <dependencies> <dependency> Modified: branches/pollen-2.0-beta-1/pom.xml =================================================================== --- branches/pollen-2.0-beta-1/pom.xml 2012-01-19 23:57:08 UTC (rev 3096) +++ branches/pollen-2.0-beta-1/pom.xml 2012-01-20 16:48:46 UTC (rev 3097) @@ -23,8 +23,9 @@ <module>pollen-services</module> <!--<module>pollen-business</module>--> <!--<module>pollen-votecounting</module>--> - <module>pollen-ui</module> - <module>pollen-wm</module> + <!--<module>pollen-ui-tapestry</module>--> + <!--<module>pollen-ui-webmotion</module>--> + <module>pollen-ui-struts2</module> </modules> <dependencyManagement> @@ -58,22 +59,45 @@ <artifactId>nuiton-utils</artifactId> <version>${nuitonUtilsVersion}</version> </dependency> + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <version>${nuitonUtilsVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-struts2</artifactId> + <version>${nuitonWebVersion}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-web</artifactId> + <version>${nuitonWebVersion}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-tapestry</artifactId> + <version>${nuitonWebVersion}</version> + </dependency> + + <dependency> <groupId>org.nuiton.i18n</groupId> <artifactId>nuiton-i18n</artifactId> <version>${nuitonI18nVersion}</version> </dependency> - <dependency> - <groupId>org.nuiton.eugene</groupId> - <artifactId>eugene</artifactId> - <version>${eugenePluginVersion}</version> - </dependency> <dependency> <groupId>org.nuiton.topia</groupId> <artifactId>topia-persistence</artifactId> <version>${topiaVersion}</version> </dependency> + <dependency> <groupId>org.nuiton.topia</groupId> <artifactId>topia-service-migration</artifactId> @@ -104,11 +128,6 @@ </dependency> <dependency> - <groupId>org.nuiton.web</groupId> - <artifactId>nuiton-tapestry-extra</artifactId> - <version>${nuitonWebVersion}</version> - </dependency> - <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4jVersion}</version> @@ -120,6 +139,8 @@ <version>${slf4jVersion}</version> <scope>runtime</scope> </dependency> + + <!-- Tapestry --> <dependency> <groupId>org.apache.tapestry</groupId> <artifactId>tapestry-upload</artifactId> @@ -136,7 +157,52 @@ </exclusion> </exclusions> </dependency> + + <!-- Struts 2 --> + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-core</artifactId> + <version>${struts2Version}</version> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-plugin</artifactId> + <version>${jqueryPluginVersion}</version> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-grid-plugin</artifactId> + <version>${jqueryPluginVersion}</version> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-json-plugin</artifactId> + <version>${struts2Version}</version> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-sitemesh-plugin</artifactId> + <version>${struts2Version}</version> + </dependency> + + <dependency> + <groupId>org.apache.struts.xwork</groupId> + <artifactId>xwork-core</artifactId> + <version>${struts2Version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> <groupId>org.jdom</groupId> <artifactId>jdom</artifactId> <version>1.1</version> @@ -154,7 +220,7 @@ <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> - <version>3.8.0.GA</version> + <version>3.10.0.GA</version> </dependency> <dependency> <groupId>net.sf.opencsv</groupId> @@ -166,23 +232,34 @@ <artifactId>rome</artifactId> <version>1.0</version> </dependency> + + <!-- base postgres --> <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>${postgresqlVersion}</version> + </dependency> + + <!-- base h2 --> + <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <version>1.3.162</version> + <version>${h2Version}</version> </dependency> + <dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>9.0-801.jdbc4</version> - </dependency> - <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-runner</artifactId> + <version>${jettyVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> @@ -340,11 +417,16 @@ <eugenePluginVersion>2.4.1</eugenePluginVersion> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> <tapestryVersion>5.1.0.5</tapestryVersion> - <nuitonWebVersion>0.1</nuitonWebVersion> - <nuitonUtilsVersion>2.3.1</nuitonUtilsVersion> - <processorPluginVersion>1.2.2</processorPluginVersion> + <nuitonWebVersion>1.9.1</nuitonWebVersion> + <nuitonUtilsVersion>2.4.4</nuitonUtilsVersion> + <h2Version>1.3.163</h2Version> + <postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion> + <struts2Version>2.3.1.1</struts2Version> + <jqueryPluginVersion>3.2.1</jqueryPluginVersion> <slf4jVersion>1.6.4</slf4jVersion> + <jettyVersion>8.1.0.RC2</jettyVersion> + <!--Multilanguage maven-site --> <siteLocales>en,fr</siteLocales> @@ -369,12 +451,6 @@ </dependencies> </plugin> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-maven-plugin</artifactId> - <version>8.0.4.v20111024</version> - </plugin> - <!-- EUGene plugin for entities generation --> <plugin> <groupId>org.nuiton.eugene</groupId> @@ -397,6 +473,20 @@ <artifactId>maven-i18n-plugin</artifactId> <version>${nuitonI18nVersion}</version> </plugin> + + <!-- remove this when using mavenpom 3.1 --> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <version>1.4</version> + </plugin> + + <!-- remove this when using mavenpom 3.1 --> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <version>${jettyVersion}</version> + </plugin> </plugins> </pluginManagement> @@ -408,6 +498,13 @@ </resources> </build> + <reporting> + + <!-- par defaut pas de report pour les sites --> + <excludeDefaults>true</excludeDefaults> + + </reporting> + <!-- ************************************************************* --> <!-- *** Build Environment ************************************** --> <!-- ************************************************************* -->
participants (1)
-
tchemit@users.chorem.org