Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: 5957afdd by Tony CHEMIT at 2018-03-07T09:47:46Z clean code - - - - - f6fbda7f by Tony CHEMIT at 2018-03-07T09:48:01Z improve release process (now use ultreia.io magic) - - - - - 7 changed files: - t3-domain/src/main/java/fr/ird/t3/io/input/access/T3ReferentielEntityVisitor.java - + t3-installer/.mvn/add-build-number - + t3-installer/.mvn/application-assembly - t3-installer/pom.xml - t3-installer/src/main/assembly/bin.xml - + t3-installer/src/main/assembly/i18n.xml - t3/pom.xml Changes: ===================================== t3-domain/src/main/java/fr/ird/t3/io/input/access/T3ReferentielEntityVisitor.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3ReferentielEntityVisitor.java +++ b/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3ReferentielEntityVisitor.java @@ -39,128 +39,75 @@ import org.nuiton.topia.persistence.TopiaEntity; */ public class T3ReferentielEntityVisitor extends AbstractT3EntityVisitor { - /** Logger. */ - private static final Log log = - LogFactory.getLog(T3ReferentielEntityVisitor.class); + private static final Log log = LogFactory.getLog(T3ReferentielEntityVisitor.class); - public T3ReferentielEntityVisitor(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) { + T3ReferentielEntityVisitor(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) { super(dataSource, referentiel); } @Override - public void onVisitSimpleProperty(String propertyName, - Class<?> type, - T3AccessEntity entity, T3AccessEntityMeta meta) { + public void onVisitSimpleProperty(String propertyName, Class<?> type, T3AccessEntity entity, T3AccessEntityMeta meta) { // just set the property into the entity - if (!deepVisit) { if (!propertyName.equals(meta.getTopiaNaturalId())) { - // not a deep visit and not a pKey property name, skip visit return; } } - Serializable newValue = getProperty(propertyName, meta, row); - if (newValue != null) { if (log.isDebugEnabled()) { String colName = meta.getPropertyColumnName(propertyName); - log.debug("get property [" + propertyName + "] (type:" + - type.getName() + ") (dbcol:" + colName + ") = " + - newValue); + log.debug(String.format("get property [%s] (type:%s) (dbcol:%s) = %s", propertyName, type.getName(), colName, newValue)); } entity.setProperty(propertyName, newValue); } } @Override - public void onVisitComposition(String propertyName, - Class<?> type, - T3AccessEntity entity, - T3AccessEntityMeta meta) { - + public void onVisitComposition(String propertyName, Class<?> type, T3AccessEntity entity, T3AccessEntityMeta meta) { if (!deepVisit) { return; } - // find the reference entity to add as composition Serializable newValue = getProperty(propertyName, meta, row); if (newValue == null) { - // rien a faire si la composition est nulle return; } - - AbstractAccessEntityMeta.PropertyMapping mapping = - meta.getPropertyMapping(propertyName); + AbstractAccessEntityMeta.PropertyMapping mapping = meta.getPropertyMapping(propertyName); Class<?> compositionType = mapping.getType(); - - T3AccessEntityMeta compoMeta; - - T3AccessEntityMeta[] compoMetas = - dataSource.getMetaForType(compositionType); - + T3AccessEntityMeta[] compoMetas = dataSource.getMetaForType(compositionType); if (compoMetas.length == 0) { - if (log.isWarnEnabled()) { - log.warn("Skip composition [" + meta.getType() + " - " + - propertyName + "], meta of type [" + compositionType + - "] not found..."); - } + log.warn(String.format("Skip composition [%s - %s], meta of type [%s] not found...", meta.getType(), propertyName, compositionType)); return; } - if (compoMetas.length > 1) { - - // on n'autorise pas d'avoir plusieurs méta à traiter - // il s'agit d'une reférence sur un référentiel + // on n'autorise pas d'avoir plusieurs méta à traiter - il s'agit d'une reférence sur un référentiel throw new IllegalStateException( - "Found more than one meta for referentiel type [" + - compositionType + "] : " + Arrays.toString(compoMetas)); + String.format("Found more than one meta for referentiel type [%s] : %s", compositionType, Arrays.toString(compoMetas))); } - - compoMeta = compoMetas[0]; - + T3AccessEntityMeta compoMeta = compoMetas[0]; TopiaEntity compoEntity = getReferenceEntity(compoMeta, newValue); - if (compoEntity == null) { - // could not find the correct composition entity throw new IllegalStateException( - "Could not find reference entity of type [" + - compoMeta.getType() + "] with pKey [" + newValue + "]"); + String.format("Could not find reference entity of type [%s] with pKey [%s]", compoMeta.getType(), newValue)); } - -// // find the correct entity -// T3AccessEntity toSave = (T3AccessEntity) compoEntity; -// -// if (log.isDebugEnabled()) { -// log.debug("Will add composition [" + propertyName + -// ":" + toSave + "] to " + entity); -// } // then affect it to this entity for the given property entity.setProperty(propertyName, compoEntity); } @Override - public void onVisitAssociation(String propertyName, - Class<?> type, - T3AccessEntity entity, - T3AccessEntityMeta meta) { + public void onVisitAssociation(String propertyName, Class<?> type, T3AccessEntity entity, T3AccessEntityMeta meta) { // no used for reference entity - throw new IllegalStateException( - "Can not visit an association for a reference entity " + - entity); + throw new IllegalStateException(String.format("Can not visit an association for a reference entity %s", entity)); } @Override - public void onVisitReverseAssociation(String propertyName, - T3AccessEntity entity, - T3AccessEntityMeta meta) { + public void onVisitReverseAssociation(String propertyName, T3AccessEntity entity, T3AccessEntityMeta meta) { // no used for reference entity - throw new IllegalStateException( - "Can not visit a reverse association for a reference entity " + - entity); + throw new IllegalStateException(String.format("Can not visit a reverse association for a reference entity %s", entity)); } } ===================================== t3-installer/.mvn/add-build-number ===================================== --- /dev/null +++ b/t3-installer/.mvn/add-build-number ===================================== t3-installer/.mvn/application-assembly ===================================== --- /dev/null +++ b/t3-installer/.mvn/application-assembly ===================================== t3-installer/pom.xml ===================================== --- a/t3-installer/pom.xml +++ b/t3-installer/pom.xml @@ -140,48 +140,10 @@ <build> - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-dependencies</id> - <goals> - <goal>copy-dependencies</goal> - </goals> - <phase>process-classes</phase> - <configuration> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>true</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - <silent>true</silent> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - <pluginManagement> <plugins> <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <useUniqueVersions>true</useUniqueVersions> - <addClasspath>true</addClasspath> - <classpathPrefix>./lib/</classpathPrefix> - <mainClass>${maven.jar.main.class}</mainClass> - </manifest> - </archive> - </configuration> - </plugin> - - <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-Xms512m -Xmx1512m</argLine> @@ -291,39 +253,6 @@ </profile> <profile> - <id>assembly-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/main/assembly/bin.xml</descriptor> - </descriptors> - <attach>true</attach> - </configuration> - <executions> - <execution> - <id>create-assemblies</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> <id>run-reference-tools-its</id> <activation> <property> ===================================== t3-installer/src/main/assembly/bin.xml ===================================== --- a/t3-installer/src/main/assembly/bin.xml +++ b/t3-installer/src/main/assembly/bin.xml @@ -28,20 +28,12 @@ <fileSets> <fileSet> - <directory>${project.build.directory}/lib</directory> - <outputDirectory>lib</outputDirectory> - <fileMode>0755</fileMode> - <includes> - <include>*.jar</include> - </includes> - </fileSet> - - <fileSet> <directory>${project.build.directory}</directory> <outputDirectory/> <fileMode>0755</fileMode> <includes> <include>${project.build.finalName}.jar</include> + <include>${project.build.finalName}.exe</include> </includes> </fileSet> @@ -55,7 +47,7 @@ </fileSet> <fileSet> - <directory>${installer.cache}/t3-data-ddl-${t3-data.version}</directory> + <directory>${installer.cache.dir}/t3-data-ddl-${t3-data.version}</directory> <outputDirectory>scripts/ddl</outputDirectory> <includes> <include>**/*</include> @@ -63,7 +55,7 @@ </fileSet> <fileSet> - <directory>${installer.cache}/t3-data-referential-${t3-data.version}</directory> + <directory>${installer.cache.dir}/t3-data-referential-${t3-data.version}</directory> <outputDirectory>scripts/referential</outputDirectory> <includes> <include>**/*</include> @@ -71,7 +63,7 @@ </fileSet> <fileSet> - <directory>${installer.cache}/t3-data-zones-${t3-data.version}</directory> + <directory>${installer.cache.dir}/t3-data-zones-${t3-data.version}</directory> <outputDirectory>scripts/zones</outputDirectory> <includes> <include>**/*</include> @@ -79,7 +71,7 @@ </fileSet> <fileSet> - <directory>${installer.cache}/t3-data-h2-${t3-data.version}</directory> + <directory>${installer.cache.dir}/t3-data-h2-${t3-data.version}</directory> <outputDirectory>scripts/h2</outputDirectory> <includes> <include>**/*</include> @@ -106,6 +98,7 @@ <includes> <include>**/*.sh</include> <include>**/*.bat</include> + <include>**/*.exe</include> </includes> </fileSet> </fileSets> ===================================== t3-installer/src/main/assembly/i18n.xml ===================================== --- /dev/null +++ b/t3-installer/src/main/assembly/i18n.xml @@ -0,0 +1,36 @@ +<!-- + #%L + T3 :: Installer + %% + Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io + %% + 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% + --> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>i18n</id> + <formats> + <format>zip</format> + </formats> + <fileSets> + <fileSet> + <directory>target/classes/META-INF</directory> + <outputDirectory/> + <includes> + <include>t3-i18n*</include> + </includes> + </fileSet> + </fileSets> +</assembly> ===================================== t3/pom.xml ===================================== --- a/t3/pom.xml +++ b/t3/pom.xml @@ -76,7 +76,6 @@ <artifactId>t3-installer</artifactId> <version>${project.version}</version> <type>zip</type> - <classifier>bin</classifier> </artifactItem> </artifactItems> </configuration> View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/9b358873bc52532b61c1b78c480f6453... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/9b358873bc52532b61c1b78c480f6453... You're receiving this email because of your account on gitlab.com.