Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
June 2012
- 5 participants
- 163 discussions
01 Jun '12
Author: tchemit
Date: 2012-06-01 12:04:08 +0200 (Fri, 01 Jun 2012)
New Revision: 3410
Url: http://chorem.org/repositories/revision/pollen/3410
Log:
updates to nuiton-utils 2.4.9 + use aggregate application config report
Modified:
trunk/pollen-ui-struts2/pom.xml
trunk/pom.xml
trunk/src/site/rst/configure.rst
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-06-01 10:03:18 UTC (rev 3409)
+++ trunk/pollen-ui-struts2/pom.xml 2012-06-01 10:04:08 UTC (rev 3410)
@@ -197,7 +197,7 @@
<properties>
<i18n.silent>true</i18n.silent>
- <i18n.bundleOutputName>pollen-i18n</i18n.bundleOutputName>
+ <i18n.bundleOutputName>${pollenI18nBundle}</i18n.bundleOutputName>
<redmine.releaseFiles>
target/${project.build.finalName}.war,
@@ -440,36 +440,6 @@
</build>
</profile>
- <profile>
- <id>reporting</id>
- <activation>
- <property>
- <name>performRelease</name>
- <value>true</value>
- </property>
- </activation>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils-maven-report-plugin</artifactId>
- <version>${nuitonUtilsVersion}</version>
- <reportSets>
- <reportSet>
- <reports>
- <report>application-config-report</report>
- </reports>
- </reportSet>
- </reportSets>
- <configuration>
- <i18nBundleName>${i18n.bundleOutputName}</i18nBundleName>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- </profile>
-
</profiles>
</project>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-06-01 10:03:18 UTC (rev 3409)
+++ trunk/pom.xml 2012-06-01 10:04:08 UTC (rev 3410)
@@ -1,5 +1,7 @@
<?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">
+<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>
@@ -181,7 +183,7 @@
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<nuitonWebVersion>1.11</nuitonWebVersion>
- <nuitonUtilsVersion>2.4.8</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.4.9-SNAPSHOT</nuitonUtilsVersion>
<h2Version>1.3.167</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
<struts2Version>2.3.4</struts2Version>
@@ -190,6 +192,7 @@
<slf4jVersion>1.6.4</slf4jVersion>
<jettyVersion>${jettyPluginVersion}</jettyVersion>
+ <pollenI18nBundle>pollen-i18n</pollenI18nBundle>
<!-- license to use -->
<license.licenseName>agpl_v3</license.licenseName>
@@ -601,14 +604,18 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>l10n-maven-plugin</artifactId>
- <version>${l10nPluginVersion}</version>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils-maven-report-plugin</artifactId>
+ <version>${nuitonUtilsVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>aggregate-application-config-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
<configuration>
- <locales>
- <locale>fr_FR</locale>
- <locale>en_GB</locale>
- </locales>
+ <i18nBundleName>${pollenI18nBundle}</i18nBundleName>
</configuration>
</plugin>
Modified: trunk/src/site/rst/configure.rst
===================================================================
--- trunk/src/site/rst/configure.rst 2012-06-01 10:03:18 UTC (rev 3409)
+++ trunk/src/site/rst/configure.rst 2012-06-01 10:04:08 UTC (rev 3410)
@@ -96,4 +96,4 @@
| MySql | org.hibernate.dialect.MySQLDialect | com.mysql.jdbc.Driver | jdbc:mysql:pollen |
+-------------------------+------------------------------------------+-----------------------------------+------------------------------------------+
-.. _options page: ./pollen-ui-struts2/application-config-report.html
\ No newline at end of file
+.. _options page: ./application-config-report.html
\ No newline at end of file
1
0
r3409 - trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration
by tchemit@users.chorem.org 01 Jun '12
by tchemit@users.chorem.org 01 Jun '12
01 Jun '12
Author: tchemit
Date: 2012-06-01 12:03:18 +0200 (Fri, 01 Jun 2012)
New Revision: 3409
Url: http://chorem.org/repositories/revision/pollen/3409
Log:
fixes #574: Mauvais d?\195?\169pouillement Vote Condorcet
Modified:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java 2012-06-01 09:42:49 UTC (rev 3408)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java 2012-06-01 10:03:18 UTC (rev 3409)
@@ -72,7 +72,7 @@
@Override
protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
- PreparedStatement ps = connection.prepareStatement("select topiaid from vote where vote in (select topiaid from poll where votecountingtype=2);");
+ PreparedStatement ps = connection.prepareStatement("select topiaid from vote where topiaid in (select topiaid from poll where votecountingtype=2);");
return ps;
}
1
0
r3408 - in trunk: . pollen-persistence/src/main/java/org/chorem/pollen/entities/migration pollen-persistence/src/main/resources/META-INF/services pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll
by tchemit@users.chorem.org 01 Jun '12
by tchemit@users.chorem.org 01 Jun '12
01 Jun '12
Author: tchemit
Date: 2012-06-01 11:42:49 +0200 (Fri, 01 Jun 2012)
New Revision: 3408
Url: http://chorem.org/repositories/revision/pollen/3408
Log:
using topia 2.6.11 (use new migration mode)
fixes #574: Mauvais d?\195?\169pouillement Vote Condorcet
fixes #576: Impossible de modifier un vote condorcet pour revenir ?\195?\160 "null"
Added:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java
trunk/pollen-persistence/src/main/resources/META-INF/services/org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG$MigrationCallBackForVersion
Modified:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_1.java
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2.java
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3.java
trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3_1.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
trunk/pom.xml
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -24,7 +24,7 @@
package org.chorem.pollen.entities.migration;
import org.chorem.pollen.entities.PollenDAOHelper;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
@@ -36,29 +36,31 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.3
*/
-public class PollenMigrationCallback extends TopiaMigrationCallbackByClass {
+public class PollenMigrationCallback extends TopiaMigrationCallbackByClassNG {
- public static final Version V_1_1 = VersionUtil.valueOf("1.1");
+// public static final Version V_1_1 = VersionUtil.valueOf("1.1");
+//
+// public static final Version V_1_2 = VersionUtil.valueOf("1.2");
+//
+// public static final Version V_1_3 = VersionUtil.valueOf("1.3");
+//
+// public static final Version V_1_3_1 = VersionUtil.valueOf("1.3.1");
+//
+// public static final Version V_1_4 = VersionUtil.valueOf("1.4");
- public static final Version V_1_2 = VersionUtil.valueOf("1.2");
+// /** Les versions de mise à jour disponibles. */
+// public static final Version[] AVAILABLE_VERSIONS = new Version[]{
+// V_1_1, V_1_2, V_1_3, V_1_3_1, V_1_4
+// };
- public static final Version V_1_3 = VersionUtil.valueOf("1.3");
-
- public static final Version V_1_3_1 = VersionUtil.valueOf("1.3.1");
-
- /** Les versions de mise à jour disponibles. */
- public static final Version[] AVAILABLE_VERSIONS = new Version[]{
- V_1_1, V_1_2, V_1_3, V_1_3_1
- };
-
public PollenMigrationCallback() {
- super(new PollenMigrationCallBackForVersionResolver());
+ super(new MigrationCallBackForVersionResolverByServiceLoader());
}
- @Override
- public Version[] getAvailableVersions() {
- return AVAILABLE_VERSIONS;
- }
+// @Override
+// public Version[] getAvailableVersions() {
+// return AVAILABLE_VERSIONS;
+// }
@Override
public Version getApplicationVersion() {
@@ -70,26 +72,26 @@
return true;
}
- /**
- * Migration resolver for each version.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.1
- */
- public static class PollenMigrationCallBackForVersionResolver implements MigrationCallBackForVersionResolver {
-
- @Override
- public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
-
- String fqn = PollenMigrationCallback.class.getName() + "V" + version.getValidName();
- Class<?> klass;
- try {
- klass = Class.forName(fqn);
- } catch (ClassNotFoundException e) {
- throw new IllegalStateException(
- "Could not find migration class " + fqn, e);
- }
- return (Class<? extends MigrationCallBackForVersion>) klass;
- }
- }
+// /**
+// * Migration resolver for each version.
+// *
+// * @author tchemit <chemit(a)codelutin.com>
+// * @since 1.0.1
+// */
+// public static class PollenMigrationCallBackForVersionResolver implements MigrationCallBackForVersionResolver {
+//
+// @Override
+// public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
+//
+// String fqn = PollenMigrationCallback.class.getName() + "V" + version.getValidName();
+// Class<?> klass;
+// try {
+// klass = Class.forName(fqn);
+// } catch (ClassNotFoundException e) {
+// throw new IllegalStateException(
+// "Could not find migration class " + fqn, e);
+// }
+// return (Class<? extends MigrationCallBackForVersion>) klass;
+// }
+// }
}
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_1.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_1.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_1.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -28,7 +28,9 @@
import org.hibernate.dialect.PostgreSQLDialect;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
import java.util.Arrays;
import java.util.List;
@@ -39,10 +41,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.3
*/
-public class PollenMigrationCallbackV1_1 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion {
+public class PollenMigrationCallbackV1_1 extends TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion {
- public PollenMigrationCallbackV1_1(TopiaMigrationCallbackByClass callBack) {
- super(PollenMigrationCallback.V_1_1, callBack);
+ @Override
+ public Version getVersion() {
+ return VersionUtil.valueOf("1.1");
}
@Override
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -28,7 +28,9 @@
import org.hibernate.dialect.PostgreSQLDialect;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
import java.util.Arrays;
import java.util.List;
@@ -39,10 +41,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.3
*/
-public class PollenMigrationCallbackV1_2 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion {
+public class PollenMigrationCallbackV1_2 extends TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion {
- public PollenMigrationCallbackV1_2(TopiaMigrationCallbackByClass callBack) {
- super(PollenMigrationCallback.V_1_2, callBack);
+ @Override
+ public Version getVersion() {
+ return VersionUtil.valueOf("1.2");
}
@Override
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -33,7 +33,9 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaSQLQuery;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -48,10 +50,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.3
*/
-public class PollenMigrationCallbackV1_3 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion {
+public class PollenMigrationCallbackV1_3 extends TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion {
- public PollenMigrationCallbackV1_3(TopiaMigrationCallbackByClass callBack) {
- super(PollenMigrationCallback.V_1_3, callBack);
+ @Override
+ public Version getVersion() {
+ return VersionUtil.valueOf("1.3");
}
@Override
@@ -60,14 +63,6 @@
boolean showSql,
boolean showProgression) throws TopiaException {
-// Dialect dialect =
-// Dialect.getDialect(tx.getHibernateConfiguration().getProperties());
-//
-// if (dialect instanceof PostgreSQLDialect) {
-//
-// } else if (dialect instanceof H2Dialect) {
-// }
-
// change choice type to use enumeration
migrateChoiceTypes(tx, queries);
@@ -86,11 +81,11 @@
// add author column for Comment
addCommentAuthorColumn(queries);
}
-
+
private void addCommentAuthorColumn(List<String> queries) {
queries.add("ALTER TABLE comment ADD COLUMN author VARCHAR(255);");
-
+
queries.add("UPDATE comment AS c SET author = (SELECT p.votingId FROM pollAccount p WHERE c.pollAccount = p.topiaId);");
queries.add("ALTER TABLE comment ALTER COLUMN author TYPE VARCHAR(255);");
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3_1.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3_1.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_3_1.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -26,7 +26,9 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaSQLQuery;
-import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -40,10 +42,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.3.1
*/
-public class PollenMigrationCallbackV1_3_1 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion {
+public class PollenMigrationCallbackV1_3_1 extends TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion {
- public PollenMigrationCallbackV1_3_1(TopiaMigrationCallbackByClass callBack) {
- super(PollenMigrationCallback.V_1_3_1, callBack);
+ @Override
+ public Version getVersion() {
+ return VersionUtil.valueOf("1.3.1");
}
@Override
Added: trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java (rev 0)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -0,0 +1,125 @@
+/*
+ * #%L
+ * Pollen :: Persistence
+ *
+ * $Id: PollenMigrationCallbackV1_3_1.java 3407 2012-05-28 17:06:39Z tchemit $
+ * $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-persistence/src/main/java/org… $
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package org.chorem.pollen.entities.migration;
+
+import org.chorem.pollen.business.persistence.VoteToChoice;
+import org.chorem.pollen.business.persistence.VoteToChoiceImpl;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.framework.TopiaSQLQuery;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * Migration for version {@code 1.4}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4
+ */
+public class PollenMigrationCallbackV1_4 extends TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion {
+
+ @Override
+ public Version getVersion() {
+ return VersionUtil.valueOf("1.4");
+ }
+
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries,
+ boolean showSql,
+ boolean showProgression) throws TopiaException {
+
+ // remove all votes of condorcet type with a null value (<=0)
+ // see http://chorem.org/issues/574
+ // see http://chorem.org/issues/576
+ removeAllCondorcetNullVotes(tx, queries);
+ }
+
+ private void removeAllCondorcetNullVotes(TopiaContextImplementor tx,
+ List<String> queries) throws TopiaException {
+
+ // get all votes from all polls with votecountingtype = 2 (condorcet)
+
+ TopiaSQLQuery<String> getAllVotesQuery = new TopiaSQLQuery<String>() {
+
+ @Override
+ protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ PreparedStatement ps = connection.prepareStatement("select topiaid from vote where vote in (select topiaid from poll where votecountingtype=2);");
+ return ps;
+ }
+
+ @Override
+ protected String prepareResult(ResultSet set) throws SQLException {
+ return set.getString(1);
+ }
+ };
+ List<String> voteIds = getAllVotesQuery.findMultipleResult(tx);
+
+ for (String voteId : voteIds) {
+
+ // get voteToChoice for this vote
+ VoteToChoice voteToChoice =
+ new GetVoteToChoiceSQLQuery(voteId).findSingleResult(tx);
+
+ if (voteToChoice.getVoteValue() <= 0) {
+
+ // delete this vote
+
+ queries.add("DELETE FROM votetochoice where topiaid ='" + voteToChoice.getTopiaId() + "';");
+ }
+ }
+ }
+
+ private static class GetVoteToChoiceSQLQuery extends TopiaSQLQuery<VoteToChoice> {
+
+ private final String voteId;
+
+ public GetVoteToChoiceSQLQuery(String voteId) {
+ this.voteId = voteId;
+ }
+
+ @Override
+ protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ PreparedStatement ps = connection.prepareStatement(
+ "SELECT topiaid, votevalue FROM votetochoice WHERE vote = ?;");
+ ps.setString(1, voteId);
+ return ps;
+ }
+
+ @Override
+ protected VoteToChoice prepareResult(ResultSet set) throws SQLException {
+ VoteToChoice result = new VoteToChoiceImpl();
+ result.setTopiaId(set.getString(1));
+ result.setVoteValue(set.getInt(2));
+ return result;
+ }
+ }
+}
Added: trunk/pollen-persistence/src/main/resources/META-INF/services/org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG$MigrationCallBackForVersion
===================================================================
--- trunk/pollen-persistence/src/main/resources/META-INF/services/org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG$MigrationCallBackForVersion (rev 0)
+++ trunk/pollen-persistence/src/main/resources/META-INF/services/org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG$MigrationCallBackForVersion 2012-06-01 09:42:49 UTC (rev 3408)
@@ -0,0 +1,5 @@
+org.chorem.pollen.entities.migration.PollenMigrationCallbackV1_1
+org.chorem.pollen.entities.migration.PollenMigrationCallbackV1_2
+org.chorem.pollen.entities.migration.PollenMigrationCallbackV1_3
+org.chorem.pollen.entities.migration.PollenMigrationCallbackV1_3_1
+org.chorem.pollen.entities.migration.PollenMigrationCallbackV1_4
\ No newline at end of file
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-01 09:42:49 UTC (rev 3408)
@@ -34,6 +34,7 @@
import org.chorem.pollen.business.persistence.Vote;
import org.chorem.pollen.business.persistence.VoteToChoice;
import org.chorem.pollen.common.PollType;
+import org.chorem.pollen.common.VoteCountingType;
/**
* Votes to a poll.
@@ -81,14 +82,27 @@
}
}
-
int nbVotes = 0;
int totalValues = 0;
for (VoteToChoice voteToChoice : vote.getChoiceVoteToChoice()) {
Integer value = voteToChoice.getVoteValue();
+ if (value == null) {
+ // not vote
+ continue;
+ }
// XXX-fdesbois-2012-04-11 : for a VoteCountingType#NUMBER the difference between 0 and null value could be important
- if (value != null && value != 0) {
+ if (isCondorcetVoteCounting()) {
+ if (value > 0) {
+
+ // for condorcet vote, must be strictly greater than 0
+ // see http://chorem.org/issues/574
+ // see http://chorem.org/issues/576
+ nbVotes++;
+ totalValues += value;
+ }
+ // for other vote type, value must be > 0
+ } else if (value != 0) {
nbVotes++;
totalValues += value;
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-05-28 17:06:39 UTC (rev 3407)
+++ trunk/pom.xml 2012-06-01 09:42:49 UTC (rev 3408)
@@ -176,7 +176,7 @@
<projectId>pollen</projectId>
<!-- customized versions -->
- <topiaVersion>2.6.10</topiaVersion>
+ <topiaVersion>2.6.11-SNAPSHOT</topiaVersion>
<eugenePluginVersion>2.4.2</eugenePluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
1
0