This is an automated email from the git hooks/post-receive script. New commit to branch feature1378-MAJ_libs in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit 5906453ab9a19c5c9adedc494cfc953ad711a923 Author: David Cossé <cosse@codelutin.com> Date: Thu Dec 29 19:12:16 2016 +0100 refs #1373 mise à jour version topia --- .../chorem/lima/business/LimaBusinessConfig.java | 5 +-- .../org/chorem/lima/business/LimaInterceptor.java | 27 +++++++------- .../chorem/lima/entity/LimaFlywayServiceImpl.java | 10 +++--- .../org/chorem/lima/business/LimaTestsConfig.java | 2 -- .../org/chorem/lima/common/FixedH2Dialect.java | 42 ++++++++++++++++++++++ .../src/main/xmi/lima-callao-model.properties | 6 ++-- .../lima/report/service/DocumentService.java | 1 - .../FinancialTransactionViewHandler.java | 20 +++++------ pom.xml | 6 ++-- 9 files changed, 80 insertions(+), 39 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java index c3ecca2..a3fa1e4 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaBusinessConfig.java @@ -29,7 +29,6 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.business.accountingrules.FranceAccountingRules; import org.chorem.lima.business.config.LimaConfigOptionDef; -import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaFlywayServiceImpl; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; @@ -116,8 +115,6 @@ public class LimaBusinessConfig { protected static Properties getRootContextProperties() { if (getInstance().rootContextProperties == null) { Properties result = instance.getFlatOptions(); - // add persistence classes from generated code - result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString()); Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap(); toAddIfNotPresent.put("topia.service.migration", LimaFlywayServiceImpl.class.getName()); @@ -336,7 +333,7 @@ public class LimaBusinessConfig { CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima-business.config", String.class, true, true), - DB_DIALECT("hibernate.dialect","", "org.hibernate.dialect.H2Dialect", String.class, false, false), + DB_DIALECT("hibernate.dialect","", "org.chorem.lima.common.FixedH2Dialect", String.class, false, false), DB_USER_NAME("hibernate.connection.username","", "sa", String.class, false, false), DB_PASSWORD("hibernate.connection.password","", "", String.class, false, false), DB_DRIVER("hibernate.connection.driver_class","", "org.h2.Driver", String.class, false, false), diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java b/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java index 8681c41..236ca36 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java @@ -22,13 +22,14 @@ package org.chorem.lima.business; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaXAResource; import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier; -import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; import org.nuiton.topia.persistence.TopiaApplicationContextCache; +import org.nuiton.topia.persistence.TopiaPersistenceContext; import javax.annotation.Resource; import javax.ejb.Stateless; @@ -37,6 +38,7 @@ import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; import javax.transaction.Transaction; import javax.transaction.TransactionManager; +import java.util.Set; /** * Interceptor for topia context transaction. @@ -83,27 +85,28 @@ public class LimaInterceptor { LimaBusinessConfig.getRootContextProperties(), LimaConfigurationHelper.getCreateTopiaContextFunction()); - LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext(); + TopiaPersistenceContext tx; + Set<TopiaPersistenceContext> contexts = rootContext.getPersistenceContexts(); + if (CollectionUtils.isEmpty(contexts)) { + rootContext.newPersistenceContext(); + contexts = rootContext.getPersistenceContexts(); + } + tx = contexts.iterator().next(); - DAO_HELPER.set(tx); + DAO_HELPER.set((LimaCallaoTopiaDaoSupplier) tx); Transaction tr = transactionManager.getTransaction(); // enlist topia xaresource, will commited or rollback // by container tr.enlistResource(new LimaXAResource(tx)); - - try { - result = context.proceed(); - } finally { - DAO_HELPER.remove(); - } - } else { - result = context.proceed(); } + } - } else { + try { result = context.proceed(); + } finally { + DAO_HELPER.remove(); } return result; diff --git a/lima-business/src/main/java/org/chorem/lima/entity/LimaFlywayServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/entity/LimaFlywayServiceImpl.java index c2109d8..339ddb6 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/LimaFlywayServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/LimaFlywayServiceImpl.java @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.h2.Driver; import org.nuiton.topia.flyway.TopiaFlywayServiceImpl; import org.nuiton.topia.persistence.TopiaApplicationContext; -import org.nuiton.topia.persistence.TopiaConfigurationConstants; +import org.nuiton.topia.persistence.TopiaConfiguration; import org.nuiton.topia.persistence.TopiaException; import java.sql.Connection; @@ -51,11 +51,11 @@ public class LimaFlywayServiceImpl extends TopiaFlywayServiceImpl { protected Connection getConnection(TopiaApplicationContext topiaApplicationContext) throws SQLException { - Map<String, String> configuration = topiaApplicationContext.getConfiguration(); + TopiaConfiguration configuration0 = topiaApplicationContext.getConfiguration(); - String url = configuration.get(TopiaConfigurationConstants.CONFIG_URL); - String user = configuration.get(TopiaConfigurationConstants.CONFIG_USER); - String password = configuration.get(TopiaConfigurationConstants.CONFIG_PASS); + String url = configuration0.getJdbcConnectionUrl(); + String user = configuration0.getJdbcConnectionUser(); + String password = configuration0.getJdbcConnectionPassword(); DriverManager.registerDriver(new Driver()); Connection connection = DriverManager.getConnection(url, user, password); diff --git a/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java b/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java index a7f3277..abbed22 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java +++ b/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java @@ -23,7 +23,6 @@ package org.chorem.lima.business; */ import com.google.common.collect.Maps; -import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.nuiton.config.ApplicationConfig; import org.nuiton.topia.flyway.TopiaFlywayService; import org.nuiton.topia.flyway.TopiaFlywayServiceImpl; @@ -52,7 +51,6 @@ public class LimaTestsConfig { protected void setRootContextProperties(LimaBusinessConfig instance) { Properties result = instance.getFlatOptions(); // add persistence classes from generated code - result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString()); Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap(); toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName()); diff --git a/lima-callao/src/main/java/org/chorem/lima/common/FixedH2Dialect.java b/lima-callao/src/main/java/org/chorem/lima/common/FixedH2Dialect.java new file mode 100644 index 0000000..5a74cb9 --- /dev/null +++ b/lima-callao/src/main/java/org/chorem/lima/common/FixedH2Dialect.java @@ -0,0 +1,42 @@ +package org.chorem.lima.common; + +/* + * #%L + * Agrosyst :: Services + * $Id: FixedH2Dialect.java 6424 2016-10-24 16:06:49Z dcosse $ + * $HeadURL: https://svn.codelutin.com/agrosyst/trunk/agrosyst-services/src/main/java/fr/... $ + * %% + * Copyright (C) 2013 - 2016 INRA + * %% + * 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% + */ + +import java.sql.Types; + +/** + * Override the H2Dialect to fix detected wrong value + * + * @author Arnaud Thimel (Code Lutin) + */ +public class FixedH2Dialect extends org.hibernate.dialect.H2Dialect { + + public FixedH2Dialect() { + super(); + + registerColumnType( Types.LONGVARCHAR, String.format("varchar(%d)", Integer.MAX_VALUE) ); + } + +} + diff --git a/lima-callao/src/main/xmi/lima-callao-model.properties b/lima-callao/src/main/xmi/lima-callao-model.properties index dad8b12..c1cb0d4 100644 --- a/lima-callao/src/main/xmi/lima-callao-model.properties +++ b/lima-callao/src/main/xmi/lima-callao-model.properties @@ -20,12 +20,14 @@ # #L% ### # Precise l'entete de l'ensemble des fichiers generes -model.tagvalue.copyright=/*\n Copyright (C) 2009-2012 Lima Callao\n */ model.tagvalue.version=0.8.7.0 model.tagvalue.constantPrefix=PROPERTY_ model.tagValue.notGenerateToString=true +model.tagValue.hibernateAttributeType.java.lang.String=text model.tagValue.hibernateAttributeType.String=text -model.tagValue.doNotGenerateBooleanGetMethods=false +model.tagValue.hibernateAttributeType.Integer=java.lang.Integer +model.tagValue.hibernateAttributeType.java.sql.Blob=blob +model.tagvalue.useEnumerationName=true # natural id org.chorem.lima.entity.Account.class.tagvalue.naturalIdMutable=false diff --git a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java index e91f708..fe15ea4 100644 --- a/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java +++ b/lima-report/src/main/java/org/chorem/lima/report/service/DocumentService.java @@ -118,7 +118,6 @@ public class DocumentService { jasperReports = new JasperReports(); File reportDir = LimaReportConfig.getInstance().getReportsModelDir(); - FileUtil.createDirectoryIfNecessary(reportDir); String reportDirPath = reportDir.getAbsolutePath(); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java index ab9621e..a480bc8 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java @@ -151,16 +151,16 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo @Override public void tableChanged(TableModelEvent e) { - - boolean mustRecompute = e.getType() == TableModelEvent.DELETE - || e.getType() == TableModelEvent.INSERT - || (e.getType() == TableModelEvent.UPDATE && - (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); - - if (mustRecompute) { - computeBalanceStatusText(); - } - + if (initializationComplete) { + boolean mustRecompute = e.getType() == TableModelEvent.DELETE + || e.getType() == TableModelEvent.INSERT + || (e.getType() == TableModelEvent.UPDATE && + (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); + + if (mustRecompute) { + computeBalanceStatusText(); + } + } } }); diff --git a/pom.xml b/pom.xml index 23f28d2..33e2a9e 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ <projectId>lima</projectId> <!-- customized libs version --> - <eugeneVersion>2.14</eugeneVersion> + <nuitonConfigVersion>3.1</nuitonConfigVersion> <nuitonConfigVersion>3.1</nuitonConfigVersion> <nuitonDecoratorVersion>3.0</nuitonDecoratorVersion> <nuitonProfilingVersion>3.0</nuitonProfilingVersion> @@ -163,7 +163,8 @@ <nuitonI18nVersion>3.6.2</nuitonI18nVersion> <nuitonUtilsVersion>3.0-rc-16</nuitonUtilsVersion> <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion> - <topiaVersion>3.0-beta-15</topiaVersion> + <eugeneVersion>2.15</eugeneVersion> + <topiaVersion>3.1.3</topiaVersion> <commonsCodecVersion>1.10</commonsCodecVersion> <commonsEmailVersion>1.4</commonsEmailVersion> @@ -360,7 +361,6 @@ <artifactId>hibernate-core</artifactId> <version>${hibernateVersion}</version> </dependency> - <!-- Services --> <dependency> <groupId>org.apache.openejb</groupId> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.