Author: fdesbois Date: 2010-03-23 16:39:36 +0100 (Tue, 23 Mar 2010) New Revision: 2956 Log: - Clean business module to begin 2.0 version - Use a Transformer (in a module name pollen-template) to generate abstract services + context interfaces Added: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java trunk/pollen-business/src/main/java/org/chorem/pollen/entity/ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/entity/VoteImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java trunk/pollen-topia-template/ trunk/pollen-topia-template/LICENSE.txt trunk/pollen-topia-template/README.txt trunk/pollen-topia-template/changelog.txt trunk/pollen-topia-template/pom.xml trunk/pollen-topia-template/src/ trunk/pollen-topia-template/src/main/ trunk/pollen-topia-template/src/main/java/ trunk/pollen-topia-template/src/main/java/org/ trunk/pollen-topia-template/src/main/java/org/chorem/ trunk/pollen-topia-template/src/main/java/org/chorem/pollen/ trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/ trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenContextImplementor.java trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenServiceTransformer.java Removed: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenBusinessException.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImplementor.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenProperty.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/package-info.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPersonListConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollAccountConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataUserConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVotingListConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/package-info.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/CommentDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PersonListDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollAccountDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultListDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/UserDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VoteDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VotingListDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/package-info.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/PollenMigrationCallbackHandler.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/package-info.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/SendMail.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoice.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceList.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccount.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRule.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResults.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVote.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/package-info.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MD5.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MailUtil.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/PropertiesLoader.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/package-info.java trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/ScalingVote.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/package-info.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/SendMailTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceListImplTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePreventRuleImplTest.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java Modified: trunk/pollen-business/pom.xml trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContext.java trunk/pollen-business/src/main/xmi/pollen.properties trunk/pollen-business/src/main/xmi/pollen.zargo trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java trunk/pollen-votecounting/pom.xml trunk/pom.xml Modified: trunk/pollen-business/pom.xml =================================================================== --- trunk/pollen-business/pom.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/pom.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -10,7 +10,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <groupId>org.chorem.pollen</groupId> @@ -19,6 +19,11 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>pollen-template</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>pollen-votecounting</artifactId> <version>${project.version}</version> </dependency> @@ -108,32 +113,33 @@ <!-- By default, generation from ObjectModel --> <configuration> <!-- Corresponding to extracted package from zargo file --> - <fullPackagePath>org.chorem.pollen.business</fullPackagePath> + <fullPackagePath>org.chorem.pollen</fullPackagePath> <!-- DefaultPackage used for DAOHelper generation --> - <defaultPackage>org.chorem.pollen.business.persistence</defaultPackage> + <defaultPackage>org.chorem.pollen</defaultPackage> <templates> - org.nuiton.topia.generator.TopiaMetaTransformer + org.nuiton.topia.generator.TopiaMetaTransformer, + org.chorem.pollen.template.PollenServiceTransformer </templates> </configuration> <goals> <goal>smart-generate</goal> </goals> </execution> - <execution> + <!--<execution> <phase>generate-sources</phase> <id>copy-mapping-files</id> <configuration> - <!-- Config for copyVersionFiles --> + Config for copyVersionFiles <includes>**/*.objectmodel</includes> <copyVersionDir>${project.basedir}/src/main/resources/oldmappings/pollen</copyVersionDir> <copyVersionFiles>**/*.hbm.xml</copyVersionFiles> - <!-- Warning : the overwrite is working for both goals --> + Warning : the overwrite is working for both goals <overwrite>true</overwrite> </configuration> <goals> <goal>copyVersionFiles</goal> </goals> - </execution> + </execution>--> </executions> </plugin> <plugin> Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java (from rev 2951, trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenBusinessException.java) =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,51 @@ + +package org.chorem.pollen; +import static org.nuiton.i18n.I18n.n_; + +/** + * PollenBusinessException + * + * Created: 24 févr. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class PollenBusinessException extends Exception { + + private static final long serialVersionUID = 1L; + + protected PollenExceptionType type; + + protected Object[] args; + + public PollenBusinessException(PollenExceptionType type) { + super(type.getMessage()); + } + + public PollenBusinessException(PollenExceptionType type, Object... args) { + super(type.getMessage()); + this.args = args; + } + + public enum PollenExceptionType { + //LOAD_CONFIGURATION(n_("pollen.exception.load_configuration")), + POLL_NOT_EXIST(n_("pollen.exception.poll_not_exist")); + + private String message; + + PollenExceptionType(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + } + + public Object[] getArgs() { + return args; + } +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: svn:mergeinfo + Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java (from rev 2953, trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImpl.java) =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenContextImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,342 @@ + +package org.chorem.pollen; + +import java.util.Date; +import java.util.Properties; +import java.util.UUID; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.business.PollenException; +//import org.chorem.pollen.PollenDAOHelper; +//import org.chorem.pollen.business.services.SendMail; +//import org.chorem.pollen.business.services.ServiceUserImpl; +import org.nuiton.i18n.I18n; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaNotFoundException; +import org.nuiton.util.ApplicationConfig; +import org.nuiton.util.ArgumentsParserException; +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; +import org.nuiton.i18n.init.DefaultI18nInitializer; + +/** + * PollenContext + * + * Created: 24 févr. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class PollenContextImpl implements PollenContextImplementor { + + /** log. */ + private static final Log log = LogFactory.getLog(PollenContextImpl.class); + + public static final String DEFAULT_FILENAME = "pollen.properties"; + + private ApplicationConfig configuration; + + private Date currentDate; + +// private SendMail sendMail; + + /** Conversion service for services **/ +// private PollenConverter converter; + + public PollenContextImpl() { + + } + + @Override + public void finalize() { + stop(); + } + + /** + * Default configuration file will be loaded using + * {@link org.nuiton.util.ApplicationConfig }. + * Then the other configuration initialization will be done in + * {@link #loadConfiguration(ApplicationConfig)} method. + */ + private void loadDefaultConfiguration() { + try { + if (log.isInfoEnabled()) { + log.info("load default configuration from " + + PollenContextImpl.DEFAULT_FILENAME); + } + ApplicationConfig conf = new ApplicationConfig(); + conf.setConfigFileName(PollenContextImpl.DEFAULT_FILENAME); + conf.parse(new String[]{}); + + conf.printConfig(); + + loadConfiguration(conf); + } catch (ArgumentsParserException eee) { + doCatch(eee, n_("pollen.error.context.parse"), + PollenContextImpl.DEFAULT_FILENAME); + } + } + + /** + * Load the application configuration : + * <pre> + * - Add entities implementation classes for Topia-persistence + * - Add model version for Topia-migration-service + * </pre> + * + * @param conf ApplicationConfig + */ + @Override + public void loadConfiguration(ApplicationConfig conf) { + configuration = conf; + configuration.setOption("topia.persistence.classes", + PollenDAOHelper.getImplementationClassesAsString()); + configuration.setOption("topia.service.migration.version", + PollenDAOHelper.getModelVersion()); + } + + /** + * 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> + * + */ + @Override + public void start() { + try { + if (log.isInfoEnabled()) { + log.info("Start Pollen"); + log.info("Initialize i18n bundle"); + } + I18n.setInitializer(new DefaultI18nInitializer("pollen-business")); + I18n.init(); + +// ServiceUserImpl serviceUser = new ServiceUserImpl(this); +// serviceUser.createDefaultAdmin( +// getProperty(PollenProperty.ADMIN_LOGIN), +// getProperty(PollenProperty.ADMIN_PASSWORD), +// getProperty(PollenProperty.ADMIN_EMAIL) +// ); +// +// sendMail = new SendMail(this); +// sendMail.start(); + + if (log.isInfoEnabled()) { + log.info("pollen is started !"); + } + + } catch (Exception eee) { + doCatch(eee, n_("pollen.error.context.start")); + } + } + + /** + * Stop the application. Close the Topia rootContext. + */ + @Override + public void stop() { + try { + if (log.isDebugEnabled()) { + log.debug("Stop Pollen"); + } + getTopiaRootContext().closeContext(); +// sendMail.stopExec(); + } catch (Exception eee) { + doCatch(eee, n_("pollen.error.context.stop")); + } + } + +// @Override +// public SendMail getSendMail() { +// return sendMail; +// } + + /** + * Get a property from the configuration. + * + * @param property PollenProperty + * @return value of this property + */ + @Override + public String getProperty(PollenProperty property) { + return getConfiguration().getOption(property.getKey()); + } + + /** + * Test if the property is defined in this context + * + * @param property PollenProperty + * @return value of this property + */ + @Override + public boolean hasProperty(PollenProperty property) { + return !getProperty(property).equals(""); + } + + /** + * Get a property from the configuration. + * + * @param key of the property + * @return value of this property + */ + public String getProperty(String key) { + return getConfiguration().getOption(key); + } + + /** + * Get all properties from the configuration + * + * @return the Properties of the application + */ + public Properties getProperties() { + return getConfiguration().getOptions(); + } + + /** + * Get the configuration of the application. + * + * @return the ApplicationConfig + */ + @Override + public ApplicationConfig getConfiguration() { + if (configuration == null) { + loadDefaultConfiguration(); + } + return configuration; + } + + /** + * Get the Topia rootContext. + * + * @return the main TopiaContext needed to begin new transaction + */ + @Override + public TopiaContext getTopiaRootContext() { + try { + return TopiaContextFactory.getContext(getProperties()); + } catch (TopiaNotFoundException eee) { + doCatch(eee, n_("pollen.error.context.getRootContext")); + } + return null; + } + +// @Override +// public PollenConverter getConverter() { +// if (converter == null) { +// converter = new PollenConverter(); +// } +// return converter; +// } + + /** + * Manage exceptions. The {@code exception} will be embedded in a + * PollenException with the {@code message} provided. + * Used in catch statement in services. + * + * @param eee the exception to manage + * @param message the message to add to the new PollenException + * @param args for message + * @throws PollenException which contains the exception as the cause + */ + @Override + public void doCatch(Exception eee, String message, Object... args) + throws PollenException { + doCatch(null, eee, message); + } + + /** + * Manage exceptions. The {@code exception} will be embedded in a + * PollenException with the {@code message} provided. Also, the current + * {@code transaction} will be rollback. + * Used in catch statement in services. + * + * @param transaction the current TopiaContext + * @param eee the exception to manage + * @param message the message to add to the new PollenException + * @param args for message + */ + @Override + public void doCatch(TopiaContext transaction, Exception eee, String message, + Object... args) throws PollenException { + if (log.isErrorEnabled()) { + log.error(_(message, args), eee); + } + + // rollback de la transaction courante + if (transaction != null) { + try { + transaction.rollbackTransaction(); + } catch (TopiaException ex) { + if (log.isErrorEnabled()) { + log.error(_("pollen.error.context.rollback"), ex); + } + } + } + // PollenBusinessException must be managed (catch and throw) when needed +// if (! (eee instanceof PollenBusinessException)) { + throw new PollenException(eee, message, args); +// } + } + + /** + * Close current TopiaContext. + * Used in finally statement in services. + * + * @param transaction current TopiaContext + */ + @Override + public void doFinally(TopiaContext transaction) { + if (transaction != null) { + try { + transaction.closeContext(); + } catch (TopiaException eee) { + if (log.isErrorEnabled()) { + log.error(_("pollen.error.context.close"), eee); + } + } + } + } + + /** + * Create an id to easily managed polls using urls. + * + * @return a fresh generated String + */ + @Override + public String createPollenUrlId() { + return UUID.randomUUID().toString().replaceAll("-", ""); + } + +// public void setCurrentDate(Date currentDate) { +// PollenContextBusiness.currentDate = currentDate; +// } + + @Override + public Date getCurrentDate() { + if (currentDate == null) { + currentDate = new Date(); + } + return currentDate; + } + + /** + * Set the current date in context. Used for test + * + * @param currentDate to set in the context + */ + public void setCurrentDate(Date currentDate) { + this.currentDate = currentDate; + } + +} Copied: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java (from rev 2953, trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenProperty.java) =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,60 @@ + +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 **/ + 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"); + + String key; + + PollenProperty(String key) { + this.key = key; + } + + public String getKey() { + return key; + } + +// public String getValue() { +// return PollenContexImpl.getProperty(this); +// } + +// public boolean hasValue() { +// return !getValue().equals(""); +// } +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenProperty.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: svn:mergeinfo + Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenBusinessException.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenBusinessException.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenBusinessException.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,52 +0,0 @@ - -package org.chorem.pollen.business; -import static org.nuiton.i18n.I18n._; -import static org.nuiton.i18n.I18n.n_; - -/** - * PollenBusinessException - * - * Created: 24 févr. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class PollenBusinessException extends Exception { - - private static final long serialVersionUID = 1L; - - protected PollenExceptionType type; - - protected Object[] args; - - public PollenBusinessException(PollenExceptionType type) { - super(type.getMessage()); - } - - public PollenBusinessException(PollenExceptionType type, Object... args) { - super(type.getMessage()); - this.args = args; - } - - public enum PollenExceptionType { - //LOAD_CONFIGURATION(n_("pollen.exception.load_configuration")), - POLL_NOT_EXIST(n_("pollen.exception.poll_not_exist")); - - private String message; - - PollenExceptionType(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - } - - public Object[] getArgs() { - return args; - } -} Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContext.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContext.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContext.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,9 +1,9 @@ package org.chorem.pollen.business; +import org.chorem.pollen.PollenProperty; import java.util.Date; -import java.util.Properties; -import org.chorem.pollen.business.services.SendMail; +//import org.chorem.pollen.business.services.SendMail; import org.nuiton.util.ApplicationConfig; /** @@ -54,7 +54,7 @@ * * @return the SendMail running thread */ - SendMail getSendMail(); +// SendMail getSendMail(); /** * Get a property from the configuration. Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,342 +0,0 @@ - -package org.chorem.pollen.business; - -import java.util.Date; -import java.util.Properties; -import java.util.UUID; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.services.SendMail; -import org.chorem.pollen.business.services.ServiceUserImpl; -import org.nuiton.i18n.I18n; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaNotFoundException; -import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.ArgumentsParserException; -import static org.nuiton.i18n.I18n._; -import static org.nuiton.i18n.I18n.n_; -import org.nuiton.i18n.init.DefaultI18nInitializer; - -/** - * PollenContext - * - * Created: 24 févr. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class PollenContextImpl implements PollenContextImplementor { - - /** log. */ - private static final Log log = LogFactory.getLog(PollenContextImpl.class); - - public static final String DEFAULT_FILENAME = "pollen.properties"; - - private ApplicationConfig configuration; - - private Date currentDate; - - private SendMail sendMail; - - /** Conversion service for services **/ - private PollenConverter converter; - - public PollenContextImpl() { - - } - - @Override - public void finalize() { - stop(); - } - - /** - * Default configuration file will be loaded using - * {@link org.nuiton.util.ApplicationConfig }. - * Then the other configuration initialization will be done in - * {@link #loadConfiguration(ApplicationConfig)} method. - */ - private void loadDefaultConfiguration() { - try { - if (log.isInfoEnabled()) { - log.info("load default configuration from " + - PollenContextImpl.DEFAULT_FILENAME); - } - ApplicationConfig conf = new ApplicationConfig(); - conf.setConfigFileName(PollenContextImpl.DEFAULT_FILENAME); - conf.parse(new String[]{}); - - conf.printConfig(); - - loadConfiguration(conf); - } catch (ArgumentsParserException eee) { - doCatch(eee, n_("pollen.error.context.parse"), - PollenContextImpl.DEFAULT_FILENAME); - } - } - - /** - * Load the application configuration : - * <pre> - * - Add entities implementation classes for Topia-persistence - * - Add model version for Topia-migration-service - * </pre> - * - * @param conf ApplicationConfig - */ - @Override - public void loadConfiguration(ApplicationConfig conf) { - configuration = conf; - configuration.setOption("topia.persistence.classes", - PollenModelDAOHelper.getImplementationClassesAsString()); - configuration.setOption("topia.service.migration.version", - PollenModelDAOHelper.getModelVersion()); - } - - /** - * 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> - * - */ - @Override - public void start() { - try { - if (log.isInfoEnabled()) { - log.info("Start Pollen"); - log.info("Initialize i18n bundle"); - } - I18n.setInitializer(new DefaultI18nInitializer("pollen-business")); - I18n.init(); - - ServiceUserImpl serviceUser = new ServiceUserImpl(this); - serviceUser.createDefaultAdmin( - getProperty(PollenProperty.ADMIN_LOGIN), - getProperty(PollenProperty.ADMIN_PASSWORD), - getProperty(PollenProperty.ADMIN_EMAIL) - ); - - sendMail = new SendMail(this); - sendMail.start(); - - if (log.isInfoEnabled()) { - log.info("pollen is started !"); - } - - } catch (Exception eee) { - doCatch(eee, n_("pollen.error.context.start")); - } - } - - /** - * Stop the application. Close the Topia rootContext. - */ - @Override - public void stop() { - try { - if (log.isDebugEnabled()) { - log.debug("Stop Pollen"); - } - getRootContext().closeContext(); - sendMail.stopExec(); - } catch (Exception eee) { - doCatch(eee, n_("pollen.error.context.stop")); - } - } - - @Override - public SendMail getSendMail() { - return sendMail; - } - - /** - * Get a property from the configuration. - * - * @param property PollenProperty - * @return value of this property - */ - @Override - public String getProperty(PollenProperty property) { - return getConfiguration().getOption(property.getKey()); - } - - /** - * Test if the property is defined in this context - * - * @param property PollenProperty - * @return value of this property - */ - @Override - public boolean hasProperty(PollenProperty property) { - return !getProperty(property).equals(""); - } - - /** - * Get a property from the configuration. - * - * @param key of the property - * @return value of this property - */ - public String getProperty(String key) { - return getConfiguration().getOption(key); - } - - /** - * Get all properties from the configuration - * - * @return the Properties of the application - */ - public Properties getProperties() { - return getConfiguration().getOptions(); - } - - /** - * Get the configuration of the application. - * - * @return the ApplicationConfig - */ - @Override - public ApplicationConfig getConfiguration() { - if (configuration == null) { - loadDefaultConfiguration(); - } - return configuration; - } - - /** - * Get the Topia rootContext. - * - * @return the main TopiaContext needed to begin new transaction - */ - @Override - public TopiaContext getRootContext() { - try { - return TopiaContextFactory.getContext(getProperties()); - } catch (TopiaNotFoundException eee) { - doCatch(eee, n_("pollen.error.context.getRootContext")); - } - return null; - } - - @Override - public PollenConverter getConverter() { - if (converter == null) { - converter = new PollenConverter(); - } - return converter; - } - - /** - * Manage exceptions. The {@code exception} will be embedded in a - * PollenException with the {@code message} provided. - * Used in catch statement in services. - * - * @param eee the exception to manage - * @param message the message to add to the new PollenException - * @param args for message - * @throws PollenException which contains the exception as the cause - */ - @Override - public void doCatch(Exception eee, String message, Object... args) - throws PollenException { - doCatch(null, eee, message); - } - - /** - * Manage exceptions. The {@code exception} will be embedded in a - * PollenException with the {@code message} provided. Also, the current - * {@code transaction} will be rollback. - * Used in catch statement in services. - * - * @param transaction the current TopiaContext - * @param eee the exception to manage - * @param message the message to add to the new PollenException - * @param args for message - * @throws PollenException - */ - @Override - public void doCatch(TopiaContext transaction, Exception eee, String message, - Object... args) throws PollenException { - if (log.isErrorEnabled()) { - log.error(_(message, args), eee); - } - - // rollback de la transaction courante - if (transaction != null) { - try { - transaction.rollbackTransaction(); - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error(_("pollen.error.context.rollback"), ex); - } - } - } - // PollenBusinessException must be managed (catch and throw) when needed -// if (! (eee instanceof PollenBusinessException)) { - throw new PollenException(eee, message, args); -// } - } - - /** - * Close current TopiaContext. - * Used in finally statement in services. - * - * @param transaction current TopiaContext - */ - @Override - public void doFinally(TopiaContext transaction) { - if (transaction != null) { - try { - transaction.closeContext(); - } catch (TopiaException eee) { - if (log.isErrorEnabled()) { - log.error(_("pollen.error.context.close"), eee); - } - } - } - } - - /** - * Create an id to easily managed polls using urls. - * - * @return a fresh generated String - */ - @Override - public String createPollenUrlId() { - return UUID.randomUUID().toString().replaceAll("-", ""); - } - -// public void setCurrentDate(Date currentDate) { -// PollenContextBusiness.currentDate = currentDate; -// } - - @Override - public Date getCurrentDate() { - if (currentDate == null) { - currentDate = new Date(); - } - return currentDate; - } - - /** - * Set the current date in context. Used for test - * - * @param currentDate to set in the context - */ - public void setCurrentDate(Date currentDate) { - this.currentDate = currentDate; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImplementor.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImplementor.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImplementor.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,78 +0,0 @@ - -package org.chorem.pollen.business; - -import org.nuiton.topia.TopiaContext; - -/** - * PollenContextImplementor - * - * Created: 20 mars 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public interface PollenContextImplementor extends PollenContext { - - /** - * Topia main context used to open new transaction. - * - * @return the topia root context - */ - TopiaContext getRootContext(); - - /** - * Pollen converter used to convert entities to DTO. - * - * @return the current pollen converter - */ - PollenConverter getConverter(); - - /** - * Manage exceptions. The {@code exception} will be embedded in a - * PollenException with the {@code message} provided. - * Used in catch statement in services. - * - * @param eee the exception to manage - * @param message the message to add to the new PollenException - * @param args for message - * @throws PollenException which contains the exception as the cause - */ - void doCatch(Exception eee, String message, Object... args) - throws PollenException; - - /** - * Manage exceptions. The {@code exception} will be embedded in a - * PollenException with the {@code message} provided. Also, the current - * {@code transaction} will be rollback. - * Used in catch statement in services. - * - * @param transaction the current TopiaContext - * @param eee the exception to manage - * @param message the message to add to the new PollenException - * @param args for message - * @throws PollenException - */ - void doCatch(TopiaContext transaction, Exception eee, String message, - Object... args) throws PollenException; - - /** - * Close current TopiaContext. - * Used in finally statement in services. - * - * @param transaction current TopiaContext - */ - void doFinally(TopiaContext transaction); - - /** - * Create a unique UId for entities which need it (PollAccount, Poll). - * This UId represent the entity in UI module. - * - * @return a new pollenUrlId (UId) - */ - String createPollenUrlId(); - - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,312 +0,0 @@ - -package org.chorem.pollen.business; - -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.CommentDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.dto.VoteDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.Comment; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PreventRule; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteToChoice; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.votecounting.business.NumberMethod; -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.util.beans.BinderBuilder; -import org.nuiton.util.beans.BinderProvider; - -/** - * PollenConverter - * - * Created: 22 févr. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class PollenConverter { - - private static final Log log = LogFactory.getLog(PollenConverter.class); - - private BinderBuilder builder; - - private List<Class<? extends TopiaEntity>> prepareLoaded; - - public PollenConverter() { - builder = new BinderBuilder(); - prepareLoaded = new ArrayList<Class<? extends TopiaEntity>>(); - } - - private final void prepare(Class<? extends TopiaEntity> entityClass, - Class<?> dtoClass, String... properties) { - - if (prepareLoaded.contains(entityClass)) { - return; - } - - // Binder DTO -> Entity - builder.createBinderModel(dtoClass, entityClass). - addSimpleProperties(properties); - - BinderProvider.registerBinder(builder); - - // Binder Entity -> DTO - builder.createBinderModel(entityClass, dtoClass). - addSimpleProperties(properties); - //builder.addProperty(TopiaEntity.TOPIA_ID, "id"); - - BinderProvider.registerBinder(builder); - - prepareLoaded.add(entityClass); - } - - public void preparePollConverters() { - String[] properties = new String[] { - Poll.TITLE, - Poll.DESCRIPTION, - Poll.BEGIN_CHOICE_DATE, - Poll.END_CHOICE_DATE, - Poll.BEGIN_DATE, - Poll.END_DATE, - Poll.CLOSED, - Poll.ANONYMOUS, - Poll.ANONYMOUS_VOTE_ALLOWED, - Poll.PUBLIC_RESULTS, - Poll.CONTINUOUS_RESULTS, - Poll.CHOICE_ADD_ALLOWED, - Poll.MAX_CHOICE_NB - }; - - prepare(Poll.class, PollDTO.class, properties); - } - - public void prepareChoiceConverters() { - String[] properties = new String[] { - Choice.NAME, - Choice.DESCRIPTION, - Choice.VALIDATE - }; - - prepare(Choice.class, ChoiceDTO.class, properties); - } - - public void prepareVotingListConverters() { - String[] properties = new String[] { - VotingList.NAME, - VotingList.WEIGHT - }; - - prepare(VotingList.class, VotingListDTO.class, properties); - } - - public void preparePollAccountConverters() { - String[] properties = new String[] { - PollAccount.VOTING_ID, - PollAccount.EMAIL - }; - - prepare(PollAccount.class, PollAccountDTO.class, properties); - } - - public void preparePreventRuleConverters() { - String[] properties = new String[] { - PreventRule.ACTIVE, - PreventRule.METHOD, - PreventRule.ONE_TIME, - PreventRule.REPEATED, - PreventRule.SCOPE, - PreventRule.SENSIBILITY - }; - - prepare(PreventRule.class, PreventRuleDTO.class, properties); - } - - public void prepareVoteConverters() { - String[] properties = new String[] { - Vote.WEIGHT, - Vote.COMMENT, - Vote.ANONYMOUS - }; - - prepare(Vote.class, VoteDTO.class, properties); - } - - public void prepareCommentConverters() { - String[] properties = new String[] { - Comment.TEXT, - Comment.POST_DATE, - Comment.AUTHOR - }; - - prepare(Comment.class, CommentDTO.class, properties); - } - - public Choice convert(ChoiceDTO dto, Choice entity) { - BinderProvider.getBinder( - ChoiceDTO.class, Choice.class).copy(dto, entity); - return entity; - } - - public ChoiceDTO convert(Choice entity, ChoiceDTO dto) { - BinderProvider.getBinder( - Choice.class, ChoiceDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - String name = entity.getName(); - dto.setHidden(name != null - && name.startsWith(NumberMethod.HIDDEN_PREFIX)); - dto.setPollUId(entity.getPoll().getPollId()); - return dto; - } - - public Poll convert(PollDTO dto, Poll entity) { - BinderProvider.getBinder(PollDTO.class, Poll.class).copy(dto, entity); - entity.setChoiceType(dto.getChoiceType().name()); - entity.setPollType(dto.getPollType().name()); - entity.setVoteCounting(dto.getVoteCounting().name()); - return entity; - } - - public PollDTO convert(Poll entity, PollDTO dto) { - BinderProvider.getBinder(Poll.class, PollDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - dto.setPollUId(entity.getPollId()); - dto.setChoiceType(ChoiceType.valueOf(entity.getChoiceType())); - dto.setPollType(PollType.valueOf(entity.getPollType())); - dto.setVoteCounting(VoteCountingType.valueOf(entity.getVoteCounting())); - - PollAccount creator = entity.getCreator(); - UserAccount user = creator.getUserAccount(); - dto.setCreatorId(creator.getTopiaId()); - dto.setCreatorName(creator.getVotingId()); - dto.setCreatorEmail(creator.getEmail()); - if (creator.getUserAccount() != null) { - dto.setUserId(user.getTopiaId()); - } - return dto; - } - - public VotingList convert(VotingListDTO dto, VotingList entity) { - BinderProvider.getBinder( - VotingListDTO.class, VotingList.class).copy(dto, entity); - return entity; - } - - public VotingListDTO convert(VotingList entity, VotingListDTO dto) { - BinderProvider.getBinder( - VotingList.class, VotingListDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - return dto; - } - - public PollAccount convert(PollAccountDTO dto, PollAccount entity) { - BinderProvider.getBinder( - PollAccountDTO.class, PollAccount.class).copy(dto, entity); - return entity; - } - - public PollAccountDTO convert(PollAccount entity, PollAccountDTO dto) { - BinderProvider.getBinder( - PollAccount.class, PollAccountDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - dto.setAccountUId(entity.getAccountId()); - return dto; - } - - public PreventRule convert(PreventRuleDTO dto, PreventRule entity) { - BinderProvider.getBinder( - PreventRuleDTO.class, PreventRule.class).copy(dto, entity); - return entity; - } - - public PreventRuleDTO convert(PreventRule entity, PreventRuleDTO dto) { - BinderProvider.getBinder( - PreventRule.class, PreventRuleDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - Poll poll = entity.getPoll(); - dto.setPollId(poll.getTopiaId()); - return dto; - } - - public Vote convert(VoteDTO dto, Vote entity) { - BinderProvider.getBinder(VoteDTO.class, Vote.class).copy(dto, entity); - return entity; - } - - /** - * Convert a Vote entity to a VoteDTO. - * Add pollId in the DTO corresponding to the poll topiaId owner of the - * vote. Add choices (ChoiceDTO) for vote values. - * The user linked with the vote may be a votingList (group voteCounting) - * or a pollAccount (other voteCounting type). - * - * @param entity Vote - * @param dto VoteDTO - * @return VoteDTO - */ - public VoteDTO convert(Vote entity, VoteDTO dto) { - BinderProvider.getBinder(Vote.class, VoteDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - Poll poll = entity.getPoll(); - dto.setPollId(poll.getTopiaId()); - - // Set reference only if not anonymous - //if (!entity.getAnonymous()) { - PollAccount account = entity.getPollAccount(); - VotingList list = entity.getVotingList(); - // Set references - // vote for a list - if (list != null) { - dto.setVotingListId(list.getTopiaId()); - // vote for a person (pollAccount) - } else {/*if (account != null) { must have a pollaccount */ - //dto.setPollAccountId(account.getTopiaId()); - dto.setName(account.getVotingId()); -// if (account.getUserAccount() != null) { -// dto.setUserId(account.getUserAccount().getTopiaId()); -// } - } - //} - - // Choices for voteValues - for (VoteToChoice choice : entity.getChoiceVoteToChoice()) { -// ChoiceDTO choiceDTO = -// convert(choice.getChoice(), new ChoiceDTO()); -// choiceDTO.setValue(choice.getVoteValue()); -// dto.addChoice(choiceDTO); - dto.setChoiceValue(choice.getChoice().getTopiaId(), - choice.getVoteValue()); - } - return dto; - } - - public Comment convert(CommentDTO dto, Comment entity) { - BinderProvider.getBinder( - CommentDTO.class, Comment.class).copy(dto, entity); - return entity; - } - - public CommentDTO convert(Comment entity, CommentDTO dto) { - BinderProvider.getBinder( - Comment.class, CommentDTO.class).copy(entity, dto); - dto.setId(entity.getTopiaId()); - return dto; - } - - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenProperty.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenProperty.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenProperty.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,60 +0,0 @@ - -package org.chorem.pollen.business; - -/** - * 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 **/ - 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"); - - String key; - - PollenProperty(String key) { - this.key = key; - } - - public String getKey() { - return key; - } - -// public String getValue() { -// return PollenContexImpl.getProperty(this); -// } - -// public boolean hasValue() { -// return !getValue().equals(""); -// } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/PreventRuleManager.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,195 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.business; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.utils.MailUtil; - -/** - * Classe de gestion des règles de notification. Cette classe exécute des - * méthodes en fonction de la règle définie. - * - * @author rannou - * @version $Id$ - */ -public class PreventRuleManager { - - /** log. */ - private static final Log log = LogFactory.getLog(PreventRuleManager.class); - - /** Représente l'action qui ne fait rien. */ - public static final String NULL_ACTION = "nullAction"; - /** Représente l'action qui écrit sur la sortie standard. */ - public static final String PRINT_ACTION = "printAction"; - /** Représente l'action qui envoi un email de notification. */ - public static final String EMAIL_ACTION = "emailAction"; - - private PreventRuleDTO preventRule = null; - - /** - * Constructeur. - * - * @param preventRule règle à utiliser - */ - public PreventRuleManager(PreventRuleDTO preventRule) { - this.preventRule = preventRule; - } - - /** - * Exécution de la méthode définie par la règle. La méthode s'exécute sans - * prise en compte de la sensibilité de la règle. - */ - public boolean execute() { - return execute(null, null, null); - } - - /** - * Exécution de la méthode définie par la règle. La méthode s'exécute si la - * valeur correspond à la sensibilité de la règle. - * - * @param value valeur conditionnant l'exécution de la règle. - */ - public boolean execute(Integer value) { - return execute(null, value, null); - } - - /** - * Exécution de la méthode définie par la règle. La méthode s'exécute si la - * portée est égale à la portée de la règle. - * - * @param scope portée de la règle. - */ - public boolean execute(String scope) { - return execute(scope, null, null); - } - - /** - * Exécution de la méthode définie par la règle. La méthode s'exécute si la - * valeur correspond à la sensibilité de la règle et si la portée est égale - * à la portée de la règle. - * - * @param scope portée de la règle. - * @param value valeur conditionnant l'exécution de la règle. - */ - public boolean execute(String scope, Integer value) { - return execute(scope, value, null); - } - - /** - * Exécution de la méthode définie par la règle. La méthode s'exécute si la - * valeur correspond à la sensibilité de la règle et si la portée est égale - * à la portée de la règle. - * - * @param scope portée de la règle. - * @param value valeur conditionnant l'exécution de la règle. - * @param data données utiles pour l'exécution de la règle. - * @return true si la méthode à été exécutée, false sinon. - */ - public boolean execute(String scope, Integer value, Object data) { - - // Si la règle n'est pas active, on ne fait rien - if (!preventRule.isActive()) { - log.debug("Règle non active"); - return false; - } - - // Si la règle est à exécution unique, on la désactive - if (preventRule.isOneTime()) { - log.debug("Règle à exécution unique : désactivation"); - preventRule.setActive(false); - } - - // Si la règle est répétitive (exécution tous les n), on met à jour la valeur - if (value != null && preventRule.isRepeated() - && preventRule.getSensibility() != 0) { - value = value % preventRule.getSensibility() - + preventRule.getSensibility(); - } - - try { - if ((value == null || value == preventRule.getSensibility()) - && (scope == null || scope.equals(preventRule.getScope()))) { - if (log.isDebugEnabled()) { - log.debug("méthod " + preventRule.getMethod() + "(scope : " - + preventRule.getScope() + ", sensibility : " - + preventRule.getSensibility() + ")"); - } - - Method method = this.getClass().getMethod( - preventRule.getMethod(), Object.class); - method.invoke(this, data); - } else { - return false; - } - } catch (Exception e) { - log.error("Erreur lors de l'appel de la méthode " - + preventRule.getMethod(), e); - return false; - } - return true; - } - - /** - * Action qui ne fait rien. - * - * TODO set this method to protected - */ - public static void nullAction(Object data) { - // ne fait rien - } - - /** - * Action qui écrit sur la sortie standard. - * - * TODO set this method to protected - */ - public static void printAction(Object data) { - String message = ""; - if (data instanceof String) { - message = (String) data; - } - System.out.println("printAction : " + message); - } - - /** - * Action qui envoi un email de notification. - * - * @param data mail data - * - * TODO set this method to protected - */ - public static void emailAction(Object data) { - Map<String, String> fields = null; - if (data instanceof Map<?, ?>) { - fields = (Map<String, String>) data; - MailUtil.sendMail(fields.get("host"), Integer.parseInt(fields - .get("port")), fields.get("from"), fields.get("to"), fields - .get("title"), fields.get("msg")); - } - else { - if (log.isWarnEnabled()) { - log.warn("emailAction data parameter is not instance of Map"); - } - } - - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/business/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Classes métiers utiles pour l'application. - */ -package org.chorem.pollen.business.business; \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,104 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.votecounting.business.NumberMethod; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos Choice en entité et vice-versa. - * - * @author enema - * @version $Id$ - */ -public class DataChoiceConverter extends DataConverter { - - /** - * Création d'une entité choix à partir d'un dto choix. - * - * @param choiceDTO Le dto choix - * @param eChoice L'entité choix - * @deprecated use {@link org.chorem.pollen.business.PollenConverter} - */ - @Deprecated - public void populateChoiceEntity(ChoiceDTO choiceDTO, Choice eChoice) - throws TopiaException { - eChoice.setName(choiceDTO.getName()); - eChoice.setDescription(choiceDTO.getDescription()); - eChoice.setValidate(choiceDTO.isValidate()); - - // Very bad, must create the choice on the poll not the inverse - if (choiceDTO.getPollId().length() > 0) { - PollDAO pollDAO = PollenModelDAOHelper - .getPollDAO(super.transaction); - Poll pollEntity = pollDAO.findByTopiaId(choiceDTO.getPollId()); - eChoice.setPoll(pollEntity); - } - } - - /** - * Création d'un dto choix à partir d'une entité choix. - * - * @param eChoice L'entité choix - * @return Le dto choix - * @deprecated use {@link org.chorem.pollen.business.PollenConverter} - */ - @Deprecated - public ChoiceDTO createChoiceDTO(Choice eChoice) { - ChoiceDTO choiceDTO = new ChoiceDTO(); - choiceDTO.setId(eChoice.getTopiaId()); - String eChoiceName = eChoice.getName(); - choiceDTO.setName(eChoiceName); - choiceDTO.setHidden(eChoiceName != null - && eChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); - choiceDTO.setDescription(eChoice.getDescription()); - choiceDTO.setValidate(eChoice.getValidate()); - - if (eChoice.getPoll() != null) { - choiceDTO.setPollUId(eChoice.getPoll().getPollId()); - } - - return choiceDTO; - } - - /** - * Retourne une liste de dtos choix à partir d'une collection d'entités. - * - * @param cChoices Les entités choix - * @return la liste des dtos choix - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public List<ChoiceDTO> createChoiceDTOs(Collection<Choice> cChoices) { - List<ChoiceDTO> results = new ArrayList<ChoiceDTO>(); - ChoiceDTO dto; - for (Choice c : cChoices) { - dto = this.createChoiceDTO(c); - results.add(dto); - } - return results; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,54 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import org.nuiton.topia.TopiaContext; - -/** - * Classe de base pour la conversion dto - entité. - * - * @author enema - * @version $Id$ - */ -public class DataConverter { - TopiaContext transaction = null; - - public DataConverter() { - - } - - public DataConverter(TopiaContext transaction) { - this.transaction = transaction; - } - - /** - * - * @param transaction le topiaContext - */ - public void setTransaction(TopiaContext transaction) { - this.transaction = transaction; - } - - /** - * - * @return transaction topiaContext - */ - public TopiaContext getTransaction() { - return this.transaction; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPersonListConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPersonListConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPersonListConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,98 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.List; - -import org.chorem.pollen.business.dto.PersonListDTO; -import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.nuiton.topia.TopiaException; - -/** - * Conversion des dtos PersonList en entités et vice-versa. - * - * @author tcicognani - * @author rannou - * @version $Id: DataPersonListConverter.java 2615 2009-07-01 13:47:45Z nrannou - * $ - */ -public class DataPersonListConverter extends DataConverter { - - /** - * Création d'une liste à partir d'un dto liste. - * - * @param ePersonList L'entité liste. - * @param personListDTO le dto liste. - */ - public void populatePersonListEntity(PersonListDTO personListDTO, - PersonList ePersonList) throws TopiaException { - ePersonList.setName(personListDTO.getName()); - - if (personListDTO.getUserId().length() > 0) { - UserAccountDAO userDAO = PollenModelDAOHelper - .getUserAccountDAO(super.transaction); - UserAccount userAccountEntity = userDAO.findByTopiaId(personListDTO - .getUserId()); - ePersonList.setOwner(userAccountEntity); - } - } - - /** - * Création d'un dto liste à partir d'une liste. - * - * @param ePersonList L'entité liste. - * @return le dto liste. - */ - public PersonListDTO createPersonListDTO(PersonList ePersonList) { - PersonListDTO personListDTO = new PersonListDTO(); - personListDTO.setId(ePersonList.getTopiaId()); - personListDTO.setName(ePersonList.getName()); - - if (ePersonList.getOwner() != null) { - personListDTO.setUserId(ePersonList.getOwner().getTopiaId()); - } - if (ePersonList.getPollAccount().size() > 0) { - DataPollAccountConverter converter = new DataPollAccountConverter(); - personListDTO.setPollAccounts(converter - .createPollAccountDTOs(ePersonList.getPollAccount())); - } - - return personListDTO; - } - - /** - * Création d'une liste de dtos personList à partir d'une liste d'entité - * personList. - * - * @param lPersonLists liste d'entités personList - * @return la liste des dtos personList - */ - public List<PersonListDTO> createPersonListDTOs( - List<PersonList> lPersonLists) { - ArrayList<PersonListDTO> results = new ArrayList<PersonListDTO>(); - PersonListDTO dto; - for (PersonList l : lPersonLists) { - dto = this.createPersonListDTO(l); - results.add(dto); - } - return results; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollAccountConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollAccountConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollAccountConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,160 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.List; - -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.business.persistence.PersonListDAO; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos pollAccount en entité et vice-versa. - * - * @author kmorin - * @version $Id: DataPollAccountConverter.java 2652 2009-07-17 08:10:26Z nrannou - * $ - */ -public class DataPollAccountConverter extends DataConverter { - - /** - * Création d'un compte à partir d'un dto compte. - * - * @param pollAccountDTO le dto compte - * @param ePollAccount l'entité compte - * @throws TopiaException - */ - public void populatePollAccountEntity(PollAccountDTO pollAccountDTO, - PollAccount ePollAccount) throws TopiaException { - //ePollAccount.setAccountId(pollAccountDTO.getAccountId()); - ePollAccount.setEmail(pollAccountDTO.getEmail()); - ePollAccount.setVotingId(pollAccountDTO.getVotingId()); - - if (pollAccountDTO.getUserId().length() > 0) { - UserAccountDAO userAccountDAO = PollenModelDAOHelper - .getUserAccountDAO(super.transaction); - UserAccount userAccountEntity = userAccountDAO - .findByTopiaId(pollAccountDTO.getUserId()); - ePollAccount.setUserAccount(userAccountEntity); - } - if (pollAccountDTO.getPersonListId().length() > 0) { - PersonListDAO personListDAO = PollenModelDAOHelper - .getPersonListDAO(super.transaction); - PersonList personListEntity = personListDAO - .findByTopiaId(pollAccountDTO.getPersonListId()); - ePollAccount.setPersonList(personListEntity); - } - - // Conversion des PersonToList - if (ePollAccount.getVotingListPersonToList() != null) { - for (PersonToList personToList : ePollAccount - .getVotingListPersonToList()) { - personToList.setWeight(pollAccountDTO.getWeight()); - personToList.setHasVoted(pollAccountDTO.isHasVoted()); - //votingLists - } - } - } - - /** - * Création d'un compte à partir de ses attributs. - * - * @param votingId le votingId - * @param email l'email - * @param ePollAccount l'entité compte - * @throws TopiaException - */ - public void populatePollAccountEntity(String votingId, String email, - String userId, PollAccount ePollAccount) throws TopiaException { - ePollAccount.setEmail(email); - ePollAccount.setVotingId(votingId); - - if (userId != null && userId.length() > 0) { - UserAccountDAO userAccountDAO = PollenModelDAOHelper - .getUserAccountDAO(super.transaction); - UserAccount userAccountEntity = userAccountDAO - .findByTopiaId(userId); - ePollAccount.setUserAccount(userAccountEntity); - } - } - - /** - * Création d'un dto pollAccount à partir d'une entité. - * - * @param ePollAccount l'entité - * @return le dto PollAccount - */ - public PollAccountDTO createPollAccountDTO(PollAccount ePollAccount) { - PollAccountDTO dto = new PollAccountDTO(); - dto.setId(ePollAccount.getTopiaId()); - dto.setAccountUId(ePollAccount.getAccountId()); - dto.setEmail(ePollAccount.getEmail()); - dto.setVotingId(ePollAccount.getVotingId()); - - if (ePollAccount.getUserAccount() != null) { - dto.setUserId(ePollAccount.getUserAccount().getTopiaId()); - } - if (ePollAccount.getPersonList() != null) { - dto.setPersonListId(ePollAccount.getPersonList().getTopiaId()); - } - - if (ePollAccount.getVote().size() > 0) { - DataVoteConverter voteConverter = new DataVoteConverter(); - dto.setVoteDTOs(voteConverter - .createVoteDTOs(ePollAccount.getVote())); - } - - // Conversion des PersonToList - if (ePollAccount.getVotingListPersonToList() != null) { - //DataVotingListConverter votingListConverter = new DataVotingListConverter(); - for (PersonToList personToList : ePollAccount - .getVotingListPersonToList()) { - //VotingListDTO votingListDTO = votingListConverter.createVotingListDTO(personToList.getVotingList()); - - dto.setWeight(personToList.getWeight()); - dto.setHasVoted(personToList.getHasVoted()); - //dto.setVotingListId(votingListDTO.getId()); - } - } - - return dto; - } - - /** - * Retourne une liste de dtos pollAccount à partir d'une liste d'entités. - * - * @param lPollAccounts liste de entités pollAccount - * @return la liste des dtos pollAccount - */ - public List<PollAccountDTO> createPollAccountDTOs( - List<PollAccount> lPollAccounts) { - ArrayList<PollAccountDTO> results = new ArrayList<PollAccountDTO>(); - PollAccountDTO dto; - for (PollAccount p : lPollAccounts) { - dto = this.createPollAccountDTO(p); - results.add(dto); - } - return results; - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,219 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import org.chorem.pollen.business.PollenConverter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenBusinessException; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.CommentDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.Comment; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PreventRule; -import org.chorem.pollen.business.services.ServicePreventRule; -import org.chorem.pollen.business.services.ServicePreventRuleImpl; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos Poll en entité et vice-versa. - * - * @author enema - * @version $Id$ - */ -public class DataPollConverter extends DataConverter { - DataChoiceConverter choiceConverter = new DataChoiceConverter(); - DataVoteConverter voteConverter = new DataVoteConverter(); - DataPreventRuleConverter preventRuleConverter = new DataPreventRuleConverter(); - DataVotingListConverter votingListConverter = new DataVotingListConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(DataPollConverter.class); - - /** - * Création d'un dto sondage à partir d'une entité. - * - * @param ePoll l'entité sondage - * @return le dto sondage - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public PollDTO createPollDTO(Poll ePoll, PollenConverter converter) { - PollDTO pollDTO = converter.convert(ePoll, new PollDTO()); - -// pollDTO.setId(ePoll.getTopiaId()); -// pollDTO.setPollId(ePoll.getPollId()); -// pollDTO.setTitle(ePoll.getTitle()); -// pollDTO.setDescription(ePoll.getDescription()); -// pollDTO.setBeginChoiceDate(ePoll.getBeginChoiceDate()); -// pollDTO.setEndChoiceDate(ePoll.getEndChoiceDate()); -// pollDTO.setBeginDate(ePoll.getBeginDate()); -// pollDTO.setEndDate(ePoll.getEndDate()); -// pollDTO.setAnonymous(ePoll.getAnonymous()); -// pollDTO.setAnonymousVoteAllowed(ePoll.getAnonymousVoteAllowed()); -// pollDTO.setPublicResults(ePoll.getPublicResults()); -// pollDTO.setContinuousResults(ePoll.getContinuousResults()); -// pollDTO.setChoiceAddAllowed(ePoll.getChoiceAddAllowed()); -// pollDTO.setClosed(ePoll.getClosed()); -// pollDTO.setMaxChoiceNb(ePoll.getMaxChoiceNb()); -// pollDTO.setChoiceType(EnumController.getChoiceType(ePoll)); -// pollDTO.setPollType(EnumController.getPollType(ePoll)); -// pollDTO.setVoteCounting(EnumController.getVoteCountingType(ePoll)); - - if (ePoll.getCreator() != null) { - pollDTO.setCreatorId(ePoll.getCreator().getTopiaId()); - pollDTO.setCreatorEmail(ePoll.getCreator().getEmail()); - } - if (ePoll.getChoice().size() > 0) { - pollDTO.setChoices(choiceConverter.createChoiceDTOs(ePoll - .getChoice())); - } -// if (ePoll.getVote().size() > 0) { -// pollDTO.setVoteDTOs(voteConverter.createVoteDTOs(ePoll.getVote())); -// } - for (Comment comment : ePoll.getComment()) { - CommentDTO dto = - converter.convert(comment, new CommentDTO()); - pollDTO.addComment(dto); - } -// if (ePoll.getComment().size() > 0) { -// pollDTO.setComments(commentConverter.createCommentDTOs(ePoll -// .getComment())); -// } - if (ePoll.getPreventRule().size() > 0) { - pollDTO.setPreventRuleDTOs(preventRuleConverter - .createPreventRuleDTOs(ePoll.getPreventRule())); - } - if (ePoll.getVotingList().size() > 0) { - pollDTO.setVotingListDTOs(votingListConverter - .createVotingListDTOs(ePoll.getVotingList())); - } - - return pollDTO; - } - - /** - * Retourne une liste de dtos sondage à partir d'une liste d'entités. - * - * @param lPolls liste de entités sondages - * @param converter - * @return la liste des dtos sondages - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public List<PollDTO> createPollDTOs(List<Poll> lPolls, PollenConverter converter) { - ArrayList<PollDTO> results = new ArrayList<PollDTO>(); - PollDTO dto; - for (Poll p : lPolls) { - dto = this.createPollDTO(p, converter); - results.add(dto); - } - return results; - } - -// /** -// * Persistance des choix d'une entité sondage à partir d'un DTO. -// * -// * @param pollDTO le dto sondage -// * @param ePoll l'entité sondage -// * @deprecated use dao managment instead -// */ -// @Deprecated -// public void persistChoices(PollDTO pollDTO, Poll ePoll, PollenContextImplementor context) -// throws TopiaException, PollenBusinessException { -// -// // mise à jour ou création des choix -// ServiceChoice sChoice = new ServiceChoiceImpl(context); -// for (ChoiceDTO choiceDTO : pollDTO.getChoices()) { -// boolean updated = sChoice.updateChoice(choiceDTO); -// if (!updated) { -// choiceDTO.setId(sChoice.createChoice(choiceDTO)); -// } -// -// if (log.isDebugEnabled()) { -// log.debug("Choice " + choiceDTO.getName() + " (" -// + choiceDTO.getId() + ") updated: " + updated); -// } -// } -// -// // suppression des choix -// boolean validChoice = false; -// Iterator<Choice> itChoice = ePoll.getChoice().iterator(); -// while (itChoice.hasNext()) { -// Choice currentChoice = itChoice.next(); -// for (ChoiceDTO choiceDTO : pollDTO.getChoices()) { -// if (currentChoice.getTopiaId().equals(choiceDTO.getId())) { -// validChoice = true; -// } -// } -// if (!validChoice) { -// sChoice.deleteChoice(currentChoice.getTopiaId()); -// } -// validChoice = false; -// } -// } - - /** - * Persistance des règles de notification d'une entité sondage à partir d'un - * DTO. - * - * @param pollDTO le dto sondage - * @param ePoll l'entité sondage - */ - public void persistPreventRules(PollDTO pollDTO, Poll ePoll, PollenContextImplementor context) - throws TopiaException, PollenBusinessException { - - // mise à jour ou création des règles de notification - ServicePreventRule sPreventRule = new ServicePreventRuleImpl(context); - for (PreventRuleDTO preventRuleDTO : pollDTO.getPreventRuleDTOs()) { - boolean updated = sPreventRule.updatePreventRule(preventRuleDTO); - if (!updated) { - preventRuleDTO.setId(sPreventRule - .createPreventRule(preventRuleDTO)); - } - - if (log.isDebugEnabled()) { - log.debug("PreventRule (" + preventRuleDTO.getId() - + ") updated: " + updated); - } - } - - // suppression des règles de notification - boolean validRule = false; - Iterator<PreventRule> it = ePoll.getPreventRule().iterator(); - while (it.hasNext()) { - PreventRule currentRule = it.next(); - for (PreventRuleDTO preventRuleDTO : pollDTO.getPreventRuleDTOs()) { - if (currentRule.getTopiaId().equals(preventRuleDTO.getId())) { - validRule = true; - } - } - if (!validRule) { - sPreventRule.deletePreventRule(currentRule.getTopiaId()); - } - validRule = false; - } - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPreventRuleConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,105 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.PreventRule; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos règle en entité et vice-versa. - * - * @author rannou - * @version $Id: DataPreventRuleConverter.java 2615 2009-07-01 13:47:45Z nrannou - * $ - */ -public class DataPreventRuleConverter extends DataConverter { - - /** - * Création d'une entité à partir d'un dto règle. - * - * @param preventRuleDTO le dto de la règle - * @param ePreventRule l'entité de la règle - */ - public void populatePreventRuleEntity(PreventRuleDTO preventRuleDTO, - PreventRule ePreventRule) throws TopiaException { - ePreventRule.setScope(preventRuleDTO.getScope()); - ePreventRule.setSensibility(preventRuleDTO.getSensibility()); - ePreventRule.setActive(preventRuleDTO.isActive()); - ePreventRule.setOneTime(preventRuleDTO.isOneTime()); - ePreventRule.setRepeated(preventRuleDTO.isRepeated()); - ePreventRule.setMethod(preventRuleDTO.getMethod()); - - if (preventRuleDTO.getPollId().length() > 0) { - PollDAO pollDAO = PollenModelDAOHelper - .getPollDAO(super.transaction); - Poll pollEntity = pollDAO.findByTopiaId(preventRuleDTO.getPollId()); - ePreventRule.setPoll(pollEntity); - } - } - - /** - * Création d'un dto à partir d'une entité règle. - * - * @param preventRule l'entité de la règle - * @return Le dto règle créé * - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public PreventRuleDTO createPreventRuleDTO(PreventRule preventRule) { - PreventRuleDTO preventRuleDTO = new PreventRuleDTO(); - preventRuleDTO.setId(preventRule.getTopiaId()); - preventRuleDTO.setScope(preventRule.getScope()); - preventRuleDTO.setSensibility(preventRule.getSensibility()); - preventRuleDTO.setActive(preventRule.getActive()); - preventRuleDTO.setOneTime(preventRule.getOneTime()); - preventRuleDTO.setRepeated(preventRule.getRepeated()); - preventRuleDTO.setMethod(preventRule.getMethod()); - - if (preventRule.getPoll() != null) { - preventRuleDTO.setPollId(preventRule.getPoll().getTopiaId()); - } - - return preventRuleDTO; - } - - /** - * Retourne une liste de dtos règle à partir d'une collection d'entités. - * - * @param cPreventRules collection des entités règle - * @return la liste des dtos règle - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public List<PreventRuleDTO> createPreventRuleDTOs( - Collection<PreventRule> cPreventRules) { - List<PreventRuleDTO> results = new ArrayList<PreventRuleDTO>(); - PreventRuleDTO dto; - for (PreventRule r : cPreventRules) { - dto = this.createPreventRuleDTO(r); - results.add(dto); - } - return results; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,107 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.List; - -import org.chorem.pollen.business.dto.ResultDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.Result; -import org.chorem.pollen.business.persistence.ResultDAO; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.votecounting.business.NumberMethod; -import org.chorem.pollen.votecounting.dto.ChoiceDTO; -import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos en entité pour les résultats. - * - * @author fdesbois - * @version $Id$ - */ -public class DataResultConverter extends DataConverter { - - public DataResultConverter(TopiaContext transaction) { - super(transaction); - } - - /** - * Création des résultats de sondage à partir d'un dto de résultats de - * sondage. - * - * @param dto le dto des résultats de sondage. - */ - public void populateResultEntities(VoteCountingResultDTO dto) - throws TopiaException { - for (ChoiceDTO choice : dto.getChoices()) { - //if (choice.isResult) { - ResultDAO daoResult = PollenModelDAOHelper.getResultDAO(transaction); - Result eResult = daoResult.create(); - - ChoiceDAO daoChoice = PollenModelDAOHelper.getChoiceDAO(transaction); - Choice eChoice = daoChoice.findByTopiaId(choice.getIdChoice()); - - PollDAO daoPoll = PollenModelDAOHelper.getPollDAO(transaction); - Poll ePoll = daoPoll.findByPollId(dto.getIdPoll()); - ePoll.addResult(eResult); - - eResult.setName(eChoice.getName()); - eResult.setByGroup(dto.isByGroup()); - eResult.setPoll(ePoll); - eResult.setResultValue(String.valueOf(choice.getValue())); - -// EnumController enumCtrl = new EnumController(transaction); -// enumCtrl.setVoteCounting(dto.getTypeVoteCounting(), eResult); - eResult.setVoteCounting(dto.getTypeVoteCounting().name()); - //} - } - } - - /** - * Retourne la liste des résultats d'un sondage sous forme de DTOs. - * - * @param ePoll le sondage (entitée Poll) - * @return la liste des DTO Result - */ - public List<ResultDTO> createResultDTOs(Poll ePoll) { - List<ResultDTO> results = new ArrayList<ResultDTO>(); - for (Result res : ePoll.getResult()) { - ResultDTO dto = new ResultDTO(); - dto.setId(res.getTopiaId()); - dto.setPollId(ePoll.getPollId()); - String resName = res.getName(); - dto.setName(resName); - dto.setHidden(resName != null && - resName.startsWith(NumberMethod.HIDDEN_PREFIX)); - dto.setValue(res.getResultValue()); - dto.setByGroup(res.getByGroup()); - dto.setChoiceType(ChoiceType.valueOf(ePoll.getChoiceType())); - dto.setVoteCounting(VoteCountingType.valueOf(ePoll.getVoteCounting())); - results.add(dto); - } - return results; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataUserConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataUserConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataUserConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,98 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.List; - -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.persistence.UserAccount; - -/** - * Gestion de la conversion des dtos User en entité et vice-versa. - * - * @author enema - * @version $Id$ - */ -public class DataUserConverter extends DataConverter { - - /** - * Création d'une entité utilisateur à partir d'un dto utilisateur. - * - * @param userDTO Le dto utilisateur - * @param eUser L'entité utilisateur - */ - public void populateUserEntity(UserDTO userDTO, UserAccount eUser, - String password) { - eUser.setLogin(userDTO.getLogin()); - eUser.setEmail(userDTO.getEmail()); - eUser.setFirstName(userDTO.getFirstName()); - eUser.setLastName(userDTO.getLastName()); - eUser.setLanguage(userDTO.getLanguage()); - eUser.setAdministrator(userDTO.isAdministrator()); - eUser.setPassword(password); - } - - /** - * Mise à jour d'un utilisateur à partir d'un dto utilisateur. - * - * @param userDTO Le dto utilisateur - * @param eUser l'entité utilisateur - */ - public void populateUserEntity(UserDTO userDTO, UserAccount eUser) { - eUser.setEmail(userDTO.getEmail()); - eUser.setFirstName(userDTO.getFirstName()); - eUser.setLastName(userDTO.getLastName()); - eUser.setLanguage(userDTO.getLanguage()); - eUser.setAdministrator(userDTO.isAdministrator()); - } - - /** - * Création d'un DTO utilisateur à partir d'une entité utilisateur. - * - * @param eUser L'entité utilisateur - * @return Le DTO utilisateur - */ - public UserDTO createUserDTO(UserAccount eUser) { - UserDTO userDTO = new UserDTO(); - userDTO.setId(eUser.getTopiaId()); - userDTO.setLogin(eUser.getLogin()); - userDTO.setEmail(eUser.getEmail()); - userDTO.setFirstName(eUser.getFirstName()); - userDTO.setLastName(eUser.getLastName()); - userDTO.setLanguage(eUser.getLanguage()); - userDTO.setAdministrator(eUser.getAdministrator()); - return userDTO; - } - - /** - * retourne une liste de dtos des utilisateurs à partir d'une liste - * d'entité. - * - * @param lUsers Liste de entités utilisateur - * @return la liste des dtos utilisateurs - */ - public List<UserDTO> createUserDTOs(List<UserAccount> lUsers) { - ArrayList<UserDTO> results = new ArrayList<UserDTO>(); - UserDTO dto; - for (UserAccount u : lUsers) { - dto = this.createUserDTO(u); - results.add(dto); - } - return results; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,231 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import java.util.Map; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.VoteDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteDAO; -import org.chorem.pollen.business.persistence.VoteToChoice; -import org.chorem.pollen.business.persistence.VoteToChoiceDAO; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.persistence.VotingListDAO; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos Vote en entité et vice-versa. - * - * @version $Id$ - */ -public class DataVoteConverter extends DataConverter { - - /** - * Création d'une entité vote à partir d'un dto vote. - * - * @param voteDTO Le dto vote. - * @param eVote L'entité vote. - */ - public void populateVoteEntity(VoteDTO voteDTO, Vote eVote) - throws TopiaException { - eVote.setWeight(voteDTO.getWeight()); - eVote.setComment(voteDTO.getComment()); - eVote.setAnonymous(voteDTO.isAnonymous()); - - if (voteDTO.getPollId() != null) { - PollDAO pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - Poll pollEntity = pollDAO.findByTopiaId(voteDTO.getPollId()); - pollEntity.addVote(eVote); // Rajout du vote au sondage - eVote.setPoll(pollEntity); - } - if (voteDTO.getPollAccountId() != null) { - PollAccountDAO pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(super.transaction); - PollAccount pollAccountEntity = pollAccountDAO - .findByTopiaId(voteDTO.getPollAccountId()); - eVote.setPollAccount(pollAccountEntity); - } - if (voteDTO.getVotingListId() != null) { - VotingListDAO votingListDAO = PollenModelDAOHelper - .getVotingListDAO(super.transaction); - VotingList votingListEntity = votingListDAO.findByTopiaId(voteDTO - .getVotingListId()); - eVote.setVotingList(votingListEntity); - } - } - - /** - * Création d'un dto vote à partir d'une entité vote. - * - * @param eVote L'entité vote - * @return Le dto vote - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public VoteDTO createVoteDTO(Vote eVote) { - VoteDTO voteDTO = new VoteDTO(); - voteDTO.setId(eVote.getTopiaId()); - voteDTO.setWeight(eVote.getWeight()); - voteDTO.setComment(eVote.getComment()); - voteDTO.setAnonymous(eVote.getAnonymous()); - - if (eVote.getPoll() != null) { - voteDTO.setPollId(eVote.getPoll().getTopiaId()); - } - if (eVote.getPollAccount() != null) { - voteDTO.setPollAccountId(eVote.getPollAccount().getTopiaId()); - voteDTO.setName(eVote.getPollAccount().getVotingId()); - UserAccount user = eVote.getPollAccount().getUserAccount(); - if (user != null) { - voteDTO.setUserId(user.getTopiaId()); - } - } - if (eVote.getVotingList() != null) { - voteDTO.setVotingListId(eVote.getVotingList().getTopiaId()); - } - - // Conversion des VoteToChoice - if (eVote.getChoiceVoteToChoice() != null) { - DataChoiceConverter choiceConverter = new DataChoiceConverter(); - for (VoteToChoice voteToChoice : eVote.getChoiceVoteToChoice()) { - Choice choice = voteToChoice.getChoice(); - if (choice != null) { -// ChoiceDTO choiceDTO = choiceConverter -// .createChoiceDTO(voteToChoice.getChoice()); -// choiceDTO.setValue(voteToChoice.getVoteValue()); -// voteDTO.getChoiceDTOs().add(choiceDTO); - voteDTO.setChoiceValue(choice.getTopiaId(), - voteToChoice.getVoteValue()); - } - } - } - - return voteDTO; - } - - /** - * Retourne une liste de dtos vote à partir d'une collection d'entités. - * - * @param cVotes collection des entités vote - * @return la liste des dtos vote - * @deprecated use {@link ConverterHelper} - */ - @Deprecated - public List<VoteDTO> createVoteDTOs(Collection<Vote> cVotes) { - List<VoteDTO> results = new ArrayList<VoteDTO>(); - VoteDTO dto; - for (Vote v : cVotes) { - dto = this.createVoteDTO(v); - results.add(dto); - } - return results; - } - - /** - * Mise à jour des VoteToChoice d'une entité vote à partir d'un dto vote. - * - * @param voteDTO Le dto vote. - * @param eVote L'entité vote. - * @throws TopiaException - * @deprecated must copy this code in serviceVote - */ - @Deprecated - public void populateChoiceVote(VoteDTO voteDTO, Vote eVote) - throws TopiaException { -// -// for (ChoiceDTO choiceDTO : voteDTO.getChoiceDTOs()) { -// choiceDTO.setVoteId(eVote.getTopiaId()); -// } -// -// eVote.setChoiceVoteToChoice(this.getVoteToChoices(voteDTO -// .getChoiceDTOs())); - - VoteToChoiceDAO dao = - PollenModelDAOHelper.getVoteToChoiceDAO(super.transaction); - - ChoiceDAO choiceDAO = PollenModelDAOHelper.getChoiceDAO(super.transaction); - - for (Map.Entry<String, Integer> choiceValue : - voteDTO.getChoiceValues().entrySet()) { - - // Find existing choice - Choice choice = choiceDAO.findByTopiaId(choiceValue.getKey()); - - // Find existing vote - VoteToChoice voteToChoice = dao.findByProperties( - VoteToChoice.CHOICE, choice, - VoteToChoice.VOTE, eVote); - - // Create new vote if needed - if (voteToChoice == null) { - voteToChoice = dao.create( - VoteToChoice.CHOICE, choice, - VoteToChoice.VOTE, eVote); - } - // Update vote value - voteToChoice.setVoteValue(choiceValue.getValue()); - } - - } - - /** - * Retourne la liste des VoteToChoice à partir d'une liste de dtos choix. - * - * @param choiceDTOs La liste des dtos choix - * @return la liste d'entités VoteToChoice - */ - @Deprecated - private List<VoteToChoice> getVoteToChoices(List<ChoiceDTO> choiceDTOs) - throws TopiaException { - List<VoteToChoice> liste = new ArrayList<VoteToChoice>(); - - for (ChoiceDTO choice : choiceDTOs) { - VoteToChoiceDAO voteToChoiceDAO = PollenModelDAOHelper - .getVoteToChoiceDAO(super.transaction); - VoteToChoice voteToChoice = voteToChoiceDAO.create(); - voteToChoice.setVoteValue(choice.getValue()); - - // Ajout du vote - VoteDAO voteDAO = PollenModelDAOHelper - .getVoteDAO(super.transaction); - Vote voteEntity = voteDAO.findByTopiaId(choice.getVoteId()); - voteToChoice.setVote(voteEntity); - - // Ajout choix - ChoiceDAO choiceDAO = PollenModelDAOHelper - .getChoiceDAO(super.transaction); - Choice choiceEntity = choiceDAO.findByTopiaId(choice.getId()); - voteToChoice.setChoice(choiceEntity); - - liste.add(voteToChoice); - } - - return liste; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,223 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.Comment; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteToChoice; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.services.ServicePollAccount; -import org.chorem.pollen.business.services.ServicePollAccountImpl; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.votecounting.business.NumberMethod; -import org.chorem.pollen.votecounting.dto.CommentDTO; -import org.chorem.pollen.votecounting.dto.PollChoiceDTO; -import org.chorem.pollen.votecounting.dto.PollDTO; -import org.chorem.pollen.votecounting.dto.VoteToChoiceDTO; -import org.chorem.pollen.votecounting.dto.VotingGroupDTO; -import org.chorem.pollen.votecounting.dto.VotingPersonDTO; - -/** - * Classe de conversion d'entités en DTO pour le module voteCounting. - * - * @author fdesbois - * @author rannou - * @version $Id: DataVoteCountingConverter.java 2696 2009-08-10 16:18:15Z - * nrannou $ - */ -public class DataVoteCountingConverter extends DataConverter { - - /** - * Création d'un DTO sondage d'export à partir d'une entité sondage. - * - * @param ePoll l'entité sondage - * @return le DTO sondage d'export - */ - public static PollDTO createPollDTOForVoteCounting(Poll ePoll) { - PollDTO pollDTO = new PollDTO(ePoll.getPollId()); - pollDTO.setTitle(ePoll.getTitle()); - pollDTO.setDescription(ePoll.getDescription()); - pollDTO.setBeginChoiceDate(ePoll.getBeginChoiceDate()); - pollDTO.setBeginDate(ePoll.getBeginDate()); - pollDTO.setEndDate(ePoll.getEndDate()); - pollDTO.setAnonymous(ePoll.getAnonymous()); - pollDTO.setAnonymousVoteAllowed(ePoll.getAnonymousVoteAllowed()); - pollDTO.setPublicResults(ePoll.getPublicResults()); - pollDTO.setContinuousResults(ePoll.getContinuousResults()); - pollDTO.setChoiceAddAllowed(ePoll.getChoiceAddAllowed()); - pollDTO.setClosed(ePoll.getClosed()); - pollDTO.setCreatorId(ePoll.getCreator().getVotingId()); - pollDTO.setCreatorEmail(ePoll.getCreator().getEmail()); - pollDTO.setMaxChoiceNb(ePoll.getMaxChoiceNb()); - pollDTO.setPollType(PollType.valueOf(ePoll.getPollType())); - pollDTO.setChoiceType(ChoiceType.valueOf(ePoll.getChoiceType())); - pollDTO.setVoteCounting(VoteCountingType.valueOf(ePoll.getVoteCounting())); - - for (Comment comment : ePoll.getComment()) { - pollDTO.getComments().add(createPollCommentDTO(comment)); - } - for (Choice choice : ePoll.getChoice()) { - pollDTO.getChoices().add(createPollChoiceDTO(choice)); - } - if (ePoll.getVotingList() != null && !ePoll.getVotingList().isEmpty()) { - for (VotingList list : ePoll.getVotingList()) { - pollDTO.getVotingGroups().add(createVotingGroupDTO(list)); - } - } else { - // un groupe par défaut si il y en a pas - VotingGroupDTO group = new VotingGroupDTO("unique", 1); - group.setName("unique"); - for (Vote vote : ePoll.getVote()) { - group.getVotingPersons().add(createVotingPersonDTO(vote)); - } - pollDTO.getVotingGroups().add(group); - } - return pollDTO; - } - - private static CommentDTO createPollCommentDTO(Comment comment) { - CommentDTO commentDTO = new CommentDTO(comment.getAuthor(), comment.getText()); - return commentDTO; - } - - private static PollChoiceDTO createPollChoiceDTO(Choice choice) { - PollChoiceDTO choiceDTO = new PollChoiceDTO(choice.getTopiaId()); - String choiceName = choice.getName(); - choiceDTO.setName(choiceName); - choiceDTO.setHidden(choiceName != null && - choiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); - choiceDTO.setDescription(choice.getDescription()); - return choiceDTO; - } - - private static VotingGroupDTO createVotingGroupDTO(VotingList list) { - VotingGroupDTO group = new VotingGroupDTO(list.getTopiaId(), list - .getWeight()); - group.setName(list.getName()); - - for (PersonToList pToList : list.getPollAccountPersonToList()) { - Vote vote = getPollVoteByPollAccount(list.getPoll(), pToList - .getPollAccount()); - if (vote != null) { // Pas de vote pour cette personne : doit engendrer erreur ?!? - group.getVotingPersons().add(createVotingPersonDTO(vote)); - } - } - return group; - } - - private static VotingPersonDTO createVotingPersonDTO(Vote vote) { - VotingPersonDTO votingPerson = new VotingPersonDTO(vote - .getPollAccount().getVotingId(), vote.getWeight()); - votingPerson.setEmail(vote.getPollAccount().getEmail()); - - for (VoteToChoice vToChoice : vote.getChoiceVoteToChoice()) { - if (vToChoice != null && vToChoice.getChoice() != null) { - votingPerson.getChoices().add(createVoteToChoiceDTO(vToChoice)); - } - } - return votingPerson; - } - - private static VoteToChoiceDTO createVoteToChoiceDTO(VoteToChoice vToChoice) { - String topiaId = vToChoice.getChoice().getTopiaId(); - VoteToChoiceDTO vote = new VoteToChoiceDTO(topiaId, vToChoice - .getVoteValue()); - - return vote; - } - - /* A Deplacer au bon endroit (PollImpl) si c'est possible */ - private static Vote getPollVoteByPollAccount(Poll poll, PollAccount account) { - for (Vote vote : poll.getVote()) { - if (account.getTopiaId().equals(vote.getPollAccount().getTopiaId())) { - return vote; - } - } - return null; - } - - /** - * Création d'un DTO sondage à partir d'un DTO sondage d'export. - * - * @param pollDTO le DTO sondage d'export - * @return le DTO sondage - */ - public static org.chorem.pollen.business.dto.PollDTO createPollDTO( - PollDTO pollDTO) { - org.chorem.pollen.business.dto.PollDTO bPollDTO = new org.chorem.pollen.business.dto.PollDTO( - pollDTO.getPollId()); - bPollDTO.setTitle(pollDTO.getTitle()); - bPollDTO.setDescription(pollDTO.getDescription()); - bPollDTO.setBeginChoiceDate(pollDTO.getBeginChoiceDate()); - bPollDTO.setBeginDate(pollDTO.getBeginDate()); - bPollDTO.setEndDate(pollDTO.getEndDate()); - bPollDTO.setAnonymous(pollDTO.isAnonymous()); - bPollDTO.setAnonymousVoteAllowed(pollDTO.isAnonymousVoteAllowed()); - bPollDTO.setPublicResults(pollDTO.isPublicResults()); - bPollDTO.setContinuousResults(pollDTO.isContinuousResults()); - bPollDTO.setChoiceAddAllowed(pollDTO.isChoiceAddAllowed()); - bPollDTO.setClosed(pollDTO.isClosed()); - bPollDTO.setCreatorId(pollDTO.getCreatorId()); - bPollDTO.setCreatorEmail(pollDTO.getCreatorEmail()); - bPollDTO.setMaxChoiceNb(pollDTO.getMaxChoiceNb()); - bPollDTO.setPollType(pollDTO.getPollType()); - bPollDTO.setChoiceType(pollDTO.getChoiceType()); - bPollDTO.setVoteCounting(pollDTO.getVoteCounting()); - - for (CommentDTO comment : pollDTO.getComments()) { - bPollDTO.getComments().add(createPollCommentDTO(comment)); - } - for (PollChoiceDTO choice : pollDTO.getChoices()) { - bPollDTO.getChoices().add(createPollChoiceDTO(choice)); - } - // TODO conversion des groupes et des votes - - return bPollDTO; - } - - private static org.chorem.pollen.business.dto.CommentDTO createPollCommentDTO( - CommentDTO commentDTO) { -// ServicePollAccount spa = new ServicePollAccountImpl(); -// PollAccount account = spa.createPollAccount(commentDTO.getVotingID(), -// null, null); -// org.chorem.pollen.business.dto.CommentDTO bCommentDTO = new org.chorem.pollen.business.dto.CommentDTO( -// commentDTO.getText(), null, account.getTopiaId()); - - org.chorem.pollen.business.dto.CommentDTO bCommentDTO = new org.chorem.pollen.business.dto.CommentDTO(); - bCommentDTO.setText(commentDTO.getText()); - bCommentDTO.setAuthor(commentDTO.getVotingID()); - return bCommentDTO; - } - - private static org.chorem.pollen.business.dto.ChoiceDTO createPollChoiceDTO( - PollChoiceDTO pollChoiceDTO) { - org.chorem.pollen.business.dto.ChoiceDTO bChoiceDTO = new org.chorem.pollen.business.dto.ChoiceDTO(); - String pollChoiceName = pollChoiceDTO.getName(); - bChoiceDTO.setName(pollChoiceName); - bChoiceDTO.setHidden(pollChoiceName != null - && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); - bChoiceDTO.setDescription(pollChoiceDTO.getDescription()); - return bChoiceDTO; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVotingListConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVotingListConverter.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVotingListConverter.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,197 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.converters; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.PersonToListDAO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteDAO; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.persistence.VotingListDAO; -import org.nuiton.topia.TopiaException; - -/** - * Gestion de la conversion des dtos VotingList en entité et vice-versa. - * - * @author enema - * @version $Id: DataVotingListConverter.java 2650 2009-07-16 12:57:46Z nrannou - * $ - */ -public class DataVotingListConverter extends DataConverter { - - /** - * Création d'une liste à partir d'un dto liste. - * - * @param votingListDTO le dto votingList - * @param eVotingList l'entité votingList - */ - public void populateVotingListEntity(VotingListDTO votingListDTO, - VotingList eVotingList) throws TopiaException { - eVotingList.setName(votingListDTO.getName()); - eVotingList.setWeight(votingListDTO.getWeight()); - - if (votingListDTO.getPollId() != null) { - if (votingListDTO.getPollId().length() > 0) { - PollDAO pollDAO = PollenModelDAOHelper - .getPollDAO(super.transaction); - Poll pollEntity = pollDAO.findByTopiaId(votingListDTO - .getPollId()); - eVotingList.setPoll(pollEntity); - } - } - if (votingListDTO.getVoteId() != null) { - if (votingListDTO.getVoteId().length() > 0) { - VoteDAO voteDAO = PollenModelDAOHelper - .getVoteDAO(super.transaction); - Vote voteEntity = voteDAO.findByTopiaId(votingListDTO - .getVoteId()); - eVotingList.setVote(voteEntity); - } - } - } - - /** - * Création d'un dto votingList à partir d'une entité. - * - * @param eVotingList l'entité votingList - * @return le dto votingList - */ - public VotingListDTO createVotingListDTO(VotingList eVotingList) { - VotingListDTO dto = new VotingListDTO(); - dto.setId(eVotingList.getTopiaId()); - dto.setName(eVotingList.getName()); - dto.setWeight(eVotingList.getWeight()); - - dto.setPollAccountDTOs(this.getPollAccountDTOs(eVotingList - .getPollAccountPersonToList())); - - if (eVotingList.getPoll() != null) { - dto.setPollId(eVotingList.getPoll().getTopiaId()); - } - if (eVotingList.getVote() != null) { - dto.setVoteId(eVotingList.getVote().getTopiaId()); - } - - return dto; - } - - /** - * Retourne une liste de dtos votingList à partir d'une liste d'entités. - * - * @param lVotingLists liste de entités votingList - * @return la liste des dtos votingList - */ - public List<VotingListDTO> createVotingListDTOs( - List<VotingList> lVotingLists) { - List<VotingListDTO> results = new ArrayList<VotingListDTO>(); - VotingListDTO dto; - for (VotingList v : lVotingLists) { - dto = this.createVotingListDTO(v); - results.add(dto); - } - return results; - } - - /** - * Retourne une liste de pollAccount correspondant aux personnes de la - * liste. - * - * @param persons les personnes - * @return liste des comptes - */ - private List<PollAccountDTO> getPollAccountDTOs( - Collection<PersonToList> persons) { - - List<PollAccountDTO> accounts = new ArrayList<PollAccountDTO>(); - DataPollAccountConverter converter = new DataPollAccountConverter(); - - for (PersonToList p : persons) { - accounts.add(converter.createPollAccountDTO(p.getPollAccount())); - } - - return accounts; - } - - /** - * Mise à jour des PersonToList d'une entité votingList à partir d'un dto - * votingList. - * - * @param votingListDTO Le dto votingList. - * @param eVotingList L'entité votingList. - */ - public void populatePersonVotingList(VotingListDTO votingListDTO, - VotingList eVotingList) throws TopiaException { - - // Mise à jour des identifiants de liste dans les pollAccounts - for (PollAccountDTO pollAccountDTO : votingListDTO.getPollAccountDTOs()) { - pollAccountDTO.setVotingListId(eVotingList.getTopiaId()); - } - - // Mise à jour des PersonToList correspondants à la liste de votants - eVotingList.setPollAccountPersonToList(this - .getPersonToLists(votingListDTO.getPollAccountDTOs())); - } - - /** - * Retourne la liste des PersonToList à partir d'une liste de dtos - * votingList. - * - * @param pollAccountDTOs La liste des dtos votingList - * @return la liste d'entités PersonToList - */ - private List<PersonToList> getPersonToLists( - List<PollAccountDTO> pollAccountDTOs) throws TopiaException { - List<PersonToList> liste = new ArrayList<PersonToList>(); - - for (PollAccountDTO pollAccountDTO : pollAccountDTOs) { - PersonToListDAO personToListDAO = PollenModelDAOHelper - .getPersonToListDAO(super.transaction); - PersonToList personToListEntity = personToListDAO.create(); - personToListEntity.setWeight(pollAccountDTO.getWeight()); - personToListEntity.setHasVoted(pollAccountDTO.isHasVoted()); - - // Ajout de la votingList - VotingListDAO votingListDAO = PollenModelDAOHelper - .getVotingListDAO(super.transaction); - VotingList votingListEntity = votingListDAO - .findByTopiaId(pollAccountDTO.getVotingListId()); - personToListEntity.setVotingList(votingListEntity); - - // Ajout du pollAccount - PollAccountDAO pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(super.transaction); - PollAccount pollAccountEntity = pollAccountDAO - .findByTopiaId(pollAccountDTO.getId()); - personToListEntity.setPollAccount(pollAccountEntity); - - liste.add(personToListEntity); - } - - return liste; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Gestion de la conversion des DTO en entités et des entités en DTO. - */ -package org.chorem.pollen.business.converters; \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,167 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; - -import org.chorem.pollen.votecounting.dto.PollChoiceDTO; - -/** - * Classe DTO représentant un choix de sondage. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class ChoiceDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** main id (topiaId) **/ - private String id = ""; - - /** name of the choice **/ - private String name = ""; - - /** description of the choice **/ - private String description = ""; - - /** ?? **/ - private Boolean validate = false; - - /** - * VOTE context : value of the choice in a vote. - * Not fill by servicePoll - **/ - private Integer value = 0; - - /** - * VOTE context : topiaId of the vote where the choice is done - * FIXME-FD20100224 Is it really needed ?? - **/ - private String voteId = ""; - - /** - * topiaId of the poll owner of this choice - * FIXME-FD20100224 Is it really needed ?? - */ - private String pollId = ""; - - /** - * pollUId of the poll owner of this choice - */ - private String pollUId; - - /** used for specific choice in Number VoteCounting **/ - private Boolean hidden = false; - - public ChoiceDTO() { - - } - - @Deprecated - public ChoiceDTO(String id) { - this.id = id; - } - - @Deprecated - public ChoiceDTO(String name, String voteId, String pollId) { - this.name = name; - this.voteId = voteId; - //this.pollId = pollId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Integer getValue() { - return value; - } - - public void setValue(Integer value) { - this.value = value; - } - - public Boolean isValidate() { - return validate; - } - - public Boolean getValidate() { - return isValidate(); - } - - public void setValidate(Boolean validate) { - this.validate = validate; - } - - public String getVoteId() { - return voteId; - } - - public void setVoteId(String voteId) { - this.voteId = voteId; - } - - public String getPollId() { - return pollId; - } - - public void setPollId(String pollId) { - this.pollId = pollId; - } - - public String getPollUId() { - return pollUId; - } - - public void setPollUId(String pollUId) { - this.pollUId = pollUId; - } - - public Boolean isHidden() { - return hidden; - } - - public Boolean getHidden() { - return isHidden(); - } - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/CommentDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/CommentDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/CommentDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,75 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.Date; - -/** - * Classe DTO représentant un commentaire. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class CommentDTO implements Serializable { - - /** main id (topiaId) **/ - private String id; - - /** content of the comment **/ - private String text; - - /** date where the comment were created **/ - private Date postDate; - - /** author of the comment **/ - private String author; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public Date getPostDate() { - return postDate; - } - - public void setPostDate(Date postDate) { - this.postDate = postDate; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PersonListDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PersonListDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PersonListDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,110 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Classe DTO représentant une liste de personnes. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class PersonListDTO implements Serializable { - - private String id = ""; - - private String userId = ""; - - private String name = ""; - - private List<PollAccountDTO> persons = new ArrayList<PollAccountDTO>(); - - public PersonListDTO() { - - } - - public PersonListDTO(String id) { - this.id = id; - } - - public PersonListDTO(String name, String userId) { - super(); - this.name = name; - this.userId = userId; - - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List<PollAccountDTO> getPollAccounts() { - return persons; - } - - public void setPollAccounts(List<PollAccountDTO> persons) { - this.persons = persons; - } - - public boolean addPollAccount(PollAccountDTO account) { - if (persons == null) { - persons = new ArrayList<PollAccountDTO>(); - } - return persons.add(account); - } - - public boolean removePollAccount(String accountId) { - if (persons == null) { - return false; - } - Iterator<PollAccountDTO> it = persons.iterator(); - while (it.hasNext()) { - PollAccountDTO account = it.next(); - if (accountId.equals(account.getId())) { - it.remove(); - return true; - } - } - return false; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollAccountDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollAccountDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollAccountDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,176 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Classe DTO représentant un votant. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class PollAccountDTO implements Serializable { - - private String id; - - /** UId of the account used in urls **/ - private String accountUId; - - /** Name of the account **/ - private String votingId; - - /** TopiaId of the user linked with the account **/ - private String userId; - - /** Email of the account **/ - private String email; - - /** Weight of the account (already defined in the vote) **/ - private Double weight; - - /** - * Determine if the account has already voted (used for vote page) - * Seems not necessary to manage vote, no constraint define on changing - * existing vote if it's the correct user or account. - **/ - private Boolean hasVoted; - - - - private String votingListId = ""; - - private String personListId = ""; - - private List<VoteDTO> voteDTOs = new ArrayList<VoteDTO>(); - - public PollAccountDTO() { - - } - - @Deprecated - public PollAccountDTO(String id) { - this.id = id; - } - - @Deprecated - public PollAccountDTO(String votingId, String email, String personListId, - String votingListId, String userId) { - super(); - this.votingId = votingId; - this.email = email; - this.personListId = personListId; - this.votingListId = votingListId; - this.userId = userId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getAccountUId() { - return accountUId; - } - - public void setAccountUId(String accountUId) { - this.accountUId = accountUId; - } - - public String getVotingId() { - return votingId; - } - - public void setVotingId(String votingId) { - this.votingId = votingId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Deprecated - public Double getWeight() { - return weight; - } - - @Deprecated - public void setWeight(Double weight) { - this.weight = weight; - } - - public Boolean isHasVoted() { - return hasVoted; - } - - public Boolean getHasVoted() { - return isHasVoted(); - } - - public void setHasVoted(Boolean hasVoted) { - this.hasVoted = hasVoted; - } - - @Deprecated - public String getVotingListId() { - return votingListId; - } - - @Deprecated - public void setVotingListId(String votingListId) { - this.votingListId = votingListId; - } - - @Deprecated - public String getPersonListId() { - return personListId; - } - - @Deprecated - public void setPersonListId(String personListId) { - this.personListId = personListId; - } - - @Deprecated - public List<VoteDTO> getVoteDTOs() { - return voteDTOs; - } - - @Deprecated - public void setVoteDTOs(List<VoteDTO> voteDTOs) { - this.voteDTOs = voteDTOs; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,424 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; - -/** - * Classe DTO représentant un sondage. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class PollDTO implements Serializable { - - private String id = ""; - - private String pollUId; - - private String title = ""; - - private String description = ""; - - private Date beginDate = null; - - private Date endDate = null; - - private Date beginChoiceDate = null; - - private Date endChoiceDate = null; - - private Integer maxChoiceNb = 0; - - private Boolean closed = false; - - private Boolean choiceAddAllowed = false; - - private Boolean anonymousVoteAllowed = false; - - private Boolean anonymous = false; - - private Boolean publicResults = false; - - private Boolean continuousResults = false; - - private PollType pollType = null; - - private VoteCountingType voteCounting = null; - - private ChoiceType choiceType = ChoiceType.TEXT; - - private String userId = ""; - - /** topiaId of the creator (pollAccount) **/ - private String creatorId = ""; - - /** name of the creator (pollAccount.votingId) **/ - private String creatorName; - - /** email of the creator **/ - private String creatorEmail = ""; - - private List<CommentDTO> comments = new ArrayList<CommentDTO>(); - - private List<VotingListDTO> votingListDTOs = new ArrayList<VotingListDTO>(); - - private int nbVotes; - - private List<PreventRuleDTO> preventRuleDTOs = new ArrayList<PreventRuleDTO>(); - - private List<ChoiceDTO> choices = new ArrayList<ChoiceDTO>(); - - private List<ResultDTO> resultDTOs = new ArrayList<ResultDTO>(); - - public PollDTO() { - - } - - public PollDTO(String id) { - this.id = id; - } - - public PollDTO(String title, String creatorId, ChoiceType choiceType, - PollType pollType, VoteCountingType voteCounting) { - super(); - this.title = title; - this.pollType = pollType; - this.creatorId = creatorId; - this.choiceType = choiceType; - this.voteCounting = voteCounting; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getPollUId() { - return pollUId; - } - - public void setPollUId(String pollId) { - this.pollUId = pollId; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getBeginDate() { - return beginDate; - } - - public void setBeginDate(Date beginDate) { - this.beginDate = beginDate; - } - - /** - * Get the value of endChoiceDate - * - * @return the value of endChoiceDate - */ - public Date getEndChoiceDate() { - return endChoiceDate; - } - - /** - * Set the value of endChoiceDate - * - * @param endChoiceDate new value of endChoiceDate - */ - public void setEndChoiceDate(Date endChoiceDate) { - this.endChoiceDate = endChoiceDate; - } - - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public Date getBeginChoiceDate() { - return beginChoiceDate; - } - - public void setBeginChoiceDate(Date beginChoiceDate) { - this.beginChoiceDate = beginChoiceDate; - } - - public Integer getMaxChoiceNb() { - return maxChoiceNb; - } - - public void setMaxChoiceNb(Integer maxChoiceNb) { - this.maxChoiceNb = maxChoiceNb; - } - - public Boolean isClosed() { - return closed; - } - - public Boolean getClosed() { - return isClosed(); - } - - public void setClosed(Boolean closed) { - this.closed = closed; - } - - public Boolean isChoiceAddAllowed() { - return choiceAddAllowed; - } - - public Boolean getChoiceAddAllowed() { - return isChoiceAddAllowed(); - } - - public void setChoiceAddAllowed(Boolean choiceAddAllowed) { - this.choiceAddAllowed = choiceAddAllowed; - } - - public Boolean isAnonymousVoteAllowed() { - return anonymousVoteAllowed; - } - - public Boolean getAnonymousVoteAllowed() { - return isAnonymousVoteAllowed(); - } - - public void setAnonymousVoteAllowed(Boolean anonymousVoteAllowed) { - this.anonymousVoteAllowed = anonymousVoteAllowed; - } - - public Boolean isAnonymous() { - return anonymous; - } - - public Boolean getAnonymous() { - return isAnonymous(); - } - - public void setAnonymous(Boolean anonymous) { - this.anonymous = anonymous; - } - - public Boolean isPublicResults() { - return publicResults; - } - - public Boolean getPublicResults() { - return isPublicResults(); - } - - public void setPublicResults(Boolean publicResults) { - this.publicResults = publicResults; - } - - public Boolean isContinuousResults() { - return continuousResults; - } - - public Boolean getContinuousResults() { - return isContinuousResults(); - } - - public void setContinuousResults(Boolean continuousResults) { - this.continuousResults = continuousResults; - } - - public PollType getPollType() { - return pollType; - } - - public void setPollType(PollType pollType) { - this.pollType = pollType; - } - - public VoteCountingType getVoteCounting() { - return voteCounting; - } - - public void setVoteCounting(VoteCountingType voteCounting) { - this.voteCounting = voteCounting; - } - - public ChoiceType getChoiceType() { - return choiceType; - } - - public void setChoiceType(ChoiceType choiceType) { - this.choiceType = choiceType; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getCreatorId() { - return creatorId; - } - - public void setCreatorId(String creatorId) { - this.creatorId = creatorId; - } - - public String getCreatorName() { - return creatorName; - } - - public void setCreatorName(String creatorName) { - this.creatorName = creatorName; - } - - public String getCreatorEmail() { - return creatorEmail; - } - - public void setCreatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - } - - public List<CommentDTO> getComments() { - return comments; - } - - public void setComments(List<CommentDTO> commentDTOs) { - this.comments = commentDTOs; - } - - public boolean addComment(CommentDTO comment) { - if (comments == null) { - comments = new ArrayList<CommentDTO>(); - } - return comments.add(comment); - } - - public boolean removeComment(String commentId) { - if (comments == null) { - return false; - } - Iterator<CommentDTO> it = comments.iterator(); - while (it.hasNext()) { - CommentDTO comment = it.next(); - if (commentId.equals(comment.getId())) { - it.remove(); - return true; - } - } - return false; - } - - public List<VotingListDTO> getVotingListDTOs() { - return votingListDTOs; - } - - public void setVotingListDTOs(List<VotingListDTO> votingListDTOs) { - this.votingListDTOs = votingListDTOs; - } - - public int getNbVotes() { - return nbVotes; - } - - public void setNbVotes(int nbVotes) { - this.nbVotes = nbVotes; - } - - public List<PreventRuleDTO> getPreventRuleDTOs() { - return preventRuleDTOs; - } - - public void setPreventRuleDTOs(List<PreventRuleDTO> preventRuleDTOs) { - this.preventRuleDTOs = preventRuleDTOs; - } - - public void addPreventRule(PreventRuleDTO rule) { - if (preventRuleDTOs == null) { - preventRuleDTOs = new ArrayList<PreventRuleDTO>(); - } - preventRuleDTOs.add(rule); - } - - public List<ChoiceDTO> getChoices() { - return choices; - } - - public void setChoices(List<ChoiceDTO> choiceDTOs) { - this.choices = choiceDTOs; - } - - public void addChoice(ChoiceDTO choice) { - if (choices == null) { - choices = new ArrayList<ChoiceDTO>(); - } - choices.add(choice); - } - - public boolean removeChoice(String choiceId) { - if (choices == null) { - return false; - } - Iterator<ChoiceDTO> it = choices.iterator(); - while (it.hasNext()) { - ChoiceDTO choice = it.next(); - if (choiceId.equals(choice.getId())) { - it.remove(); - return true; - } - } - return false; - } - - public List<ResultDTO> getResultDTOs() { - return resultDTOs; - } - - public void setResultDTOs(List<ResultDTO> resultDTOs) { - this.resultDTOs = resultDTOs; - } - -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/PreventRuleDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,152 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; - -/** - * Classe DTO représentant une règle de notification. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class PreventRuleDTO implements Serializable { - - /** main id (topiaId) **/ - private String id = ""; - - /** - * topiaId of the poll owner of this preventRule - * FIXME-FD20100224 Is it really needed ?? - **/ - private String pollId = ""; - - private String scope = ""; - - private Integer sensibility = 0; - - private Boolean active = true; - - private Boolean oneTime = false; - - private Boolean repeated = false; - - private String method = ""; - - public PreventRuleDTO() { - } - - public PreventRuleDTO(String id) { - this.id = id; - } - - public PreventRuleDTO(String pollId, String scope, int sensibility, - boolean repeated, String method) { - super(); - this.scope = scope; - this.sensibility = sensibility; - this.repeated = repeated; - this.method = method; - this.pollId = pollId; - } - - public PreventRuleDTO(String scope, int sensibility, boolean repeated, - String method) { - super(); - this.scope = scope; - this.sensibility = sensibility; - this.repeated = repeated; - this.method = method; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getPollId() { - return pollId; - } - - public void setPollId(String pollId) { - this.pollId = pollId; - } - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - public Integer getSensibility() { - return sensibility; - } - - public void setSensibility(Integer sensibility) { - this.sensibility = sensibility; - } - - public Boolean isActive() { - return active; - } - - public Boolean getActive() { - return isActive(); - } - - public void setActive(Boolean active) { - this.active = active; - } - - public Boolean isOneTime() { - return oneTime; - } - - public Boolean getOneTime() { - return isOneTime(); - } - - public void setOneTime(Boolean oneTime) { - this.oneTime = oneTime; - } - - public Boolean isRepeated() { - return repeated; - } - - public Boolean getRepeated() { - return isRepeated(); - } - - public void setRepeated(Boolean repeated) { - this.repeated = repeated; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,129 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; - -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.VoteCountingType; - -/** - * Classe DTO représentant un résultat de sondage. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class ResultDTO implements Serializable { - - private String id = ""; - - private String name = ""; - - private String value = ""; - - private String pollId = ""; - - private ChoiceType choiceType; - - private VoteCountingType voteCounting; - - private boolean byGroup = false; - - private boolean hidden = false; - - public ResultDTO() { - - } - - public ResultDTO(String id) { - this.id = id; - } - - public ResultDTO(String name, String pollId, ChoiceType choiceType, - VoteCountingType myVoteCounting) { - super(); - this.name = name; - this.pollId = pollId; - this.choiceType = choiceType; - this.voteCounting = myVoteCounting; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getPollId() { - return pollId; - } - - public void setPollId(String pollId) { - this.pollId = pollId; - } - - public ChoiceType getChoiceType() { - return choiceType; - } - - public void setChoiceType(ChoiceType choiceType) { - this.choiceType = choiceType; - } - - public VoteCountingType getVoteCounting() { - return voteCounting; - } - - public void setVoteCounting(VoteCountingType voteCounting) { - this.voteCounting = voteCounting; - } - - public boolean isByGroup() { - return byGroup; - } - - public void setByGroup(boolean byGroup) { - this.byGroup = byGroup; - } - - public boolean isHidden() { - return hidden; - } - - public void setHidden(boolean hidden) { - this.hidden = hidden; - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultListDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultListDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultListDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,38 +0,0 @@ -package org.chorem.pollen.business.dto; - -import java.util.List; - -import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; - -/** - * Classe DTO représentant une liste de résultats. - * - * @version $Revision$ $Date$ - * @since 1.2.2 - */ -public class ResultListDTO { - - /** Liste des résultats */ - private List<ResultDTO> resultDTOs = null; - - /** Résultat issu du dépouillement du vote */ - private VoteCountingResultDTO voteCountingResultDTO = null; - - public List<ResultDTO> getResultDTOs() { - return resultDTOs; - } - - public void setResultDTOs(List<ResultDTO> resultDTOs) { - this.resultDTOs = resultDTOs; - } - - public VoteCountingResultDTO getVoteCountingResultDTO() { - return voteCountingResultDTO; - } - - public void setVoteCountingResultDTO(VoteCountingResultDTO voteCountingResultDTO) { - this.voteCountingResultDTO = voteCountingResultDTO; - } - - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/UserDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/UserDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/UserDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,136 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Classe DTO représentant un utilisateur. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class UserDTO implements Serializable { - - private String id = ""; - - private String login = ""; - - private String firstName = ""; - - private String lastName = ""; - - private boolean administrator = false; - - private String language = ""; - - private String email = ""; - - private List<PersonListDTO> personListDTOs = new ArrayList<PersonListDTO>(); - - private List<PollAccountDTO> pollAccountDTOs = new ArrayList<PollAccountDTO>(); - - public UserDTO() { - - } - - public UserDTO(String id) { - this.id = id; - } - - public UserDTO(String login, String firstName, String lastName) { - this.login = login; - this.firstName = firstName; - this.lastName = lastName; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public boolean isAdministrator() { - return administrator; - } - - public void setAdministrator(boolean administrator) { - this.administrator = administrator; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public List<PersonListDTO> getPersonListDTOs() { - return personListDTOs; - } - - public void setPersonListDTOs(List<PersonListDTO> personListDTOs) { - this.personListDTOs = personListDTOs; - } - - public List<PollAccountDTO> getPollAccountDTOs() { - return pollAccountDTOs; - } - - public void setPollAccountDTOs(List<PollAccountDTO> pollAccountDTOs) { - this.pollAccountDTOs = pollAccountDTOs; - } - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VoteDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VoteDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VoteDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,197 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * Classe DTO représentant un vote. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class VoteDTO implements Serializable { - - /** main id (topiaId) **/ - private String id = ""; - - /** weight of the person who has voted depends on poll context **/ - private Double weight = 0.; - - /** - * FIXME-FD20100224 comment on the vote. Where is it used in ui ? - **/ - private String comment = ""; - - /** the vote is anonymous or not **/ - private Boolean anonymous = false; - - /** account who has voted : only defined if anonymous = false **/ - private String pollAccountId; - - /** QUICK FIX to have pollAccount votingId **/ - private String name; - - /** QUICK FIX to have pollAccount userId **/ - private String userId; - - /** - * topiaId of the poll where the vote is done - * FIXME-FD20100224 Is it really needed ?? - **/ - private String pollId = ""; - - /** topiaId of the list corresponding to this vote **/ - private String votingListId = ""; - - /** choices made by this vote **/ -// private List<ChoiceDTO> choiceDTOs = new ArrayList<ChoiceDTO>(); - private Map<String, Integer> choiceValues; - - public VoteDTO() { - } - - @Deprecated - public VoteDTO(String id) { - this.id = id; - } - - @Deprecated - public VoteDTO(String accountUId, String pollId, String votingListId) { -// this.accountUId = accountUId; - this.pollId = pollId; - this.votingListId = votingListId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Double getWeight() { - return weight; - } - - public void setWeight(Double weight) { - this.weight = weight; - } - - @Deprecated - public String getComment() { - return comment; - } - - @Deprecated - public void setComment(String comment) { - this.comment = comment; - } - - public Boolean isAnonymous() { - return anonymous; - } - - public Boolean getAnonymous() { - return isAnonymous(); - } - - public void setAnonymous(Boolean anonymous) { - this.anonymous = anonymous; - } - - public String getPollAccountId() { - return pollAccountId; - } - - public void setPollAccountId(String pollAccountId) { - this.pollAccountId = pollAccountId; - } - - @Deprecated - public String getName() { - return name; - } - - @Deprecated - public void setName(String name) { - this.name = name; - } - - @Deprecated - public String getUserId() { - return userId; - } - - @Deprecated - public void setUserId(String userId) { - this.userId = userId; - } - - @Deprecated - public String getPollId() { - return pollId; - } - - @Deprecated - public void setPollId(String pollId) { - this.pollId = pollId; - } - - public String getVotingListId() { - return votingListId; - } - - public void setVotingListId(String votingListId) { - this.votingListId = votingListId; - } - - public void setChoiceValue(String choiceId, Integer value) { - getChoiceValues().put(choiceId, value); - } - - public Integer getChoiceValue(String choiceId) { - return getChoiceValues().get(choiceId); - } - - public Map<String, Integer> getChoiceValues() { - if (choiceValues == null) { - choiceValues = new HashMap<String, Integer>(); - } - return choiceValues; - } - -// public List<ChoiceDTO> getChoiceDTOs() { -// return choiceDTOs; -// } -// -// public void setChoiceDTOs(List<ChoiceDTO> choiceDTOs) { -// this.choiceDTOs = choiceDTOs; -// } -// -// public void addChoice(ChoiceDTO choice) { -// if (choiceDTOs == null) { -// choiceDTOs = new ArrayList<ChoiceDTO>(); -// } -// choiceDTOs.add(choice); -// } - -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VotingListDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VotingListDTO.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/VotingListDTO.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,106 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.dto; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Classe DTO représentant une liste de votants. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class VotingListDTO implements Serializable { - - private String id = ""; - - private String name = ""; - - private Double weight = 1.; - - private String pollId = ""; - - private String voteId = ""; - - private List<PollAccountDTO> pollAccountDTOs = new ArrayList<PollAccountDTO>(); - - public VotingListDTO() { - - } - - public VotingListDTO(String id) { - this.id = id; - } - - public VotingListDTO(String name, String pollId) { - super(); - this.name = name; - this.pollId = pollId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Double getWeight() { - return weight; - } - - public void setWeight(Double weight) { - this.weight = weight; - } - - public String getPollId() { - return pollId; - } - - public void setPollId(String pollId) { - this.pollId = pollId; - } - - public String getVoteId() { - return voteId; - } - - public void setVoteId(String voteId) { - this.voteId = voteId; - } - - public List<PollAccountDTO> getPollAccountDTOs() { - return pollAccountDTOs; - } - - public void setPollAccountDTOs(List<PollAccountDTO> pollAccountDTOs) { - this.pollAccountDTOs = pollAccountDTOs; - } - -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Data Transfert Objects. - */ -package org.chorem.pollen.business.dto; \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/PollenMigrationCallbackHandler.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/PollenMigrationCallbackHandler.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/PollenMigrationCallbackHandler.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,252 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.migration; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.dialect.Dialect; -import org.hibernate.dialect.H2Dialect; -import org.hibernate.dialect.PostgreSQLDialect; -import org.nuiton.topia.migration.DatabaseManager; -import org.nuiton.topia.migration.callback.MigrationCallbackHandler; -import org.nuiton.util.VersionUtil; - -/** - * Classe d'interaction avant la migration (MigrationCallbackHandler). - * - * @author rannou - * @version $Id: PollenMigrationCallbackHandler.java 2615 2009-07-01 13:47:45Z - * nrannou $ - */ -public class PollenMigrationCallbackHandler implements MigrationCallbackHandler { - - /** log. */ - private static final Log log = LogFactory - .getLog(PollenMigrationCallbackHandler.class); - - @Override - public MigrationChoice doMigration(DatabaseManager dbManager, - String dbVersion, String applicationVersion) { - - if (log.isInfoEnabled()) { - log.info("Migration : version de la base : " + dbVersion - + ", version de l'application : " + applicationVersion); - } - - Dialect dialect = dbManager.getDbConfiguration().buildSettings() - .getDialect(); - MigrationChoice result = MigrationChoice.NO_MIGRATION; - - // ouverture d'une connexion direct JDBC sur la base - try { - Connection conn = dbManager.getConnection(); - try { - conn.setAutoCommit(false); - if (VersionUtil.valueOf(dbVersion).before( - VersionUtil.valueOf("1.1"))) { - migrateTo1_1(conn, dialect); - } - if (VersionUtil.valueOf(dbVersion).before( - VersionUtil.valueOf("1.2"))) { - migrate1_1To1_2(conn, dialect); - } - if (VersionUtil.valueOf(dbVersion).before( - VersionUtil.valueOf("1.3"))) { - migrate1_2To1_3(conn, dialect); - } - conn.commit(); - result = MigrationChoice.CUSTOM_MIGRATION; - } catch (Exception eee) { - log.error("Migration impossible de la base", eee); - conn.rollback(); - } finally { - conn.close(); - } - } catch (Exception eee) { - log.error("Erreur lors de la tentative de migration", eee); - } - return result; - } - - /** Migration de la version 0 à 1.1 */ - private void migrateTo1_1(Connection conn, Dialect dialect) - throws SQLException { - log.info("Migrate to version 1_1"); - String[] sqls = null; - - // Script de migration - if (dialect instanceof PostgreSQLDialect) { - sqls = new String[] { - "alter table useraccount rename langage to language;", - "alter table pollaccount add accountid varchar;", - "update pollaccount set accountid=md5(topiaid);", - "alter table persontolist drop column hasvoted;", - "alter table persontolist add hasvoted boolean default false;", - "alter table vote add anonymous boolean default false;", - "alter table preventrule add active boolean default true;", - "alter table preventrule add onetime boolean default false;", }; - } else if (dialect instanceof H2Dialect) { - sqls = new String[] { - "alter table useraccount alter column langage rename to language;", - "alter table pollaccount add accountid varchar;", - "update pollaccount set accountid=hash('sha256', stringtoutf8(topiaid), 1000);", - "alter table persontolist drop column hasvoted;", - "alter table persontolist add hasvoted boolean default false;", - "alter table vote add anonymous boolean default false;", - "alter table preventrule add active boolean default true;", - "alter table preventrule add onetime boolean default false;", }; - } else { - if (log.isErrorEnabled()) { - log - .error("Migration non prise en charge pour ce type de dialect : " - + dialect); - } - } - - // Exécution de la migration - for (String sql : sqls) { - log.info("try " + sql); - PreparedStatement sta = conn.prepareStatement(sql); - sta.executeUpdate(); - log.info("done " + sql); - } - } - - /** Migration de la version 1.1 à 1.2 */ - private void migrate1_1To1_2(Connection conn, Dialect dialect) - throws SQLException { - log.info("Migrate version 1_1 to version 1_2"); - String[] sqls = null; - - // Script de migration - if (dialect instanceof PostgreSQLDialect) { - sqls = new String[] { - "alter table poll add endchoicedate timestamp without time zone;" }; - } else if (dialect instanceof H2Dialect) { - sqls = new String[] { - "alter table poll add endchoicedate timestamp before begindate;" }; - } else { - if (log.isErrorEnabled()) { - log - .error("Migration non prise en charge pour ce type de dialect : " - + dialect); - } - } - - // Exécution de la migration - for (String sql : sqls) { - log.info("try " + sql); - PreparedStatement sta = conn.prepareStatement(sql); - sta.executeUpdate(); - log.info("done " + sql); - } - } - - /** Migration de la version 1.2 à 1.3 */ - private void migrate1_2To1_3(Connection conn, Dialect dialect) - throws SQLException { - log.info("Migrate version 1_1 to version 1_2"); - String[] sqls = null; - - // Script de migration - if (dialect instanceof PostgreSQLDialect) { - sqls = new String[] { - // VoteCounting becomes a String field instead of a table - "alter table poll add votecounting1 varchar;", - "update poll as p set votecounting1 = (select v.name from votecounting v where v.topiaId = p.votecounting);", - "alter table poll drop column votecounting;", - "alter table poll rename votecounting1 to votecounting;", - "alter table result add votecounting1 varchar;", - "update result as r set votecounting1 = (select v.name from votecounting v where v.topiaId = r.votecounting);", - "alter table result drop column votecounting;", - "alter table result rename votecounting1 to votecounting;", - "drop table votecounting;", - // PollType becomes a String field instead of a table - "alter table poll add polltype1 varchar;", - "update poll as p set polltype1 = (select t.name from polltype t where t.topiaId = p.polltype);", - "alter table poll drop column polltype;", - "alter table poll rename polltype1 to polltype;", - "drop table polltype;", - // ChoiceType becomes a String field instead of a table - "alter table poll add choicetype1 varchar;", - "update poll as p set choicetype1 = (select t.name from choicetype t where t.topiaId = p.choicetype);", - "alter table poll drop column choicetype;", - "alter table poll rename choicetype1 to choicetype;", - "drop table choicetype;", - // Remove link between comment and pollAccount : only name - // is needed - "alter table comment add author varchar;", - "update comment as c set author = (select a.votingId from pollaccount a where a.topiaId = c.pollaccount);", - "alter table comment drop column pollaccount;" - }; - } else if (dialect instanceof H2Dialect) { - sqls = new String[] { - // VoteCounting becomes a String field instead of a table - "alter table poll add votecounting1 varchar;", - "update poll as p set votecounting1 = (select v.name from votecounting v where v.topiaId = p.votecounting);", - "alter table result add votecounting1 varchar;", - "update result as r set votecounting1 = (select v.name from votecounting v where v.topiaId = r.votecounting);", - "drop table votecounting;", - "alter table poll drop column votecounting;", - "alter table poll alter column votecounting1 rename to votecounting;", - "alter table result drop column votecounting;", - "alter table result alter column votecounting1 rename to votecounting;", - // PollType becomes a String field instead of a table - "alter table poll add polltype1 varchar;", - "update poll as p set polltype1 = (select t.name from polltype t where t.topiaId = p.polltype);", - "drop table polltype;", - "alter table poll drop column polltype;", - "alter table poll alter column polltype1 rename to polltype;", - // ChoiceType becomes a String field instead of a table - "alter table poll add choicetype1 varchar;", - "update poll as p set choicetype1 = (select t.name from choicetype t where t.topiaId = p.choicetype);", - "drop table choicetype;", - "alter table poll drop column choicetype;", - "alter table poll alter column choicetype1 rename to choicetype;", - // Remove link between comment and pollAccount : only name - // is needed - "alter table comment add author varchar;", - "update comment as c set author = (select a.votingId from pollaccount a where a.topiaId = c.pollaccount);", - "update comment set pollaccount = null;" - // FIXME-FD20100224 - // org.h2.jdbc.JdbcSQLException: Column may be referenced - // by "PUBLIC.FK38A5EE5F65D3F731"; SQL statement: - // can't drop constraint because the name is generated by - // hibernate -// "alter table comment drop column pollaccount;" - }; - } else { - if (log.isErrorEnabled()) { - log - .error("Migration non prise en charge pour ce type de dialect : " - + dialect); - } - } - - // Exécution de la migration - for (String sql : sqls) { - log.info("try " + sql); - PreparedStatement sta = conn.prepareStatement(sql); - sta.executeUpdate(); - log.info("done " + sql); - } - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/migration/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Migration de la base de données. - */ -package org.chorem.pollen.business.migration; \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/SendMail.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/SendMail.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/SendMail.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,259 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.util.List; -import java.util.Map; - -import org.apache.commons.io.FileUtils; -import org.chorem.pollen.business.utils.MailUtil; -import org.nuiton.util.FileUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import au.com.bytecode.opencsv.CSVReader; -import au.com.bytecode.opencsv.CSVWriter; -import org.apache.commons.io.IOUtils; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.PollenProperty; - -/** - * Mass mail management class. - * - * This class store email to send in a csv file, and send it (one per second) in - * a second time. - * This class can restart to send mail at application restart. - * - * For a mass mail sending to start, following files must be present: - * <ul> - * <li>xxx.emails : CSV file ("email", "subject", "body")</li> - * <li>xxx.index : next index to manage ( inited at 0)</li> - * </ul> - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class SendMail extends Thread { - - /** logger. */ - private static final Logger log = LoggerFactory.getLogger(SendMail.class); - - protected PollenContextImplementor context; - - public static final String EXTENSION_MAIL = ".mail"; - public static final String EXTENSION_INDEX = ".index"; - - /** Mail storage directory. */ - protected File mailStorageDirectory; - - protected volatile boolean stop; - - public SendMail(PollenContextImplementor context) { - this.context = context; - if (log.isInfoEnabled()) { - log.info("P:[ SendMail ] init"); - } - // get email directory in configuration - // create it if not exists - String filename = context.getProperty(PollenProperty.EMAIL_DIR); - mailStorageDirectory = new File(filename); - if (!mailStorageDirectory.exists()) { - if (mailStorageDirectory.mkdirs()) { - if (log.isDebugEnabled()) { - log.debug("Email storage directory created in : " + mailStorageDirectory.getAbsolutePath()); - } - } - } - } - - public synchronized void stopExec() { - stop = true; - } - - /* - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - if (log.isInfoEnabled()) { - log.info("P:[ SendMail ] start"); - } - - // try to find existing files - while (!stop) { - try { - sendAllMails(); - - // bloque thread until next notify - sleep(); - } - catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Error during SendMail main loop", ex); - } - } - } - } - - protected synchronized void sleep() throws InterruptedException { - wait(); - } - - public synchronized void wakeUp() { - notifyAll(); - } - - /** - * Look for all xx.index file, and restart mail sending on - * non ending mass mail sending. - * - * After execution, delete mail and index file. - * @throws IOException - */ - protected void sendAllMails() throws IOException { - - // don't do for, allways take the first found - // a new one can be created when managing one other - List<File> indexFiles = null; - do { - - // filter is java valid : .*\\.index - indexFiles = FileUtil.find(mailStorageDirectory, ".*\\" + EXTENSION_INDEX, false); - - if (!indexFiles.isEmpty()) { - File indexFile = indexFiles.get(0); - // convert index content to int - String indexContent = FileUtils.readFileToString(indexFile, "UTF-8"); - int index = Integer.parseInt(indexContent); - - // get mail content file - File mailFile = new File(indexFile.getAbsolutePath().replaceAll(EXTENSION_INDEX + "$", EXTENSION_MAIL)); - - if (log.isDebugEnabled()) { - log.debug("Managing mail file : " + mailFile + " (from index " + indexContent + ")"); - } - - Reader indexFileReader = new BufferedReader(new FileReader(mailFile)); - CSVReader cvsReader = new CSVReader(indexFileReader); - - int currentIndex = 0; - String[] currentLine = cvsReader.readNext(); - while (currentLine != null) { - String receiver = currentLine[0]; - String subject = currentLine[1]; - String body = currentLine[2]; - - // index contains next index to treat so == is ok - if (currentIndex >= index) { - String host = - context.getProperty(PollenProperty.EMAIL_HOST); - int port = Integer.parseInt( - context.getProperty(PollenProperty.EMAIL_PORT)); - String from = - context.getProperty(PollenProperty.EMAIL_FROM); - MailUtil.sendMail(host, port, from, - receiver, subject, body); - - // index contains next index to treat - FileUtils.writeStringToFile(indexFile, String.valueOf(currentIndex + 1)); - - // wait 2 secondes between each mail to not - // load smtp server - try { - Thread.sleep(1000); - } catch (InterruptedException ex) { - if (log.isErrorEnabled()) { - log.error("Can't wait between mail", ex); - } - } - } - else { - if (log.isDebugEnabled()) { - log.debug("Mail to " + receiver + " already sent in a previous execution, skip."); - } - } - - currentIndex++; - currentLine = cvsReader.readNext(); - } - - // delete woth index and mail file - mailFile.delete(); - indexFile.delete(); - } - else { - if (log.isInfoEnabled()) { - log.info("No more index mail index file found, go to sleep a while :)"); - } - } - } while (!indexFiles.isEmpty()); - } - - /** - * Prepare mail list. - * - * TODO : improve configuration reading - * - * @param id - * @param mailData - * @throws IOException - */ - public void prepareMails(String id, List<Map<String, String>> mailData) throws IOException { - - Writer fileWriter = null; - CSVWriter cvsWriter = null; - try { - - // write CSV datas - File emailFile = new File(mailStorageDirectory, id + EXTENSION_MAIL); - fileWriter = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(emailFile))); - cvsWriter = new CSVWriter(fileWriter); - - for (Map<String, String> singleMailData : mailData) { - String[] nextLine = new String[] { - singleMailData.get("receiver"), - singleMailData.get("subject"), - singleMailData.get("body") - }; - cvsWriter.writeNext(nextLine); - } - - // write index (default to 0) - File indexFile = new File(mailStorageDirectory, id + EXTENSION_INDEX); - FileUtil.writeString(indexFile, "0"); - } - finally { - if (cvsWriter != null) { - cvsWriter.close(); - } - IOUtils.closeQuietly(fileWriter); - } - - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuth.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,47 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.chorem.pollen.business.dto.UserDTO; - -/** - * Interface du service d'authentification. - * - * @author kmorin - * @version $Id$ - */ -public interface ServiceAuth { - - /** - * Identification d'un utilisateur. Vérification du couple login, password. - * - * @param login le login de l'utilisateur à identifié - * @param password le password entré par l'utilisateur - * @return vrai si l'utilisateur est identifié, false sinon - */ - public boolean isLoginRight(String login, String password); - - /** - * Identification d'un utilisateur. Récupération des informations de cet - * utilisateur. - * - * @param login le login de l'utilisateur à identifié - * @param password le password entré par l'utilisateur - * @return l'utilisateur identifié par le login - */ - public UserDTO getUser(String login, String password); -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceAuthImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,111 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataUserConverter; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.nuiton.topia.TopiaContext; - -/** - * Implémentation du service d'authentification. - * - * @author kmorin - * @author rannou - * @version $Id$ - */ -public class ServiceAuthImpl implements ServiceAuth { - - private PollenContextImplementor context; - private UserAccountDAO userDAO = null; - private DataUserConverter converter = new DataUserConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceAuthImpl.class); - - public ServiceAuthImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public boolean isLoginRight(String login, String password) { - TopiaContext transaction = null; - boolean result = false; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByLogin(login); - if (userEntity != null && password.equals(userEntity.getPassword())) { - result = true; - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((userEntity == null) ? "null" : userEntity - .getLogin())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public UserDTO getUser(String login, String password) { - TopiaContext transaction = null; - UserDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByLogin(login); - if (userEntity != null && password.equals(userEntity.getPassword())) { - result = converter.createUserDTO(userEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getLogin())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoice.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoice.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoice.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,94 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.nuiton.topia.TopiaContext; - -/** - * Interface de gestion des choix - * - * @author enema - * @version $Id$ - */ -public interface ServiceChoice { - - /** - * Création d'un choix - * - * @param choice le dto choix - * @return l'identifiant du choix - * @deprecated only used for tests or internal - */ - @Deprecated - public String createChoice(ChoiceDTO choice); - - /** - * Mise à jour d'un choix pour un sondage - * - * @param choiceDTO - * @return true si le choix a été mise à jours - * @deprecated only used for tests or internal - */ - @Deprecated - public boolean updateChoice(ChoiceDTO choiceDTO); - - /** - * Suppression d'un choix de sondage - * - * @param choiceId l'identifiant du choix - * @return true si le choix a été mis à jours - * @deprecated use {@link org.chorem.pollen.business.services.ServicePoll#deleteChoice(org.chorem.pollen.business.dto.PollDTO, java.lang.String) } - */ - @Deprecated - public boolean deleteChoice(String choiceId); - - /** - * Recherche d'un choix par son identifiant - * - * @param choiceId l'identifiant du choix - * @return le choix - * @deprecated only used for tests or internal - */ - @Deprecated - public ChoiceDTO findChoiceById(String choiceId); - - /** - * Recherche de choix d'un sondage à partir du nom - * - * @param choiceName le nom du choix - * @param pollId l'identifiant du sondage - * @return les choix - * @deprecated never used - */ - @Deprecated - public List<ChoiceDTO> findChoicesByName(String choiceName, String pollId); - - /** - * Recherche de tous les choix d'un sondage - * - * @param properties filtre sur les champs de la table choix - * @return les choix du sondage - * @deprecated only used for tests - */ - @Deprecated - public List<ChoiceDTO> selectChoices(Map<String, Object> properties); -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceChoiceImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,273 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContextImpl; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataChoiceConverter; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.utils.ContextUtil; -import org.nuiton.topia.TopiaContext; - -/** - * Gestion des choix d'un sondage. - * - * @author enema - * @version $Id$ - */ -public class ServiceChoiceImpl implements ServiceChoice { - - private PollenContextImplementor context; - private ChoiceDAO choiceDAO = null; - private DataChoiceConverter converter = new DataChoiceConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceChoiceImpl.class); - - public ServiceChoiceImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public String createChoice(ChoiceDTO choice) { - TopiaContext transaction = null; - String topiaId = ""; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - Choice choiceEntity = choiceDAO.create(); - converter.setTransaction(transaction); - converter.populateChoiceEntity(choice, choiceEntity); - - topiaId = choiceEntity.getTopiaId(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return ""; - } finally { - ContextUtil.doFinally(transaction); - } - } - -// @Override -// public List<Choice> createChoices(List<ChoiceDTO> choices, String pollId, -// TopiaContext transaction) { -// if (choices.isEmpty() || pollId.length() == 0) { -// return null; -// } -// -// List<Choice> result = null; -// try { -// choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); -// converter.setTransaction(transaction); -// -// result = new ArrayList<Choice>(); -// for (ChoiceDTO choice : choices) { -// Choice choiceEntity = choiceDAO.create(); -// choice.setId(choiceEntity.getTopiaId()); -// //choice.setPollUId(pollId); -// converter.populateChoiceEntity(choice, choiceEntity); -// result.add(choiceEntity); -// } -// -// return result; -// } catch (Exception e) { -// ContextUtil.doCatch(e, transaction); -// return null; -// } -// } - - @Override - public boolean updateChoice(ChoiceDTO choiceDTO) { - TopiaContext transaction = null; - boolean resu = false; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - Choice choiceEntity = choiceDAO.findByTopiaId(choiceDTO.getId()); - if (choiceEntity != null) { - converter.setTransaction(transaction); - converter.populateChoiceEntity(choiceDTO, choiceEntity); - - choiceDAO.update(choiceEntity); - transaction.commitTransaction(); - resu = true; - } - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + choiceDTO.getId()); - } - - return resu; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deleteChoice(String choiceId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - Choice choiceEntity = choiceDAO.findByTopiaId(choiceId); - - choiceDAO.delete(choiceEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + choiceId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public ChoiceDTO findChoiceById(String choiceId) { - TopiaContext transaction = null; - ChoiceDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - Choice choiceEntity = choiceDAO.findByTopiaId(choiceId); - - if (choiceEntity != null) { - converter.setTransaction(transaction); - result = converter.createChoiceDTO(choiceEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<ChoiceDTO> findChoicesByName(String choiceName, String pollId) { - TopiaContext transaction = null; - List<ChoiceDTO> results = null; - List<Choice> choiceEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - HashMap<String, Object> properties = new HashMap<String, Object>(); - properties.put("pollId", pollId); - properties.put("name", choiceName); - - choiceEntities = choiceDAO.findAllByProperties(properties); - - converter.setTransaction(transaction); - results = converter.createChoiceDTOs(choiceEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<ChoiceDTO> selectChoices(Map<String, Object> properties) { - TopiaContext transaction = null; - List<ChoiceDTO> results = null; - List<Choice> choiceEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - if (properties == null) { - choiceEntities = choiceDAO.findAll(); - if (log.isWarnEnabled()) { - log - .warn("Attention : tous les choix ont été sélectionnés !"); - } - } else { - choiceEntities = choiceDAO.findAllByProperties(properties); - } - converter.setTransaction(transaction); - results = converter.createChoiceDTOs(choiceEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceList.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceList.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceList.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,111 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.PersonListDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.VotingList; -import org.nuiton.topia.TopiaContext; - -/** - * Interface du service de gestion des listes de votants et des listes de - * favoris. - * - * @author enema - * @version $Id$ - */ -public interface ServiceList { - - /** - * Création d'une liste de votant - * - * @param votingList la liste - * @return identifiant de la liste créée - * @deprecated useless method : used only in tests - */ - @Deprecated - public String createVotingList(VotingListDTO votingList); - - /** - * Mise à jour d'une liste de votant - * - * @param votingList la liste - * @return true si la liste a été mise à jours - */ - public boolean updateVotingList(VotingListDTO votingList); - - /** - * Création d'une liste de favoris - * - * @param personList la liste - * @return identifiant de la liste créée - */ - public String createPersonList(PersonListDTO personList); - - /** - * Create an {@code account} in a {@code personList}. - * - * @param personList where the account will be added - * @param account to create - */ - void createAccountInPersonList(PersonListDTO personList, - PollAccountDTO account); - - /** - * Delete an account using its {@code accountId} from a {@code personList}. - * - * @param personList where the account will be removed - * @param accountId topiaId of the account to delete - */ - void deleteAccountFromPersonList(PersonListDTO personList, String accountId); - - /** - * Suppression d'une liste de favoris - * - * @param personListId l'identifiant de la liste - * @return true si la liste a été supprimée - */ - public boolean deletePersonList(String personListId); - - /** - * Suppression des listes de favoris d'un utilisateur - * - * @param userId l'identifiant de l'utilisateur - * @return true si les listes ont été supprimées - */ - public boolean deletePersonLists(String userId); - - /** - * Recherche d'une liste par son identifiant - * - * @param personListId l'identifiant de la liste - * @return la liste - */ - public PersonListDTO findPersonListById(String personListId); - - /** - * Recherche des listes de favoris d'un utilisateur. - * - * @param userId Le créateur de la liste - * @return les listes - */ - public List<PersonListDTO> findPersonListByUser(String userId); -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceListImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,385 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataPersonListConverter; -import org.chorem.pollen.business.converters.DataVotingListConverter; -import org.chorem.pollen.business.dto.PersonListDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.business.persistence.PersonListDAO; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.persistence.VotingListDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.nuiton.topia.TopiaContext; -import static org.nuiton.i18n.I18n.n_; - -/** - * Implémentation du service de gestion des listes. - * - * @author enema - * @author rannou - * @version $Id$ - */ -public class ServiceListImpl implements ServiceList { - - private PollenContextImplementor context; - private VotingListDAO votingListDAO = null; - private PersonListDAO personListDAO = null; - private DataVotingListConverter votingListConverter = new DataVotingListConverter(); - private DataPersonListConverter personListConverter = new DataPersonListConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceListImpl.class); - - public ServiceListImpl(PollenContextImplementor context) { - this.context = context; - - this.context.getConverter().preparePollAccountConverters(); - this.context.getConverter().prepareVotingListConverters(); - } - - @Override - public String createVotingList(VotingListDTO votingList) { - TopiaContext transaction = null; - String topiaId = ""; - try { - transaction = context.getRootContext().beginTransaction(); - - votingListDAO = PollenModelDAOHelper.getVotingListDAO(transaction); - - VotingList votingListEntity = votingListDAO.create(); - - votingListConverter.setTransaction(transaction); - votingListConverter.populateVotingListEntity(votingList, - votingListEntity); - - // Création des pollAccount de la liste si nécessaire - // FIXME do not call a Service from an other one - ServicePollAccount spa = new ServicePollAccountImpl(context); - //spa.createPollAccounts(votingList.getPollAccountDTOs(), transaction); - for (PollAccountDTO account : votingList.getPollAccountDTOs()) { - if (spa.findPollAccountById(account.getId()) == null) { - account.setId(spa.createPollAccount(account)); - } - } - - // Création des PersonToList - votingListConverter.populatePersonVotingList(votingList, - votingListEntity); - - topiaId = votingListEntity.getTopiaId(); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return ""; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean updateVotingList(VotingListDTO votingList) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - votingListDAO = PollenModelDAOHelper.getVotingListDAO(transaction); - - VotingList entity = votingListDAO.findByTopiaId(votingList.getId()); - - votingListConverter.setTransaction(transaction); - votingListConverter.populateVotingListEntity(votingList, entity); - - votingListDAO.update(entity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + votingList.getId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public String createPersonList(PersonListDTO personList) { - TopiaContext transaction = null; - String topiaId = ""; - try { - transaction = context.getRootContext().beginTransaction(); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - PersonList entity = personListDAO.create(); - - personListConverter.setTransaction(transaction); - personListConverter.populatePersonListEntity(personList, entity); - - // Création des comptes de la liste - // FIXME do not call a Service from an other one - ServicePollAccount spa = new ServicePollAccountImpl(context); - for (PollAccountDTO account : personList.getPollAccounts()) { - account.setPersonListId(entity.getTopiaId()); - } - entity.setPollAccount(spa.createPollAccounts(personList - .getPollAccounts(), transaction)); - - topiaId = entity.getTopiaId(); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return ""; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public void createAccountInPersonList(PersonListDTO personList, PollAccountDTO account) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - - PersonList eList = personListDAO.findByTopiaId(personList.getId()); - - PollAccountDAO accountDAO = - PollenModelDAOHelper.getPollAccountDAO(transaction); - - // Create new pollAccount - String accountUID = context.createPollenUrlId(); - PollAccount eAccount = accountDAO.create(accountUID); - context.getConverter().convert(account, eAccount); - - // Add the account into the list - eList.addPollAccount(eAccount); - - transaction.commitTransaction(); - - // Update change in dtos - account.setId(eAccount.getTopiaId()); - account.setAccountUId(eAccount.getAccountId()); - personList.addPollAccount(account); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.serviceList.createAccountForPersonList"), - personList.getName(), account.getVotingId()); - } finally { - context.doFinally(transaction); - } - } - - @Override - public void deleteAccountFromPersonList(PersonListDTO personList, String accountId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - // Find the account - PollAccountDAO accountDAO = - PollenModelDAOHelper.getPollAccountDAO(transaction); - PollAccount eAccount = accountDAO.findByTopiaId(accountId); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - - PersonList eList = personListDAO.findByTopiaId(personList.getId()); - - // The remove will delete the comment because no poll will be - // attached to him (delete-orphan) - eList.removePollAccount(eAccount); - - accountDAO.delete(eAccount); - - transaction.commitTransaction(); - - // Update change in dto - personList.removePollAccount(accountId); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.serviceList.deleteAccountFromPersonList"), - accountId, personList.getName(), personList.getId()); - } finally { - context.doFinally(transaction); - } - } - - @Override - public boolean deletePersonList(String personListId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - - PersonList entity = personListDAO.findByTopiaId(personListId); - - personListDAO.delete(entity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + personListId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deletePersonLists(String userId) { - TopiaContext transaction = null; - List<PersonList> personListEntities = null; - UserAccountDAO userDAO = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - UserAccount user = userDAO.findByTopiaId(userId); - - personListEntities = new ArrayList<PersonList>(); - personListEntities.addAll(user.getFavoriteList()); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - - for (PersonList entity : personListEntities) { - personListDAO.delete(entity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug(personListEntities.size() - + " entities deleted for user: " + userId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public PersonListDTO findPersonListById(String personListId) { - TopiaContext transaction = null; - PersonListDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - personListDAO = PollenModelDAOHelper.getPersonListDAO(transaction); - - PersonList personListEntity = personListDAO - .findByTopiaId(personListId); - - if (personListEntity != null) { - personListConverter.setTransaction(transaction); - result = personListConverter - .createPersonListDTO(personListEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<PersonListDTO> findPersonListByUser(String userId) { - TopiaContext transaction = null; - List<PersonListDTO> results = null; - List<PersonList> personListEntities = null; - UserAccountDAO userDAO = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - UserAccount user = userDAO.findByTopiaId(userId); - - personListEntities = new ArrayList<PersonList>(); - personListEntities.addAll(user.getFavoriteList()); - - personListConverter.setTransaction(transaction); - results = personListConverter - .createPersonListDTOs(personListEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,164 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.CommentDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; - -/** - * Interface du service de gestion des sondages. - * - * @author enema - * @version $Id$ - */ -public interface ServicePoll { - - /** - * Création d'un sondage - * - * @param poll le sondage - * @return identifiant du sondage créé - */ - public String createPoll(PollDTO poll); - - /** - * Mise à jour du sondage - * - * @param poll le sondage - * @return true si le sondage a été mise à jour - */ - public boolean updatePoll(PollDTO poll); - - /** - * Suppression du sondage - * - * @param pollId le sondage - * @return true si le sondage a été supprimé - */ - public boolean deletePoll(String pollId); - - /** - * Get a new poll for creation form. - * - * @return a new PollDTO with params initialized - */ - public PollDTO getNewPoll(); - - /** - * Get a new poll which is a copy from the {@code poll}. - * - * @param poll to copy - * @return a new poll which is a copy from the one in argument - */ - public PollDTO getNewPoll(PollDTO poll); - - /** - * Récupération d'un sondage à partir de son identifiant. - * - * @param pollId identifiant du sondage (différent du topiaId) - * @return le sondage - */ - public PollDTO getPoll(String pollId); - - /** - * Récupération des sondages d'un utilisateur - * - * @param userId Le créateur du sondage - * @return liste de sondages - */ - public List<PollDTO> findPollsByUser(String userId); - - /** - * Récupération des sondages auxquels un utilisateur a participé. - * - * @param userId L'identifiant de l'utilisateur - * @return liste de sondages - */ - public List<PollDTO> findParticipatedPolls(String userId); - - /** - * Récupération des sondages auxquels un utilisateur est invité. - * - * @param userId L'identifiant de l'utilisateur - * @return liste de sondages - */ - public List<PollDTO> findInvitedPolls(String userId); - - /** - * Récupération des sondages en cours. - * - * @param withEndDate sélectionner uniquement les sondages ayant une date de - * fin - * @return liste de sondages - */ - public List<PollDTO> findRunningPolls(boolean withEndDate); - - /** - * Récupération des sondages - * - * @param properties filtre - * @return liste de sondages - */ - public List<PollDTO> selectPolls(Map<String, Object> properties); - - /** - * Create a comment for the poll. - * - * @param poll owner of the comment - * @param comment to create - */ - public void createComment(PollDTO poll, CommentDTO comment); - - /** - * Delete a comment from a {@code poll}. - * - * @param poll owner of the comment - * @param commentId id of the comment to delete - */ - public void deleteComment(PollDTO poll, String commentId); - - /** - * Retrieve all comments for the {@code poll} - * - * @param poll owner of the comment - * @return the list of comments of the poll - */ - public List<CommentDTO> getComments(PollDTO poll); - - - /** - * Return the pollAccount corresponding to the {@code accountUId} for the - * restricted {@code poll}. - * TODO : need JUnit test, must be done for 1.3 - * - * @param accountUId to check the restriction constraint - * @param poll reference - * @return the pollAccount found from poll or null if there is no - * pollAccount in poll restriction for the accountUId in argument - */ - public PollAccountDTO getRestrictedAccount(String accountUId, PollDTO poll); - - public ChoiceDTO getNewHiddenChoice(ChoiceDTO choice, String votingId); - - public void createChoice(PollDTO poll, ChoiceDTO choice); - - public void deleteChoice(PollDTO poll, String choiceId); -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccount.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccount.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccount.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,89 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; - -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.persistence.PollAccount; -import org.nuiton.topia.TopiaContext; - -/** - * Interface du service de gestion des comptes. - * - * @author kmorin - * @version $Id$ - */ -public interface ServicePollAccount { - - /** - * Creation d'un compte utilisateur. - * - * @param pollAccount le compte à creer - * @return le topiaId du compte créé - * @deprecated useless method : not used in UI - */ - @Deprecated - public String createPollAccount(PollAccountDTO pollAccount); - - /** - * Creation des comptes utilisateur. - * - * @param pollAccounts les comptes à creer - * @param transaction la transaction - * @return les comptes créés - * @deprecated useless method : not used in UI - */ - @Deprecated - public List<PollAccount> createPollAccounts( - List<PollAccountDTO> pollAccounts, TopiaContext transaction); - - /** - * Suppression d'un compte. - * - * @param pollAccountId le compte a creer - * @return true si le compte a été supprimer - * @deprecated never used - */ - @Deprecated - public boolean deletePollAccount(String pollAccountId); - - /** - * Modification d'un compte. - * - * @param pollAccount le compte a modifier - * @return true si le compte à été modifier - */ - public boolean updatePollAccount(PollAccountDTO pollAccount); - - /** - * Récupération du compte à partir de son identifiant ToPIA. - * - * @param pollAccountId l'identifiant Topia du compte à rechercher - * @return un compte - */ - public PollAccountDTO findPollAccountById(String pollAccountId); - - /** - * Récupération du compte à partir de son identifiant. - * - * @param pollAccountId l'identifiant du compte à rechercher - * @return un compte - */ - public PollAccountDTO findPollAccountByAccountId(String pollAccountId); -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollAccountImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,250 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataPollAccountConverter; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.utils.ContextUtil; -import org.nuiton.topia.TopiaContext; - -/** - * Implémentation du service de gestion des comptes. - * - * @author kmorin - * @author rannou - * @version $Id$ - */ -public class ServicePollAccountImpl implements ServicePollAccount { - - private PollenContextImplementor context; - private PollAccountDAO pollAccountDAO = null; - private DataPollAccountConverter converter = new DataPollAccountConverter(); - - /** log. */ - private static final Log log = LogFactory - .getLog(ServicePollAccountImpl.class); - - public ServicePollAccountImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public String createPollAccount(PollAccountDTO pollAccountDTO) { - TopiaContext transaction = null; - String topiaId; - try { - transaction = context.getRootContext().beginTransaction(); - - pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(transaction); - - // Identifiant du compte - String id = ContextUtil.createPollenUrlId(); - PollAccount pollAccountEntity = pollAccountDAO.create(id); - - converter.setTransaction(transaction); - converter.populatePollAccountEntity(pollAccountDTO, - pollAccountEntity); - - topiaId = pollAccountEntity.getTopiaId(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<PollAccount> createPollAccounts( - List<PollAccountDTO> pollAccounts, TopiaContext transaction) { - if (pollAccounts.isEmpty()) { - return null; - } - - List<PollAccount> result = null; - try { - pollAccountDAO = PollenModelDAOHelper.getPollAccountDAO(transaction); - - converter.setTransaction(transaction); - - result = new ArrayList<PollAccount>(); - for (PollAccountDTO pollAccount : pollAccounts) { - PollAccount entity = pollAccountDAO.create(); - - // Identifiants du compte - String id = UUID.randomUUID().toString(); - pollAccount.setAccountUId(id.replaceAll("-", "")); - pollAccount.setId(entity.getTopiaId()); - - converter.populatePollAccountEntity(pollAccount, entity); - result.add(entity); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } - } - - @Override - public boolean deletePollAccount(String pollAccountId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(transaction); - PollAccount pollAccountEntity = pollAccountDAO - .findByTopiaId(pollAccountId); - pollAccountDAO.delete(pollAccountEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + pollAccountId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean updatePollAccount(PollAccountDTO pollAccountDTO) { - TopiaContext transaction = null; - boolean resu = false; - try { - transaction = context.getRootContext().beginTransaction(); - - pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(transaction); - PollAccount pollAccountEntity = pollAccountDAO - .findByTopiaId(pollAccountDTO.getId()); - - if (pollAccountEntity != null) { - converter.setTransaction(transaction); - converter.populatePollAccountEntity(pollAccountDTO, - pollAccountEntity); - - pollAccountDAO.update(pollAccountEntity); - transaction.commitTransaction(); - resu = true; - } - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + pollAccountDTO.getId()); - } - - return resu; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public PollAccountDTO findPollAccountById(String pollAccountId) { - TopiaContext transaction = null; - PollAccountDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(transaction); - - PollAccount pollAccountEntity = pollAccountDAO - .findByTopiaId(pollAccountId); - - if (pollAccountEntity != null) { - converter.setTransaction(transaction); - result = converter.createPollAccountDTO(pollAccountEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public PollAccountDTO findPollAccountByAccountId(String pollAccountId) { - TopiaContext transaction = null; - PollAccountDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - pollAccountDAO = PollenModelDAOHelper - .getPollAccountDAO(transaction); - - PollAccount pollAccountEntity = pollAccountDAO - .findByAccountId(pollAccountId); - - if (pollAccountEntity != null) { - converter.setTransaction(transaction); - result = converter.createPollAccountDTO(pollAccountEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,885 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.converters.DataPollConverter; -import org.chorem.pollen.business.converters.DataVotingListConverter; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.CommentDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.Comment; -import org.chorem.pollen.business.persistence.CommentDAO; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.PreventRule; -import org.chorem.pollen.business.persistence.PreventRuleDAO; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.persistence.VotingListDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.persistence.PersonToListDAO; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.votecounting.business.NumberMethod; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaQuery; -import org.nuiton.topia.framework.TopiaQuery.Op; -import static org.nuiton.i18n.I18n._; -import static org.nuiton.i18n.I18n.n_; - -/** - * Implémentation du service de gestion des sondages. - * - * @author Erwan Nema - * @author rannou - * @version $Id$ - */ -public class ServicePollImpl implements ServicePoll { - - private PollenContextImplementor context; - private PollDAO pollDAO = null; - private DataPollConverter converter = new DataPollConverter(); - /** log. */ - private static final Log log = LogFactory.getLog(ServicePollImpl.class); - - public ServicePollImpl(PollenContextImplementor context) { - this.context = context; - - this.context.getConverter().preparePollConverters(); - this.context.getConverter().prepareChoiceConverters(); - this.context.getConverter().prepareVotingListConverters(); - this.context.getConverter().preparePollAccountConverters(); - this.context.getConverter().preparePreventRuleConverters(); - this.context.getConverter().prepareVoteConverters(); - this.context.getConverter().prepareCommentConverters(); - } - - @Override - public String createPoll(PollDTO pollDTO) { - TopiaContext transaction = null; - String result = null; - try { - - if (log.isInfoEnabled()) { - log.info("P:[ createPoll ] : " + pollDTO); - } - - transaction = context.getRootContext().beginTransaction(); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - - // Create with the pollId from dto - String pollId = pollDTO.getPollUId(); - Poll entity = pollDAO.create(pollId); - context.getConverter().convert(pollDTO, entity); - - // ** Manage the poll creator - PollAccount creator = prepareCreator(transaction, pollDTO); - entity.setCreator(creator); - - // ** Create new choices - ChoiceDAO choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - for (ChoiceDTO choiceDTO : pollDTO.getChoices()) { - Choice choice = - context.getConverter().convert(choiceDTO, choiceDAO.create()); - choice.setPoll(entity); - } - - // ** Create new votingLists - for (VotingListDTO listDTO : pollDTO.getVotingListDTOs()) { - VotingList votingList = createVotingList(transaction, listDTO); - votingList.setPoll(entity); - } - - // ** Create new preventRules - PreventRuleDAO ruleDAO = - PollenModelDAOHelper.getPreventRuleDAO(transaction); - for (PreventRuleDTO ruleDTO : pollDTO.getPreventRuleDTOs()) { - PreventRule rule = - context.getConverter().convert(ruleDTO, ruleDAO.create()); - rule.setPoll(entity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + entity); - } - - result = entity.getTopiaId(); - - // Update dto : need creator and id update - // WARN : Update for choices, preventRules and - // votingLists is not needed in this case - context.getConverter().convert(entity, pollDTO); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.createPoll"), - pollDTO.getTitle(), pollDTO.getCreatorId()); - } finally { - context.doFinally(transaction); - } - return result; - } - - /** - * Prepare pollAccount as creator for {@code poll} save. If userId is - * defined, the pollAccount will be searched in database testing all fields - * (user, creatorName as votingId and email). If no result is found or no - * userId, a new pollAccount is created. - * - * @param transaction current TopiaContext - * @param poll PollDTO which contains creator data (userId, creatorId, - * creatorEmail) - * @return the PollAccount used as creator for this poll - * @throws TopiaException - */ - private final PollAccount prepareCreator(TopiaContext transaction, - PollDTO poll) throws TopiaException { - - // Search user from database - UserAccount user = PollenModelDAOHelper.getUserAccountDAO(transaction). - findByTopiaId(poll.getUserId()); - - // Prepare properties for find or create - Map<String, Object> accountProperties = new HashMap<String, Object>(); - accountProperties.put(PollAccount.USER_ACCOUNT, user); - accountProperties.put(PollAccount.VOTING_ID, poll.getCreatorName()); - accountProperties.put(PollAccount.EMAIL, poll.getCreatorEmail()); - - PollAccountDAO accountDAO = - PollenModelDAOHelper.getPollAccountDAO(transaction); - - PollAccount creator = null; - // Get existing account (profile) for user - if (user != null) { - creator = accountDAO.findByProperties(accountProperties); - } - // Create new account if account properties changed or no user found - if (creator == null) { - accountProperties.put( - PollAccount.ACCOUNT_ID, context.createPollenUrlId()); - creator = accountDAO.create(accountProperties); - } - return creator; - } - - /** - * Create a new votingList from a VotingListDTO. Used when poll is created. - * Each pollAccount of the list will be created unless it already exists - * in database (Don't know if needed because pollAccounts can't be loaded - * in a new poll creation). - * - * @param transaction current TopiaContext - * @param listDTO VotingListDTO source - * @return VotingList entity created - * @throws TopiaException - */ - private final VotingList createVotingList(TopiaContext transaction, - VotingListDTO listDTO) throws TopiaException { - - VotingListDAO dao = PollenModelDAOHelper.getVotingListDAO(transaction); - VotingList votingList = - context.getConverter().convert(listDTO, dao.create()); - - PollAccountDAO pollAccountDAO = - PollenModelDAOHelper.getPollAccountDAO(transaction); - - for (PollAccountDTO accountDTO : listDTO.getPollAccountDTOs()) { - double weight = accountDTO.getWeight(); - PollAccount account = - pollAccountDAO.findByTopiaId(accountDTO.getId()); - - // Create a new PollAccount if not already exists - if (account == null) { - String accountId = context.createPollenUrlId(); - account = pollAccountDAO.create(accountId); - context.getConverter().convert(accountDTO, account); - } - - // Create association between VotingList and PollAccount - PollenModelDAOHelper.getPersonToListDAO(transaction).create( - PersonToList.POLL_ACCOUNT, account, - PersonToList.VOTING_LIST, votingList, - PersonToList.WEIGHT, weight); - } - - return votingList; - } - - @Override - public boolean updatePoll(PollDTO pollDTO) { - TopiaContext transaction = null; - try { - - if (log.isInfoEnabled()) { - log.info("P:[ updatePoll ] : " + pollDTO); - } - - transaction = context.getRootContext().beginTransaction(); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - - Poll pollEntity = pollDAO.findByTopiaId(pollDTO.getId()); - - context.getConverter().convert(pollDTO, pollEntity); - - ChoiceDAO choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - // ** Update choices (no add, no remove) - for (ChoiceDTO choiceDTO : pollDTO.getChoices()) { - Choice choice = choiceDAO.findByTopiaId(choiceDTO.getId()); - context.getConverter().convert(choiceDTO, choice); - choice.update(); - } - - // Les règles de notifications restent mystérieuses - // Y a t-il un besoin de suppression ? - converter.persistPreventRules(pollDTO, pollEntity, context); - - pollDAO.update(pollEntity); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + pollDTO.getId()); - } - - return true; - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.updatePoll"), - pollDTO.getTitle(), pollDTO.getPollUId()); - return false; - } finally { - context.doFinally(transaction); - } - } - - @Override - public PollDTO getNewPoll() { - PollDTO newPoll = new PollDTO(); - newPoll.setVoteCounting(VoteCountingType.NORMAL); - newPoll.setPollType(PollType.FREE); - newPoll.setPollUId(context.createPollenUrlId()); - return newPoll; - } - - @Override - public PollDTO getNewPoll(PollDTO poll) { - PollDTO newPoll = new PollDTO(); - return newPoll; - } - - @Override - public boolean deletePoll(String pollId) { - TopiaContext transaction = null; - try { - - if (log.isInfoEnabled()) { - log.info("P:[ deletePoll ] : pollId = " + pollId); - } - - transaction = context.getRootContext().beginTransaction(); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - - Poll pollEntity = pollDAO.findByTopiaId(pollId); - - pollDAO.delete(pollEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + pollId); - } - - return true; - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.deletePoll"), pollId); - return false; - } finally { - context.doFinally(transaction); - } - } - - @Override - public PollDTO getPoll(String pollId) { - TopiaContext transaction = null; - PollDTO result = null; - try { - if (log.isInfoEnabled()) { - log.info("P:[ getPoll ] : pollUId = " + pollId); - } - - transaction = context.getRootContext().beginTransaction(); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - - Poll pollEntity = pollDAO.findByPollId(pollId); - - if (pollEntity != null) { - result = context.getConverter().convert(pollEntity, new PollDTO()); - - // Load choices - for (Choice choice : pollEntity.getChoice()) { - ChoiceDTO dto = - context.getConverter().convert(choice, new ChoiceDTO()); - result.addChoice(dto); - } - - -// List<Long> tmp = transaction.find( -// "SELECT COUNT(*)" + -// " FROM " + Vote.class.getName() + -// " WHERE poll.pollId = :pollUId", -// "pollUId", pollId); -// int count = tmp.get(0).intValue(); - -// VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); -// int count = voteDAO.createQuery().add(Poll.POLL_ID, pollId).executeCount(); - - // Need the number total of votes to push in the dto - int count = new TopiaQuery(Vote.class). - add(Vote.POLL + "." + Poll.POLL_ID, pollId). - executeCount(transaction); - - result.setNbVotes(count); - - // Load votes -// for (Vote vote : pollEntity.getVote()) { -// VoteDTO dto = -// context.getConverter().convert(vote, new VoteDTO()); -// result.addVote(dto); -// } - - // Load comments -// for (Comment comment : pollEntity.getComment()) { -// CommentDTO dto = -// context.getConverter().convert(comment, new CommentDTO()); -// result.addComment(dto); -// } - - // Load preventRules - for (PreventRule rule : pollEntity.getPreventRule()) { - PreventRuleDTO dto = - context.getConverter().convert(rule, new PreventRuleDTO()); - result.addPreventRule(dto); - } - - // TODO Refactor this - if (pollEntity.getVotingList().size() > 0) { - DataVotingListConverter votingListConverter = new DataVotingListConverter(); - result.setVotingListDTOs(votingListConverter.createVotingListDTOs(pollEntity.getVotingList())); - } - } - - //transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.getPoll"), pollId); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<PollDTO> findPollsByUser(String userId) { - TopiaContext transaction = null; - List<PollDTO> results = null; - UserAccountDAO userDAO = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - UserAccount user = userDAO.findByTopiaId(userId); - - List<Poll> pollEntities = new ArrayList<Poll>(); - for (PollAccount pollAccount : user.getPollAccount()) { - pollEntities.addAll(pollAccount.getPollsCreated()); - } - - converter.setTransaction(transaction); - results = converter.createPollDTOs(pollEntities, - context.getConverter()); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<PollDTO> findParticipatedPolls(String userId) { - TopiaContext transaction = null; - List<PollDTO> results = null; - UserAccountDAO userDAO = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - UserAccount user = userDAO.findByTopiaId(userId); - - Set<Poll> pollEntities = new HashSet<Poll>(); - for (PollAccount pollAccount : user.getPollAccount()) { - for (Vote vote : pollAccount.getVote()) { - pollEntities.add(vote.getPoll()); - } - } - - converter.setTransaction(transaction); - results = converter.createPollDTOs( - new ArrayList<Poll>(pollEntities), context.getConverter()); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<PollDTO> findInvitedPolls(String userId) { - TopiaContext transaction = null; - List<PollDTO> results = null; - UserAccountDAO userDAO = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - UserAccount user = userDAO.findByTopiaId(userId); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - List<Poll> polls = pollDAO.findAll(); - - Set<Poll> pollEntities = new HashSet<Poll>(); - for (Poll poll : polls) { - for (VotingList votingList : poll.getVotingList()) { - for (PersonToList personToList : votingList.getPollAccountPersonToList()) { - if (!personToList.getHasVoted()) { - PollAccount pollAccount = personToList.getPollAccount(); - if (pollAccount != null && pollAccount.getEmail() != null && pollAccount.getEmail().equals( - user.getEmail())) { - pollEntities.add(poll); - } - } - } - } - } - - converter.setTransaction(transaction); - results = converter.createPollDTOs( - new ArrayList<Poll>(pollEntities), - context.getConverter()); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<PollDTO> findRunningPolls(boolean withEndDate) { - TopiaContext transaction = null; - List<PollDTO> results = null; - try { - transaction = context.getRootContext().beginTransaction(); - - PollDAO dao = PollenModelDAOHelper.getPollDAO(transaction); - - String beginDate = Poll.BEGIN_DATE; - String endDate = Poll.END_DATE; - Date currentDate = context.getCurrentDate(); - - TopiaQuery query = dao.createQuery(). - addNullOr(beginDate, Op.LT, currentDate); - - if (withEndDate) { - query.add(endDate, Op.GT, currentDate); - } else { - query.addNullOr(endDate, Op.GT, currentDate); - } - - List<Poll> entities = dao.findAllByQuery(query); - - // requête de sélection des sondages -// if (withEndDate) { -// pollEntities = transaction -// .find("from " -// + Poll.class.getName() -// + " as poll where (poll.endDate is not null and poll.endDate > current_timestamp())" -// + " and (poll.beginDate is null or poll.beginDate < current_timestamp())"); -// } else { -// pollEntities = transaction -// .find("from " -// + Poll.class.getName() -// + " as poll where (poll.endDate is null or poll.endDate > current_timestamp())" -// + " and (poll.beginDate is null or poll.beginDate < current_timestamp())"); -// } - - converter.setTransaction(transaction); - results = converter.createPollDTOs(entities, - context.getConverter()); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<PollDTO> selectPolls(Map<String, Object> properties) { - TopiaContext transaction = null; - List<PollDTO> results = null; - List<Poll> pollEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - pollDAO = PollenModelDAOHelper.getPollDAO(transaction); - - if (properties == null) { - pollEntities = pollDAO.findAll(); - if (log.isWarnEnabled()) { - log.warn("Attention : tous les sondages ont été sélectionnés !"); - } - } else { - pollEntities = pollDAO.findAllByProperties(properties); - } - converter.setTransaction(transaction); - results = converter.createPollDTOs(pollEntities, - context.getConverter()); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception eee) { - ContextUtil.doCatch(eee, transaction, - _("pollen.error.servicePoll.getAllPolls")); - return null; - } finally { - context.doFinally(transaction); - } - } - - @Override - public void createComment(PollDTO poll, CommentDTO comment) { - TopiaContext transaction = null; - try { - if (log.isInfoEnabled()) { - log.info("P:[ createComment ] : pollUId = " + poll.getPollUId() + - " _ comment = " + comment); - } - transaction = context.getRootContext().beginTransaction(); - - // Create the new comment - CommentDAO dao = PollenModelDAOHelper.getCommentDAO(transaction); - Comment eComment = - context.getConverter().convert(comment, dao.create()); - - // Get the poll entity corresponding - Poll ePoll = PollenModelDAOHelper.getPollDAO(transaction). - findByTopiaId(poll.getId()); - - // Add the comment into the poll - ePoll.addComment(eComment); - - transaction.commitTransaction(); - - // Update change in dtos - comment.setId(eComment.getTopiaId()); - poll.addComment(comment); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.addComment"), - comment.getAuthor(), poll.getTitle(), poll.getId()); - } finally { - context.doFinally(transaction); - } - } - - @Override - public void deleteComment(PollDTO poll, String commentId) { - TopiaContext transaction = null; - try { - if (log.isInfoEnabled()) { - log.info("P:[ deleteComment ] : pollUId = " + poll.getPollUId() + - " _ commentId = " + commentId); - } - transaction = context.getRootContext().beginTransaction(); - - // Find the comment - CommentDAO dao = PollenModelDAOHelper.getCommentDAO(transaction); - Comment eComment = dao.findByTopiaId(commentId); - - // Get the poll entity corresponding - Poll ePoll = PollenModelDAOHelper.getPollDAO(transaction). - findByTopiaId(poll.getId()); - - // The remove will delete the comment because no poll will be - // attached to him (delete-orphan) - ePoll.removeComment(eComment); - - transaction.commitTransaction(); - - // Update change in dto - poll.removeComment(commentId); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.deleteComment"), commentId, - poll.getTitle(), poll.getId()); - } finally { - context.doFinally(transaction); - } - } - - @Override - public List<CommentDTO> getComments(PollDTO poll) { - TopiaContext transaction = null; - List<CommentDTO> results = new ArrayList<CommentDTO>(); - try { - if (log.isInfoEnabled()) { - log.info("P:[ getComments ] : pollUId = " + poll.getPollUId()); - } - transaction = context.getRootContext().beginTransaction(); - - CommentDAO dao = PollenModelDAOHelper.getCommentDAO(transaction); - TopiaQuery query = dao.createQuery(). - add(Comment.POLL + "." + Poll.POLL_ID, poll.getPollUId()); - - List<Comment> entities = dao.findAllByQuery(query); - - for (Comment entity : entities) { - CommentDTO dto = - context.getConverter().convert(entity, new CommentDTO()); - results.add(dto); - } - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.getComments"), - poll.getTitle(), poll.getId()); - } finally { - context.doFinally(transaction); - } - return results; - } - - @Override - public PollAccountDTO getRestrictedAccount(String accountUId, PollDTO poll) { - TopiaContext transaction = null; - PollAccountDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - if (log.isInfoEnabled()) { - log.info("P:[ getRestrictedAccount ] : accountUId = " + accountUId + - " _ pollUId = " + poll.getPollUId()); - } - - // Use PersonToList association entity to find coherence between - // the poll and votingId -// List<PersonToList> tmp = transaction.find( -// "FROM " + PersonToList.class.getName() + -// " WHERE pollAccount.accountId = :accountUId" + -// " AND votingList.poll.pollId = :pollUId", -// "accountUId", accountUId, -// "pollUId", poll.getPollId()); - - PersonToListDAO dao = - PollenModelDAOHelper.getPersonToListDAO(transaction); - TopiaQuery query = dao.createQuery(). - add(PersonToList.POLL_ACCOUNT + "." + - PollAccount.ACCOUNT_ID, accountUId). - add(PersonToList.VOTING_LIST + "." + - VotingList.POLL + "." + Poll.POLL_ID, poll.getPollUId()); - - PersonToList assoc = dao.findByQuery(query); - - if (assoc != null) { - PollAccount account = assoc.getPollAccount(); - context.getConverter().convert(account, result); - } - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.getRestrictedAccount"), - accountUId, poll.getPollUId()); - } finally { - context.doFinally(transaction); - } - return result; - } - - @Override - public ChoiceDTO getNewHiddenChoice(ChoiceDTO choice, String votingId) { - ChoiceDTO hiddenChoice = new ChoiceDTO(); - hiddenChoice.setName(NumberMethod.HIDDEN_PREFIX + - choice.getName() + "#" + votingId); - hiddenChoice.setHidden(true); - hiddenChoice.setValue(choice.getValue()); // ?? -// hiddenChoice.setPollUId(choice.getPollUId()); -// hiddenChoice.setVoteId(choice.getVoteId()); // ?? - hiddenChoice.setValidate(false); - return hiddenChoice; - } - - @Override - public void createChoice(PollDTO poll, ChoiceDTO choice) { - TopiaContext transaction = null; - try { - if (log.isInfoEnabled()) { - log.info("P:[ createChoice ] : pollUId = " + poll.getPollUId() + - " _ choiceName = " + choice.getName() + - " _ choiceDescription = " + choice.getDescription()); - } - transaction = context.getRootContext().beginTransaction(); - - // Get the poll entity corresponding - Poll ePoll = PollenModelDAOHelper.getPollDAO(transaction). - findByTopiaId(poll.getId()); - - // Create the new choice entity - ChoiceDAO dao = PollenModelDAOHelper.getChoiceDAO(transaction); - Choice eChoice = context.getConverter().convert(choice, - dao.create()); - - // Add the choice in the Poll - ePoll.addChoice(eChoice); - - transaction.commitTransaction(); - - // Update changes in dtos - choice.setId(eChoice.getTopiaId()); - poll.addChoice(choice); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.createChoice"), - poll.getTitle(), poll.getId()); - } finally { - context.doFinally(transaction); - } - } - - @Override - public void deleteChoice(PollDTO poll, String choiceId) { - TopiaContext transaction = null; - try { - if (log.isInfoEnabled()) { - log.info("P:[ deleteChoice ] : pollUId = " + poll.getPollUId() + - " _ choiceId = " + choiceId); - } - transaction = context.getRootContext().beginTransaction(); - - // Find the choice - ChoiceDAO dao = PollenModelDAOHelper.getChoiceDAO(transaction); - Choice eChoice = dao.findByTopiaId(choiceId); - - // Get the poll entity corresponding - Poll ePoll = PollenModelDAOHelper.getPollDAO(transaction). - findByTopiaId(poll.getId()); - - // The remove will delete the choice because no poll will be - // attached to him (delete-orphan) - ePoll.removeChoice(eChoice); - - transaction.commitTransaction(); - - // Update change in dto - poll.removeChoice(choiceId); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.servicePoll.deleteChoice"), choiceId, - poll.getTitle(), poll.getId()); - } finally { - context.doFinally(transaction); - } - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRule.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRule.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRule.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,90 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.persistence.PreventRule; -import org.nuiton.topia.TopiaContext; - -/** - * Interface de gestion des règles de notification. - * - * @author rannou - * @version $Id$ - */ -public interface ServicePreventRule { - - /** - * Création d'une règle de notification. - * - * @param preventRule le dto de la règle - * @return l'identifiant de la règle - */ - public String createPreventRule(PreventRuleDTO preventRule); - - /** - * Création des règles de notification du sondage - * - * @param preventRules les dtos des règles - * @param pollId l'identifiant du sondage - * @param transaction la transaction du sondage - * @return les règles créées - */ - public List<PreventRule> createPreventRules( - List<PreventRuleDTO> preventRules, String pollId, - TopiaContext transaction); - - /** - * Mise à jour d'une règle de notification. - * - * @param preventRuleDTO le dto de la règle - * @return true si la règle a été mise à jours - */ - public boolean updatePreventRule(PreventRuleDTO preventRuleDTO); - - /** - * Suppression d'une règle de notification. - * - * @param preventRuleId l'identifiant de la règle - * @return true si la règle a été mise à jours - */ - public boolean deletePreventRule(String preventRuleId); - - /** - * Recherche d'un règle de notification par son identifiant. - * - * @param preventRuleId l'identifiant de la règle - * @return la règle - * @deprecated useless method : used only in tests - */ - @Deprecated - public PreventRuleDTO findPreventRuleById(String preventRuleId); - - /** - * Recherche de toutes les règles de notification. - * - * @param properties filtre sur les champs de la table preventRule - * @return les règles - * @deprecated useless method : used only in tests - */ - @Deprecated - public List<PreventRuleDTO> selectPreventRules( - Map<String, Object> properties); -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePreventRuleImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,252 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataPreventRuleConverter; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.PreventRule; -import org.chorem.pollen.business.persistence.PreventRuleDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.nuiton.topia.TopiaContext; - -/** - * Gestion des règles de notification. - * - * @author rannou - * @version $Id$ - */ -public class ServicePreventRuleImpl implements ServicePreventRule { - - private PollenContextImplementor context; - private PreventRuleDAO preventRuleDAO = null; - private DataPreventRuleConverter converter = new DataPreventRuleConverter(); - - /** log. */ - private static final Log log = LogFactory - .getLog(ServicePreventRuleImpl.class); - - public ServicePreventRuleImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public String createPreventRule(PreventRuleDTO preventRule) { - TopiaContext transaction = null; - String topiaId = ""; - try { - transaction = context.getRootContext().beginTransaction(); - - preventRuleDAO = PollenModelDAOHelper - .getPreventRuleDAO(transaction); - - PreventRule preventRuleEntity = preventRuleDAO.create(); - converter.setTransaction(transaction); - converter.populatePreventRuleEntity(preventRule, preventRuleEntity); - - topiaId = preventRuleEntity.getTopiaId(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return ""; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<PreventRule> createPreventRules( - List<PreventRuleDTO> preventRules, String pollId, TopiaContext transaction) { - if (preventRules.isEmpty() || pollId.length() == 0) { - return null; - } - - List<PreventRule> result = null; - try { - preventRuleDAO = PollenModelDAOHelper.getPreventRuleDAO(transaction); - - converter.setTransaction(transaction); - - result = new ArrayList<PreventRule>(); - for (PreventRuleDTO preventRule : preventRules) { - PreventRule preventRuleEntity = preventRuleDAO.create(); - preventRule.setId(preventRuleEntity.getTopiaId()); - preventRule.setPollId(pollId); - converter.populatePreventRuleEntity(preventRule, - preventRuleEntity); - result.add(preventRuleEntity); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } - } - - @Override - public boolean updatePreventRule(PreventRuleDTO preventRuleDTO) { - TopiaContext transaction = null; - boolean resu = false; - try { - transaction = context.getRootContext().beginTransaction(); - - preventRuleDAO = PollenModelDAOHelper - .getPreventRuleDAO(transaction); - - PreventRule preventRuleEntity = preventRuleDAO - .findByTopiaId(preventRuleDTO.getId()); - if (preventRuleEntity != null) { - converter.setTransaction(transaction); - converter.populatePreventRuleEntity(preventRuleDTO, - preventRuleEntity); - - preventRuleDAO.update(preventRuleEntity); - transaction.commitTransaction(); - resu = true; - } - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + preventRuleDTO.getId()); - } - - return resu; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deletePreventRule(String preventRuleId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - preventRuleDAO = PollenModelDAOHelper - .getPreventRuleDAO(transaction); - - PreventRule preventRuleEntity = preventRuleDAO - .findByTopiaId(preventRuleId); - - preventRuleDAO.delete(preventRuleEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + preventRuleId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public PreventRuleDTO findPreventRuleById(String preventRuleId) { - TopiaContext transaction = null; - PreventRuleDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - preventRuleDAO = PollenModelDAOHelper - .getPreventRuleDAO(transaction); - - PreventRule preventRuleEntity = preventRuleDAO - .findByTopiaId(preventRuleId); - - if (preventRuleEntity != null) { - converter.setTransaction(transaction); - result = converter.createPreventRuleDTO(preventRuleEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<PreventRuleDTO> selectPreventRules( - Map<String, Object> properties) { - TopiaContext transaction = null; - List<PreventRuleDTO> results = null; - List<PreventRule> preventRuleEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - preventRuleDAO = PollenModelDAOHelper - .getPreventRuleDAO(transaction); - - if (properties == null) { - preventRuleEntities = preventRuleDAO.findAll(); - if (log.isWarnEnabled()) { - log - .warn("Attention : toutes les règles de notification ont été sélectionnées !"); - } - } else { - preventRuleEntities = preventRuleDAO - .findAllByProperties(properties); - } - converter.setTransaction(transaction); - results = converter.createPreventRuleDTOs(preventRuleEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResults.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResults.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResults.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,92 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.chorem.pollen.business.dto.ResultListDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.common.VoteCountingType; - -/** - * Interface du service de gestion de résultats. - * - * @author fdesbois - * @version $Id$ - */ -public interface ServiceResults { - - /** - * Récupère les résultats d'un sondage. - * - * @param pollId identifiant du sondage - * @return resultats, null si le sondage n'est pas fermé - */ - public ResultListDTO getAllResults(String pollId); - - /** - * Récupère les résultats d'un sondage pour un seul type de dépouillement. - * - * @param pollId identifiant du sondage - * @param voteCounting : type de dépouillement - * @return results, null si le sondage n'est pas fermé ou ne peut être - * dépouillé de cette façon - */ - public ResultListDTO getResultsByVoteCounting(String pollId, - VoteCountingType voteCounting); - - /** - * Récupère les résultats d'un sondage avec le dépouillement normal sans - * gestion des groupes. Utile si PollType == GROUP. - * - * @param pollId identifiant du sondage - * @return results - */ - public ResultListDTO getNormalResults(String pollId); - - /** - * Récupère les résultats d'un sondage avec le dépouillement normal avec - * gestion des groupes. Possible uniquement si PollType == GROUP. - * - * @param pollId identifiant du sondage - * @return results si PollType == GROUP, null sinon - */ - public ResultListDTO getGroupResults(String pollId); - - /** - * Export d'un sondage au format XML. - * - * @param pollId identifiant ToPIA du sondage - * @return chemin du fichier créé sur le serveur - */ - public String exportPoll(String pollId); - - /** - * Import d'un fichier XML. - * - * @param filePath chemin du fichier à importer - * @return identifiant du sondage nouvellement importé - */ - public String importPoll(String filePath); - - /** - * Import d'un fichier XML. - * - * @param filePath chemin du fichier à importer - * @param user l'utilisateur important le fichier - * @return identifiant du sondage nouvellement importé - */ - public String importPoll(String filePath, UserDTO user); -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceResultsImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,305 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataResultConverter; -import org.chorem.pollen.business.converters.DataVoteCountingConverter; -import org.chorem.pollen.business.dto.ResultDTO; -import org.chorem.pollen.business.dto.ResultListDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.Result; -import org.chorem.pollen.business.utils.ContextUtil; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.chorem.pollen.votecounting.dto.PollDTO; -import org.chorem.pollen.votecounting.dto.PollExportDTO; -import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; -import org.chorem.pollen.votecounting.services.ServiceExport; -import org.chorem.pollen.votecounting.services.ServiceExportImpl; -import org.chorem.pollen.votecounting.services.ServiceVoteCounting; -import org.chorem.pollen.votecounting.services.ServiceVoteCountingImpl; -import org.nuiton.topia.TopiaContext; -import static org.nuiton.i18n.I18n.n_; - -/** - * Implémentation du service de gestion des résultats. - * - * @author fdesbois - * @author rannou - * @version $Id$ - */ -public class ServiceResultsImpl implements ServiceResults { - - private PollenContextImplementor context; - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceResultsImpl.class); - - public ServiceResultsImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public ResultListDTO getAllResults(String pollId) { - return getResults(pollId, null, false, false); - } - - @Override - public ResultListDTO getResultsByVoteCounting(String pollId, - VoteCountingType voteCounting) { - return getResults(pollId, voteCounting, false, false); - } - - @Override - public ResultListDTO getGroupResults(String pollId) { - return getResults(pollId, null, true, true); - } - - @Override - public ResultListDTO getNormalResults(String pollId) { - return getResults(pollId, null, true, false); - } - - /** - * Récupère les résultats d'un sondage. - * - * @param pollId le sondage - * @param voteCounting type de dépouillement - * @param byGroup résultats par groupe - * @param groupOnly résultats uniquement par groupe - * @return les résultats du sondage - */ - private ResultListDTO getResults(String pollId, - VoteCountingType voteCounting, boolean byGroup, boolean groupOnly) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - PollDAO daoPoll = PollenModelDAOHelper.getPollDAO(transaction); - Poll ePoll = daoPoll.findByPollId(pollId); - - DataResultConverter converter = new DataResultConverter(transaction); - if (log.isDebugEnabled()) { - log.debug(ePoll.getPollId() + " (" + voteCounting - + ") has results: " + hasResults(ePoll, voteCounting)); - } - - // Dépouillement du sondage. - // S'il n'existe pas de résultats ou si le sondage est encore ouvert. - //if (!hasResults(ePoll, voteCounting) || !ePoll.getIsClosed()) { - PollDTO dto = DataVoteCountingConverter - .createPollDTOForVoteCounting(ePoll); - - if (voteCounting != null) { - dto.setVoteCounting(voteCounting); - } - - ePoll.clearResult(); - - ServiceVoteCounting service = new ServiceVoteCountingImpl(); - VoteCountingResultDTO result = service.executeVoteCounting(dto); - converter.populateResultEntities(result); - if (PollType.isGroupType(ePoll.getPollType())) { - result = service.executeGroupCounting(dto); - converter.populateResultEntities(result); - } - - //} - - transaction.commitTransaction(); - - // Conversion et trie des résultats - List<ResultDTO> list = converter.createResultDTOs(ePoll); - - VoteCountingType voteCountingType = - VoteCountingType.valueOf(ePoll.getVoteCounting()); - - Iterator<ResultDTO> it = list.iterator(); - while (it.hasNext()) { - ResultDTO curr = it.next(); - - // Cas d'un dépouillement particulier - // Suppression des resultats qui ne sont pas de se dépouillement - if (voteCounting != null - && curr.getVoteCounting() != voteCounting) { - it.remove(); - } - - // Cas d'un sondage de type GROUP avec filtre - if (byGroup) { - - // Filtre group : Suppression resultats non group - if (groupOnly && !curr.isByGroup()) { - it.remove(); - } - - // Filtre non group : Suppression resultats group - else if (!groupOnly && curr.isByGroup()) { - it.remove(); - } - - // Suppression des autres resultats de depouillements differents - if (curr.getVoteCounting() != voteCountingType) { - it.remove(); - } - } - } - - ResultListDTO resultListDTO = new ResultListDTO(); - resultListDTO.setResultDTOs(list); - resultListDTO.setVoteCountingResultDTO(result); - - return resultListDTO; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - /** - * Retourne vrai si le sondage a des résultats. - * - * @param ePoll le sondage - * @param type type de dépouillement - * @return vrai si le sondage a des résultats - */ - private boolean hasResults(Poll ePoll, VoteCountingType type) { - Collection<Result> results = ePoll.getResult(); - if (results == null || results.isEmpty()) { - return false; - } - if (!results.isEmpty() && type == null) { - return true; - } - - for (Result curr : results) { - if (VoteCountingType.valueOf(curr.getVoteCounting()) == type) { - return true; - } - } - return false; - } - - @Override - public String exportPoll(String pollId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - // Recherche du sondage - PollDAO daoPoll = PollenModelDAOHelper.getPollDAO(transaction); - Poll ePoll = daoPoll.findByPollId(pollId); - - // Dépouillement du sondage. - DataResultConverter converter = new DataResultConverter(transaction); - PollDTO dto = DataVoteCountingConverter - .createPollDTOForVoteCounting(ePoll); - - ePoll.clearResult(); - - ServiceVoteCounting service = new ServiceVoteCountingImpl(); - List<VoteCountingResultDTO> results = new ArrayList<VoteCountingResultDTO>(); - VoteCountingResultDTO result = service.executeVoteCounting(dto); - converter.populateResultEntities(result); - results.add(result); - - if (PollType.isGroupType(ePoll.getPollType())) { - VoteCountingResultDTO groupResult = service - .executeGroupCounting(dto); - converter.populateResultEntities(groupResult); - results.add(groupResult); - } - - transaction.commitTransaction(); - - // Transformation du sondage - PollExportDTO pollExport = new PollExportDTO(); - pollExport.setPollId(pollId); - pollExport.setPoll(dto); - pollExport.setVoteCountingResults(results); - - // Export du sondage - ServiceExport serviceExport = new ServiceExportImpl(); - String filename = serviceExport.executeExport(pollExport); - - if (log.isInfoEnabled()) { - log.info("Poll exported: " + pollId); - } - - return filename; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public String importPoll(String filePath) { - return importPoll(filePath, null); - } - - @Override - public String importPoll(String filePath, UserDTO user) { - String topiaId = ""; - - try { - - // Import du sondage - ServiceExport serviceExport = new ServiceExportImpl(); - PollExportDTO pollExportDTO = serviceExport.executeImport(filePath); - - // Transformation du sondage - // FIXME do not call a Service from an other one - ServicePoll servicePoll; - servicePoll = new ServicePollImpl(context); - org.chorem.pollen.business.dto.PollDTO poll = DataVoteCountingConverter - .createPollDTO(pollExportDTO.getPoll()); - - // Enregistrement du sondage - if (user != null) { - poll.setUserId(user.getId()); - } - topiaId = servicePoll.createPoll(poll); - - if (log.isInfoEnabled()) { - log.info("Poll imported: " + topiaId); - } - - } catch (Exception eee) { - context.doCatch(eee, - n_("pollen.error.serviceResults.importPoll")); - } - - return topiaId; - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUser.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,105 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.UserDTO; - -/** - * Interface du service de gestion des utilisateurs. - * - * @author amine - * @version $Id$ - */ -public interface ServiceUser { - - /** - * Création des utilisateurs - * - * @param user l'utilisateur - * @param password le mot de passe - * @return l'identifiant de l'utilisateur créé - */ - public String createUser(UserDTO user, String password); - - /** - * Modification d'un utilistaeur - * - * @param user utilisateur - * @return true si l'utilisateur a été modifié - */ - public boolean updateUser(UserDTO user); - - /** - * Suppression d'un utilisateur - * - * @param login de l'utilisateur à supprimer - * @return true si l'utilisateur a été supprimé - */ - public boolean deleteUser(String login); - - /** - * Suppression d'un utilisateur - * - * @param user un utilisateur - * @return true si l'utilisateur a été supprimé - */ - public boolean deleteUser(UserDTO user); - - /** - * Récupération d'un utilisateur à partir de son identifiant - * - * @param userId identifiant de l'utilisateur - * @return l'utilisateur - */ - public UserDTO findUserById(String userId); - - /** - * Récupération des utilisateurs - * - * @param properties filtre - * @return liste d'utilisateurs - */ - public List<UserDTO> selectUsers(Map<String, Object> properties); - - /** - * Mise à jour du mot de passe d'un utilisateur - * - * @param user l'utilisateur - * @param newPassword le nouveau mot de passe - * @return true si le mot de passe a été modifié - */ - public boolean updatePasswordUser(UserDTO user, String newPassword); - - /** - * Test de l'existance d'un identifiant utilisateur - * - * @param login l'identifiant utilisateur - * @return true si l'identifiant existe, false sinon - */ - public boolean isUserLoginExisting(String login); - - /** - * Test de l'existance d'un email utilisateur - * - * @param email l'email utilisateur - * @return true si l'email existe, false sinon - */ - public boolean isUserEmailExisting(String email); -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceUserImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,349 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContext; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataUserConverter; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.chorem.pollen.business.utils.MD5; -import org.nuiton.topia.TopiaContext; -import static org.nuiton.i18n.I18n.n_; - -/** - * Implémentation du service de gestion des utilisateurs. - * - * @author amine - * @author rannou - * @version $Id$ - */ -public class ServiceUserImpl implements ServiceUser { - private PollenContextImplementor context; - private UserAccountDAO userDAO = null; - private DataUserConverter converter = new DataUserConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceUserImpl.class); - - public ServiceUserImpl(PollenContextImplementor context) { - this.context = context; - } - - @Override - public String createUser(UserDTO user, String password) { - TopiaContext transaction = null; - String topiaId = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - if (userDAO.findByLogin(user.getLogin()) != null - || (!"".equals(user.getEmail()) && userDAO.findByEmail(user - .getEmail()) != null)) { - return null; - } - - UserAccount userEntity = userDAO.create(); - converter.populateUserEntity(user, userEntity, password); - - topiaId = userEntity.getTopiaId(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deleteUser(String login) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByLogin(login); - - userDAO.delete(userEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + userEntity.getTopiaId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deleteUser(UserDTO user) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByTopiaId(user.getId()); - userDAO.delete(userEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + userEntity.getTopiaId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public UserDTO findUserById(String userId) { - TopiaContext transaction = null; - UserDTO result = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByTopiaId(userId); - - if (userEntity != null) { - converter.setTransaction(transaction); - result = converter.createUserDTO(userEntity); - } - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity found: " - + ((result == null) ? "null" : result.getId())); - } - - return result; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<UserDTO> selectUsers(Map<String, Object> properties) { - TopiaContext transaction = null; - List<UserDTO> results = null; - List<UserAccount> userEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - if (properties == null) { - userEntities = userDAO.findAll(); - if (log.isWarnEnabled()) { - log - .warn("Attention : tous les utilisateurs ont été sélectionnés !"); - } - } else { - userEntities = userDAO.findAllByProperties(properties); - } - - results = converter.createUserDTOs(userEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean updateUser(UserDTO user) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByTopiaId(user.getId()); - - converter.setTransaction(transaction); - converter.populateUserEntity(user, userEntity); - - userDAO.update(userEntity); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + user.getId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean updatePasswordUser(UserDTO user, String newPassword) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - - UserAccount userEntity = userDAO.findByTopiaId(user.getId()); - - userEntity.setPassword(newPassword); - userEntity.update(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + user.getId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean isUserLoginExisting(String login) { - TopiaContext transaction = null; - boolean userExists = true; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - if (userDAO.findByLogin(login) == null) { - userExists = false; - } - - if (log.isDebugEnabled()) { - log.debug("Entity exists for the login " + login + ": " - + userExists); - } - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return true; - } finally { - ContextUtil.doFinally(transaction); - } - return userExists; - } - - @Override - public boolean isUserEmailExisting(String email) { - TopiaContext transaction = null; - boolean userExists = true; - try { - transaction = context.getRootContext().beginTransaction(); - - userDAO = PollenModelDAOHelper.getUserAccountDAO(transaction); - if (userDAO.findByEmail(email) == null) { - userExists = false; - } - - if (log.isDebugEnabled()) { - log.debug("Entity exists for the email " + email + ": " - + userExists); - } - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return true; - } finally { - ContextUtil.doFinally(transaction); - } - return userExists; - } - - public void createDefaultAdmin(String login, String password, String email) { - TopiaContext transaction = null; - try { - - transaction = context.getRootContext().beginTransaction(); - - UserAccountDAO dao = - PollenModelDAOHelper.getUserAccountDAO(transaction); - - int nbAdmin = dao.createQuery(). - add(UserAccount.ADMINISTRATOR, Boolean.TRUE).executeCount(); - - if (nbAdmin == 0) { - UserAccount userEntity = dao.create(); - userEntity.setLogin(login); - String encodedPassword = MD5.encode(password); - userEntity.setPassword(encodedPassword); - userEntity.setEmail(email); - userEntity.setAdministrator(true); - - if (log.isInfoEnabled()) { - log.info("Utilisateur " + userEntity.getLogin() + " créé."); - } - - transaction.commitTransaction(); - } - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.serviceUser.createDefaultAdmin"), - login, email); - } finally { - context.doFinally(transaction); - } - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVote.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVote.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVote.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,95 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.dto.VoteDTO; - -/** - * Interface du service de vote. - * - * @version $Id$ - */ -public interface ServiceVote { - - /** - * Rajouter un vote à un sondage - * - * @param voteDTO Le DTO du vote - * @return L'ID du vote créé - */ - public String createVote(VoteDTO voteDTO, PollAccountDTO pollAccountDTO); - - /** - * Mise à jour d'un vote - * - * @param voteDTO Le DTO du vote - * @return Retourne TRUE si la mise à jour s'est correctement déroulée - */ - public boolean updateVote(VoteDTO voteDTO); - - /** - * Supprime un vote de la base de données - * - * @param voteId L'identifiant du vote - * @return Retourne TRUE si la suppression s'est correctement déroulée - */ - public boolean deleteVote(String voteId); - - /** - * Retrieve existings votes from the {@code poll}. Only needed votes inside - * the range ({@code startIndex} and {@code endIndex}) will be retrieve. - * The results will be ordered by creationDate (the last vote done will - * be at the end of the list). - * - * @param poll to retrieve votes - * @param startIndex begin range for resulting votes - * @param endIndex end range for resulting votes - * @return the votes corresponding to the poll between the range - */ - public List<VoteDTO> getVotesByPoll(PollDTO poll, - int startIndex, int endIndex); - - public PollAccountDTO getNewPollAccount(UserDTO user); - - /** - * Test if the {@code votingId} has already voted for the {@code poll}. - * - * @param votingId to test existing vote - * @param poll where the votingId can have already voted - * @return true if the votingId has already voted or false otherwise - */ - public boolean hasAlreadyVoted(String votingId, PollDTO poll); - - /** - * Retourne les votes d'un sondage - * - * @param properties La HashMap pour sélectionner les votes d'un sondage. Il - * faut y mettre le bon champs pollId - * @return Les votes d'un sondage dans un DTO, le tout stocké dans une - * liste. - */ - public List<VoteDTO> selectVotes(Map<String, Object> properties); - - public VoteDTO getNewVote(PollAccountDTO account); - -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServiceVoteImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,524 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenContextImplementor; -import org.chorem.pollen.business.converters.DataPollAccountConverter; -import org.chorem.pollen.business.converters.DataVoteConverter; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.dto.VoteDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.PersonToListDAO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteDAO; -import org.chorem.pollen.business.persistence.VoteToChoice; -import org.chorem.pollen.business.persistence.VoteToChoiceDAO; -import org.chorem.pollen.business.persistence.VotingList; -import org.chorem.pollen.business.persistence.VotingListDAO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.chorem.pollen.common.PollType; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaQuery; -import org.nuiton.topia.persistence.TopiaEntity; -import static org.nuiton.i18n.I18n.n_; - -/** - * Implémentation du service de gestion des votes. - * - * @author rannou - * @version $Id$ - */ -public class ServiceVoteImpl implements ServiceVote { - - private PollenContextImplementor context; - private DataVoteConverter converter = new DataVoteConverter(); - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceVoteImpl.class); - - public ServiceVoteImpl(PollenContextImplementor context) { - this.context = context; - - this.context.getConverter().prepareVoteConverters(); - } - - @Override - public String createVote(VoteDTO voteDTO, PollAccountDTO pollAccountDTO) { - TopiaContext transaction = null; - String topiaId = null; - try { - transaction = context.getRootContext().beginTransaction(); - - // création du compte associé au vote s'il n'existe pas - // sinon mise à jour du compte - //ServicePollAccount spa = new ServicePollAccountImpl(); - if (pollAccountDTO != null) { - pollAccountDTO.setHasVoted(true); - PollAccountDAO pollAccountDAO = PollenModelDAOHelper.getPollAccountDAO(transaction); - - PollAccount pollAccountEntity = - pollAccountDAO.findByTopiaId(pollAccountDTO.getId()); - -// PollAccountDTO account = spa.findPollAccountById(pollAccountDTO -// .getId()); - if (pollAccountEntity == null) { - log.debug("Nouveau compte associé au vote"); - pollAccountEntity = pollAccountDAO.create( - context.createPollenUrlId()); - // EVO #108 : Migration to ToPIA 2.3, the entity must be - // commited because an other findBy is called in the - // converter (wtf ?! :/). This behavior doesn't work - // anymore. - transaction.commitTransaction(); -// voteDTO.setPollAccountId(spa -// .createPollAccount(pollAccountDTO)); - } else { - log.debug("Compte associé au vote : " + pollAccountEntity.getTopiaId()); - //spa.updatePollAccount(pollAccountDTO); - //voteDTO.setPollAccountId(account.getId()); - - } - // Fill pollAccountEntity from DTO in argument - DataPollAccountConverter pollAccountConverter = new DataPollAccountConverter(); - pollAccountConverter.setTransaction(transaction); - pollAccountConverter.populatePollAccountEntity(pollAccountDTO, - pollAccountEntity); - // Update pollAccountEntity - pollAccountDAO.update(pollAccountEntity); - - voteDTO.setPollAccountId(pollAccountEntity.getTopiaId()); - voteDTO.setVotingListId(pollAccountDTO.getVotingListId()); - voteDTO.setWeight(pollAccountDTO.getWeight()); - log.debug("Poids du vote : " + voteDTO.getWeight()); - } else { - voteDTO.setPollAccountId(null); - } - - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); - - Vote voteEntity = voteDAO.create(); - converter.setTransaction(transaction); - converter.populateVoteEntity(voteDTO, voteEntity); - - transaction.commitTransaction(); - - converter.populateChoiceVote(voteDTO, voteEntity); - - topiaId = voteEntity.getTopiaId(); - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity created: " + topiaId); - } - - return topiaId; - } catch (Exception eee) { - ContextUtil.doCatch(eee, transaction, "Problem when creating vote with pollAccount"); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean updateVote(VoteDTO voteDTO) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); - Vote voteEntity = voteDAO.findByTopiaId(voteDTO.getId()); - converter.setTransaction(transaction); - converter.populateVoteEntity(voteDTO, voteEntity); - voteEntity.update(); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity updated: " + voteDTO.getId()); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public boolean deleteVote(String voteId) { - TopiaContext transaction = null; - try { - transaction = context.getRootContext().beginTransaction(); - - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); - Vote voteEntity = voteDAO.findByTopiaId(voteId); - voteEntity.delete(); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entity deleted: " + voteId); - } - - return true; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return false; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public List<VoteDTO> getVotesByPoll(PollDTO poll, - int startIndex, int endIndex) { - TopiaContext transaction = null; - List<VoteDTO> results = new ArrayList<VoteDTO>(); - try { - if (log.isInfoEnabled()) { - log.info("P:[ getVotesByPoll ] : " + - "pollUId = " + poll.getPollUId() + - " _ startIndex = " + startIndex + - " _ endIndex = " + endIndex); - } - - // No need to load votes for an anonymous poll - if (poll.isAnonymous()) { - return results; - } - - // FIXME-FD20100309 : change dto to suppress link from poll to vote - // It's not necessary to have votes when retrieving the poll, this - // method do this job only when it's needed - transaction = context.getRootContext().beginTransaction(); - -// List<Vote> votes = transaction.find( -// "FROM " + Vote.class.getName() + -// " WHERE poll.pollId = :pollUId" + -// " ORDER BY topiaCreateDate", -// startIndex, endIndex, -// "pollUId", poll.getPollId()); - - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); - // Order the results by creation date (the last vote done will be - // at the end of the list) - TopiaQuery query = voteDAO.createQuery(). - add(Vote.POLL + "." + Poll.POLL_ID, poll.getPollUId()). - addOrder(TopiaEntity.TOPIA_CREATE_DATE). - setLimit(startIndex, endIndex); - - List<Vote> eVotes = voteDAO.findAllByQuery(query); - - if (log.isDebugEnabled()) { - log.debug("Nb votes found : " + eVotes.size()); - } - for (Vote eVote : eVotes) { - VoteDTO vote = context.getConverter().convert(eVote, new VoteDTO()); - results.add(vote); - } -// converter.setTransaction(transaction); -// results = converter.createVoteDTOs(votes); - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.serviceVote.getVotesByPoll"), - poll.getPollUId()); - } finally { - context.doFinally(transaction); - } - return results; - } - - @Override - public PollAccountDTO getNewPollAccount(UserDTO user) { - PollAccountDTO result = new PollAccountDTO(); - if (user == null) { - return result; - } - // Initialize the default account for user - if (user.getFirstName() != null && user.getLastName() != null) { - result.setVotingId( - user.getFirstName() + " " + user.getLastName()); - - } else if (user.getFirstName() != null) { - result.setVotingId(user.getFirstName()); - - } else if (user.getLastName() != null) { - result.setVotingId(user.getLastName()); - } - // Link the new account with the user - result.setUserId(user.getId()); - return result; - } - - @Override - public boolean hasAlreadyVoted(String votingId, PollDTO poll) { - TopiaContext transaction = null; - boolean result = false; - try { - if (log.isInfoEnabled()) { - log.info("P:[ hasAlreadyVoted ] : votingId = " + votingId + - " _ pollUId = " + poll.getPollUId()); - } - - transaction = context.getRootContext().beginTransaction(); - -// List<Long> tmp = transaction.find( -// "SELECT COUNT(*)" + -// " FROM " + Vote.class.getName() + -// " WHERE poll.pollId = :pollUId" + -// " AND pollAccount.votingId = :votingId", -// "pollUId", poll.getPollId(), -// "votingId", votingId); - - // Test using a count on votes - TopiaQuery query = new TopiaQuery(Vote.class). - add(Vote.POLL + "." + Poll.POLL_ID, poll.getPollUId()). - add(Vote.POLL_ACCOUNT + "." + PollAccount.VOTING_ID, - votingId); - - int count = query.executeCount(transaction); - - // If the count is greater than 0, there is an existing votingId - // who has already voted for the poll - result = count > 0; - - } catch (Exception eee) { - context.doCatch(transaction, eee, - n_("pollen.error.serviceVote.hasAlreadyVoted"), - votingId, poll.getPollUId()); - } finally { - context.doFinally(transaction); - } - return result; - } - - @Override - public List<VoteDTO> selectVotes(Map<String, Object> properties) { - TopiaContext transaction = null; - List<VoteDTO> results = null; - List<Vote> voteEntities = null; - try { - transaction = context.getRootContext().beginTransaction(); - - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(transaction); - - if (properties == null) { - voteEntities = voteDAO.findAll(); - if (log.isWarnEnabled()) { - log.warn("Attention : tous les votes ont été sélectionnés !"); - } - } else { - voteEntities = voteDAO.findAllByProperties(properties); - } - - converter.setTransaction(transaction); - results = converter.createVoteDTOs(voteEntities); - - transaction.commitTransaction(); - - if (log.isDebugEnabled()) { - log.debug("Entities found: " - + ((results == null) ? "null" : results.size())); - } - - return results; - } catch (Exception e) { - ContextUtil.doCatch(e, transaction); - return null; - } finally { - ContextUtil.doFinally(transaction); - } - } - - @Override - public VoteDTO getNewVote(PollAccountDTO account) { - VoteDTO result = new VoteDTO(); - result.setWeight(1.); - result.setPollAccountId(account.getId()); - return result; - } - - private void updateChoiceValues(TopiaContext transaction, - VoteDTO vote, Vote eVote) throws TopiaException { - - VoteToChoiceDAO voteToChoiceDAO = - PollenModelDAOHelper.getVoteToChoiceDAO(transaction); - - ChoiceDAO choiceDAO = PollenModelDAOHelper.getChoiceDAO(transaction); - - for (Map.Entry<String, Integer> choiceValue : - vote.getChoiceValues().entrySet()) { - - // Find existing choice - Choice choice = choiceDAO.findByTopiaId(choiceValue.getKey()); - - // Find existing vote - VoteToChoice voteToChoice = voteToChoiceDAO.findByProperties( - VoteToChoice.CHOICE, choice, - VoteToChoice.VOTE, eVote); - - // Create new vote if needed - if (voteToChoice == null) { - voteToChoice = voteToChoiceDAO.create( - VoteToChoice.CHOICE, choice, - VoteToChoice.VOTE, eVote); - } - // Update vote value - voteToChoice.setVoteValue(choiceValue.getValue()); - } - } - - private PersonToList validateForRestrictedPoll(TopiaContext transaction, - VoteDTO vote, PollAccount eAccount, Poll ePoll) - throws TopiaException { - PersonToList person = null; - if (eAccount == null) { - //throw exception : not allowed - return person; - } else { - PersonToListDAO personDAO = - PollenModelDAOHelper.getPersonToListDAO(transaction); - - String pPoll = - PersonToList.VOTING_LIST + "." + VotingList.POLL; - - TopiaQuery query = personDAO.createQuery(). - add(PersonToList.POLL_ACCOUNT, eAccount). - add(PersonToList.HAS_VOTED, Boolean.FALSE). - add(pPoll, ePoll); - - person = personDAO.findByQuery(query); - if (person == null && !ePoll.getAnonymous()) { - // throw exception : not allowed - return person; - } - } - return person; - } - -// @Override -// public void createOrUpdateVote(VoteDTO vote, PollDTO poll) { -// TopiaContext transaction = null; -// try { -// PollType pollType = poll.getPollType(); -// -// //PollAccountDTO account = vote.getAccount(); -// -// if (log.isInfoEnabled()) { -// log.info("P:[ getNewVote ] : " + -// "accountName = " + account.getVotingId() + -// " _ accountUId = " + account.getAccountUId() + -// " _ pollUId = " + poll.getPollUId() + -// " _ pollType = " + pollType); -// } -// -// transaction = context.getRootContext().beginTransaction(); -// -// VoteDAO dao = PollenModelDAOHelper.getVoteDAO(transaction); -// -// Vote eVote = dao.findByTopiaId(vote.getId()); -// -// if (eVote != null) { -// -// updateChoiceValues(transaction, vote, eVote); -// -// // Don't touch to pollAccount for existing vote -// } else { -// -// Poll ePoll = PollenModelDAOHelper.getPollDAO(transaction). -// findByTopiaId(poll.getId()); -// -// // Retrieve existing account -// PollAccountDAO accountDAO = -// PollenModelDAOHelper.getPollAccountDAO(transaction); -// PollAccount eAccount = -// accountDAO.findByTopiaId(account.getId()); -// -// PersonToList person = null; -// if (pollType.isRestrictedOrGroup()) { -// person = validateForRestrictedPoll(transaction, vote, -// eAccount, ePoll); -// } else { -// if (eAccount == null) { -// // Create new Account -// eAccount = -// accountDAO.create(context.createPollenUrlId()); -// context.getConverter().convert(account, eAccount); -// } -// -// VotingListDAO listDAO = -// PollenModelDAOHelper.getVotingListDAO(transaction); -// -// VotingList list = null; -// if (ePoll.sizeVotingList() == 0) { -// list = listDAO.create(); -// } else { -// list = ePoll.getVotingList().get(0); -// -// } -// } -// -// // Link with existing connected user -// if (account.getUserId() != null) { -// UserAccount user = -// PollenModelDAOHelper.getUserAccountDAO(transaction). -// findByTopiaId(account.getUserId()); -// -// user.addPollAccount(eAccount); -// } -// -// eVote = context.getConverter().convert(vote, dao.create()); -// if (!eVote.getAnonymous()) { -// eVote.setPollAccount(eAccount); -// } -// -// ePoll.addVote(eVote); -// -// -// } -// -// -// -// } catch (Exception eee) { -// context.doCatch(transaction, eee, -// n_("pollen.error.serviceVote.getVote"), -// poll.getTitle(), poll.getId()); -// } finally { -// context.doFinally(transaction); -// } -// } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Services proposés par le module Business. - */ -package org.chorem.pollen.business.services; \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/ContextUtil.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,387 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.utils; - -import java.util.Properties; - -import java.util.UUID; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.PollenBusinessException; -import org.chorem.pollen.business.PollenContextImpl; -import org.chorem.pollen.business.PollenException; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.UserAccount; -import org.chorem.pollen.business.persistence.UserAccountDAO; -import org.chorem.pollen.business.services.ServiceUserImpl; -import org.hibernate.exception.SQLGrammarException; -import org.nuiton.i18n.I18n; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaNotFoundException; -import org.nuiton.topia.persistence.TopiaDAO; -import org.nuiton.topia.persistence.TopiaEntity; - -/** - * Charge et génère le contexte global. - * - * @author rannou - * @version $Id$ - * @deprecated use class {@link org.chorem.pollen.business.PollenContext} - */ -@Deprecated -public class ContextUtil { - - /** log. */ - private static final Log log = LogFactory.getLog(ContextUtil.class); - - /** - * Instance de la classe (patron singleton) - */ - private static ContextUtil instance = null; - - /** - * Contexte global - */ - private TopiaContext context = null; - - /** - * Propriétés de la base de données. - */ - @Deprecated - private Properties conf; - /** - * Retourne le contexte global. - * - * @return le contexte global - * @ - * @deprecated use {@link #getRootContext } instead - */ -// @Deprecated -// public TopiaContext getContext() { -// return PollenContexImpl.getRootContext(); -// } -// -// /** -// * Retourne la configuration de la base de données. -// * -// * @return la configuration -// * @ -// */ -// public Properties getConf() { -// return PollenContexImpl.getProperties(); -// } - /** - * Construction du contexte global - * @deprecated use directly {@link #getRootContext} method - */ - @Deprecated - public void buildContext() { - if (context == null || context.isClosed()) { - try { - if (log.isInfoEnabled()) { - log.info("Construction du contexte global..."); - } - context = TopiaContextFactory.getContext(conf); - } catch (TopiaNotFoundException e) { - if (log.isErrorEnabled()) { - log.error("Erreur lors de la construction du contexte", e); - } - e.printStackTrace(); - } - } - } - - /** - * Fermeture du contexte global - * @deprecated not necessary, the close will be done in PollenRunner - */ - @Deprecated - public void closeContext() { - if (context != null && !context.isClosed()) { - try { - if (log.isInfoEnabled()) { - log.info("Fermeture du contexte global..."); - } - context.closeContext(); - } catch (TopiaException e) { - if (log.isErrorEnabled()) { - log.error("Erreur lors de la fermeture du contexte", e); - } - e.printStackTrace(); - } - } - } - - /** - * Retourne l'instance unique de la classe (patron singleton) - * - * @return L'instance de la classe - * @deprecated ContextUtil methods are static - */ - @Deprecated - public static ContextUtil getInstance() { - if (instance == null) { - instance = new ContextUtil(); - } - return instance; - } - - /** - * Use to get properties filename in JNDI envirronement. - * - * Usefull to use un different war in embedded war context. - * - * @return properties filename found in JNDI (or a default one) - * @deprecated not usefull anymore, the default properties file is loaded - * even if the application is embedded. - */ - @Deprecated - protected String getPropertiesFileName() { - String filename = null; - - try { - Context jndiContext = new InitialContext(); - - filename = (String) jndiContext.lookup("configurationfilename"); - } catch (NamingException e) { - - // ce n'est pas forcement une erreur - // elle arrive si l'application est lancé normalement - // c'est a dire (hors war embarqué par winstone) - if (log.isInfoEnabled()) { - log.info("JNDI context not found (normal launch, jndi only exist in winstone launch)"); - - if (log.isTraceEnabled()) { - log.trace("Can't get jndi", e); - } - } - } - - // .. if styll null, set default one - if (filename == null || filename.isEmpty()) { - filename = "pollen.properties"; - } - - return filename; - } - - /** - * Constructeur. Construit le contexte global après avoir lu le fichier de - * configuration de Pollen. - */ - private ContextUtil() { - -// String propertiesFilename = getPropertiesFileName(); - String propertiesFilename = "pollen.properties"; - - // Chargement du fichier de configuration - conf = PropertiesLoader.loadPropertiesFile(propertiesFilename); - conf.setProperty("topia.persistence.classes", - PollenModelDAOHelper.getImplementationClassesAsString()); - conf.setProperty("topia.service.migration.version", - PollenModelDAOHelper.getModelVersion()); - - I18n.init(); - - // Construction du contexte global - buildContext(); - - // Initialisation de la base de données. Si elle n'existe pas on la crée - // FIXME Il ne faudrait pas se baser sur l'exception SQLGrammarException pour détecter que la base n'existe pas - try { - initDB(); - } catch (TopiaException e) { - log.error("Base de données inexistante"); - if (e.getCause() instanceof SQLGrammarException) { - log.info("Création de la base de données..."); - try { - context.createSchema(); - log.info("Base de données créée"); - initDB(); - } catch (TopiaException ex) { - log.error("Échec lors de la création de la base", ex); - } - } - } - } - - /** - * Chargement des valeurs initiales dans la base de données. - * - * @throws TopiaException - * @deprecated use - * {@link ServiceUserImpl#createDefaultAdmin(String, String, String) } - * method to create the default admin - */ - @Deprecated - protected void initDB() throws TopiaException { - TopiaContext transaction = null; - transaction = context.beginTransaction(); - - // Chargement des types de choix dans la table choiceType -// ChoiceTypeDAO choiceTypeDAO = PollenModelDAOHelper -// .getChoiceTypeDAO(transaction); -// loadDB("choiceType", choiceTypeDAO); -// transaction.commitTransaction(); - - // Chargement des types de sondage dans la table pollType -// PollTypeDAO pollTypeDAO = PollenModelDAOHelper -// .getPollTypeDAO(transaction); -// loadDB("pollType", pollTypeDAO); -// transaction.commitTransaction(); - - // Chargement des types de dépouillement dans la table voteCounting -// VoteCountingDAO voteCountingDAO = PollenModelDAOHelper -// .getVoteCountingDAO(transaction); -// loadDB("voteCounting", voteCountingDAO); -// transaction.commitTransaction(); - - // Chargement de l'utilisateur par défaut - UserAccountDAO userAccountDAO = PollenModelDAOHelper - .getUserAccountDAO(transaction); - loadAdmin(userAccountDAO); - transaction.commitTransaction(); - - transaction.closeContext(); - } - - /** - * Chargement des types dans la base de données à partir du fichier de - * configuration. - * - * @param element la clé du type dans le fichier de configuration - * @param dao le DAO correspondant au type - * @throws TopiaException - */ - private void loadDB(String element, TopiaDAO dao) throws TopiaException { - String strType = conf.getProperty(element); - String[] tabTypes = strType.split(","); - - // Recherche chaque element de la liste et le crée dans - // la base de données s'il n'existe pas - for (int i = 0; i < tabTypes.length; i++) { - TopiaEntity entity = dao.findByProperty("name", tabTypes[i]); - - if (entity == null) { - dao.create("name", tabTypes[i]); - } - } - - if (log.isInfoEnabled()) { - log.info("Types " + element + " créés."); - } - } - - /** - * Chargement de l'utilisateur par défaut dans la base de données à partir - * du fichier de configuration. - * - * @param dao le DAO pour les utilisateurs - * @throws TopiaException - */ - private void loadAdmin(UserAccountDAO dao) throws TopiaException { - if (dao.findAllByAdministrator(true).size() == 0) { - UserAccount userEntity = dao.create(); - userEntity.setLogin(conf.getProperty("adminLogin")); - userEntity.setPassword(MD5 - .encode(conf.getProperty("adminPassword"))); - userEntity.setEmail(conf.getProperty("adminEmail")); - userEntity.setAdministrator(true); - - if (log.isInfoEnabled()) { - log.info("Utilisateur " + userEntity.getLogin() + " créé."); - } - } - } - - /** - * - * @param e - * @param transaction - * @throws PollenException - * @deprecated must defined a message using {@link PollenContext#doCatch(Exception, TopiaContext, String) } - */ - @Deprecated - public static void doCatch(Exception e, TopiaContext transaction) throws PollenException { - doCatch(e, transaction, "Échec lors du déroulement de la transaction"); - } - - /** - * Méthode exécutée lorsqu'une exception est détectée. - * - * @param eee - * @param message - * @param transaction la transaction courante - * @throws PollenException - * @deprecated must defined a message using {@link PollenContext#doCatch(Exception, TopiaContext, String) } - */ - @Deprecated - public static void doCatch(Exception eee, TopiaContext transaction, String message) throws PollenException { - if (log.isErrorEnabled()) { - log.error(message, eee); - } - - // rollback de la transaction courante - if (transaction != null) { - try { - transaction.rollbackTransaction(); - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Échec lors du rollback de la transaction", ex); - } - } - } - // PollenBusinessException must be managed (catch and throw) when needed -// if (! (eee instanceof PollenBusinessException)) { - throw new PollenException(eee, message); -// } - } - - /** - * Méthode exécutée dans tous les cas pour libérer la transaction. - * - * @param transaction transaction en cours - * @deprecated must defined a message using {@link PollenContext#doFinally(TopiaContext) } - */ - @Deprecated - public static void doFinally(TopiaContext transaction) { - if (transaction != null) { - try { - transaction.closeContext(); - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Échec lors de la fermeture de la transaction", ex); - } - } - } - } - - /** - * @return generated string for urlId - * @deprecated must defined a message using {@link PollenContext#createPollenUrlId() } - */ - @Deprecated - public static String createPollenUrlId() { - return UUID.randomUUID().toString().replaceAll("-", ""); - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MD5.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MD5.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MD5.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,59 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.utils; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Classe utilitaire permettant d'encoder des chaîne en MD5. - * - * @version $Id$ - */ -public class MD5 { - - /** - * Encode la chaine passé en paramètre avec l’algorithme MD5 - * - * @param key : la chaine à encoder - * @return la valeur (string) hexadécimale sur 32 bits - */ - public static String encode(String key) { - - byte[] uniqueKey = key.getBytes(); - byte[] hash = null; - - try { - // on récupère un objet qui permettra de crypter la chaine - hash = MessageDigest.getInstance("MD5").digest(uniqueKey); - } catch (NoSuchAlgorithmException e) { - throw new Error("no MD5 support in this VM"); - } - - StringBuffer hashString = new StringBuffer(); - for (int i = 0; i < hash.length; ++i) { - String hex = Integer.toHexString(hash[i]); - if (hex.length() == 1) { - hashString.append("0"); - hashString.append(hex.charAt(hex.length() - 1)); - } else { - hashString.append(hex.substring(hex.length() - 2)); - } - } - return hashString.toString(); - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MailUtil.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MailUtil.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/MailUtil.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,73 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.utils; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.SimpleEmail; - -/** - * Classe permettant d'envoyer des mails. Basée sur {@link SimpleEmail} (commons-email). - * - * @author rannou - * @version $Id$ - */ -public class MailUtil { - - /** log. */ - private static final Log log = LogFactory.getLog(MailUtil.class); - - /** - * Envoi d'un email. - * - * @param host Nom du serveur - * @param port Port SMTP - * @param from Adresse email de l'expéditeur - * @param to Adresse email du destinataire - * @param subject Sujet - * @param msg Message - */ - public static void sendMail(String host, int port, String from, String to, - String subject, String msg) { - SimpleEmail email = new SimpleEmail(); - try { - email.setHostName(host); - email.setSmtpPort(port); - email.setFrom(from); - email.addTo(to); - email.setSubject(subject); - email.setMsg(msg); - email.setCharset("UTF-8"); - email.send(); - } catch (EmailException e) { - log.error("Erreur à l'envoi d'email", e); - } - - if (log.isInfoEnabled()) { - log.info("Mail sent to : " + to); - - if (log.isDebugEnabled()) { - log.debug("Détail de l'email : " + "\ndate: " + email.getSentDate() - + "\nhostname: " + email.getHostName() + "\nport: " - + email.getSmtpPort() + "\nfrom: " - + email.getFromAddress().toString() + "\nto: " + to - + "\nsubject: " + email.getSubject()); - } - } - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/PropertiesLoader.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/PropertiesLoader.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/PropertiesLoader.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,72 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.utils; - -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.Resource; - -/** - * Charge les propriétés du fichier properties pour la configuration de la base - * de données - * - * @author rannou - * @version $Id$ - * @deprecated use {@link org.chorem.pollen.business.PollenContext } to manage - * configuration using {@link org.nuiton.util.ApplicationConfig } - */ -@Deprecated -public class PropertiesLoader { - - /** log. */ - private static final Log log = LogFactory.getLog(PropertiesLoader.class); - - /** - * Charge le fichier properties et retourne les propriétés créées - * - * @param filename Le fichier properties - * @return Les propriétés de la base de données - */ - public static Properties loadPropertiesFile(String filename) { - Properties conf = null; - - try { - conf = new Properties(); - - //URL url = Resource.getURL(filename); - //conf.load(url.openStream()); - - Properties confAll = Resource.getConfigProperties(filename); - for (String key : confAll.stringPropertyNames()) { - conf.setProperty(key, confAll.getProperty(key)); - } - - if (log.isDebugEnabled()) { - log.debug("Propriétés: " + conf); - } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Lecture impossible du fichier de propriétés : " - + filename, e); - } - } - - return conf; - } -} Deleted: trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/package-info.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/utils/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,4 +0,0 @@ -/** - * Classes utilitaires. - */ -package org.chorem.pollen.business.utils; \ No newline at end of file Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,39 @@ + +package org.chorem.pollen.entity; + +/** + * PollImpl + * + * Created: 23 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class PollImpl extends PollAbstract { + + private static final long serialVersionUID = 1L; + + @Override + public boolean canVote(PollAccount person) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean canAdminPoll(PollAccount person) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean canCreateChoice(PollAccount person) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean canAccessPoll(PollAccount person) { + throw new UnsupportedOperationException("Not supported yet."); + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollImpl.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/VoteImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/VoteImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/VoteImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,24 @@ + +package org.chorem.pollen.entity; + +/** + * VoteImpl + * + * Created: 23 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class VoteImpl extends VoteAbstract { + + private static final long serialVersionUID = 1L; + + @Override + public boolean canUpdateVote(PollAccount person) { + throw new UnsupportedOperationException("Not supported yet."); + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/VoteImpl.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,119 @@ + +package org.chorem.pollen.service; + +import java.util.List; +import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.PollenContextImplementor; +import org.chorem.pollen.PollenDAOHelper; +import org.chorem.pollen.entity.PollDAO; +import org.chorem.pollen.entity.Choice; +import org.chorem.pollen.entity.Comment; +import org.chorem.pollen.entity.Poll; +import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.entity.PollImpl; +import org.chorem.pollen.entity.UserAccount; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; + +/** + * ServicePoll + * + * Created: 23 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class ServicePollImpl extends ServicePollAbstract { + + public ServicePollImpl(PollenContextImplementor context) { + super(context); + } + + @Override + protected Poll executeGetNewPoll(TopiaContext transaction) + throws TopiaException { + + PollDAO dao = PollenDAOHelper.getPollDAO(transaction); + + return new PollImpl(); + } + + @Override + protected Poll executeGetNewPoll(TopiaContext transaction, Poll poll) + throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeCreatePoll(TopiaContext transaction, Poll poll) + throws TopiaException { + + PollDAO dao = PollenDAOHelper.getPollDAO(transaction); + + + } + + @Override + protected void executeUpdatePoll(TopiaContext transaction, Poll poll) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeSavePoll(TopiaContext transaction, Poll poll) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeDeletePoll(TopiaContext transaction, Poll poll) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeDeleteChoice(TopiaContext transaction, Choice choice) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeCreateUpdateVote(TopiaContext transaction, PollAccount person) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeDeleteVote(TopiaContext transaction, Poll poll, PollAccount person) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected Poll executeGetPollForUpdate(TopiaContext transaction, String pollUId) throws PollenBusinessException, TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<Poll> executeGetAllPolls(TopiaContext transaction) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<Poll> executeGetRunningPolls(TopiaContext transaction) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<Poll> executeGetPollsByUser(TopiaContext transaction, UserAccount user) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<Comment> executeGetComments(TopiaContext transaction, Poll poll, int startIndex, int endIndex) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<PollAccount> executeGetVotes(TopiaContext transaction, Poll poll, int startIndex, int endIndex) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,79 @@ + +package org.chorem.pollen.service; + +import java.util.List; +import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.PollenContextImplementor; +import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.entity.UserAccount; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; + +/** + * ServiceUserImpl + * + * Created: 23 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class ServiceUserImpl extends ServiceUserAbstract { + + public ServiceUserImpl(PollenContextImplementor context) { + super(context); + } + + @Override + protected UserAccount executeConnect(TopiaContext transaction, String login, String password) throws PollenBusinessException, TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeCreateUpdateUser(TopiaContext transaction, UserAccount user) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeDeleteUser(TopiaContext transaction, UserAccount user) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<UserAccount> executeGetUsers(TopiaContext transaction) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected PollAccount executeGetNewList(TopiaContext transaction) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeCreateUpdateList(TopiaContext transaction, PollAccount list) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected void executeDeleteList(TopiaContext transaction, PollAccount list) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected List<PollAccount> executeGetFavoriteLists(TopiaContext transaction) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected PollAccount executeGetNewPerson(TopiaContext transaction, UserAccount user) throws TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + protected PollAccount executeGetPerson(TopiaContext transaction, String accountUId) throws PollenBusinessException, TopiaException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ChoiceImpl" node="org.chorem.pollen.business.persistence.ChoiceImpl" proxy="org.chorem.pollen.business.persistence.Choice" table="choice"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="description" name="description" node="description" type="text"/> - <property access="field" column="validate" name="validate" node="validate" type="java.lang.Boolean"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="voteVoteToChoice" node="voteVoteToChoice"> - <key column="choice"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ChoiceTypeImpl" node="org.chorem.pollen.business.persistence.ChoiceTypeImpl" proxy="org.chorem.pollen.business.persistence.ChoiceType" table="choiceType"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.CommentImpl" node="org.chorem.pollen.business.persistence.CommentImpl" proxy="org.chorem.pollen.business.persistence.Comment" table="comment"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="text" name="text" node="text" type="text"/> - <property access="field" column="postDate" name="postDate" node="postDate" type="java.util.Date"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PersonListImpl" node="org.chorem.pollen.business.persistence.PersonListImpl" proxy="org.chorem.pollen.business.persistence.PersonList" table="personList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <many-to-one class="org.chorem.pollen.business.persistence.UserAccountImpl" column="owner" embed-xml="false" name="owner" node="owner/@topiaId"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="pollAccount" node="pollAccount"> - <key column="personList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" embed-xml="false" node="topiaId"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PersonToListImpl" node="org.chorem.pollen.business.persistence.PersonToListImpl" proxy="org.chorem.pollen.business.persistence.PersonToList" table="personToList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="weight" name="weight" node="weight" type="double"/> - <property access="field" column="hasVoted" name="hasVoted" node="hasVoted" type="text"/> - <many-to-one class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" embed-xml="false" name="votingList" node="votingList/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollAccountImpl" node="org.chorem.pollen.business.persistence.PollAccountImpl" proxy="org.chorem.pollen.business.persistence.PollAccount" table="pollAccount"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="votingId" name="votingId" node="votingId" type="text"/> - <property access="field" column="email" name="email" node="email" type="text"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="votingListPersonToList" node="votingListPersonToList"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="pollsCreated" node="pollsCreated"> - <key column="creator"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="comment" node="comment"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="vote" node="vote"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PersonListImpl" column="personList" embed-xml="false" name="personList" node="personList/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.UserAccountImpl" column="userAccount" embed-xml="false" name="userAccount" node="userAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollImpl" node="org.chorem.pollen.business.persistence.PollImpl" proxy="org.chorem.pollen.business.persistence.Poll" table="poll"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="pollId" name="pollId" node="pollId" type="text"/> - <property access="field" column="title" name="title" node="title" type="text"/> - <property access="field" column="description" name="description" node="description" type="text"/> - <property access="field" column="beginChoiceDate" name="beginChoiceDate" node="beginChoiceDate" type="java.util.Date"/> - <property access="field" column="beginDate" name="beginDate" node="beginDate" type="java.util.Date"/> - <property access="field" column="endDate" name="endDate" node="endDate" type="java.util.Date"/> - <property access="field" column="maxChoiceNb" name="maxChoiceNb" node="maxChoiceNb" type="int"/> - <property access="field" column="closed" name="closed" node="closed" type="java.lang.Boolean"/> - <property access="field" column="choiceAddAllowed" name="choiceAddAllowed" node="choiceAddAllowed" type="java.lang.Boolean"/> - <property access="field" column="anonymousVoteAllowed" name="anonymousVoteAllowed" node="anonymousVoteAllowed" type="java.lang.Boolean"/> - <property access="field" column="anonymous" name="anonymous" node="anonymous" type="java.lang.Boolean"/> - <property access="field" column="publicResults" name="publicResults" node="publicResults" type="java.lang.Boolean"/> - <property access="field" column="continuousResults" name="continuousResults" node="continuousResults" type="java.lang.Boolean"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="vote" node="vote"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="choice" node="choice"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="result" node="result"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ResultImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="creator" embed-xml="false" name="creator" node="creator/@topiaId"/> - <bag embed-xml="false" inverse="true" lazy="true" name="comment" node="comment"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="preventRule" node="preventRule"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.PreventRuleImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="votingList" node="votingList"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VotingListImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollTypeImpl" column="pollType" embed-xml="false" name="pollType" node="pollType/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.ChoiceTypeImpl" column="choiceType" embed-xml="false" name="choiceType" node="choiceType/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" embed-xml="false" name="voteCounting" node="voteCounting/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollTypeImpl" node="org.chorem.pollen.business.persistence.PollTypeImpl" proxy="org.chorem.pollen.business.persistence.PollType" table="pollType"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PreventRuleImpl" node="org.chorem.pollen.business.persistence.PreventRuleImpl" proxy="org.chorem.pollen.business.persistence.PreventRule" table="preventRule"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="scope" name="scope" node="scope" type="text"/> - <property access="field" column="sensibility" name="sensibility" node="sensibility" type="int"/> - <property access="field" column="repeated" name="repeated" node="repeated" type="java.lang.Boolean"/> - <property access="field" column="method" name="method" node="method" type="text"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ResultImpl" node="org.chorem.pollen.business.persistence.ResultImpl" proxy="org.chorem.pollen.business.persistence.Result" table="result"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="resultValue" name="ResultValue" node="ResultValue" type="text"/> - <property access="field" column="byGroup" name="byGroup" node="byGroup" type="java.lang.Boolean"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" embed-xml="false" name="voteCounting" node="voteCounting/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.UserAccountImpl" node="org.chorem.pollen.business.persistence.UserAccountImpl" proxy="org.chorem.pollen.business.persistence.UserAccount" table="userAccount"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="login" name="login" node="login" type="text"/> - <property access="field" column="password" name="password" node="password" type="text"/> - <property access="field" column="firstName" name="firstName" node="firstName" type="text"/> - <property access="field" column="lastName" name="lastName" node="lastName" type="text"/> - <property access="field" column="administrator" name="administrator" node="administrator" type="java.lang.Boolean"/> - <property access="field" column="langage" name="langage" node="langage" type="text"/> - <property access="field" column="email" name="email" node="email" type="text"/> - <bag embed-xml="false" inverse="true" lazy="true" name="favoriteList" node="favoriteList"> - <key column="owner"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonListImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="pollAccount" node="pollAccount"> - <key column="userAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" embed-xml="false" node="topiaId"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteCountingImpl" node="org.chorem.pollen.business.persistence.VoteCountingImpl" proxy="org.chorem.pollen.business.persistence.VoteCounting" table="voteCounting"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteImpl" node="org.chorem.pollen.business.persistence.VoteImpl" proxy="org.chorem.pollen.business.persistence.Vote" table="vote"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="weight" name="weight" node="weight" type="double"/> - <property access="field" column="comment" name="comment" node="comment" type="text"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="choiceVoteToChoice" node="choiceVoteToChoice"> - <key column="vote"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" embed-xml="false" name="votingList" node="votingList/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="org.chorem.pollen.business.persistence.VoteToChoiceImpl" proxy="org.chorem.pollen.business.persistence.VoteToChoice" table="voteToChoice"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="voteValue" name="voteValue" node="voteValue" type="int"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" embed-xml="false" name="vote" node="vote/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.ChoiceImpl" column="choice" embed-xml="false" name="choice" node="choice/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/0/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VotingListImpl" node="org.chorem.pollen.business.persistence.VotingListImpl" proxy="org.chorem.pollen.business.persistence.VotingList" table="votingList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="weight" name="weight" node="weight" type="double"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="pollAccountPersonToList" node="pollAccountPersonToList"> - <key column="votingList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" embed-xml="false" name="vote" node="vote/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ChoiceImpl" node="org.chorem.pollen.business.persistence.ChoiceImpl" proxy="org.chorem.pollen.business.persistence.Choice" table="choice"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="description" name="description" node="description" type="text"/> - <property access="field" column="validate" name="validate" node="validate" type="java.lang.Boolean"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="voteVoteToChoice" node="voteVoteToChoice"> - <key column="choice"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ChoiceTypeImpl" node="org.chorem.pollen.business.persistence.ChoiceTypeImpl" proxy="org.chorem.pollen.business.persistence.ChoiceType" table="choiceType"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.CommentImpl" node="org.chorem.pollen.business.persistence.CommentImpl" proxy="org.chorem.pollen.business.persistence.Comment" table="comment"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="text" name="text" node="text" type="text"/> - <property access="field" column="postDate" name="postDate" node="postDate" type="java.util.Date"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PersonListImpl" node="org.chorem.pollen.business.persistence.PersonListImpl" proxy="org.chorem.pollen.business.persistence.PersonList" table="personList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <many-to-one class="org.chorem.pollen.business.persistence.UserAccountImpl" column="owner" embed-xml="false" name="owner" node="owner/@topiaId"/> - <bag embed-xml="false" inverse="true" lazy="true" name="pollAccount" node="pollAccount"> - <key column="personList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" embed-xml="false" node="topiaId"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PersonToListImpl" node="org.chorem.pollen.business.persistence.PersonToListImpl" proxy="org.chorem.pollen.business.persistence.PersonToList" table="personToList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="weight" name="weight" node="weight" type="java.lang.Double"/> - <property access="field" column="hasVoted" name="hasVoted" node="hasVoted" type="java.lang.Boolean"/> - <many-to-one class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" embed-xml="false" name="votingList" node="votingList/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollAccountImpl" node="org.chorem.pollen.business.persistence.PollAccountImpl" proxy="org.chorem.pollen.business.persistence.PollAccount" table="pollAccount"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="accountId" name="accountId" node="accountId" type="text"/> - <property access="field" column="votingId" name="votingId" node="votingId" type="text"/> - <property access="field" column="email" name="email" node="email" type="text"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="votingListPersonToList" node="votingListPersonToList"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="pollsCreated" node="pollsCreated"> - <key column="creator"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="comment" node="comment"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="vote" node="vote"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PersonListImpl" column="personList" embed-xml="false" name="personList" node="personList/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.UserAccountImpl" column="userAccount" embed-xml="false" name="userAccount" node="userAccount/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollImpl" node="org.chorem.pollen.business.persistence.PollImpl" proxy="org.chorem.pollen.business.persistence.Poll" table="poll"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="pollId" name="pollId" node="pollId" type="text"/> - <property access="field" column="title" name="title" node="title" type="text"/> - <property access="field" column="description" name="description" node="description" type="text"/> - <property access="field" column="beginChoiceDate" name="beginChoiceDate" node="beginChoiceDate" type="java.util.Date"/> - <property access="field" column="beginDate" name="beginDate" node="beginDate" type="java.util.Date"/> - <property access="field" column="endDate" name="endDate" node="endDate" type="java.util.Date"/> - <property access="field" column="maxChoiceNb" name="maxChoiceNb" node="maxChoiceNb" type="java.lang.Integer"/> - <property access="field" column="closed" name="closed" node="closed" type="java.lang.Boolean"/> - <property access="field" column="choiceAddAllowed" name="choiceAddAllowed" node="choiceAddAllowed" type="java.lang.Boolean"/> - <property access="field" column="anonymousVoteAllowed" name="anonymousVoteAllowed" node="anonymousVoteAllowed" type="java.lang.Boolean"/> - <property access="field" column="anonymous" name="anonymous" node="anonymous" type="java.lang.Boolean"/> - <property access="field" column="publicResults" name="publicResults" node="publicResults" type="java.lang.Boolean"/> - <property access="field" column="continuousResults" name="continuousResults" node="continuousResults" type="java.lang.Boolean"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="vote" node="vote"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="choice" node="choice"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="result" node="result"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ResultImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="creator" embed-xml="false" name="creator" node="creator/@topiaId"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="comment" node="comment"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="preventRule" node="preventRule"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.PreventRuleImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="votingList" node="votingList"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VotingListImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollTypeImpl" column="pollType" embed-xml="false" name="pollType" node="pollType/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.ChoiceTypeImpl" column="choiceType" embed-xml="false" name="choiceType" node="choiceType/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" embed-xml="false" name="voteCounting" node="voteCounting/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PollTypeImpl" node="org.chorem.pollen.business.persistence.PollTypeImpl" proxy="org.chorem.pollen.business.persistence.PollType" table="pollType"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.PreventRuleImpl" node="org.chorem.pollen.business.persistence.PreventRuleImpl" proxy="org.chorem.pollen.business.persistence.PreventRule" table="preventRule"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="scope" name="scope" node="scope" type="text"/> - <property access="field" column="sensibility" name="sensibility" node="sensibility" type="java.lang.Integer"/> - <property access="field" column="repeated" name="repeated" node="repeated" type="java.lang.Boolean"/> - <property access="field" column="active" name="active" node="active" type="java.lang.Boolean"/> - <property access="field" column="oneTime" name="oneTime" node="oneTime" type="java.lang.Boolean"/> - <property access="field" column="method" name="method" node="method" type="text"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.ResultImpl" node="org.chorem.pollen.business.persistence.ResultImpl" proxy="org.chorem.pollen.business.persistence.Result" table="result"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="resultValue" name="ResultValue" node="ResultValue" type="text"/> - <property access="field" column="byGroup" name="byGroup" node="byGroup" type="java.lang.Boolean"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" embed-xml="false" name="voteCounting" node="voteCounting/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.UserAccountImpl" node="org.chorem.pollen.business.persistence.UserAccountImpl" proxy="org.chorem.pollen.business.persistence.UserAccount" table="userAccount"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="login" name="login" node="login" type="text"/> - <property access="field" column="password" name="password" node="password" type="text"/> - <property access="field" column="firstName" name="firstName" node="firstName" type="text"/> - <property access="field" column="lastName" name="lastName" node="lastName" type="text"/> - <property access="field" column="administrator" name="administrator" node="administrator" type="java.lang.Boolean"/> - <property access="field" column="language" name="language" node="language" type="text"/> - <property access="field" column="email" name="email" node="email" type="text"/> - <bag embed-xml="false" inverse="true" lazy="true" name="favoriteList" node="favoriteList"> - <key column="owner"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonListImpl" embed-xml="false" node="topiaId"/> - </bag> - <bag embed-xml="false" inverse="true" lazy="true" name="pollAccount" node="pollAccount"> - <key column="userAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" embed-xml="false" node="topiaId"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteCountingImpl" node="org.chorem.pollen.business.persistence.VoteCountingImpl" proxy="org.chorem.pollen.business.persistence.VoteCounting" table="voteCounting"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteImpl" node="org.chorem.pollen.business.persistence.VoteImpl" proxy="org.chorem.pollen.business.persistence.Vote" table="vote"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="weight" name="weight" node="weight" type="java.lang.Double"/> - <property access="field" column="comment" name="comment" node="comment" type="text"/> - <property access="field" column="anonymous" name="anonymous" node="anonymous" type="java.lang.Boolean"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="choiceVoteToChoice" node="choiceVoteToChoice"> - <key column="vote"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" embed-xml="false" name="pollAccount" node="pollAccount/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" embed-xml="false" name="votingList" node="votingList/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="org.chorem.pollen.business.persistence.VoteToChoiceImpl" proxy="org.chorem.pollen.business.persistence.VoteToChoice" table="voteToChoice"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="voteValue" name="voteValue" node="voteValue" type="java.lang.Integer"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" embed-xml="false" name="vote" node="vote/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.ChoiceImpl" column="choice" embed-xml="false" name="choice" node="choice/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.1/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping auto-import="true" default-access="field" package="org.chorem.pollen.business.persistence"> - <class abstract="false" name="org.chorem.pollen.business.persistence.VotingListImpl" node="org.chorem.pollen.business.persistence.VotingListImpl" proxy="org.chorem.pollen.business.persistence.VotingList" table="votingList"> - <id length="255" name="topiaId" node="@topiaId" type="string"/> - <version name="topiaVersion" node="@topiaVersion" type="long"/> - <property name="topiaCreateDate" node="@topiaCreateDate" type="date"/> - <property access="field" column="name" name="name" node="name" type="text"/> - <property access="field" column="weight" name="weight" node="weight" type="java.lang.Double"/> - <bag cascade="all,delete-orphan" embed-xml="false" inverse="true" lazy="true" name="pollAccountPersonToList" node="pollAccountPersonToList"> - <key column="votingList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" embed-xml="false" node="topiaId"/> - </bag> - <many-to-one class="org.chorem.pollen.business.persistence.PollImpl" column="poll" embed-xml="false" name="poll" node="poll/@topiaId"/> - <many-to-one class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" embed-xml="false" name="vote" node="vote/@topiaId"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.ChoiceImpl" table="choice" node="org.chorem.pollen.business.persistence.ChoiceImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Choice" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="description" type="text" access="field" column="description" node="description"/> - <property name="validate" type="java.lang.Boolean" access="field" column="validate" node="validate"/> - <bag name="voteVoteToChoice" inverse="true" lazy="true" cascade="all,delete-orphan" node="voteVoteToChoice" embed-xml="false"> - <key column="choice"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ChoiceTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.ChoiceTypeImpl" table="choiceType" node="org.chorem.pollen.business.persistence.ChoiceTypeImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.ChoiceType" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.CommentImpl" table="comment" node="org.chorem.pollen.business.persistence.CommentImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Comment" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="text" type="text" access="field" column="text" node="text"/> - <property name="postDate" type="java.util.Date" access="field" column="postDate" node="postDate"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="pollAccount" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" node="pollAccount/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PersonListImpl" table="personList" node="org.chorem.pollen.business.persistence.PersonListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PersonList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <many-to-one name="owner" class="org.chorem.pollen.business.persistence.UserAccountImpl" column="owner" node="owner/@topiaId" embed-xml="false"/> - <bag name="pollAccount" inverse="true" lazy="true" node="pollAccount" embed-xml="false"> - <key column="personList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" node="topiaId" embed-xml="false"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PersonToListImpl" table="personToList" node="org.chorem.pollen.business.persistence.PersonToListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PersonToList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <property name="hasVoted" type="java.lang.Boolean" access="field" column="hasVoted" node="hasVoted"/> - <many-to-one name="votingList" class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" node="votingList/@topiaId" embed-xml="false" /> - <many-to-one name="pollAccount" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" node="pollAccount/@topiaId" embed-xml="false" /> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PollAccountImpl" table="pollAccount" node="org.chorem.pollen.business.persistence.PollAccountImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PollAccount" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="accountId" type="text" access="field" column="accountId" node="accountId"/> - <property name="votingId" type="text" access="field" column="votingId" node="votingId"/> - <property name="email" type="text" access="field" column="email" node="email"/> - <bag name="votingListPersonToList" inverse="true" lazy="true" cascade="all,delete-orphan" node="votingListPersonToList" embed-xml="false"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="pollsCreated" inverse="true" lazy="true" node="pollsCreated" embed-xml="false"> - <key column="creator"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="comment" inverse="true" lazy="true" node="comment" embed-xml="false"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="vote" inverse="true" lazy="true" node="vote" embed-xml="false"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="personList" class="org.chorem.pollen.business.persistence.PersonListImpl" column="personList" node="personList/@topiaId" embed-xml="false"/> - <many-to-one name="userAccount" class="org.chorem.pollen.business.persistence.UserAccountImpl" column="userAccount" node="userAccount/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PollImpl" table="poll" node="org.chorem.pollen.business.persistence.PollImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Poll" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="pollId" type="text" access="field" column="pollId" node="pollId"/> - <property name="title" type="text" access="field" column="title" node="title"/> - <property name="description" type="text" access="field" column="description" node="description"/> - <property name="beginChoiceDate" type="java.util.Date" access="field" column="beginChoiceDate" node="beginChoiceDate"/> - <property name="beginDate" type="java.util.Date" access="field" column="beginDate" node="beginDate"/> - <property name="endDate" type="java.util.Date" access="field" column="endDate" node="endDate"/> - <property name="maxChoiceNb" type="java.lang.Integer" access="field" column="maxChoiceNb" node="maxChoiceNb"/> - <property name="closed" type="java.lang.Boolean" access="field" column="closed" node="closed"/> - <property name="choiceAddAllowed" type="java.lang.Boolean" access="field" column="choiceAddAllowed" node="choiceAddAllowed"/> - <property name="anonymousVoteAllowed" type="java.lang.Boolean" access="field" column="anonymousVoteAllowed" node="anonymousVoteAllowed"/> - <property name="anonymous" type="java.lang.Boolean" access="field" column="anonymous" node="anonymous"/> - <property name="publicResults" type="java.lang.Boolean" access="field" column="publicResults" node="publicResults"/> - <property name="continuousResults" type="java.lang.Boolean" access="field" column="continuousResults" node="continuousResults"/> - <property name="endChoiceDate" type="java.util.Date" access="field" column="endChoiceDate" node="endChoiceDate"/> - <bag name="vote" inverse="true" lazy="true" cascade="all,delete-orphan" node="vote" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="choice" inverse="true" lazy="true" cascade="all,delete-orphan" node="choice" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="result" inverse="true" lazy="true" cascade="all,delete-orphan" node="result" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ResultImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="creator" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="creator" node="creator/@topiaId" embed-xml="false"/> - <bag name="comment" inverse="true" lazy="true" cascade="all,delete-orphan" node="comment" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="preventRule" inverse="true" lazy="true" cascade="all,delete-orphan" node="preventRule" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.PreventRuleImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="votingList" inverse="true" lazy="true" cascade="all,delete-orphan" node="votingList" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VotingListImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="pollType" class="org.chorem.pollen.business.persistence.PollTypeImpl" column="pollType" node="pollType/@topiaId" embed-xml="false"/> - <many-to-one name="choiceType" class="org.chorem.pollen.business.persistence.ChoiceTypeImpl" column="choiceType" node="choiceType/@topiaId" embed-xml="false"/> - <many-to-one name="voteCounting" class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" node="voteCounting/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PollTypeImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PollTypeImpl" table="pollType" node="org.chorem.pollen.business.persistence.PollTypeImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PollType" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PreventRuleImpl" table="preventRule" node="org.chorem.pollen.business.persistence.PreventRuleImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PreventRule" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="scope" type="text" access="field" column="scope" node="scope"/> - <property name="sensibility" type="java.lang.Integer" access="field" column="sensibility" node="sensibility"/> - <property name="repeated" type="java.lang.Boolean" access="field" column="repeated" node="repeated"/> - <property name="active" type="java.lang.Boolean" access="field" column="active" node="active"/> - <property name="oneTime" type="java.lang.Boolean" access="field" column="oneTime" node="oneTime"/> - <property name="method" type="text" access="field" column="method" node="method"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.ResultImpl" table="result" node="org.chorem.pollen.business.persistence.ResultImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Result" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="ResultValue" type="text" access="field" column="resultValue" node="ResultValue"/> - <property name="byGroup" type="java.lang.Boolean" access="field" column="byGroup" node="byGroup"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="voteCounting" class="org.chorem.pollen.business.persistence.VoteCountingImpl" column="voteCounting" node="voteCounting/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.UserAccountImpl" table="userAccount" node="org.chorem.pollen.business.persistence.UserAccountImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.UserAccount" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="login" type="text" access="field" column="login" node="login"/> - <property name="password" type="text" access="field" column="password" node="password"/> - <property name="firstName" type="text" access="field" column="firstName" node="firstName"/> - <property name="lastName" type="text" access="field" column="lastName" node="lastName"/> - <property name="administrator" type="java.lang.Boolean" access="field" column="administrator" node="administrator"/> - <property name="language" type="text" access="field" column="language" node="language"/> - <property name="email" type="text" access="field" column="email" node="email"/> - <bag name="favoriteList" inverse="true" lazy="true" node="favoriteList" embed-xml="false"> - <key column="owner"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonListImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="pollAccount" inverse="true" lazy="true" node="pollAccount" embed-xml="false"> - <key column="userAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" node="topiaId" embed-xml="false"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteCountingImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VoteCountingImpl" table="voteCounting" node="org.chorem.pollen.business.persistence.VoteCountingImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.VoteCounting" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VoteImpl" table="vote" node="org.chorem.pollen.business.persistence.VoteImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Vote" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <property name="comment" type="text" access="field" column="comment" node="comment"/> - <property name="anonymous" type="java.lang.Boolean" access="field" column="anonymous" node="anonymous"/> - <bag name="choiceVoteToChoice" inverse="true" lazy="true" cascade="all,delete-orphan" node="choiceVoteToChoice" embed-xml="false"> - <key column="vote"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="pollAccount" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" node="pollAccount/@topiaId" embed-xml="false"/> - <many-to-one name="votingList" class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" node="votingList/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VoteToChoiceImpl" table="voteToChoice" node="org.chorem.pollen.business.persistence.VoteToChoiceImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.VoteToChoice" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="voteValue" type="java.lang.Integer" access="field" column="voteValue" node="voteValue"/> - <many-to-one name="vote" class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" node="vote/@topiaId" embed-xml="false" /> - <many-to-one name="choice" class="org.chorem.pollen.business.persistence.ChoiceImpl" column="choice" node="choice/@topiaId" embed-xml="false" /> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.2/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VotingListImpl" table="votingList" node="org.chorem.pollen.business.persistence.VotingListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.VotingList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <bag name="pollAccountPersonToList" inverse="true" lazy="true" cascade="all,delete-orphan" node="pollAccountPersonToList" embed-xml="false"> - <key column="votingList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="vote" class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" node="vote/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.ChoiceImpl" table="choice" node="org.chorem.pollen.business.persistence.ChoiceImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Choice" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="description" type="text" access="field" column="description" node="description"/> - <property name="validate" type="java.lang.Boolean" access="field" column="validate" node="validate"/> - <bag name="voteVoteToChoice" inverse="true" lazy="true" cascade="all,delete-orphan" node="voteVoteToChoice" embed-xml="false"> - <key column="choice"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/CommentImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.CommentImpl" table="comment" node="org.chorem.pollen.business.persistence.CommentImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Comment" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="text" type="text" access="field" column="text" node="text"/> - <property name="postDate" type="java.util.Date" access="field" column="postDate" node="postDate"/> - <property name="author" type="text" access="field" column="author" node="author"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PersonListImpl" table="personList" node="org.chorem.pollen.business.persistence.PersonListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PersonList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <many-to-one name="owner" class="org.chorem.pollen.business.persistence.UserAccountImpl" column="owner" node="owner/@topiaId" embed-xml="false"/> - <bag name="pollAccount" inverse="true" lazy="true" node="pollAccount" embed-xml="false"> - <key column="personList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" node="topiaId" embed-xml="false"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PersonToListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PersonToListImpl" table="personToList" node="org.chorem.pollen.business.persistence.PersonToListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PersonToList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <property name="hasVoted" type="java.lang.Boolean" access="field" column="hasVoted" node="hasVoted"/> - <many-to-one name="votingList" class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" node="votingList/@topiaId" embed-xml="false" /> - <many-to-one name="pollAccount" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" node="pollAccount/@topiaId" embed-xml="false" /> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PollAccountImpl" table="pollAccount" node="org.chorem.pollen.business.persistence.PollAccountImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PollAccount" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <natural-id> - <property name="accountId" type="text" access="field" column="accountId" node="accountId"/> - </natural-id> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="votingId" type="text" access="field" column="votingId" node="votingId"/> - <property name="email" type="text" access="field" column="email" node="email"/> - <bag name="votingListPersonToList" inverse="true" lazy="true" cascade="all,delete-orphan" node="votingListPersonToList" embed-xml="false"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="pollsCreated" inverse="true" lazy="true" node="pollsCreated" embed-xml="false"> - <key column="creator"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="vote" inverse="true" lazy="true" node="vote" embed-xml="false"> - <key column="pollAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="personList" class="org.chorem.pollen.business.persistence.PersonListImpl" column="personList" node="personList/@topiaId" embed-xml="false"/> - <many-to-one name="userAccount" class="org.chorem.pollen.business.persistence.UserAccountImpl" column="userAccount" node="userAccount/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PollImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PollImpl" table="poll" node="org.chorem.pollen.business.persistence.PollImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Poll" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <natural-id> - <property name="pollId" type="text" access="field" column="pollId" node="pollId"/> - </natural-id> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="title" type="text" access="field" column="title" node="title"/> - <property name="description" type="text" access="field" column="description" node="description"/> - <property name="beginChoiceDate" type="java.util.Date" access="field" column="beginChoiceDate" node="beginChoiceDate"/> - <property name="beginDate" type="java.util.Date" access="field" column="beginDate" node="beginDate"/> - <property name="endDate" type="java.util.Date" access="field" column="endDate" node="endDate"/> - <property name="maxChoiceNb" type="java.lang.Integer" access="field" column="maxChoiceNb" node="maxChoiceNb"/> - <property name="closed" type="java.lang.Boolean" access="field" column="closed" node="closed"/> - <property name="choiceAddAllowed" type="java.lang.Boolean" access="field" column="choiceAddAllowed" node="choiceAddAllowed"/> - <property name="anonymousVoteAllowed" type="java.lang.Boolean" access="field" column="anonymousVoteAllowed" node="anonymousVoteAllowed"/> - <property name="anonymous" type="java.lang.Boolean" access="field" column="anonymous" node="anonymous"/> - <property name="publicResults" type="java.lang.Boolean" access="field" column="publicResults" node="publicResults"/> - <property name="continuousResults" type="java.lang.Boolean" access="field" column="continuousResults" node="continuousResults"/> - <property name="endChoiceDate" type="java.util.Date" access="field" column="endChoiceDate" node="endChoiceDate"/> - <property name="voteCounting" type="text" access="field" column="voteCounting" node="voteCounting"/> - <property name="pollType" type="text" access="field" column="pollType" node="pollType"/> - <property name="choiceType" type="text" access="field" column="choiceType" node="choiceType"/> - <bag name="vote" inverse="true" lazy="true" cascade="all,delete-orphan" node="vote" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="choice" inverse="true" lazy="true" cascade="all,delete-orphan" node="choice" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="result" inverse="true" lazy="true" cascade="all,delete-orphan" node="result" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.ResultImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="creator" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="creator" node="creator/@topiaId" embed-xml="false"/> - <bag name="comment" inverse="true" lazy="true" cascade="all,delete-orphan" node="comment" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.CommentImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="preventRule" inverse="true" lazy="true" cascade="all,delete-orphan" node="preventRule" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.PreventRuleImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="votingList" inverse="true" lazy="true" cascade="all,delete-orphan" node="votingList" embed-xml="false"> - <key column="poll"/> - <one-to-many class="org.chorem.pollen.business.persistence.VotingListImpl" node="topiaId" embed-xml="false"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/PreventRuleImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.PreventRuleImpl" table="preventRule" node="org.chorem.pollen.business.persistence.PreventRuleImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.PreventRule" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="scope" type="text" access="field" column="scope" node="scope"/> - <property name="sensibility" type="java.lang.Integer" access="field" column="sensibility" node="sensibility"/> - <property name="repeated" type="java.lang.Boolean" access="field" column="repeated" node="repeated"/> - <property name="active" type="java.lang.Boolean" access="field" column="active" node="active"/> - <property name="oneTime" type="java.lang.Boolean" access="field" column="oneTime" node="oneTime"/> - <property name="method" type="text" access="field" column="method" node="method"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/ResultImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.ResultImpl" table="result" node="org.chorem.pollen.business.persistence.ResultImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Result" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="ResultValue" type="text" access="field" column="resultValue" node="ResultValue"/> - <property name="byGroup" type="java.lang.Boolean" access="field" column="byGroup" node="byGroup"/> - <property name="voteCounting" type="text" access="field" column="voteCounting" node="voteCounting"/> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/UserAccountImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.UserAccountImpl" table="userAccount" node="org.chorem.pollen.business.persistence.UserAccountImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.UserAccount" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="login" type="text" access="field" column="login" node="login"/> - <property name="password" type="text" access="field" column="password" node="password"/> - <property name="firstName" type="text" access="field" column="firstName" node="firstName"/> - <property name="lastName" type="text" access="field" column="lastName" node="lastName"/> - <property name="administrator" type="java.lang.Boolean" access="field" column="administrator" node="administrator"/> - <property name="language" type="text" access="field" column="language" node="language"/> - <property name="email" type="text" access="field" column="email" node="email"/> - <bag name="favoriteList" inverse="true" lazy="true" node="favoriteList" embed-xml="false"> - <key column="owner"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonListImpl" node="topiaId" embed-xml="false"/> - </bag> - <bag name="pollAccount" inverse="true" lazy="true" node="pollAccount" embed-xml="false"> - <key column="userAccount"/> - <one-to-many class="org.chorem.pollen.business.persistence.PollAccountImpl" node="topiaId" embed-xml="false"/> - </bag> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VoteImpl" table="vote" node="org.chorem.pollen.business.persistence.VoteImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.Vote" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <property name="comment" type="text" access="field" column="comment" node="comment"/> - <property name="anonymous" type="java.lang.Boolean" access="field" column="anonymous" node="anonymous"/> - <bag name="choiceVoteToChoice" inverse="true" lazy="true" cascade="all,delete-orphan" node="choiceVoteToChoice" embed-xml="false"> - <key column="vote"/> - <one-to-many class="org.chorem.pollen.business.persistence.VoteToChoiceImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="pollAccount" class="org.chorem.pollen.business.persistence.PollAccountImpl" column="pollAccount" node="pollAccount/@topiaId" embed-xml="false"/> - <many-to-one name="votingList" class="org.chorem.pollen.business.persistence.VotingListImpl" column="votingList" node="votingList/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VoteToChoiceImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VoteToChoiceImpl" table="voteToChoice" node="org.chorem.pollen.business.persistence.VoteToChoiceImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.VoteToChoice" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="voteValue" type="java.lang.Integer" access="field" column="voteValue" node="voteValue"/> - <many-to-one name="vote" class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" node="vote/@topiaId" embed-xml="false" /> - <many-to-one name="choice" class="org.chorem.pollen.business.persistence.ChoiceImpl" column="choice" node="choice/@topiaId" embed-xml="false" /> - </class> -</hibernate-mapping> Deleted: trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml =================================================================== --- trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/resources/oldmappings/pollen/1.3/org/chorem/pollen/business/persistence/VotingListImpl.hbm.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> -<hibernate-mapping default-access="field" auto-import="true" package="org.chorem.pollen.business.persistence"> - <class name="org.chorem.pollen.business.persistence.VotingListImpl" table="votingList" node="org.chorem.pollen.business.persistence.VotingListImpl" abstract="false" proxy="org.chorem.pollen.business.persistence.VotingList" > - <id name="topiaId" type="string" length="255" node="@topiaId"/> - <version name="topiaVersion" type="long" node="@topiaVersion"/> - <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> - <property name="name" type="text" access="field" column="name" node="name"/> - <property name="weight" type="java.lang.Double" access="field" column="weight" node="weight"/> - <bag name="pollAccountPersonToList" inverse="true" lazy="true" cascade="all,delete-orphan" node="pollAccountPersonToList" embed-xml="false"> - <key column="votingList"/> - <one-to-many class="org.chorem.pollen.business.persistence.PersonToListImpl" node="topiaId" embed-xml="false"/> - </bag> - <many-to-one name="poll" class="org.chorem.pollen.business.persistence.PollImpl" column="poll" node="poll/@topiaId" embed-xml="false"/> - <many-to-one name="vote" class="org.chorem.pollen.business.persistence.VoteImpl" column="vote" node="vote/@topiaId" embed-xml="false"/> - </class> -</hibernate-mapping> Modified: trunk/pollen-business/src/main/xmi/pollen.properties =================================================================== --- trunk/pollen-business/src/main/xmi/pollen.properties 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-03-23 15:39:36 UTC (rev 2956) @@ -2,5 +2,5 @@ model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Pollen\n *##%*/ #model.tagvalue.dbSchema=Pollen model.tagvalue.java.lang.String=text -org.chorem.pollen.business.persistence.PollAccount.attribute.accountId.tagvalue.naturalId=true -org.chorem.pollen.business.persistence.Poll.attribute.pollId.tagvalue.naturalId=true \ No newline at end of file +#org.chorem.pollen.business.persistence.PollAccount.attribute.accountId.tagvalue.naturalId=true +#org.chorem.pollen.business.persistence.Poll.attribute.pollId.tagvalue.naturalId=true \ No newline at end of file Modified: trunk/pollen-business/src/main/xmi/pollen.zargo =================================================================== --- trunk/pollen-business/src/main/xmi/pollen.zargo 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/main/xmi/pollen.zargo 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,94 +1,154 @@ -PKΕv<pollen.argo}Tˎ�0��W >�LFU�a�tѪUG�v9pW�1�4�����v2$�����uMe/��B1n��e�Tu'Z�a�T[�!�FB��CSW����)�����C�晼|!���ڞ�@���(<Q�0�M�V�5�� -�F�9F����??��@ -�|�sը�D����A/4 -z��z�`�H�-.�-M�{G�S3*<"C}II�(�i��7��rQ#e3eRy�G�$�Rcޑ�R}���y�A��h�+����aT&U`����z�N��j��8���C�qw���;8b�Z7j�J!D{���y�^v`o;(��Z��+����s����vaF87�1ۜ[f3��C�Kʛ���*����eIJ(�Z���&��b�pږ�o����>쿽�E�h8����[�K`[ڹ��Av��PK-��\��筟�� �}���s�A��^z�2�u�RȞ��pF�X������|��b��wc�N���]�>�5������u/tB�L��O�������̎ۖ�<�PKptB�PKΕv<pollen_DC_Pollen.pgml�]k��6���_�-,�SWE|��:�5�W$�F�i`0T����U�;������D^R�Mˌ,�Lْ�xxyux������t�%�/&�����.�l��&�����?}�/���������?>>^������ۧ���W���_�0J���u�[:_��q��e��&�x�\-��r2��b9_ -��yr��\���Ow�x��__���^^��%�//��/< ��"�<� ���·���yo����c� -��,~I�_����c:�&�������t�����d�m���O�ߒ���D�go�7��_���k�|�<YL����x�H~X,�y�.��&�'�����k2��_��^ȿ=�!^.���2����{������}q����oz�L�|�+?�i:��y�Lv�a��Iʗ���\�8����>��?~�:�|�����+?�ߛ'�e<O�҄\�����8�������n�:-��^�}�9�����=�oF��v\^� -qX������FtU bhHk��mg��e_)�P��7ۛry�5�M����%��`c*#@�H� �d%s���A��Y5�]��,�?��q q�0��4�d�A��ß<�3�Wp�<M�Ż�e<��_侭x�1���7��^L�7���j��<M��z��%3�(�_�e��!���;Y~�˘���y�}�][ǒ���"��_8�P�L��l�5�� ������g��p��f� -���#�y���nw��k<_��߾qs> -7n�N�9Oz�Xn�Թ9�����-����e��:��ok`#n۔�㿳�b��M:?hLF��zwͻ��K�L�i�����3�̶�F������\����~K�fG�%G�,9�\��e�y�-9��K��ɒ˦�钫�S^rE�W�� ���!S4ϺA8@�~J�������������7�xf�2��&5p�wԣ���%]r���Mk��d��6F�v�O� ��7����-��n灪o(T��D�QL� -M��7�8�@~�="�&V� -�41$hb���c+Z�O$k����UhbȢ&&��UM�L:�������'��dnhb�����J�&�\C�&Vu&�L��I�5����@C�5������䔛kk��MLps#37G$���uO+O�0� -zH -�1�ĐmM,g��e�\ל,�����T ��w�m.�Ωb�E��G�EW�G��!@�,B��A��4�WMff -1��k�,D�}�_���k:7T����h����^��4�/��p4����pdܴ�;�{7E�ՠ -)����ЎG/�ل����C~���$��b�`N �=���g�U<n`�a -�T��>�����$��<�4���,���������Pܩx��38�%[��hK�P����Q������Z8C0 �ь�͢��,E3Jf d -n3�̠e>�C�e`d����2r�5�\�e�$C�#�z(#K���0��F��BJ����rnm�X�a�cd��ʉ�m˩�k1��4ӡPS+1u�-�l7��&��Yp���������8��\p�_�\6 -\�m�K�����d���+���X�^�H�HV�@�9G�9�*_X -\H@c@�E���#]��x�z�) ��އ�x?&����9��{��g��E���>TTF� ցk ��P�P'�Q�C=�P��@u�g��K��ډ�����q�L�ɼ�H8�}4|8M��0���V��.0#��ֽ;7���f:M�6�]�ء�s��g�dzt��%]->��d��;Kğ�-� -}���K�S'���x������,V�e#��[M%D7�|��d��F���-'� [97�p"��3� g�o�r�����]V$5���E��w�g�Ze�ӷ��!�o>i��#?�l�5=W�]�2�+)s6���˘+8��sa�P�����_(r6c��<p*c�T2�8�e[*"�rv��]��jKGϘ#�2�D��1w��4��Dʘ+��h5��'̘#R�\F�0��?��Ϙ��d̑JƜ�H�-�ڑt=c�s�a��B[�O�����'t��v�õ��C��9��q��<\yS�v�Z�\e��P$�De����8k��͚[�0�,7��ho��Is��><�r����[�r�T�-���˭z�6g�H9s�5���ϙ�_�3�"]"e�I9O� -����s�d��c���t�Wn#=�T�{������gI�aY�r�I��cJY�N�1T��0I�+%�u�jKG�c�]=�d@6�S9M�m=���1P�8_�z��cP�hؿ��cr�5z��1L�`I�����|����z=������������ �Z=���ÝR����d��� �3G���1�z˪�{���1(btp�����5�����ki��k�Q'P�1�*ը����S -���%/�p�����P�{���C6���t5&������Q|���G%ﹾ���K:J�gZdw�?�M�vn�z��M>I/|���W�������T�G��?���ȇ�d>N���7�}'��>qϷ��K�Β����^�J��&���1�xzZ$��J��u� �����.'�ܑ�ߑ���� ��&��k9�{�i=�F7�Y��z�S��>@/g'��E��P�s�u�}Gq?�������P��aw$l$�ʣ�3��?��n������tg�����l���7��df�]A��Ŏ@�� -�o���]�U���Y{�{�_^�1y�1���D��Ї���p�N���ʲ�[��S,����W�أǁ��N��ф���lǃ@hcY٤S���P�� c@L�b)4��\��ч�����IJ�B���+���G��U}���������x�ר����Z[Z4:XV<��K�C��� �f]��P�_o&Cu���-Ɓf�}eV�lVZp�+Mn]Y}�R � -���+�cA�J�&��J�ޢ��0�o�`} -��)�hZY����}+� -[)2�ue��[Z�c$���Ѻ��E�6�Ʉ"���b/}��hf�س�l�$�w�c;��ձL��e��]�v��v!j%�c���'Vz-�t/����Zح�1�n�1�π�(fн(fC��5��X1̠�1L�3�H��0����y�~�/+-��ˍ��ߏ��K;��p��ɝ�&wDG�*w�?�=�~�,�k���g,X'����$�~l��Y�ז�?h,p�%��h_C��*�;���Ac�Q?�����82����i7�!�]'w��AZyw ��N�`�r#vW$�4`w9�)�?�dͰ��5��k1���i%�s*=-���e��`Rh�� �Ԅ�HZJP��%�Id/E��p�NQ��������Ij�����A�qͣ���7��U��DW�,C�J����nU�)�kV�MW[{9J���!/�VM$%�I^� �y�r���i����U�A�U* -R����c����Z�Њ(�,8����dZY�����)\�2ה.����z�6y-���d��<�lx�iU�Ά Ԥj� -vg�S��g�)N}�ͩ�*9UV6��eU�ll���ɟ.W�D���#�������؉ND��a��kg��� -���gɲ���ٕ����{3X~6H�-73E�$$C��z���1d�X�~� ���Ғ?��w��.:�U�=�H��5�P4��v��M��2a�@�K� �dnȄ�8�0$�:`�(��� s�52!ǿ� -�$�O���I�eB�_���:���hU"�]\���������$��B�ŝR#���)͢2 -�t($��+��b,rL�j������UBi�yPa`���]qS �+�S�*W�g\���k�A&�em�5�L���h���@1�3�5],M�ϡ�z���c�k�9��j������ˡ/+�6�����#t�mB' -�ޭWӮ� -�P�`w�mW�6+ag� iػ��J����r�]-�8�mi�3���p�]-��ط��$خA�s�j1D��_�*�z�+����$X.yE���'���7C��V�e����<�l!晥��A�ʏ�b��E|���u+�I��JGV�8`9���]�����`@��"��z����N!��d�)8�$r�S(����}�s�x'��;��$�Np�]I�������/�n�3sr�'g�*�k-�B䈧��r_C��;iēt.�H�ΦC��>Vn1�x��l�1�o�[d�(�ϵޤx����� -���E�8�b�e��p�Uo��;���8űo5���C�i5x9�)"M����5�Ɍ��'S9�?r�6N���S=��@���'G|�=b�,B����p�k}y��x��|Q4Q��fz�!m���}��Y�i���@�vX6��1��%Y>��=(H5��bEa��~��2�`��9�Ax�l#��GF��1fC�z"aҧ�l���\��iEN/5��f��s1�,;3�B�����Ԛ�. �6ٮK�T��+�ǪFPә�R:��t��8���� ����J�"�n�(�R���K�Y�����@<D�j鹇#�l<��p��zT��E��1�pT����z�k::��r7 -]�p�C�s�����k�;�&j��Z��k�c�r�y�ך�Zk+5t� v���������*�u�z��V4��5��)��vs��^g�[��(���n��6v����]��$H�DY�_�� _N¦y����i�>iv\.� -���u���cƸ%�눽O��2���M�{��XE����q���;w�v�aք*рj�>��p��*&�UT8��S�eSpD�b�XE)���Q@��r�ub��U�+��vز+9�J+R1�"U��H@6ޭ>�E����IB���Hl�!�v҄O�5��*N�ϦC�y��T{�b.T1�B�z��h��t-n���D�JZo�6���6�a]��� -)�`+�2n������ev�gi�FM�s��jDk�>I+�z�nCh�^ˤdO l�p�t�"l<Kg�^��bϖ���kC�hQ�-ܪ��`���MYs�XV��"��>ٮH}���F7��N�3�7�o>Z����&7��8�ֻ��v�i���k��_%p��M�_��~��:��ot���+0ܖ���`;�DL��<��M����>��A� -����䰰�K8���\M"Ɉ�(�ˇ���mڇu�OM�p��CH_�,�k����i�^�kl:��` -@�=��ez�h�U����Y��?���L;t��o���_NƦ�/t��Ѩ�/oN� -n��y�=xqHif{n#/{���e�t�ӉxJ>���l�G��s{O��:���F��^/cاsQ��}��২ ��s�0�*R����|�:���RG��9��t�T'�R"=�������z�$!\oDK�.�W?`�{3ȏUC$�k�EG3�-�v��{�^9���d��.��P�[*}�����({t�=ێ�=dX�e�^��oBk|�ܨ{��!4��0�������=p�+M:�~D�{��H��~M���*8�v�sd�-��s����Vvh�s��9�r�T�i��8:��]�a:T=0�n1.{����ϑ/6�]l��?G��ԠC\lP���ʛ�,���<(���A���kr������?�7{]g8�%��@=�P��O�͑^�m/S��p������[��6�����ц�/��TϹ�$k�s����n6ޯ0��J�Q{U&�)?Yl��$��x��t�LޮGm�3�Nߞ"ِ#~����$r���9��� -9�g��=A�!ǼN��o98����i*� -9��1!u��Ŏ�G�m:G�':�5<� -C -Y-uʱޱQS1��sHY1ܐ���ѹ}&Vz���N�9s�5O���9�y:g�tw�ΙC4 �O�p��M�m�9�:��t�i��J�;Xi����7윌�}2�ws�RD���� g��nNQl�?k�wcRl����&���|�@r����&����� q���&LU:\9��܌��uZ�]>w[�E>��k�����[�]�}6Gϛ��J�H t�j��\���9z�d�>n��ў�5��6��N2�cEeoB�_�r32�ױzv��]1�mg�lN�mH��3�sw{f�t�?o:w�����9��s -�N���sw��p�t���\�m�9�O�Ug���7�f�6M�kx�m����)���xH�?E�]!���{f���]$��q�}�Uz���Nr?s�O���s?��_�M&�4���N�?c�N�e��6�M����/��b��\;�Cm�}�4���ڔ��%4 -Q�2kd�c���[W��������=�m_>�ϬJ���9w�e;��f�y}m�}6��al��k6�.�{.[+/=%��9w�bk�������?� -��m0�$r��5D��5~�^��PK���NIŋPKΕv<pollen.todo�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��q�(��;�D�*���+G���*(�8z)%)J -@% ���,.2���E���9e�)�E�%��� Y,B3PK4�[-m�PKΕv<pollen_profile.profile�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��qq��e��q��ÙPK7Rp:BPKΕv< -pollen.xmi�]k��8��>��5�U=S����ҕɖm쭩��R�L�~ κ��'���q�F`��"1�;����+��{ӫw�����=�(��`���N\w38���샿�l�����z���Ͼ?�����]��>����G�I���n���G��w��O����Cv߇�@4���h<(ڃd�֛/3I���?�f��-�A����l��w7t��0H@���:��(I�]F�0���1�^�#Ll�x�����Oo9�o�����/�F=������B2�/گ�>�1tg�3�a�>��}.�sQ� �C�������/�A����G~ۯ��ʿZ�@�㧯/�cz��C�g���9}۟/;淟Ņ����ӓ�EXH� �$}��#ӦΏ�ݬg�2��\T�sQ�溤ێ��Q�����!py���Y|��Q���������:��;�Ke�{`��?�0)}���Ϗ��'p.�=���U6{�In����_�����o��� -�M3{uŖlS��Q -�v� -�[K� ߝ�>���7��pAN@Ņ���릇$?�^n���~�������x���ݗ�T��T�?��}�N����J¿�>���_?�?`w٧�����q=I�]#Ğj���A�x9QPV��Y�՜oa�|L/�^`/٤��9���1^"WF{�8o-���=�c�8O�"��`� ���6e�u5�7��]��/�Y���SN�m�'?�OG{�;8����[�%��I�'���Y�A��V��|9���|Cy¼��i�j:��� �����" -�P�,5��K�2�� 9FuȗI��1AO��&CQ�|h�� -@G�6���q�����;��g'<����T�& -�w�o �A����}��D;�T�S�ȹ7�����'�-���?�p�ǣ�����D�C��"�^��vD�?��� -p���ڇ�zS����p(�\�g��8/U�ٗ�d�Y3������5���\u��j��^$I� DU7Qz��k���^����K����j��.���?d���X״Ӏ�i���р��#��i��F�l���Ѡ�M,��~j�L^��rp�Ç$����X -@����w�f1n� -{�-��_Qx<Pc7�#$�����s��֦N(�`����?N��-����C�\z��o�n��E�+~oO�.[�OS��V�ȅѳ�>�3tQ�v���O a)m\�kY�,���l�][b>P<MS%eQ�7��������Q�Y̮Du�DI��^�'K�Z�H�z�4��8�P-b��ę���Uu|���U�5%U�4O�dU��J���F��1���B�LA��� -��{���X֟,4�C��@7���/�t��2r�).n����2��Ck�����a�� -�0D:�%��i�'�[����f�9��V�̈�K�3Gqv��=2����mV]�Q33�� -M3W��ơ0�����Y\��UZ_��(rr�0R���-CHt3�F��r��!iZ*:���b������Y���7:��R�4�;��-�L)�o�ܿUjСyk"쓦�̼E�e4C�����t5�ԑ�-Rż)��M;����@�J'�ƫ#S�:�ێA{�� a�'7��Y�'��k��_i�ް���UT�ݲ��x�r�B9G���+7�}�rgke��Vq&1�����0<{{*���R.i�1��Q\\5�!Ռt� }�\;��CfP�!ӹvVn�j��[��n�I2~�f��Z:Nx��'j����Ò"9��ʙwX�0����"���O8��T�C!��k���\,S*����"욪�S&�Z�lol��(.Na-'*H>?] �鐱AR���K��2A��DH6k�X�_s-�W�`���ki�ks�0%���d�!h����Eg��R�o��Y�� �ō��A���Ό���8��[t�1fŬ�v��o��>�� ҉X\���C�N�N�L��ȷ�R�5bڝb��a��Pp8���Pj�ڒѱ�ؼ�� 3�.�t�-_����R��_�e[�EGIq˒�kЊ:�휍�����O��;�# $w$��r�����Um�F<��r{��DҤ(z}��ɟ��'O�3�e�'�ŗ��G�рLf,f�!��a4��5<��('d�bqq`���DS}ɞ���Ig! u����#��`�$и�%� -�|��~(��7���&�,�j�g/���~�IV���e�1��Rʉ�Rr+"�`�&�@�F��ˮ-��c��j���#�q]G�#2��� ���&5���Y��f#���ُZ'����>�$�䪒�TpƟ0N{��������v�7��s�:��)�̗�A\����e��'N����ȑ�#G�7I0E�K�h���ښ�*�.I:�N���E���G�C�%�g0Rx���O��8?A�UQ� ���y�d밦���q�Av��:K����YS��l��o;(5`M��z�]�R�Aʟ"�����ob��{�j�+*Pm�h�0EA3LAE��E���I���t�b�Y��$�|Rj���т0��R�$��\��8#�JV�����\ �����`�sL�+�e:n�D��C� -IB�X�c)��/���$b��q�.H���J -n��Dz�BcN�M4N�B21�#ON*5�T�> -���0�_�)瞐Ju<��5FV�|�\�V3A7]�Iqж0���$���G�|���/��^��P��9��{���]Ύq�'ZcO$lFc���7?� -S�#��o��J -X[+�f�ƺɉ���L�F��� ��\j0uhܼ��؉�C6�9 -`���=L��TjpC4�:�O��,I0 �MG��V���뼃��`�-�h��t��!��X����� ��G��i�-����p3��b�@�7���u��ؤy��R�Jc�l��H�:d�lR��Xv�� -qA�t9��f��d)|���$R��.����^\���cg����c:�0�r^:�D�*�� ��YjpC�g$���� N�,]w��F>܌ϐH�#���S J -n�^ᖀ$��32������̍���W�� �<'�x�b�<ˠ�����h�@:����o�v�U��8 0Leܲ�)2�w3���Pq��B��Qv����~��:a* �d@��A�� -�Aɕ���j64���Fb���f���R@J7c( w�H&@J(5�92�kh�@5TGTR�J�1*���� -͍U�`�!��f4"�Y� �xUjp�y�t��WQ&��H<� �R�ڐ@4ӎ���_~L�*.�L�L9&��K -����Ƨ���R2٘ �4.5`�h*gc��}��r60���?��q�PԦu��B�%��8��iRf��jBq�����\6dG����@�#����Y0�:|���/�.E�ϵ�˵��MIr��?DC����o]� �N�緲`�t��6�Ar�c�kG��$��sڪ��@�Liz��i��1N��$�xGq���w3��dR7L�Ve3�Ay����q��9a��|����@lj=���C���]��8�4i�p=V�]_�&��`ϒ�n�X�C�j7"����\8a@'�c��ܼ �N�Ҙ��s$���<��� s�-:�3@#F~���9�߲=h`������ h���kg`Y�#����3@02R{�'Q�Q�68� !�`��+���q�Z��%'<�F~I�:��,�w�r�*��(�m?.�dι#�: �T��Y*w���HJ��*a���ޤ� -���:r'W|[��!~��:��!��� -�-Nxre73��c�MOrm��^�.)H�6��ޤ�m%��7"�@���4�S3J6[�yh]k��*�M[E#�g�2�ڙVq2��#�~0�{#�������$n:����x0@��L��'����rj% �N�{O<9�,0H�*/�I��ʭ�v䉺�|&�o��\��9�=��,8ߔv�7���� -�Hq# -d��ۿ��:X�ĩ�����9�5��ƵN��+�3���:2���i����53K1� -M3��d�5$ϒ����W�8�t0��i�����t�b������Yj�B����e7I����o�o�M�#�猬"mT����%2��mߗV۾ -� -����Lr.���֤�B�;���[lX`�R\܌C�q���L����S[~����W�^Zug -�Gڍ��#R\\-��Z6���R�H������㩪�u��St�8��غb�MF[#CV<(�5�i����7y'K��\���m�<G�I'��S�ˍ�"�RS]C�L�̙F6T�T$�wк��e�W�/py�$kQ����Aqq�؛Hv؊F}�ĆG*�J�A�"f�g3p�O!K������ˮ-��-D�Je=���o^�Ð]\�c);�,]��Ԓ����uK�g/��(.���v��c�*���EV��}>���]���pٽ�+g���1j��U(o)��ӻ��vM�{�B��t(�&8>�(���x�]��������࿀�=?�_)��$R%]L�s�RC��"�/�����`��o��K�p5���ٺm����-[/frn{L�xu[�X;�m��ӷm�q�A���9��O_1Q����t�_��>�@�>��Q�?�����3M��� -�X�����cMOr!;���w+��h>'��=-�4�a���ܱ �l�s�{���)E�I����rgE�<�CJ�� -�?!JF�B?�7�3F[o���7}VԲ���?h��mX�l^�AW���J/.���~ճЬ��i�}�Π@v:Rvu���d�_�M�Az�(ԑ��♛k�.��O�#�j��#A�]��Zj��XK�Z -Rv���nG��V����#5�bR�d��¼:m)_Z +PKۄw<pollen.argo�TKn�0��� �AQt!kcwѢA��]��$=�~�'�=z��"mRv�E61�g��ޣ8���D6�T(�u�1�ﲬ��1M�Eb1bt/�@8�U�,R8Av����B}_<|*VUyZ{��j$��Z�y��`,p�Z�@k:��9F�ΐ�ߏ߲U�*��A����iT���*���Aƀ}.��H� +�����&�^Qqׄ +��P�F4J�aG�ͅx�G9����0�|�G�(�R��D4J�q\��בW$�&^)���4��d +\����QK,�zB��T���ݡ+��{��G��1����B�v������3��'(��<�W��Ճ��Ų��)L��>v�$B�l'P$�$��XGx�6nx�I +�"�~$��z �:������ͯ���S������L�B~�����~��!���ƴ��7�EqRz�K�g��= +Ǿ�o�8{��������W�p" +��[�Bv�{�g���P�Uhv�~�F ��¾�k�5/��&B����� +�w��T�m��.�m���ShA�+�n�C�$�qPZȣ��a�,�i��w�PKZ�949PKۄw<pollen_Modèle.pgml�]�n�F�ߧ���"�3�k�p�dQ�i��E��IZ� +�r��>оǾ�)���CrFQEٮ$R�|���7��������1X,�x~q�ε�I0�b?��.�>�=��&?^~��o/�~���W�������z39K����F��������������]���(���l�ޟ/7 �.���KV��|�x��u�.�/���gj�өmO�1�" +O-l�x�t�"��qoo��S[Ӵ�Z��B3Ͼ�d��{\������7 +ξ��/?�-������L�^�����}�?2𓉮�O&� �?���M�>���& +.n�h<[&�"��/��0�t�=��������B���37I��* �/���n�^����=���0���+Ͻ8�g���$�ߠˎ� +ʗ�_�\|��_�[����ᣛ�g?T��_[^��gQP�y.���/QH�O�\�Ql��>�~rG/ �����]B_r��%feuۮK���.k2�a�V��Di�7�r]X�#�H^��?K��N��� ����%U�s +�Q�:%@�p����%u��EׯXr݊s���I��Iu�]a������c�uh"�L���s�鷠�9�gūa�F�wq�ٶ��8���^��NA-��_�eކ���0���n��ۗ�Fɳ�}5L�|;����?���5,�n�<a���`L��zc��;Tےz�!�A��!��|Gѕ�ūyR��p%���p��?n�����H��_ߘ9�3��^�9�{�Pf���9����åU�<f.�5�u����z��bSnSR�����A�6�b�5 ��������c�ļq0�{�p���"�P���A���r�n[�*'����mk�,�s�{No��%��*���o:�D6]*�MW��������6��ɦ q4��NS�=�h?�I.�?����w���ge +�L�q64��\�)��(��4�چ,� ܻa$��т4�U�1���������B��+�{� +��5�дQ�S�]�>�S�o�8 +�y+�V�&���u +�c�/)�h��i��n����� ��<���WK �vZ�vX��=|��p��HWϲ��+��S����O��q��B�c���0^P#a"MO��ړ &�6�q���� +!&L��%m��2�D���FUm:x�)1*�4LT��w�a"�d���)C?�Di�����D�a"Ą��Ƅ�QoL�&��a"�:L��9l�����2s]��&b��H������^k4�0QY�8�<ք��4z�S Y�5�:��)&}\����}�tE?��w�SM)�=}��~�/g�G�2�g8[���Fȿ"��G�X�g� 40�CG���E�jl_*Y�W������:V#L��[�'�/�*s7�c��i��n��w��/��ڱh;�^�hoо +���)"w,�� ��G�S�#Wm6xǢ +8j���m���w,���1�"�:�t��$4��߱h�fC��x�ϵh�'!&�� �]<��g�x�; +�mz^$���p��b� +'�J8�Tc�������DQ�����IXY4�Q �����{L�\0��Y���_R�~Ē0K"lő��7c:��$�P���CR8�� +��#I���)��Ն�2�fe~�ԶY�W��+7*�"H�m� /*d۬�}];Q��H���������&pK�s�#N*�S?����?�I�U�e<��F"��T�Y�k���o+���%�"���f9NWl�[a+��E@������K����,6m^��II���˥�hkc�a��I�16l�*��_c���Q�T�c�c����X*I>V�����!m^x��X�=��O1�fa6�dk�U��I�D�1̅�9�1������ǻ�9:��H~�7�,�� �h���� xL(#.��Ռ��k�3B�A�}��f�m�lCf������k#�� +E;�J�`;�`�`����d`{Q�|a�=�4���6[#�ހ�����_EQ�Iv6��Nx�c�����=�6�}����� +0����|�4M������������[�\E����Lӂ��C�0����+��;��|�4@��x��p��\����O���6!E?Ab���N �|&��Q�����6u'��CE�<�H7�8-�+���atzH�i9�uk�4�dO�Hx�.y� Z�'O[(mDmᴛJ�t�'O�)���\��g �.�|m�߫�iRI��PY��"_,?dج.�� +t�<M�%O� +Ԛ<���{�<M��i�\���W�~$O.y�B�Y�ha!�5&Og�7$O�J�4cH���zC2�����>M�hʟ&j�3�f��Ƽ�j�Լu��C��iּY&PR ��c�i C˟�H��FM��M�[��4� r���f������8n��:�v3����W�ݨ4d�[���8¥����sKkt7���K�4"���q8c`0 +s�3��57��.I�C[�*�<�lww��ŋ����K���;�W!j��\�^���߾/�(6�>&zm�Zx��x��/�z����[�*��}��_b�� +�w���%�݈����9TH�Tl��g�yx��p}i�o���D?�-]z�ڄ��Y�3�7{OU<�9�\�i,ԉ�{d;)m.����-no�Aj�*��u�Y��7�( �)�/`J�"���Nz�{�h���W�y�T-رd�+�G�"�P���mV���S���2@DR̡�9�_z�������_ѧ�q�k�j�kM�y7����JV.�syq�m�x�Z*�5��O&F����O�������h7����L����g��WJ=�UpӨ��]ƌ�l���Z~Z0�Go��3¨OCpswq�<�i�CF��/vU + E�Gh��g���h�Ш�1��!��4�#F�f�D�zh��"x��[U�@�M턑�����1pM��� +\W��/�8ӄj�\��E[��7+R`�Qm�܌�z�pp�P<�"c���lN��o6n��&L(�l6��獡�6�6[* +��V��1�i��,8mu�����r���-)~�� +$��-)N0���?�(�x�Di�,X��7��&4֬d�/�9�?(i����,��f�R8$8���v�$|$�6����HhT������^l�l�k�j�b��}���ps��$ �:]A�۳�$�b{*I�����z"���V�Ϧ����g����WE0Eu~�Ϗ0��#p������{�1lf$?bO�r���F��I�� d�`�4 ��q �UgD��Ɉ�� +`*�f2ā�W�a�=h���s,8[PD�r�<���+�q(��w�[��)}Ͷ�}�+#��0~�8m'��#��AѸ���=F㬡�8I�_��8MȪb,���i�r�U�8kh4N� +V��a]��8��+�qV�y��j�:��y_�z!"W����I�u���z�n����$��.�E�Jh���z +_n���p���y�[]�F}�%�����V���S�XU�R�~$��|��rP��'Z�o��jW{�T�H�;SoF��кn�ٔ�j+nՓuY�**�eU`ۺJ���F=�m3�^ٶc��C�e�H��F]琺�<T�^ט�j+nԓ �l6[S��o6�MK$L(��l�l�c-��n��Ґ�l�[sYm�M� +<��&�`.k +�X*�ͷ�aq��B�q��h��j6ߨ�����zlR��{�&�v�S�WEwIh�TکG�L0���6|�C.������F/�3����B�y�+�,8É_� +�H��]<�f�p"P�t���t�@�P&F�2�y8(�e:_i,S��egb�r�Pfi��ђ�^��i�Ii�))�rW���� mz� +���)V�q��4��`h�N�p:�=)��t�_5�������+eyiR����\i}'sk=�u�&3 +��hH���8�+�\VN����.TN���ӥr�1��c�ŧD�����"~�T���5G�+��G.'.�):�T�~�N��!�~jD��9K���I@G�f��ϡ��9�3�Y�ӺJvږ���j�"�}�������"����ӡ���(�E��ı��7X����.�+*Ccpo�c�]@�]R��,��o94E�T�bpo�c�J�.i���}e���Y��x8�4O.أ��F�{�XSnZҵyK�SH�0��.#r,��ö� !� ��'�8uO��Ue*"��T��Ř�vI��o�4�%6����+SQV���T�����u]j�%SOb���V�R�~�f�@�:�� +[P��X�*]�J�/��2f��%QoF�^��1NS)�J+Sצ�q6� +�ƴuU)��f��h4mx?ӶW�\��A��U�����V��Tx�C���b�Hܨ�� +1��N��;����͗��� +-�r.zb��</^͓�����xc�0���"�ݳ�����o��a��Y|����D8[�i�=ː�{�{��[%�+��mЇ��|t�UZH�ǫfN^[-%E�\L��p�]-e�vYj�͂�+�V��r��9#�Co�}����6z��$��Hf�i�ʼ~�&�_��6#F*�2뺝RJѺib����ܱ��Vg2�z�.�m[N������j���t���oG!?�Y-p�T�z�G!?�Y�f@���Q����:���#v.�z;2tG�o�r%��B��3�FLcc�T��7n���q̬q������7�Y��$6�92e]�-�=����͆�f�AM���X���J5B���-����1�n6��7[�f�?����Y��ղ��͗���a�I3��֪�sk3��n����] +�[o�[�{��n����Z����aѡ�� �T%Ea%��\��P��U��aXUw,�8\ӓ��T��=�� ��5�Y\h�3U�@y�����JB� +��w=�TU����z�����61!fM;*���\Dz��Ê���@�cX��P��q�Ō� Ob-�{����(Vd��� +�Q�2�+g�=��mճ�q����_���?3j�|9q�&:G_��G���PK����PKۄw<pollen_Services.pgml�\�o�8�����ԤB ]�i��Ӥ}��!M��D�!���������K�d�.tJZcx��_���/|e +��`�=�����. +�q���ku�7���/�L��}=W��������'�� +=���"���� ђĽ���١�W�����B{ы�M��WDCV!�P���ǩoG���Ϳ�A�۵�.0�]�j]S3o}`�g�9�g3�k��z�ީ�Α���;�0\#F�� �y!^-�K�S7���洗���v��Z�Dac��?����M�7(B�>�l?��#�b�7ލ��x C�=7�4��Ú��}�!�Q�4��v��8V����l`�3��T���!ߧ}���q8����F +�?`�iR�6��m��4�/��!Z����R1��C���a��^F�����7��b��d>�Px75s��9�m�YuVm�R�U��45��;�������e���˲����B����'ZB���zh&i�2��)�uă�� +��E���^��,�7X`o���/PK�'e#@��l�!0B��VF�M�P���+3з�Ӱ����GθOay�-�]�����B�^E͐c'#d +ٜ��<y���63�+�V���u']���W[�=JB���i<饅*�ٓ���aɄ����i�B����;I_��墈��(�%[L�bi�dA����,@t�����W,��Ĵ�� +����<��ebي�Ӟ��.ug�V,�įl�cg��V65 +����h�א�* e2r�
-��B�賨�E�����A~����[��X9�Q�];�)�� �%�k�zmQ!�5��ϢAsY����gm�F�A|�*'r� -�Ɍ�� -���^*֎�2��ۊ4�o˪��ه�BcU|}D7�Q�]V�� -�m˪ն�Boޢ�6\V�x��Q����%b�/?�&����h�?K`��b�T?���'�T�Obs��D7Kd�p�D�Kd��gI�۲*>|��Ī�Ԓ�KL�A1vb9r*�z���!����/���O�BwVк�ˇBC��R����3�:dD��P�7P��Mi%?*L�U��B���R��M��J�ҫ2��4*4g�U��F�i��]���h��2����[<L*�~�u���"�a�j��TL^��dkI��]�:y�4��ZK��{�1U�S|T�\�׳t).�%��j֊�p� -�bO?����:V�Zk*��kV��k*V�5�<,��P�u���Bq��+/��P!��������="#3 �N�2�08Ҥ.jD��( �V��ê��@�M�[�_.J��5����p1P���¦��斒 -A�U���V`Tt��%D��z�る��T\�}$Z�b�$�v/�ݸ��NM BlZ[��.JrB1a�}��q1P�ƅ�GN -.t�e�EG�2���L�,%�v9�N+˓���� -\�/%~;|���ࠠ*x�pP�'�X{�0��T�^���ۋ����$��R�qPP������U �8���#�AAU��2ypP����%>/��i�I!{�a����\sI~�Ֆr�Z2��@�2`A��#+ �]2��H�����OM~Xk�R�Z��]���3Sbofv�#�}���N}q$�Ϟ�ѩ��������`���A��c� $����߿�gP'3����9���6�nVD���m"y�i����L��� rz���k�@�0k��)��J/�{C��G�^�ҡg**�DI�TOV�QO:=ɒ���]�0�3=1P��h���S��no������N$0H������O�PK�F&$��PKΕv<ptB�pollen.argoPKΕv<���NIŋGpollen_DC_Pollen.pgmlPKΕv<4�[-m��pollen.todoPKΕv<7Rp:Bypollen_profile.profilePKΕv<�F&$�� -�pollen.xmiPK1�4 \ No newline at end of file +�������ؠWcC���'u�{ԝ;�� +�dz�|�wl�:�M9S�s�l]��_�`�8�K��������Gg��V@��F�k��G�7��6-``��3�WKw�R�u��������nJa7D�����Bn������[�s�sL7b�N������?��o�~��-�1�I���g�L�1݅D8H�����U@��;0�K��?@"�q�P�O@'��dth@0.�v\�t�?C���؈I���R�/I����H���&�����v��}�ror?����Pv�BCE=Fz0 �<�X�GҔ�VX��#C��Æ�?VA@��^���5�-}�Q�� ��y�p��xE�(5��B��!S�͵f +2��e*ej���7*���!���֠����-�v܌B�6��4�P�̂8H +�Zm���y�L�0��1�}�Z,��}�\Q��(�5Ŗ{�nD>��u���E7Y� +�/P�s�BU>���H�(��o�E&�F�,���e>`g2����H�s�un�g�|��)�_'�(����N�3(�-fXъN���T�N�SE����M�JR��Pɬ}Z��i}�n�>q<��x/%��,���>Հ"�JI���>����)�Pf�F���X�-R���>�3� +\��+=�i`���(Ȏ�O�v��|0]8�y$fWEAUF�|�Pt���g�3�Gs5��q4�����c��ٶrD�=y� � a�7��i���j�8b~dC��<Lb>�;�H&mL9� ,��H�^1�>�zF +p�"�K�6�Ӑ��m J �TAXhU� t����8D OH?%<��R�!b�VN��ӵ�����Sb���V���%�[��"��N���D<�����9�� +�N��O09�PKF;�!��@PKۄw<pollen_Diagrammedeclasses.pgml�Zko�H��_�VU*��c0� PuIZEj���T�V�ʘ���a��G��w��/HC[Ԅ����9w�̽a��n�K7���.G2ꨲ�����7����(�,��8�0��tq&��tyu�^��Mg�g2�f8t x4e^�f]A'q͈�1{� �͉�o����+�;+ҹ~�n��ax���M���4�+ +R5�Ќ�������5,�úb��:P�Ծ| E����#yB��q�`���*�[�OM�~���,�����G�I��jꑄt�s`��G���G���$�����$�v���3[<7L:�������a��EU�)�5u5��ɜ�ڷp +>i(��%�s��S6�o�g���ﺶĝ���|M�y0rcs�n�6�n/=��d܍d=e�>sKf|>���2�ěsx5�HL%���J�R����*i�.�u�q�L9~:$[��:d.�(ߊ)K�c|�M���d��]Gx� �e�+���7��2�KP +�� ȅ���*7;\�o��i,�'BX�N��F� ��2k���N�qB�� I/_��d�dPb�z��p�'�H�d,3O�?���!�*�2����8�z�L��ͤy���'�"�������XL��I��2��� +bt7+���މ�0mº�Z�kP�ø���}�����Q�f�=D�>�[ք.��<?R6KO�mo�M��~��uۥ�ʭ�Vi{��m%����Kы��g3h8��B�O��(X({�O[��8�3\��i��"0�'�x@��7������nGk���MN5j"�,��[���S}j�@�\��s�Dw�@z~<h��%o(��E���n� +F�� +�$B�n�s�g������q���0�0����3�g�&2n~�_���)i<\rF��F&��L�$3���,s;�)�>���0Z�0j�V��=A*`Qwܗu��F�V��Z@�U�zO��cpb>�\#�_|i·kӏ������m[V���*�ѡ9���44[�����,HDM���{GRk��I:�^�fQ�6۳�Qd��(x�Q���Y���l1rvT��q���YT)��������j�GuU��=�X�5�gԯ; ?�g��<� +�٢�dL4�ȓ�Ϟ/�Zem�Z��Rm$tY��i��t?�V�*�ڲ�8�I�����w+�X(��P����CZ뵨R��D�V���5��S�^�aխU�������R�ǟ>^ +�!��5�/a���k���ӝ� +З���2oY��A�o���c=l�Y)��� +�dE�0 +�2�����[8�>��5Ѻk�0�9�{�G�m�����| +fx���WGM��[`y�V>������*�w���P���ai�,�*Z��b4s�1v<�v�C�1 +^� �?j���ݺU�V{y���WoS�l�H:���?>�PK9ܜ='PKۄw<pollen.todo�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��q�(��;�D�*���+G���*(�8z)%)J +@% ���,.2���E���9e�)�E�%��� Y,B3PK4�[-m�PKۄw<pollen_profile.profile�����Q(K-*���S�UP2�3PRH�K�O��K ����Z()��qq��e��q��ÙPK7Rp:BPKۄw< +pollen.xmi�]�㶕��M���H�S�ؙ�Z�k��wo�� R3�H-I���V��HQMJ��(AI��x?�?���Α��؞+�EzP��]ӳlw����q5�<H}��O����eg3������?�����Co��.��`L8D?>H����n��}<@�W�K�&)���䵡K��GI����7��_7|����I:�my�a�������������[���!�Cx�5n a��۷Q��x�`��U�7鑿����Cu2T�� ����%�g�iB��-��1PTI����+��������?K��_�ר�ҟ��[�D/�"4�i=:R��|�F�mzb��2Կ}�&~ґ� GM� +�s��D]_�zz�m����`2(�`���`��צ6�n��l6�׃�,˯���Q=ه���s�>Hv�aM{c��x�O��������@�y���D;����f��i�N�X:3m��Z���F�f_~!y:ţ���z�n��LFk@&X]�����R� ߤ�1�@bBա�ӫ���~�g�4Y����=�p}�a�|�|x����,)����U�I�F��"�gZ��g��0����**H�e7���&h�n��T77���cz:�5��|�|���<Do�ï4�:�J��peW�����A@Xو�`���%+�H���ԲL�$����!��v̟<�Dd#�����֎m2��2[�fh?C2�NL�,�,�.%���éAVD^�`�6��� +��Ԉ�Ȇ�����O��"B�� <�y���зׇ���#Lt}-��>�d0&�=��OGz�����7^����Gϰ]���Ŵ���-/O�p�cB�oax��K��f�?��g�Yż�Nh����nɢI5���S"}�W +}<ؼ��q�k ��&"�8�g�$�G?H��>����}"�͠.[���d����:�Q��A�H5EJ��S��)I R�ɜ̨��ӫ�|7-��E�o����=�oTl���7 +^��#��"�Ǔ��Z�AR�e���)~����\�ZGJu��dṟ0gӜ� +�"�����q��?���V��+cZl4?��aύ�����Yx� +R��k���5��U�R�i4���B3�6�o�t�F�$� +�ܿ���z?�-��7�Z�ׁ�և��CMo��;,�K +w�\��2��]FV9�ed���L�f�us]�S��I�y��Ԣ���<R��cA\!W�d��:Z��{�@1�(j��-Rл�[ĉ�6�J�EK +%�,/�t�rf��� +��RE��̳��Ȩ�j��a���`�Ρ|^���ֺ_�+Gیr��(�7��B/�"��?"����E7���=�G����C�m�����"+O�4(Yi$Hw�!$`p1�s�rH`�3��O��G'|{���r�p��a�������/{A6����M!qC8%7�w�=+Z�ʰ�Uy]�v��z�Q�kg�}~%Cǜ�ނ��J>���?�M��������!>�$�����7(jO��}4|����0����u�TL�=�S ��w���.P��烎���Ө�����/�o2��>s�pʟ�/2g8ϜyY�eM�`db���d�o,2����i���gD��n����m7��ѭb�T"�{ĚϞljs,,}��)R�G@��Qh-nl?߉�9Z��o2R(L�L�{���y���<�D�!2�3n4��MÌ��Z�t˜�$��Ia�X$�P3t�~蘒@:�t�߸��� � 0�k�k�Z]b���P��L?,]v#�����p����PX!��ΰ�Ҁ���3z*�Css^̊Ac!����Z�g����%}���d@������0��\����5�o�?\�8�ae�a*�u��#|϶���=�SR�z����rNr�&��CDSa��?l�J�,D���rj\��<���J��Z�09D}9=9q�U�+���:�L=�-�F܄J��.'�k3���0��[&�7>#�zpD�}n�h��}���#|u�"�&S� �S���U�7��U�����,f"�1�L��*�5֡Љ�',�n�h9k�_�B'��G��x0%�Ej +�t+&ԦЌ��B�C_OT5�0Y �p��w�i���Uw�Ae"Ѣx��P�~�q�ֲ���v�hh�ڦϝ�F�w�tP@�F�t9�?���{������4.�Z��p�X0O-̵���z +��WPbRF;>y�H��j�w�0� 4Hw����ܫ�:0�+D���K"��0�t�0������hS�C�6��şhE$��!K��]��;��%�D�A\�~-[u�a��=����@#�7�j�D$y�F��f����ß +�pk��M�L�� ��������f!Pf"E1�L��̚�TX�-B������6k���(�e:4�k�A�X���6˾��(J�e:�0ޕ�_bK���~�����_�JG��25ӡ��/3�҃TX��t���S�Y8�Uѧ���/�7X��z�Ya���3˚9x]�#����x�QAuEA��� �� +�UF��`DZi(�9�� Nw��������m�0)�2n�� �Y�(xSg�+���G@@o! �'h㑮ET+����P��W��@,��a�X�@���6���D�7�Ȑ4�b���>Z#�Z60=7��RX��fL&�=�$��'!ڮ�����C,��}W`}��kR{?�AZ{V�ҋp�� �%��*����#�u����fM>�]X�����7� 11�ͺ^L��^�7�=1�dž2�om��z�q9��l x�B8Ǘ%��V�_;� +�t�� +��P�Z���F O��B��@�S��p�P�N�P��j7�hS(r�3z��ܞ�(�.Q�┉&���[s.��_Г[s%���-ݚ��9�����9�Rz���+���&Cܛ��FMP�@GP8� �� x�2!�U��larr��<�6��a�uܹ�/~��F�b�v�.7�E@bI�&'�Xm>���»f��h�0��؞���M�}�қf ��]�1��6�Lhj�G��Md�0���վy�����`��|��|���&:��L�.Cr��ea�I�0���D��y�Ž��D�ܓL��-��t��k��L +bRQ����;�}g��r������(��g:�dN�x2�ֆ6�r6Ӎ9�Mr�ra28�O��0���n2Ѫ�'�2���aG�3�s��5y��$�Ac0����34=ׅf�K2�x�Z���(R��;�lo1�E��@�[з�-�&�wh���[nOOt=�=17W��l�/�O�t�1֑Sk���e�*�*��~�4*�U�� +N�*��u� �RN%i���Q�=pC6leqY�_� �ԣ=� ƪ�ĊD�J�������{���wdZ���el�(Ӎj����D�^�Y�Ȟ�X�:�.�l:.��$-+�jL�y.���Z�Љ�c��^5*j���£$�'w���ZOcA�G���\�(1Zq��jek�9�p��:�M���a0�PKz��Q�(\�jd=��� l�Q'([��j���B�U�&D�H��؍��o����� $��I>D��~����j�K[ܯ:�hB8{���%�ՒE����m(�B!k�l�w��P�\}��@��(1����{��J +$G��]�k�0�cЭ�w�s�Lфvv�Ihg��0�!���B�.���'�4�Ѣ1-��H9�:�/�'� +[Kq���Q��T��ܚ]��s� +P��b��#t�>�2����֭��g�ղnP���-�'O�SF�e-x�:�r������v�P;C眣��[������� +���[A-�ia���!7,�W�0�挨YҲ��ɭ"�EV��n�E�{� +��ɻ �D�R�"M��/�qʵ�K~�I5���;��"����&c�:}"a�&���%=����D +{4y"��k�n����Xk2��?��a/�T,��`,�D'V��G��C3�M��XDk���B8�n��B�T|��ʤ ��ܫ@ޮ�� +DT�f��=�9Q�L�~E5�*�� w�&b9���K�$8a���H��؍�] ���e��*��e��� +� �1ˢ&�F���C��aw��Ty�y�3���خ}o�����z�n�ZU&�� +"���jI��3��rP -�Y�1,��"���YYi"�e� +����D�_�L��٢;b@~-���LI����*�e����s����U=���*.���H͇BE����N��sE4��H�����l{��/0��}f�@�w���;bȔ�ޜ0��-d�I�M�TS9_Z^��'��ɹE����$�'yc���ic0�V�������G���'χ���s�c�e����&v�~� +����f7_����k�x�ԉ�Ce~ +�/b� ��|<�X}�<$�S��8���Ac���Vcr�F���M���T�@��E݀�i�ˎ�ό�;+�|-9UH��l8���C� W=�Q �~��|k:�.�<ۭ1��di/����\~�{)ϭ:D�� +!��8w�r^-�� ���e]0 +I�Y'^��B��Ό4� +{8�G�P��s���\�Yj��٥I���gۤ_f8,�w�X�#���J^䦏�G��;��7�0Nè�pQU� ������c'�#����6���;�t�rsp���s{���>p]���-ؑ.rM!��-[����� +��������d,5�>"�Q�p�2�~Xశ����X8ϽS`�M`!���)�)�L&��=q�=`'���e��{�I`� +`�"�5��@���ʹ�j��larJ]� {���0�قZa�Za���KZ��-̽H@`�-`��hY���'/��4lC�(8��9-[�b�1=9�QV��Ún4�}6xG�E���N��π�����Ȑtbo�ea+s����V��O���ݥ=�+�@D�aN�����J��#��E�4�(��^�M�R�봅!v�<?�م�� +*<g< XT�J�Oo��q��n��Ũ�Lᝌg���1:{+��|#c�qy�GB�"Fw���?���n��Oh$LsR��+�Բ��W��{4 �ǯ�"��vď�ߞ�_�3C�=���C$&}�F�)#�z~�hG���WD�~z�ubNhzf����( +�#��÷���2'�_�������k��豦Px�p�_� -I����]M���{���$O�QzrD� �濔&�5�e5��^�S�ó3�]yޤ�"�_VC��8�>.{+��V��V<�����[����Ԏ��;�N�6���(���#}�|��S��* +�Ow��p{r�sp���3�+�eDT� +�P�2���L����-��Xx�X�VB��������� +JM�29�qE��#���e������RU!z����{9�'N�&jga���_�I�_�iRD�~m��i�D��7[@ �q~��b��PI�7����KS���Q�R�� +<{��8��R`�T��2�x��]�D_�����BVBi�CRZ�/���W#�D��QQ�"5 +[4�Ԟ�j� + +��� +��wpCQ�W�2�ޡ�{����u<��.��ئ��<�n�Uɚz���D��$,|u6����:���x�vh>y>� +��>X�d+3�U&�����u�s%.B� ~�F�xl�� �x�M��yEh�I$�!덺Gc]�<�����C�����m�,RM�y�s�X���p��6����~\?�X!�n��;py�����u���n�l[w����6�x ��ɕ�'(���Ih�g[z?�ߥ��ǽ�ۆ?&_ +��eIx>B�����:>�c������\��B4�0����F_:��mL� �� +��yu�&����ʒ +�j��۵Sw���.t�s��]�L��X�8 +K�sc�FuӅ��{�F�A�'���a"���Շ��<���H�@j���Nˀh�W��t���-z%����ҩ9�Q�MFomښ���*�Qe��q�u�r����:U�xB%os�v���z�g�q�5��=�D��ۡ&p�����\��6`�����c�H��� �'̘2ҿ��� ��i_��dW��=�I��,-�ӓN�d��������';���-Yґ�����c�/�le+����?w�J[���Gy��W��vS��>�o��y\�um�����C�f���5��;�����3��[���jB9:x��5�����Յ]W�qJ�&݄&�?3�{e��w��E�ҭ�os�W�����rk�;^��#'�俠�P(q7�ĉ����ķtb����� +�o�sO�։�?C�K���J��]���oߵ�3��6�����������HG�e"a�r,jߵ����1��~����4�{��ԍq6�oB�+��Z���a�դٙu�7jVgDaM�'��U�"�lt�V�G��Î-��m�� ��$ۍ�"3� ��&͋�+�w�X��<�n�"��e"vf����}��G}�ʹU�f�(�Ѡ��GnU.����ʾ0=�ܨ��(�L�_- �m�־�;�q��DJ�z�b|Ƕ�$!�= +:e +�0�m�)-���\ɽ�j�S�P��(�RF�I�z�▗VC"E D�JH+JHn�v�J��h/���x�%\;α��[�(J/��1�"���ԭQ�H�� +QԞC�9����<��Ҕ�bw +����Z�[���:<�ra�bo'�y���!�k���ꆏ3��ݞ�,�U�4�އ�Ȼ?���N�i�GV�kI���wp�:�x_v�]Q NJ<����y? \1V��֊&�>?��S�ԓ�P�/�Y\������rt����އ��>=�+��~z��(����ʷ|�sU>w��S�*�������� t�����ۋ +�WT`��� +�����E&r:���k�\�ˈ�k���oN܋yAlsƯ�6g,+*�Z]�u�p�W�`��;<���g�״���s��0O7����g�co^/x� +�}� �%�3�����.)�Nh�9A�',�_S?_9�ٞM�a�w�g���������u��HDO���~�;!W��~��r�U�B˳�F��� +��T]XY���X�8Wx �$�-#�D+���`X��R��s:H��_�1*����&��������4VT�2b�b~Z��L#�� ��Ix��m����4|ĴS����h�i�%��V��zb��:�c�M-�$�-/�u.6V��-�Y��݄ޕ/�vx�ˢ��f*@S#�!T� +��ըN�e���)�M�*0𮇯���H���Dk +�]u�\�^bF��Љ�Sy��j�9�V���&K{ �b>k�h����-��kBK���c����Z- +v*xQ�诐���E?���������yO��9��7���1�/�`��o���2��%�N8�o��)��*������r��i=�;�c.�7��r�w丗�g�J�}���ͫ&�}�T��ʾ&��T�]V=`V۪�Vۊ�yE��z�j�[OO�������w����x����S��B�b�)�]~����~���m���p[(<(/��N��*s��U_�ǃ�t���g�P�KL�����4vʹ�<��\^��C��B-�|9�΅u?������B/�?N�7�}����΅�@/w�� +~\�z_�.:nӅ^�6�}[��ӈ�bą�<��e�����v��/_Lz/_L��I_�xL�p�M˽V�����Ǵ�F���4�e1�Bxg}�i��y�MLU�d.�Yy�.�����2�i��p�#9Ş�{���x��1��[?~���;���ł�P����K�s��,�;oط�}�g�ߣ� {Lt�x,4ך��D@W�Zg@��T'� �*QMX�4pbSЖ�kGK'nx�_M�s�4p��ђ�A!�'�h��uϺ��S�qP�/��k�- +��ZВ�D�- +��YP��Hr7- +�ĺZM F�iM��&B<�4p�JI��Dh��N۴d7��BK��2���`�0��Ml#N� �r��V�g��5�zs�4Tpⷣ'��\*���!���]4T�����S�\H��W�mDg������&��R�i���#EM����g4Tp�OCxsyd4Tp�GFCxs�<4Tt|��%>�Y�t +F&"y�M&}c��Y�s�eyǻ-�uj�,��X?f!���;V0��ԉh,��8+���fĪ������$�ujm,���%�K��?ɬ�/����i���X��?-�V��������\�׃��]� d���s,�/�3��Qg��;�~` yԱn�DM����:^e�����l�q��dL���*�zL�h3���^��Z��&%]_�: 4���n��kEm��f�k�A=E��&K&:.��Ds3�IA7N��4�z�"�؛ +XSD��<��ղ2��z⍉�>2�!L�N?�� +J�L����@&����>�ڲ/����( +��Ϯ�<e�Y��9�P~�3w;��PȎ��,��Dk̈́�)�&�^��Z/�`"���]u����O��&EAs��������Jb�SҜv?�Az�{m;x*������A��{h������� +p�y�y�����/l2�f� �f�4C��|�*5��?L� +��>�h}��.p2��7�Ә��>�d����DW��(@�@���Rӂ�������sk$���ܓ,���I��&����F���o�?�|��PK���"��PKۄw<Z�949pollen.argoPKۄw<����mpollen_Modèle.pgmlPKۄw<F;�!��@�pollen_Services.pgmlPKۄw<9ܜ='�pollen_Diagrammedeclasses.pgmlPKۄw<4�[-m�h#pollen.todoPKۄw<7Rp:B$pollen_profile.profilePKۄw<���"�� +�$pollen.xmiPK��G \ No newline at end of file Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestData.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,6 +1,5 @@ package org.chorem.pollen.business; -import org.chorem.pollen.business.utils.ContextUtil; import org.nuiton.topia.TopiaContext; /** @@ -21,8 +20,7 @@ public void execute() throws Exception { transaction = null; try { - transaction = TestManager.getContext(). - getRootContext().beginTransaction(); + transaction = TestManager.beginTransaction(); test(); Modified: trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/TestManager.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,6 +1,8 @@ package org.chorem.pollen.business; +import org.chorem.pollen.PollenContextImplementor; +import org.chorem.pollen.PollenContextImpl; import java.io.IOException; import java.io.InputStream; import java.util.Calendar; @@ -67,7 +69,7 @@ } public static TopiaContext beginTransaction() throws TopiaException { - return getContext().getRootContext().beginTransaction(); + return getContext().getTopiaRootContext().beginTransaction(); } } Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/business/PreventRuleManagerTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,115 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.business; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests de la gestion des règles de notification. - * - * @author rannou - * @version $Id$ - */ -public class PreventRuleManagerTest { - private PreventRuleManager manager; - - public PreventRuleManagerTest() { - } - - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() { - } - - @After - public void tearDown() { - } - - /** - * Test of execute method, of class PreventRuleManager. Using PRINT_ACTION - * not repeatable. - */ - @Test - public void testPrintAction() { - PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, false, - PreventRuleManager.NULL_ACTION); - manager = new PreventRuleManager(preventRule); - - assertTrue(manager.execute()); - assertTrue(manager.execute("test")); - assertTrue(manager.execute(2)); - assertTrue(manager.execute("test", 2, "testPrintAction")); - - assertFalse(manager.execute("scope")); - assertFalse(manager.execute(1)); - assertFalse(manager.execute("scope", 1, "testPrintAction")); - assertFalse(manager.execute(4)); - } - - /** - * Test of execute method, of class PreventRuleManager. Using PRINT_ACTION - * repeatable. - */ - @Test - public void testPrintActionRepeat() { - PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, true, - PreventRuleManager.NULL_ACTION); - manager = new PreventRuleManager(preventRule); - - assertTrue(manager.execute()); - assertTrue(manager.execute(2)); - assertTrue(manager.execute(4)); - - assertFalse(manager.execute(1)); - assertFalse(manager.execute(5)); - } - - /** - * Test of execute method, of class PreventRuleManager. Using PRINT_ACTION - * oneTime execution. - */ - @Test - public void testPrintActionOneTime() { - PreventRuleDTO preventRule = new PreventRuleDTO("test", 2, false, - PreventRuleManager.NULL_ACTION); - preventRule.setOneTime(true); - manager = new PreventRuleManager(preventRule); - - assertTrue(manager.execute(2)); - assertFalse(manager.execute(2)); - - preventRule.setActive(true); - - assertTrue(manager.execute(2)); - assertFalse(manager.execute(2)); - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/ScalingVote.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/ScalingVote.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/ScalingVote.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,223 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2010 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.scaling; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.TestManager; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteDAO; -import org.chorem.pollen.business.persistence.VoteToChoice; -import org.chorem.pollen.business.persistence.VoteToChoiceDAO; -import org.chorem.pollen.business.persistence.VotingList; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; - -/** - * TODO add comment here. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ScalingVote { - - /** log. */ - private static final Log log = LogFactory.getLog(ScalingVote.class); - - /** Adresse de la base de données (surchage l'adresse dans src/test/resources) */ -// public static final String DB_URL = "jdbc:h2:" + System.getProperty("user.home") + -// File.separator + ".pollen" + File.separator + "pollendb"; - - /** La config en cours. */ - protected static Properties config; - - /** - * Main. - * - * @param args - */ - public static void main(String args[]) throws IOException { -// System.out.println("Using database at : " + DB_URL); - -// ContextUtil contextUtil = ContextUtil.getInstance(); -// config = contextUtil.getConf(); - TestManager.start("ScalingVote"); - -// config.setProperty("hibernate.connection.url", DB_URL); -// config.remove("hibernate.hbm2ddl.auto"); - - try { - new ScalingVote().doInsertFixedNumber(); - } - catch(Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't insert mass mail", e); - } - } - } - - /** - * Insert a lot of vote into poll. - * - * This version find a poll with his name and add a vote - * for each votant in voting list. - * - * @throws TopiaException - */ - public void doInsertWithVotingList() throws TopiaException, IOException { - TopiaContext context = TestManager.beginTransaction(); - - PollDAO pollDAO = PollenModelDAOHelper.getPollDAO(context); - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(context); - VoteToChoiceDAO voteToChoiceDAO = PollenModelDAOHelper.getVoteToChoiceDAO(context); - - // find a poll with his name - Poll poll = pollDAO.findByTitle("Test condorcet 3000 v2"); - VotingList votingLists = poll.getVotingList().get(0); - - for (PersonToList personList : votingLists.getPollAccountPersonToList()) { - - PollAccount pollAccount = personList.getPollAccount(); - - // ne traite pas les email qui contienent 20 - // pour qu'il reste des choix de login ensuite - if (pollAccount.getEmail().contains("20@")) { - continue; - } - else { - if (log.isInfoEnabled()) { - log.info("Create vote for " + pollAccount.getEmail()); - } - } - - Vote myNewVote = voteDAO.create(); - myNewVote.setVotingList(votingLists); - myNewVote.setPollAccount(pollAccount); - myNewVote.setPoll(poll); - myNewVote.setWeight(new Double(1)); - myNewVote.setAnonymous(Boolean.FALSE); - - List<Choice> choices = new ArrayList<Choice>(); - choices.add(poll.getChoice().get(0)); - - List<VoteToChoice> voteToChoices = new ArrayList<VoteToChoice>(); - VoteToChoice voteToChoice = voteToChoiceDAO.create(); - voteToChoice.setChoice(poll.getChoice().get(0)); - voteToChoice.setVoteValue(1); - voteToChoice.setVote(myNewVote); - voteToChoices.add(voteToChoice); - - VoteToChoice voteToChoice2 = voteToChoiceDAO.create(); - voteToChoice2.setChoice(poll.getChoice().get(1)); - voteToChoice2.setVoteValue(2); - voteToChoice2.setVote(myNewVote); - voteToChoices.add(voteToChoice2); - - myNewVote.setChoiceVoteToChoice(voteToChoices); - myNewVote.update(); - poll.getVote().add(myNewVote); - } - - poll.update(); - context.commitTransaction(); - context.closeContext(); - - TestManager.stop(); - } - - /** - * Insert a lot of vote into poll. - * - * This version find a poll with his name and add a vote - * for each votant in voting list. - * - * @throws TopiaException - */ - public void doInsertFixedNumber() throws TopiaException, IOException { - TopiaContext context = TestManager.beginTransaction(); - - PollDAO pollDAO = PollenModelDAOHelper.getPollDAO(context); - VoteDAO voteDAO = PollenModelDAOHelper.getVoteDAO(context); - PollAccountDAO pollAccountDAO = PollenModelDAOHelper.getPollAccountDAO(context); - VoteToChoiceDAO voteToChoiceDAO = PollenModelDAOHelper.getVoteToChoiceDAO(context); - - // find a poll with his name - Poll poll = pollDAO.findByTitle("test pagination 3000"); - - for (int i = 1 ; i <= 4200 ; ++i) { - - PollAccount pollAccount = pollAccountDAO.create(); - pollAccount.setVotingId("Test " + i); - - if (log.isInfoEnabled()) { - log.info("Create vote for " + pollAccount.getVotingId()); - } - - Vote myNewVote = voteDAO.create(); - myNewVote.setPollAccount(pollAccount); - myNewVote.setPoll(poll); - myNewVote.setWeight(new Double(1)); - myNewVote.setAnonymous(Boolean.FALSE); - - List<Choice> choices = new ArrayList<Choice>(); - choices.add(poll.getChoice().get(0)); - - List<VoteToChoice> voteToChoices = new ArrayList<VoteToChoice>(); - - if (i % 2 == 0) { - VoteToChoice voteToChoice = voteToChoiceDAO.create(); - voteToChoice.setChoice(poll.getChoice().get(0)); - voteToChoice.setVoteValue(1); - voteToChoice.setVote(myNewVote); - voteToChoices.add(voteToChoice); - } - else { - VoteToChoice voteToChoice2 = voteToChoiceDAO.create(); - voteToChoice2.setChoice(poll.getChoice().get(1)); - voteToChoice2.setVoteValue(2); - voteToChoice2.setVote(myNewVote); - voteToChoices.add(voteToChoice2); - } - - myNewVote.setChoiceVoteToChoice(voteToChoices); - myNewVote.update(); - poll.getVote().add(myNewVote); - - } - poll.update(); - context.commitTransaction(); - context.closeContext(); - - TestManager.stop(); - } -} Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/package-info.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/package-info.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/scaling/package-info.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,20 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -/** - * Ensemble de classes pour injecter des données et faire de la montée en charge. - */ -package org.chorem.pollen.business.scaling; Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/SendMailTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/SendMailTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/SendMailTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,105 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2010 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.chorem.pollen.business.services.SendMail; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.chorem.pollen.business.PollenContextImpl; -import org.chorem.pollen.business.PollenProperty; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.nuiton.util.ApplicationConfig; - -/** - * Class for send mail storage class. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -@Ignore -public class SendMailTest { - - protected static SendMail sendMail; - - protected static PollenContextImpl context; - - @BeforeClass - public static void init() throws InterruptedException { - - ApplicationConfig config = new ApplicationConfig(); - config.setOption(PollenProperty.EMAIL_DIR.getKey(), "target" + File.separator + "massmail"); - config.setOption(PollenProperty.EMAIL_HOST.getKey(), "smtp"); - config.setOption(PollenProperty.EMAIL_PORT.getKey(), "25"); - config.setOption(PollenProperty.EMAIL_FROM.getKey(), "pollenreminder@codelutin.com"); - - context.loadConfiguration(config); - - sendMail = new SendMail(context); - sendMail.start(); - Thread.sleep(3000); - } - - /** - * Test to add mail and send mail. - * - * WARNING : This test really send mail, don't set it automatic. - * - * @throws IOException - * @throws InterruptedException - */ - @Test - public void testAddMail() throws IOException, InterruptedException { - List<Map<String, String>> mailList = new ArrayList<Map<String,String>>(); - - Map<String, String> mailMap = new HashMap<String, String>(); - mailMap.put("receiver", "chatellier+test@codelutin.com"); - mailMap.put("subject", "Test 18:00"); - mailMap.put("body", "Test body"); - - Map<String, String> mailMap2 = new HashMap<String, String>(); - mailMap2.put("receiver", "chorlet+test@codelutin.com"); - mailMap2.put("subject", "CR, CR CR !!! 18:00"); - mailMap2.put("body", "Des cr, encore des \"CRs\" !!!"); - - mailList.add(mailMap); - mailList.add(mailMap2); - - sendMail.prepareMails("test", mailList); - - String emailDir = context.getProperty(PollenProperty.EMAIL_DIR); - - Assert.assertTrue(new File(emailDir, "test.mail").exists()); - Assert.assertTrue(new File(emailDir, "test.index").exists()); - sendMail.wakeUp(); - - // TODO , en 5 secondes, il aura le temps d'envoyer 2 mails ? - Thread.sleep(5000); - Assert.assertFalse(new File(emailDir, "test.mail").exists()); - Assert.assertFalse(new File(emailDir, "test.index").exists()); - } -} Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceAuthImplTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,97 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.chorem.pollen.business.PollenBusinessException; -import org.chorem.pollen.business.TestManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests du service d'authentification. - * - * @author rannou - * @version $Id$ - */ -public class ServiceAuthImplTest { - private ServiceAuthImpl instance; - - @BeforeClass - public static void setUpClass() throws Exception { - TestManager.start("ServiceAuthImplTest"); - } - - @AfterClass - public static void tearDownClass() throws Exception { - TestManager.stop(); - } - - @Before - public void setUp() { - instance = new ServiceAuthImpl(TestManager.getContext()); - } - - @After - public void tearDown() { - } - - /** - * Test of isLoginRight method, of class ServiceAuthImpl. - */ - @Test - public void testIsLoginRight() { - String login = "login_isLoginRight"; - String password = "password_isLoginRight"; - boolean result1 = instance.isLoginRight(login, password); - assertFalse(result1); - - UserDTO dto = new UserDTO(); - dto.setLogin(login); - ServiceUser smu = new ServiceUserImpl(TestManager.getContext()); - smu.createUser(dto, password); - boolean result2 = instance.isLoginRight(login, password); - assertTrue(result2); - } - - /** - * Test of getUser method, of class ServiceAuthImpl. - */ - @Test - public void testGetUser() { - String login = "login_getUser"; - String password = "password_getUser"; - UserDTO result1 = instance.getUser(login, password); - assertNull(result1); - - UserDTO dto = new UserDTO(); - dto.setLogin(login); - ServiceUser smu = new ServiceUserImpl(TestManager.getContext()); - smu.createUser(dto, password); - UserDTO result2 = instance.getUser(login, password); - assertEquals(login, result2.getLogin()); - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceListImplTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceListImplTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceListImplTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,243 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.TestData; -import org.chorem.pollen.business.TestManager; -import org.chorem.pollen.business.dto.PersonListDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.VotingListDTO; -import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.business.persistence.PersonListDAO; -import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.PollAccountDAO; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests du service de gestion des listes. - * - * @author enema - * @author rannou - * @version $Id$ - */ -public class ServiceListImplTest { - private ServiceListImpl instance; - - /** log. */ - private static final Log log = LogFactory.getLog(ServiceListImplTest.class); - - public ServiceListImplTest() { - } - - @BeforeClass - public static void setUpClass() throws Exception { - TestManager.start("ServiceListImplTest"); - } - - @AfterClass - public static void tearDownClass() throws Exception { - TestManager.stop(); - } - - @Before - public void setUp() { - instance = new ServiceListImpl(TestManager.getContext()); - } - - @After - public void tearDown() { - } - - /** - * Test of createVotingList method, of class ServiceListImpl. - */ - @Test - public void testCreateVotingList() { - VotingListDTO votingList = new VotingListDTO(); - votingList.setName("test_createVotingList"); - String result = instance.createVotingList(votingList); - if (log.isDebugEnabled()) { - log.debug("result: " + result); - } - assertTrue(result.length() > 0); - } - - /** - * Test of updateVotingList method, of class ServiceListImpl. - */ - @Test - public void testUpdateVotingList() { - String votingListId = ""; - VotingListDTO dto = new VotingListDTO(); - dto.setName("test_UpdateVotingList"); - votingListId = instance.createVotingList(dto); - dto.setId(votingListId); - dto.setName("new name"); - boolean result = instance.updateVotingList(dto); - assertTrue(result); - } - - /** - * Test of createPersonList method, of class ServiceListImpl. - */ - @Test - public void testCreatePersonList() { - PersonListDTO dto = new PersonListDTO(); - dto.setName("test_createPersonList"); - String result = instance.createPersonList(dto); - assertTrue(result.length() > 0); - } - - /** - * Test of updatePersonList method, of class ServiceListImpl. - * @throws Exception - */ - @Test - public void testCreateAccountInPersonList() throws Exception { - // temp stop, must refactor all tests from this class - TestManager.stop(); - TestManager.start("createAccountInPersonList"); - instance = new ServiceListImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PersonListDTO dto = new PersonListDTO(); - dto.setName("list"); - final String personListId = instance.createPersonList(dto); - dto.setId(personListId); - - final PollAccountDTO account = new PollAccountDTO(); - account.setVotingId("Jack Pot"); - account.setEmail("jackpot@pompedup.fr"); - - /** EXEC METHOD **/ - instance.createAccountInPersonList(dto, account); - Assert.assertNotNull(account.getAccountUId()); - Assert.assertNotNull(account.getId()); - Assert.assertEquals(1, dto.getPollAccounts().size()); - - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - PollAccountDAO dao = - PollenModelDAOHelper.getPollAccountDAO(transaction); - - PollAccount eAccount = dao.findByTopiaId(account.getId()); - Assert.assertNotNull(eAccount); - Assert.assertNotNull(eAccount.getPersonList()); - Assert.assertEquals(personListId, - eAccount.getPersonList().getTopiaId()); - } - - }; - - test.execute(); - - // temp stop, must refactor all tests from this class - TestManager.stop(); - } - - - /** - * Test of updatePersonList method, of class ServiceListImpl. - */ - @Test - public void testDeleteAccountFromPersonList() throws Exception { - // temp stop, must refactor all tests from this class - TestManager.stop(); - TestManager.start("deleteAccountFromPersonList"); - instance = new ServiceListImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PersonListDTO dto = new PersonListDTO(); - dto.setName("list"); - final String personListId = instance.createPersonList(dto); - dto.setId(personListId); - - final PollAccountDTO account = new PollAccountDTO(); - account.setVotingId("Jack Pot"); - account.setEmail("jackpot@pompedup.fr"); - - instance.createAccountInPersonList(dto, account); - - /** EXEC METHOD **/ - instance.deleteAccountFromPersonList(dto, account.getId()); - - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - PollAccountDAO dao = - PollenModelDAOHelper.getPollAccountDAO(transaction); - - PollAccount eAccount = dao.findByTopiaId(account.getId()); - Assert.assertNull(eAccount); - - PersonListDAO listDAO = - PollenModelDAOHelper.getPersonListDAO(transaction); - - PersonList ePersonList = listDAO.findByTopiaId(personListId); - Assert.assertEquals(0, ePersonList.getPollAccount().size()); - } - - }; - - test.execute(); - - // temp stop, must refactor all tests from this class - TestManager.stop(); - } - - /** - * Test of deletePersonList method, of class ServiceListImpl. - */ - @Test - public void testDeletePersonList() { - PersonListDTO dto = new PersonListDTO(); - dto.setName("Test_DeletePersonList"); - String personListId = instance.createPersonList(dto); - dto.setId(personListId); - boolean result = instance.deletePersonList(personListId); - assertTrue(result); - } - - /** - * Test of findPersonListById method, of class ServiceListImpl. - */ - @Test - public void testFindPersonListById() { - PersonListDTO dto = new PersonListDTO(); - dto.setName("test_findPersonListById"); - String personListId = instance.createPersonList(dto); - PersonListDTO result = instance.findPersonListById(personListId); - String resultId = result.getId(); - assertEquals(personListId, resultId); - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePollImplTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,618 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ -package org.chorem.pollen.business.services; - -import java.io.IOException; -import java.util.ArrayList; -import org.chorem.pollen.business.dto.CommentDTO; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.Date; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.TestData; -import org.chorem.pollen.business.TestManager; -import org.chorem.pollen.business.dto.ChoiceDTO; -import org.chorem.pollen.business.dto.PollAccountDTO; -import org.chorem.pollen.business.dto.PollDTO; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.dto.VoteDTO; -import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.ChoiceDAO; -import org.chorem.pollen.business.persistence.Comment; -import org.chorem.pollen.business.persistence.CommentDAO; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollenModelDAOHelper; -import org.chorem.pollen.common.ChoiceType; -import org.chorem.pollen.common.PollType; -import org.chorem.pollen.common.VoteCountingType; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests du service de gestion des sondages. - * - * @author enema - * @version $Id$ - */ -public class ServicePollImplTest { - - private ServicePollImpl instance; - /** log. */ - private static final Log log = LogFactory.getLog(ServicePollImplTest.class); - - public ServicePollImplTest() { - } - - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() { - } - - @After - public void tearDown() throws IOException { - TestManager.stop(); - //BinderProvider.clear(); - } - - /** - * Test of createPoll method, of class ServicePollImpl. - * @throws Exception - */ - @Test - public void testCreatePoll() throws Exception { - TestManager.start("testCreatePoll"); - instance = new ServicePollImpl(TestManager.getContext()); - - PollDTO dto = instance.getNewPoll(); - dto.setBeginChoiceDate(new Date()); - dto.setBeginDate(new Date()); - dto.setChoiceType(ChoiceType.TEXT); - dto.setCreatorName("erwan"); - dto.setDescription("Test_createPoll"); - dto.setEndDate(new Date()); - dto.setAnonymous(false); - dto.setAnonymousVoteAllowed(false); - dto.setChoiceAddAllowed(false); - dto.setClosed(false); - dto.setMaxChoiceNb(3); - dto.setPollType(PollType.RESTRICTED); - dto.setVoteCounting(VoteCountingType.NORMAL); - dto.setTitle("Test_createPoll"); - - List<ChoiceDTO> choices = new ArrayList<ChoiceDTO>(); - ChoiceDTO choice1 = new ChoiceDTO(); - choice1.setName("choice1"); - choices.add(choice1); - ChoiceDTO choice2 = new ChoiceDTO(); - choice2.setName("choice2"); - choices.add(choice2); - ChoiceDTO choice3 = new ChoiceDTO(); - choice3.setName("choice3"); - choices.add(choice3); - - dto.setChoices(choices); - - instance.createPoll(dto); - final String result = dto.getId(); - if (log.isDebugEnabled()) { - log.debug("result: " + result); - } - Assert.assertNotNull(result); - - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - Poll entity = PollenModelDAOHelper.getPollDAO(transaction). - findByTopiaId(result); - Assert.assertNotNull(entity); - - Assert.assertEquals(3, entity.getChoice().size()); - Assert.assertNotNull(entity.getCreator()); - Assert.assertEquals("erwan", entity.getCreator().getVotingId()); - Assert.assertNotNull(entity.getCreator().getAccountId()); - } - }; - - test.execute(); - } - - /** - * Test of updatePoll method, of class ServicePollImpl. - */ - @Test - public void testUpdatePoll() throws Exception { - TestManager.start("testUpdatePoll"); - instance = new ServicePollImpl(TestManager.getContext()); - - String pollId = ""; - PollDTO dto = instance.getNewPoll(); - dto.setDescription("Test_updatePoll"); - dto.setTitle("Test_updatePoll"); - dto.setCreatorId("erwan"); - dto.setAnonymous(false); - dto.setPollType(PollType.FREE); - dto.setChoiceType(ChoiceType.TEXT); - dto.setVoteCounting(VoteCountingType.NORMAL); - pollId = instance.createPoll(dto); - dto.setId(pollId); - dto.setDescription("new description"); - boolean result = instance.updatePoll(dto); - assertTrue(result); - } - - /** - * Test of deletePoll method, of class ServicePollImpl. - */ - @Test - public void testDeletePoll() throws Exception { - TestManager.start("testDeletePoll"); - instance = new ServicePollImpl(TestManager.getContext()); - - PollDTO dto = instance.getNewPoll(); - dto.setDescription("Test_deletePoll"); - dto.setCreatorId("erwan"); - dto.setAnonymous(false); - dto.setPollType(PollType.FREE); - dto.setChoiceType(ChoiceType.TEXT); - dto.setVoteCounting(VoteCountingType.NORMAL); - String pollId = instance.createPoll(dto); - boolean result = instance.deletePoll(pollId); - assertTrue(result); - } - - /** - * Test of findPollByPollId method, of class ServicePollImpl. - */ - @Test - public void testFindPollByPollId() throws Exception { - TestManager.start("testFindPollByPollId"); - instance = new ServicePollImpl(TestManager.getContext()); - - String pollId = ""; - PollDTO dto = instance.getNewPoll(); - dto.setDescription("Test_findPollByPollId"); - dto.setTitle("Test_findPollByPollId"); - dto.setAnonymous(false); - dto.setPollType(PollType.FREE); - dto.setChoiceType(ChoiceType.TEXT); - dto.setVoteCounting(VoteCountingType.NORMAL); - pollId = instance.createPoll(dto); - String pollUID = dto.getPollUId(); - log.debug("pollUID : " + pollUID); - PollDTO result = instance.getPoll(pollUID); - log.debug("title : " + result.getTitle()); - assertEquals(pollId, result.getId()); - assertEquals(VoteCountingType.NORMAL, result.getVoteCounting()); - } - - /** - * Test of findPollsByName method, of class ServicePollImpl. - */ -// @Test -// public void testFindPollsByName() throws Exception { -// TestManager.start("testFindPollsByName"); -// instance = new ServicePollImpl(); -// -// PollDTO dto = instance.getNewPoll(); -// dto.setDescription("Test_findPollsByName"); -// dto.setCreatorId("erwan"); -// dto.setAnonymous(false); -// dto.setPollType(PollType.FREE); -// dto.setChoiceType(ChoiceType.TEXT); -// dto.setVoteCounting(VoteCountingType.NORMAL); -// dto.setTitle("Test_findPollsByName"); -// String pollId = instance.createPoll(dto); -// List<PollDTO> result = instance.findPollsByName("Test_findPollsByName"); -// assertEquals(result.size(), 1); -// } - - /** - * Test of findPollsByUser method, of class ServicePollImpl. - */ - @Test - public void testFindPollsByUser() throws Exception { - TestManager.start("testFindPollsByUser"); - instance = new ServicePollImpl(TestManager.getContext()); - - // création de l'utilisateur - UserDTO user = new UserDTO(); - user.setLogin("login_findPollsByUser"); - user.setEmail("email_findPollsByUser"); - ServiceUser su = new ServiceUserImpl(TestManager.getContext()); - String userId = su.createUser(user, "password"); - - // création du sondage - PollDTO poll = instance.getNewPoll(); - poll.setTitle("Test_findPollsByUser"); - poll.setUserId(userId); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - String pollId = instance.createPoll(poll); - - // recherche des sondages de l'utilisateur - List<PollDTO> result = instance.findPollsByUser(userId); - assertEquals(result.size(), 1); - } - - /** - * Test of findParticipatedPolls method, of class ServicePollImpl. - */ - @Test - public void testFindParticipatedPolls() throws Exception { - TestManager.start("testFindParticipatedPolls"); - instance = new ServicePollImpl(TestManager.getContext()); - - // création de l'utilisateur - UserDTO user = new UserDTO(); - user.setLogin("login_findParticipatedPolls"); - user.setEmail("email_findParticipatedPolls"); - ServiceUser su = new ServiceUserImpl(TestManager.getContext()); - String userId = su.createUser(user, "password"); - - // création du compte associé à l'utilisateur - PollAccountDTO account = new PollAccountDTO(); - account.setUserId(userId); - ServicePollAccount spa = new ServicePollAccountImpl(TestManager.getContext()); - String accountId = spa.createPollAccount(account); - - // création du sondage - PollDTO poll = instance.getNewPoll(); - poll.setTitle("Test_findParticipatedPolls"); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - String pollId = instance.createPoll(poll); - - // création du vote - VoteDTO vote = new VoteDTO(accountId, pollId, null); - ServiceVote sv = new ServiceVoteImpl(TestManager.getContext()); - sv.createVote(vote, account); - - // recherche des sondages de l'utilisateur - List<PollDTO> result = instance.findParticipatedPolls(userId); - assertEquals(result.size(), 1); - } - - /** - * Test of findRunningPolls method, of class ServicePollImpl. - */ - @Test - public void testFindRunningPolls() throws Exception { - TestManager.start("testFindRunningPolls"); - instance = new ServicePollImpl(TestManager.getContext()); - - Date now = TestManager.getContext().getCurrentDate(); - - // sondage en cours sans date de fin - PollDTO poll1 = instance.getNewPoll(); - poll1.setTitle("Test_findRunningPolls1"); - poll1.setPollType(PollType.FREE); - poll1.setChoiceType(ChoiceType.TEXT); - poll1.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll1); - - // sondage en cours - PollDTO poll2 = instance.getNewPoll(); - poll2.setTitle("Test_findRunningPolls2"); - poll2.setEndDate(new Date(now.getTime() + 100000)); - poll2.setPollType(PollType.FREE); - poll2.setChoiceType(ChoiceType.TEXT); - poll2.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll2); - - // sondage terminé - PollDTO poll3 = instance.getNewPoll(); - poll3.setTitle("Test_findRunningPolls3"); - poll3.setEndDate(new Date(now.getTime() - 100000)); - poll3.setPollType(PollType.FREE); - poll3.setChoiceType(ChoiceType.TEXT); - poll3.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll3); - - // sondage pas commencé - PollDTO poll4 = instance.getNewPoll(); - poll4.setTitle("Test_findRunningPolls4"); - poll4.setBeginDate(new Date(now.getTime() + 100000)); - poll4.setPollType(PollType.FREE); - poll4.setChoiceType(ChoiceType.TEXT); - poll4.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll4); - - List<PollDTO> result1 = instance.findRunningPolls(true); - List<PollDTO> result2 = instance.findRunningPolls(false); - assertTrue(result2.size() > result1.size()); - assertTrue(result1.size() > 0); - } - - /** - * Test of selectPolls method, of class ServicePollImpl. - */ - @Test - public void testSelectPolls() throws Exception { - TestManager.start("testSelectPolls"); - instance = new ServicePollImpl(TestManager.getContext()); - - PollDTO dto = instance.getNewPoll(); - dto.setDescription("test selectPolls"); - dto.setTitle("selectPolls"); - dto.setAnonymous(false); - dto.setPollType(PollType.FREE); - dto.setChoiceType(ChoiceType.TEXT); - dto.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(dto); - List<PollDTO> result = instance.selectPolls(null); - assertTrue(result.size() > 0); - } - - /** - * Test of findInvitedPolls method, of class ServicePollImpl. - */ - //@Test - public void testFindInvitedPolls() { - System.out.println("findInvitedPolls"); - } - - /** - * Test of addVoteToPoll method, of class ServicePollImpl. - */ - //@Test - public void testAddVoteToPoll() { - System.out.println("addVoteToPoll"); - } - - /** - * Test of createComment method, of class ServicePollImpl. - */ - @Test - public void testCreateComment() throws Exception { - TestManager.start("testCreateComment"); - instance = new ServicePollImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PollDTO poll = instance.getNewPoll(); - poll.setTitle("createComment"); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll); - final String pollId = poll.getId(); - - /** EXEC METHOD **/ - final CommentDTO comment = new CommentDTO(); - comment.setAuthor("Jack Pot"); - comment.setText("Un petit commentaire"); - comment.setPostDate(new Date()); - - instance.createComment(poll, comment); - - Assert.assertEquals(1, poll.getComments().size()); - Assert.assertNotNull(comment.getId()); - - // Test if the comment entity exist in database - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - CommentDAO dao = PollenModelDAOHelper.getCommentDAO(transaction); - Comment result = dao.findByTopiaId(comment.getId()); - Assert.assertNotNull(result); - Assert.assertNotNull(result.getPoll()); - Assert.assertEquals(pollId, result.getPoll().getTopiaId()); - } - }; - - test.execute(); - - } - - /** - * Test of deleteComment method, of class ServicePollImpl. - */ - @Test - public void testDeleteComment() throws Exception { - TestManager.start("testDeleteComment"); - instance = new ServicePollImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PollDTO poll = instance.getNewPoll(); - poll.setTitle("deleteComment"); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll); - - final CommentDTO comment = new CommentDTO(); - comment.setAuthor("Jack Pot"); - comment.setText("Un petit commentaire"); - comment.setPostDate(new Date()); - instance.createComment(poll, comment); - - /** EXEC METHOD **/ - - instance.deleteComment(poll, comment.getId()); - - Assert.assertEquals(0, poll.getComments().size()); - - // Test if the comment entity not exist anymore in database - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - CommentDAO dao = PollenModelDAOHelper.getCommentDAO(transaction); - Comment result = dao.findByTopiaId(comment.getId()); - Assert.assertNull(result); - } - }; - - test.execute(); - } - - /** - * Test of getRestrictedAccount method, of class ServicePollImpl. - */ - //@Test - public void testGetRestrictedAccount() throws IOException { - TestManager.start("testGetRestrictedAccount"); - instance = new ServicePollImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PollDTO poll = instance.getNewPoll(); - poll.setTitle("restrictedAccount"); - poll.setPollType(PollType.RESTRICTED); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll); - - PollAccountDTO account = new PollAccountDTO(); - account.setVotingId("toto"); - - // TODO - - } - - /** - * Test of getNewPoll method, of class ServicePollImpl. - */ - //@Test - public void testGetNewPoll_0args() { - System.out.println("getNewPoll"); - } - - /** - * Test of getNewPoll method, of class ServicePollImpl. - */ - //@Test - public void testGetNewPoll_PollDTO() { - System.out.println("getNewPoll"); - } - - /** - * Test of getPoll method, of class ServicePollImpl. - */ - //@Test - public void testGetPoll() { - System.out.println("getPoll"); - } - - /** - * Test of getComments method, of class ServicePollImpl. - */ - //@Test - public void testGetComments() { - System.out.println("getComments"); - } - - /** - * Test of getNewHiddenChoice method, of class ServicePollImpl. - */ - //@Test - public void testGetNewHiddenChoice() throws IOException { - TestManager.start("testGetNewHiddenChoice"); - instance = new ServicePollImpl(TestManager.getContext()); - - // TODO - - //ChoiceDTO choice = instance.getNewHiddenChoice(null, null) - } - - /** - * Test of createChoice method, of class ServicePollImpl. - * @throws IOException - */ - @Test - public void testCreateChoice() throws IOException { - TestManager.start("testCreateChoice"); - instance = new ServicePollImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PollDTO poll = instance.getNewPoll(); - poll.setTitle("createChoice"); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll); - - /** EXEC METHOD **/ - ChoiceDTO choice = new ChoiceDTO(); - choice.setName("CHOICE1"); - choice.setDescription("description"); - - // No constraint for creation - instance.createChoice(poll, choice); - - Assert.assertNotNull(choice.getId()); - Assert.assertEquals(1, poll.getChoices().size()); - Assert.assertEquals("CHOICE1", poll.getChoices().get(0).getName()); - } - - /** - * Test of deleteChoice method, of class ServicePollImpl. - * @throws Exception - */ - @Test - public void testDeleteChoice() throws Exception { - TestManager.start("testDeleteChoice"); - instance = new ServicePollImpl(TestManager.getContext()); - - /** PREPARE DATA **/ - PollDTO poll = instance.getNewPoll(); - poll.setTitle("createChoice"); - poll.setPollType(PollType.FREE); - poll.setChoiceType(ChoiceType.TEXT); - poll.setVoteCounting(VoteCountingType.NORMAL); - instance.createPoll(poll); - - final ChoiceDTO choice = new ChoiceDTO(); - choice.setName("CHOICE1"); - choice.setDescription("description"); - instance.createChoice(poll, choice); - - /** EXEC METHOD **/ - instance.deleteChoice(poll, choice.getId()); - - Assert.assertEquals(0, poll.getChoices().size()); - - // Test if the choice entity not exist anymore in database - TestData test = new TestData() { - - @Override - protected void test() throws Exception { - ChoiceDAO dao = PollenModelDAOHelper.getChoiceDAO(transaction); - Choice result = dao.findByTopiaId(choice.getId()); - Assert.assertNull(result); - } - }; - - test.execute(); - } -} Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePreventRuleImplTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePreventRuleImplTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServicePreventRuleImplTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,149 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import java.io.IOException; -import org.chorem.pollen.business.PollenBusinessException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.business.TestManager; -import org.chorem.pollen.business.dto.PreventRuleDTO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests de la gestion des règles de notification. - * - * @author rannou - * @version $Id: ServicePreventRuleImplTest.java 2649 2009-07-15 16:30:23Z - * nrannou $ - */ -public class ServicePreventRuleImplTest { - private ServicePreventRuleImpl instance; - - /** log. */ - private static final Log log = LogFactory - .getLog(ServicePreventRuleImplTest.class); - - public ServicePreventRuleImplTest() { - } - - @BeforeClass - public static void setUpClass() throws Exception { - TestManager.start("ServicePreventRuleImplTest"); - } - - @AfterClass - public static void tearDownClass() throws Exception { - TestManager.stop(); - } - - @Before - public void setUp() throws Exception { - instance = new ServicePreventRuleImpl(TestManager.getContext()); - } - - @After - public void tearDown() { - } - - /** - * Test of createPreventRule method, of class PreventRuleImpl. - */ - @Test - public void testCreatePreventRule() { - PreventRuleDTO dto = new PreventRuleDTO(); - dto.setScope("test"); - dto.setSensibility(2); - dto.setRepeated(false); - dto.setMethod("test_CreatePreventRule"); - String result = instance.createPreventRule(dto); - if (log.isDebugEnabled()) { - log.debug("result: " + result); - } - assertTrue(result.length() > 0); - } - - /** - * Test of updatePreventRule method, of class PreventRuleImpl. - */ - @Test - public void testUpdatePreventRule() { - PreventRuleDTO dto = new PreventRuleDTO(); - dto.setScope("test"); - dto.setSensibility(2); - dto.setMethod("test_UpdatePreventRule"); - String preventRuleId = instance.createPreventRule(dto); - dto.setId(preventRuleId); - dto.setSensibility(3); - boolean result = instance.updatePreventRule(dto); - assertTrue(result); - } - - /** - * Test of deletePreventRule method, of class PreventRuleImpl. - */ - @Test - public void testDeletePreventRule() { - PreventRuleDTO dto = new PreventRuleDTO(); - dto.setScope("test"); - dto.setSensibility(2); - dto.setMethod("test_DeletePreventRule"); - String preventRuleId = instance.createPreventRule(dto); - dto.setId(preventRuleId); - boolean result = instance.deletePreventRule(preventRuleId); - assertTrue(result); - } - - /** - * Test of findPreventRuleById method, of class PreventRuleImpl. - */ - @Test - public void testFindPreventRuleById() { - PreventRuleDTO dto = new PreventRuleDTO(); - dto.setScope("test"); - dto.setSensibility(2); - dto.setMethod("test_findPreventRuleById"); - String preventRuleId = instance.createPreventRule(dto); - PreventRuleDTO result = instance.findPreventRuleById(preventRuleId); - String resultId = result.getId(); - assertEquals(preventRuleId, resultId); - } - - /** - * Test of selectPreventRules method, of class PreventRuleImpl. - */ - @Test - public void testSelectPreventRules() { - PreventRuleDTO dto = new PreventRuleDTO(); - dto.setScope("test"); - dto.setSensibility(2); - dto.setMethod("test_selectPreventRules"); - String preventRuleId = instance.createPreventRule(dto); - List<PreventRuleDTO> result = instance.selectPreventRules(null); - assertTrue(result.size() > 1); - } -} \ No newline at end of file Deleted: trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java =================================================================== --- trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-business/src/test/java/org/chorem/pollen/business/services/ServiceUserImplTest.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -1,183 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.business.services; - -import org.chorem.pollen.business.PollenBusinessException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.chorem.pollen.business.TestManager; -import org.chorem.pollen.business.dto.UserDTO; -import org.chorem.pollen.business.utils.ContextUtil; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests du service de gestion des utilisateurs. - * - * @author rannou - * @version $Id$ - */ -public class ServiceUserImplTest { - private ServiceUserImpl instance; - - @BeforeClass - public static void setUpClass() throws Exception { - TestManager.start("ServiceUserImplTest"); - } - - @AfterClass - public static void tearDownClass() throws Exception { - TestManager.stop(); - } - - @Before - public void setUp() { - instance = new ServiceUserImpl(TestManager.getContext()); - } - - @After - public void tearDown() { - } - - /** - * Test of createUser method, of class ServiceUserImpl. - */ - @Test - public void testCreateUser() { - UserDTO user = new UserDTO(); - user.setLogin("login_CreateUser"); - String result = instance.createUser(user, "password"); - assertTrue(result.length() > 0); - } - - /** - * Test of updateUser method, of class ServiceUserImpl. - */ - @Test - public void testUpdateUser() { - UserDTO user = new UserDTO(); - user.setLogin("login_UpdateUser"); - String userId = instance.createUser(user, "password"); - user.setId(userId); - user.setFirstName("firstName_UpdateUser"); - boolean result = instance.updateUser(user); - assertTrue(result); - } - - /** - * Test of deleteUser method, of class ServiceUserImpl. - */ - @Test - public void testDeleteUser() { - - // delete with dto - UserDTO user = new UserDTO(); - user.setLogin("login_DeleteUser"); - user.setId(instance.createUser(user, "password")); - boolean result = instance.deleteUser(user); - assertTrue(result); - - // delete with login - UserDTO user2 = new UserDTO(); - user2.setLogin("login_DeleteUser"); - String userId2 = instance.createUser(user2, "password"); - boolean result2 = instance.deleteUser("login_DeleteUser"); - assertTrue(result2); - } - - /** - * Test of findUserById method, of class ServiceUserImpl. - */ - @Test - public void testFindUserById() { - UserDTO user = new UserDTO(); - user.setLogin("login_FindUserById"); - String userId = instance.createUser(user, "password"); - UserDTO result = instance.findUserById(userId); - String resultId = result.getId(); - assertEquals(userId, resultId); - } - - /** - * Test of selectUsers method, of class ServiceUserImpl. - */ - @Test - public void testSelectUsers() { - UserDTO user = new UserDTO(); - user.setLogin("login_SelectUsers"); - String userId = instance.createUser(user, "password"); - List<UserDTO> result = instance.selectUsers(null); - assertTrue(result.size() > 1); - } - - /** - * Test of updatePasswordUser method, of class ServiceUserImpl. - */ - @Test - public void testUpdatePasswordUser() { - UserDTO user = new UserDTO(); - user.setLogin("login_UpdatePasswordUser"); - user.setId(instance.createUser(user, "password")); - instance.updatePasswordUser(user, "newPassword"); - - ServiceAuth sa = new ServiceAuthImpl(TestManager.getContext()); - UserDTO result = sa.getUser(user.getLogin(), "newPassword"); - assertNotNull(result); - } - - /** - * Test of isUserLoginExisting method, of class ServiceUserImpl. - */ - @Test - public void testIsUserLoginExisting() { - UserDTO user = new UserDTO(); - user.setLogin("login_IsUserLoginExisting"); - user.setEmail("email_IsUserLoginExisting"); - String userId = instance.createUser(user, "password"); - - boolean result = instance - .isUserLoginExisting("login_IsUserLoginExisting"); - boolean result2 = instance.isUserLoginExisting("login_False"); - assertTrue(result); - assertFalse(result2); - } - - /** - * Test of isUserEmailExisting method, of class ServiceUserImpl. - */ - @Test - public void testIsUserEmailExisting() { - UserDTO user = new UserDTO(); - user.setLogin("login_IsUserEmailExisting"); - user.setEmail("email_IsUserEmailExisting"); - String userId = instance.createUser(user, "password"); - - boolean result = instance - .isUserEmailExisting("email_IsUserEmailExisting"); - boolean result2 = instance.isUserEmailExisting("email_False"); - assertTrue(result); - assertFalse(result2); - } -} \ No newline at end of file Property changes on: trunk/pollen-topia-template ___________________________________________________________________ Added: svn:ignore + target Added: trunk/pollen-topia-template/LICENSE.txt =================================================================== --- trunk/pollen-topia-template/LICENSE.txt (rev 0) +++ trunk/pollen-topia-template/LICENSE.txt 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/pollen-topia-template/README.txt =================================================================== --- trunk/pollen-topia-template/README.txt (rev 0) +++ trunk/pollen-topia-template/README.txt 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1 @@ +TODO Added: trunk/pollen-topia-template/changelog.txt =================================================================== --- trunk/pollen-topia-template/changelog.txt (rev 0) +++ trunk/pollen-topia-template/changelog.txt 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1 @@ +See changelog in pollen parent project. Added: trunk/pollen-topia-template/pom.xml =================================================================== --- trunk/pollen-topia-template/pom.xml (rev 0) +++ trunk/pollen-topia-template/pom.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,67 @@ +<?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-template</artifactId> + + <dependencies> + <dependency> + <groupId>org.nuiton.eugene</groupId> + <artifactId>eugene</artifactId> + </dependency> + <dependency> + <groupId>org.nuiton.topia</groupId> + <artifactId>topia-persistence</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>Pollen :: Template</name> + <description>Templates de génération pour Pollen</description> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + +<build> + +<plugins> + + <plugin> + <groupId>org.nuiton.processor</groupId> + <artifactId>maven-processor-plugin</artifactId> + </plugin> +</plugins> +</build> + +</project> + Copied: trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenContextImplementor.java (from rev 2953, trunk/pollen-business/src/main/java/org/chorem/pollen/business/PollenContextImplementor.java) =================================================================== --- trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenContextImplementor.java (rev 0) +++ trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenContextImplementor.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,70 @@ + +package org.chorem.pollen.template; + +import org.nuiton.topia.TopiaContext; + +/** + * PollenContextImplementor + * + * Created: 20 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public interface PollenContextImplementor /*extends PollenContext*/ { + + /** + * Topia main context used to open new transaction. + * + * @return the topia root context + */ + TopiaContext getRootContext(); + + /** + * Pollen converter used to convert entities to DTO. + * + * @return the current pollen converter + */ +// PollenConverter getConverter(); + + /** + * Manage exceptions. The {@code exception} will be embedded in a + * PollenException with the {@code message} provided. + * Used in catch statement in services. + * + * @param eee the exception to manage + * @param message the message to add to the new PollenException + * @param args for message + * @throws PollenException which contains the exception as the cause + */ +// void doCatch(Exception eee, String message, Object... args) +// throws PollenException; + + /** + * Manage exceptions. The {@code exception} will be embedded in a + * PollenException with the {@code message} provided. Also, the current + * {@code transaction} will be rollback. + * Used in catch statement in services. + * + * @param transaction the current TopiaContext + * @param eee the exception to manage + * @param message the message to add to the new PollenException + * @param args for message + * @throws PollenException + */ +// void doCatch(TopiaContext transaction, Exception eee, String message, +// Object... args) throws PollenException; + + /** + * Close current TopiaContext. + * Used in finally statement in services. + * + * @param transaction current TopiaContext + */ +// void doFinally(TopiaContext transaction); + + +} Property changes on: trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenContextImplementor.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: svn:mergeinfo + Added: trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenServiceTransformer.java =================================================================== --- trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenServiceTransformer.java (rev 0) +++ trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenServiceTransformer.java 2010-03-23 15:39:36 UTC (rev 2956) @@ -0,0 +1,330 @@ + +package org.chorem.pollen.template; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.eugene.GeneratorUtil; +import org.nuiton.eugene.Template; +import org.nuiton.eugene.java.ObjectModelTransformerToJava; +import org.nuiton.eugene.models.object.ObjectModel; +import org.nuiton.eugene.models.object.ObjectModelClass; +import org.nuiton.eugene.models.object.ObjectModelInterface; +import org.nuiton.eugene.models.object.ObjectModelModifier; +import org.nuiton.eugene.models.object.ObjectModelOperation; +import org.nuiton.eugene.models.object.ObjectModelParameter; +import org.nuiton.i18n.I18n; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.generator.TopiaGeneratorUtil; + +/*{generator option: parentheses = false}*/ + +/*{generator option: writeString = +}*/ + +/** + * PollenServiceTransformer + * + * Created: 23 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class PollenServiceTransformer extends ObjectModelTransformerToJava { + + protected String modelName; + + protected String defaultPackageName; + + protected String getContextInterfaceName() { + return modelName + "Context"; + } + + protected String getContextImplementorInterfaceName() { + return getContextInterfaceName() + "Implementor"; + } + + protected String getExceptionClassName() { + return modelName + "Exception"; + } + + protected String getServiceAbstractClassName(String serviceName) { + return serviceName + "Abstract"; + } + + @Override + public void transformFromModel(ObjectModel model) { + modelName = model.getName(); + defaultPackageName = getOutputProperties(). + getProperty(Template.PROP_DEFAULT_PACKAGE); + + ObjectModelInterface contextImplementor = + model.getInterface(defaultPackageName + "." + + getContextImplementorInterfaceName()); + + ObjectModelInterface context = + model.getInterface(defaultPackageName + "." + + getContextInterfaceName()); + + ObjectModelClass exception = createExceptionClass(); + + ObjectModelInterface newContextImplementor = + this.createInterface(getContextImplementorInterfaceName(), + defaultPackageName); + ObjectModelInterface newContext = + this.createInterface(getContextInterfaceName(), + defaultPackageName); + + this.addInterface(newContextImplementor, + newContext.getQualifiedName()); + + if (contextImplementor != null) { + // Copy of defined operations + // interfaces of contextImplementor are not copied + copyInterfaceOperations(contextImplementor, newContextImplementor); + } + + if (context != null) { + // Copy of defined operations + // interfaces of context are not copied + copyInterfaceOperations(context, newContext); + } + + this.addOperation(newContextImplementor, + "getTopiaRootContext", TopiaContext.class); + + ObjectModelOperation doCatch1 = + this.addOperation(newContextImplementor, "doCatch", "void"); + this.addParameter(doCatch1, Exception.class, "eee"); + this.addParameter(doCatch1, String.class, "message"); + this.addParameter(doCatch1, "Object...", "args"); + this.addException(doCatch1, exception.getQualifiedName()); + + ObjectModelOperation doCatch2 = + this.addOperation(newContextImplementor, "doCatch", "void"); + this.addParameter(doCatch2, TopiaContext.class, "transaction"); + this.addParameter(doCatch2, Exception.class, "eee"); + this.addParameter(doCatch2, String.class, "message"); + this.addParameter(doCatch2, "Object...", "args"); + this.addException(doCatch2, exception.getQualifiedName()); + + ObjectModelOperation doFinally = + this.addOperation(newContextImplementor, "doFinally", "void"); + this.addParameter(doFinally, TopiaContext.class, "transaction"); + } + + protected ObjectModelClass createExceptionClass() { + + ObjectModelClass exception = + this.createClass(getExceptionClassName(), defaultPackageName); + + this.setSuperClass(exception, RuntimeException.class); + this.addAttribute(exception, "args", "Object[]", null, + ObjectModelModifier.PROTECTED); + + ObjectModelOperation constructor = + this.addConstructor(exception, ObjectModelModifier.PUBLIC); + + this.addParameter(constructor, Throwable.class, "eee"); + this.addParameter(constructor, String.class, "message"); + this.addParameter(constructor, "Object...", "args"); + + setOperationBody(constructor, "" + /*{ + super(message, eee); + this.args = args; + }*/ + ); + + ObjectModelOperation getArgs = + this.addOperation(exception, "getArgs", "Object[]", + ObjectModelModifier.PUBLIC); + + setOperationBody(getArgs, "" + /*{ + return args; + }*/ + ); + + return exception; + } + + protected void copyInterfaceOperations(ObjectModelInterface source, + ObjectModelInterface dest) { + for (ObjectModelOperation op : source.getOperations()) { + ObjectModelOperation newOp = + this.addOperation(dest, + op.getName(), op.getReturnType(), + ObjectModelModifier.PUBLIC); + setDocumentation(newOp.getReturnParameter(), + op.getReturnParameter().getDocumentation()); + for (ObjectModelParameter param : op.getParameters()) { + ObjectModelParameter newParam = + this.addParameter(newOp, param.getType(), + param.getName()); + setDocumentation(newParam, param.getDocumentation()); + } + for (String ex : op.getExceptions()) { + this.addException(newOp, ex); + } + setDocumentation(newOp, op.getDocumentation()); + } + } + + @Override + public void transformFromInterface(ObjectModelInterface interfacez) { + // skip ContextImplementor and Context interfaces + if (!interfacez.hasStereotype(TopiaGeneratorUtil.STEREOTYPE_SERVICE)) { + return; + } + + // Create INTERFACE + ObjectModelInterface serviceInterface = + this.createInterface(interfacez.getName(), + interfacez.getPackageName()); + + copyInterfaceOperations(interfacez, serviceInterface); + + + // Create ABSTRACT CLASS + ObjectModelClass service = this.createAbstractClass( + getServiceAbstractClassName(interfacez.getName()), + interfacez.getPackageName()); + + this.addInterface(service, serviceInterface.getQualifiedName()); + + // Add Logger +// this.addAttribute(service, "log", +// Log.class, +// "LogFactory.getLog(" + interfacez.getName() + ".class)", +// ObjectModelModifier.PRIVATE, +// ObjectModelModifier.STATIC, +// ObjectModelModifier.FINAL); + this.addAttribute(service, "log", + Log.class, null, + ObjectModelModifier.PRIVATE, + ObjectModelModifier.FINAL); + + this.addImport(service, Log.class); + this.addImport(service, LogFactory.class); + + String contextFqn = defaultPackageName + "." + + getContextImplementorInterfaceName(); + + // Add Context Attribute + constructor + this.addAttribute(service, "context", contextFqn, null, + ObjectModelModifier.PROTECTED); + + // Constructor + ObjectModelOperation constructor = + this.addConstructor(service, ObjectModelModifier.PUBLIC); + this.addParameter(constructor, contextFqn, "context"); + setOperationBody(constructor, "" + /*{ + this.context = context; + this.log = LogFactory.getLog(<%=interfacez.getName()%>.class); + }*/ + ); + + // Prepare operation generations + String first = modelName.substring(0, 1); + String serviceName = + GeneratorUtil.toLowerCaseFirstLetter(interfacez.getName()); + + this.addImport(service, TopiaContext.class); + this.addImport(service, I18n.class); + + for (ObjectModelOperation op : interfacez.getOperations()) { + + // Implementation of interface operation + ObjectModelOperation implOp = + this.addOperation(service, + op.getName(), op.getReturnType(), + ObjectModelModifier.PUBLIC); + this.addAnnotation(service, implOp, Override.class.getSimpleName()); + + String opName = StringUtils.capitalize(op.getName()); + + // Abstract operation to execute method content + ObjectModelOperation abstOp = + this.addOperation(service, "execute" + opName, + op.getReturnType(), + ObjectModelModifier.ABSTRACT, + ObjectModelModifier.PROTECTED); + this.addParameter(abstOp, TopiaContext.class, "transaction"); + this.addException(abstOp, TopiaException.class); + + // Copy exceptions + for (String ex : op.getExceptions()) { + this.addException(implOp, ex); + this.addException(abstOp, ex); + } + + String toStringAppend = ""; + String separatorLog = " : "; + String opParams = ""; + // Copy operation parameters + for (ObjectModelParameter param : op.getParameters()) { + String paramName = param.getName(); + this.addParameter(implOp, param.getType(), param.getName()); + this.addParameter(abstOp, param.getType(), param.getName()); + + // Prepare Log + toStringAppend += + "\n\t\t.append(\"" + separatorLog + paramName + " = \")" + + ".append(" + paramName + ")"; + separatorLog = " _ "; + + // Prepare Abstract method params + opParams += ", " + param.getName(); + } + + // Error key for i18n + String errorKey = StringUtils.lowerCase(modelName) + ".error." + + serviceName + "." + op.getName(); + + String opReturn = !op.getReturnType().equals("void") ? + "return " : ""; + String finalReturn = !op.getReturnType().equals("void") ? + "return null;" : ""; + + setOperationBody(implOp, "" + /*{ + TopiaContext transaction = null; + try { + transaction = context.getTopiaRootContext().beginTransaction(); + if (log.isInfoEnabled()) { + String message = new StringBuilder("<%=first%>:[ <%=opName%> ]")<%=toStringAppend%>. + toString(); + log.info(message); + } + + <%=opReturn%>execute<%=opName%>(transaction<%=opParams%>); + + } catch (Exception eee) { + context.doCatch(transaction, eee, I18n.n_("<%=errorKey%>")); + } finally { + context.doFinally(transaction); + } + <%=finalReturn%> + }*/ + ); + + } + + } + +// @Override +// public void transformFromClass(ObjectModelClass clazz) { +// if (!clazz.getName().equals(getContextClassName())) { +// return; +// } +// +// +// } + + +} Property changes on: trunk/pollen-topia-template/src/main/java/org/chorem/pollen/template/PollenServiceTransformer.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-votecounting/pom.xml =================================================================== --- trunk/pollen-votecounting/pom.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pollen-votecounting/pom.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -10,7 +10,7 @@ <parent> <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <groupId>org.chorem.pollen</groupId> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-03-23 11:15:12 UTC (rev 2955) +++ trunk/pom.xml 2010-03-23 15:39:36 UTC (rev 2956) @@ -15,10 +15,11 @@ <groupId>org.chorem</groupId> <artifactId>pollen</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <modules> - <module>pollen-ui</module> +<!-- <module>pollen-ui</module>--> + <module>pollen-template</module> <module>pollen-business</module> <module>pollen-votecounting</module> </modules> @@ -57,6 +58,11 @@ <version>${nuiton-utils.version}</version> </dependency> <dependency> + <groupId>org.nuiton.eugene</groupId> + <artifactId>eugene</artifactId> + <version>${eugene.version}</version> + </dependency> + <dependency> <groupId>org.nuiton.topia</groupId> <artifactId>topia-persistence</artifactId> <version>${topia.version}</version> @@ -304,11 +310,12 @@ <!-- customized versions --> <!--javadoc.version>2.4</javadoc.version--> - <topia.version>2.3</topia.version> + <topia.version>2.3.1-SNAPSHOT</topia.version> <eugene.version>2.0</eugene.version> <i18n.version>1.1.1-SNAPSHOT</i18n.version> <tapestry.version>5.1.0.5</tapestry.version> <nuiton-utils.version>1.2</nuiton-utils.version> + <processor.version>1.0.2</processor.version> <!-- <chorem-commons.version>1.0.0-alpha-2-SNAPSHOT</chorem-commons.version>--> <!--Multilanguage maven-site --> @@ -362,6 +369,26 @@ <artifactId>maven-i18n-plugin</artifactId> <version>${i18n.version}</version> </plugin> + <plugin> + <groupId>org.nuiton.processor</groupId> + <artifactId>maven-processor-plugin</artifactId> + <version>${processor.version}</version> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>process</goal> + </goals> + </execution> + </executions> + <configuration> + <includes>**/*.java</includes> + <filters> + org.nuiton.processor.filters.GeneratorTemplatesFilter, + org.nuiton.processor.filters.ActiveLogsCodeFilter + </filters> + </configuration> + </plugin> </plugins> </pluginManagement>