T3-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
- 424 discussions
[Git][ultreiaio/ird-t3][develop] 3 commits: Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
by Tony CHEMIT 06 Mar '18
by Tony CHEMIT 06 Mar '18
06 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
dce06545 by Tony CHEMIT at 2018-03-06T15:48:07Z
Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
- - - - -
bafe8b93 by Tony CHEMIT at 2018-03-06T15:48:08Z
Mise en place de l'import sans log books (reste à remplir l'ocean à partir des coordonnées de l'activité fictive) (see #116)
- - - - -
961f8808 by Tony CHEMIT at 2018-03-06T15:48:08Z
Règles d'acceptation des marées dans les traitements (closes #276)
- - - - -
30 changed files:
- t3-actions/pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContext.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/SampleSetImpl.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3EntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessEntityProxyHandler.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
- t3-domain/src/main/resources/db/migration/V2_3_01_add-Trip-tripType.sql
- + t3-domain/src/main/resources/db/migration/V2_3_02_add-VesselActivity-row.sql
- t3-domain/src/main/xmi/t3-persistence.properties
- t3-domain/src/main/xmi/t3-persistence.zargo
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/ImportInputSourceActionTest.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
- t3-msaccess-importer/src/main/java/fr/ird/msaccess/importer/AbstractAccessDataSource.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/e46c2d8fb4e2566e6c6a0139beea4ee…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/e46c2d8fb4e2566e6c6a0139beea4ee…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] Règles d'acceptation des marées dans les traitements (closes #276)
by Tony CHEMIT 06 Mar '18
by Tony CHEMIT 06 Mar '18
06 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
e46c2d8f by Tony CHEMIT at 2018-03-06T15:44:21Z
Règles d'acceptation des marées dans les traitements (closes #276)
- - - - -
4 changed files:
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- − t3-web/src/main/java/fr/ird/t3/web/validators/Level1ConfigurationFieldValidator.java
- t3-web/src/main/resources/fr/ird/t3/web/actions/data/level1/ManageLevel1ConfigurationAction-validateLevel1Configuration-validation.xml
- t3-web/src/main/resources/validators.xml
Changes:
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
@@ -234,8 +234,7 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao<
}
/**
- * Obtains all trips usable for a level 1 configuration, says :
- * <p/>
+ * Obtains all trips usable for a level 1 configuration, says:
* <ul>
* <li>Only for senneur vessel simple type</li>
* <li>samplesOnly = true or completionStatus >0</li>
@@ -247,8 +246,7 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao<
*/
@SuppressWarnings("unused")
public List<E> findAllForLevel1() {
- String hql = "SELECT t FROM TripImpl t WHERE t.vessel.vesselType.vesselSimpleType.code = 1 " +
- "AND (t.tripType = 1 OR (t.completionStatus IS NOT NULL AND t.completionStatus > 0))";
+ String hql = "SELECT t FROM TripImpl t WHERE t.vessel.vesselType.vesselSimpleType.code = 1";
List<E> result = findAll(hql);
sortTrips(result);
return result;
=====================================
t3-web/src/main/java/fr/ird/t3/web/validators/Level1ConfigurationFieldValidator.java deleted
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/validators/Level1ConfigurationFieldValidator.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * #%L
- * T3 :: Web
- * %%
- * 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%
- */
-package fr.ird.t3.web.validators;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import com.opensymphony.xwork2.validator.ValidationException;
-import fr.ird.t3.actions.data.level0.Level0Step;
-import fr.ird.t3.actions.data.level1.Level1Configuration;
-import fr.ird.t3.entities.data.Trip;
-import org.nuiton.decorator.Decorator;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.t;
-
-/**
- * Validate that a level 1 configuration have all his trips ok for a
- * level 1 treatment.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 1.0
- */
-public class Level1ConfigurationFieldValidator extends T3BaseFieldValidatorSupport {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void validateWhenNotSkip(Object object) throws ValidationException {
- if (getValidatorContext().hasFieldErrors()) {
- // do not continue
- return;
- }
-
- Level1Configuration configuration = (Level1Configuration) getFieldValue("configuration", object);
-
- Map<String, Trip> tripByTopiaIds = (Map<String, Trip>) getFieldValue("tripByTopiaIds", object);
-
- // check that every selected trip has his level 0 done.
- Set<String> tripIds = configuration.getSampleIdsByTripId().keySet();
-
- Decorator<Trip> decoratorByType = (Decorator<Trip>) getFieldValue("tripDecorator", object);
-
- Level0Step[] level0Steps = Level0Step.values();
- Multimap<String, Level0Step> m = ArrayListMultimap.create();
- for (String tripId : tripIds) {
-
- Trip trip = tripByTopiaIds.get(tripId);
-
- if (!trip.isSamplesOnly()) {
-
- // only check level0Step done only if Trip#tripType = 1
- String key = decoratorByType.toString(trip);
- for (Level0Step level0Step : level0Steps) {
-
- boolean tripState = level0Step.getTripState(trip);
- if (!tripState) {
- m.put(key, level0Step);
- }
- }
- }
- }
-
- if (!m.isEmpty()) {
-
- // there is some trips without full level0 done
-
- for (String tripStr : m.keySet()) {
- Collection<Level0Step> steps = m.get(tripStr);
- addFieldError("matchingTripCount",
- t("t3.error.missing.level0.steps.for.trip", tripStr, steps));
- }
- }
- }
-
- @Override
- public String getValidatorType() {
- return "level1Configuration";
- }
-}
=====================================
t3-web/src/main/resources/fr/ird/t3/web/actions/data/level1/ManageLevel1ConfigurationAction-validateLevel1Configuration-validation.xml
=====================================
--- a/t3-web/src/main/resources/fr/ird/t3/web/actions/data/level1/ManageLevel1ConfigurationAction-validateLevel1Configuration-validation.xml
+++ b/t3-web/src/main/resources/fr/ird/t3/web/actions/data/level1/ManageLevel1ConfigurationAction-validateLevel1Configuration-validation.xml
@@ -80,12 +80,4 @@
</field>
- <field name="matchingSampleCount">
-
- <field-validator type="level1Configuration">
- <message/>
- </field-validator>
-
- </field>
-
</validators>
=====================================
t3-web/src/main/resources/validators.xml
=====================================
--- a/t3-web/src/main/resources/validators.xml
+++ b/t3-web/src/main/resources/validators.xml
@@ -43,6 +43,5 @@
<!-- T3+ validators -->
<validator name="login" class="fr.ird.t3.web.validators.LoginValidator"/>
<validator name="checkJdbcConnection" class="fr.ird.t3.web.validators.CheckJdbcConnectionValidator"/>
- <validator name="level1Configuration" class="fr.ird.t3.web.validators.Level1ConfigurationFieldValidator"/>
</validators>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/e46c2d8fb4e2566e6c6a0139beea4ee1…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/e46c2d8fb4e2566e6c6a0139beea4ee1…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 3 commits: Gros nettoyage de code : - utilisation api java 8 - ajout d'un cache sur les…
by Tony CHEMIT 06 Mar '18
by Tony CHEMIT 06 Mar '18
06 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
7a87832d by Tony CHEMIT at 2018-03-06T15:38:18Z
Gros nettoyage de code : - utilisation api java 8 - ajout d'un cache sur les download de ird-t3-data - amélioration api de test - reformat code - mise à jour des licenses, ...
- - - - -
019938ca by Tony CHEMIT at 2018-03-06T15:38:23Z
Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
- - - - -
11cd0058 by Tony CHEMIT at 2018-03-06T15:38:23Z
Mise en place de l'import sans log books (reste à remplir l'ocean à partir des coordonnées de l'activité fictive) (see #116)
- - - - -
27 changed files:
- .gitignore
- pom.xml
- src/site/site.xml
- t3-actions/pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/Level0Step.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/AbstractLevel1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ComputeWeightOfCategoriesForSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSampleSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleCountedAndMeasuredAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleWeightToSetAction.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/1233217bda651f40c35c2771cba0711…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/1233217bda651f40c35c2771cba0711…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 8 commits: Replace samplesOnly by TripType on persistence (See #116)
by Tony CHEMIT 06 Mar '18
by Tony CHEMIT 06 Mar '18
06 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
da5304ea by Tony CHEMIT at 2018-03-04T00:53:45Z
Replace samplesOnly by TripType on persistence (See #116)
- - - - -
8e373b7d by Tony CHEMIT at 2018-03-04T09:08:45Z
Refactor avdth input modules + add missing license header (See #116)
- - - - -
589a3ab1 by Tony CHEMIT at 2018-03-04T16:59:33Z
Improve input tests.
- - - - -
b452e9c1 by Tony CHEMIT at 2018-03-04T16:59:42Z
Gros nettoyage de code : - utilisation api java 8 - ajout d'un cache sur les download de ird-t3-data - amélioration api de test - reformat code - mise à jour des licenses, ...
- - - - -
7b3132f2 by Tony CHEMIT at 2018-03-05T21:58:56Z
Continue nettoyage de code
- - - - -
3667ac7e by Tony CHEMIT at 2018-03-06T11:03:16Z
Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
- - - - -
5a0c55b1 by Tony CHEMIT at 2018-03-06T15:36:36Z
Mise en place de l'import sans log books (reste à remplir l'ocean à partir des coordonnées de l'activité fictive) (see #116)
- - - - -
1233217b by Tony CHEMIT at 2018-03-06T15:37:19Z
Merge branch 'feature/116' into develop
- - - - -
27 changed files:
- .gitignore
- pom.xml
- src/site/site.xml
- t3-actions/pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/Level0Step.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/AbstractLevel1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ComputeWeightOfCategoriesForSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSampleSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleCountedAndMeasuredAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleWeightToSetAction.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/67840bd972c5b3a107dcb32d9ab908a…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/67840bd972c5b3a107dcb32d9ab908a…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT deleted branch feature/116 at ultreiaio / ird-t3
---
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][feature/116] 2 commits: Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
by Tony CHEMIT 06 Mar '18
by Tony CHEMIT 06 Mar '18
06 Mar '18
Tony CHEMIT pushed to branch feature/116 at ultreiaio / ird-t3
Commits:
3667ac7e by Tony CHEMIT at 2018-03-06T11:03:16Z
Add new vessel activity + use enum name instead of ordinal (See ultreiaio/ird-t3#116)
- - - - -
5a0c55b1 by Tony CHEMIT at 2018-03-06T15:36:36Z
Mise en place de l'import sans log books (reste à remplir l'ocean à partir des coordonnées de l'activité fictive) (see #116)
- - - - -
30 changed files:
- t3-actions/pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContext.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/SampleSetImpl.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3EntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessEntityProxyHandler.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
- t3-domain/src/main/resources/db/migration/V2_3_01_add-Trip-tripType.sql
- + t3-domain/src/main/resources/db/migration/V2_3_02_add-VesselActivity-row.sql
- t3-domain/src/main/xmi/t3-persistence.properties
- t3-domain/src/main/xmi/t3-persistence.zargo
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/ImportInputSourceActionTest.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
- t3-msaccess-importer/src/main/java/fr/ird/msaccess/importer/AbstractAccessDataSource.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/7b3132f2cfca236e8db3dbdd714af37…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/7b3132f2cfca236e8db3dbdd714af37…
You're receiving this email because of your account on gitlab.com.
1
0
05 Mar '18
Tony CHEMIT pushed to branch feature/116 at ultreiaio / ird-t3
Commits:
7b3132f2 by Tony CHEMIT at 2018-03-05T21:58:56Z
Continue nettoyage de code
- - - - -
23 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ComputeWeightOfCategoriesForSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSampleSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleCountedAndMeasuredAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleWeightToSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/Level1Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/RedistributeSampleNumberToSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/StandardizeSampleMeasuresAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/L2CatchStratum.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/L2CatchStratumLoader.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/Level2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level3/L3SampleStratumLoader.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level3/Level3Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level2/Level2Action.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level2/Level2Action_en.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level3/Level3Action.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level3/Level3Action_en.ftl
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/7b3132f2cfca236e8db3dbdd714af374…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/7b3132f2cfca236e8db3dbdd714af374…
You're receiving this email because of your account on gitlab.com.
1
0
04 Mar '18
Tony CHEMIT pushed to branch feature/116 at ultreiaio / ird-t3
Commits:
589a3ab1 by Tony CHEMIT at 2018-03-04T16:59:33Z
Improve input tests.
- - - - -
b452e9c1 by Tony CHEMIT at 2018-03-04T16:59:42Z
Gros nettoyage de code : - utilisation api java 8 - ajout d'un cache sur les download de ird-t3-data - amélioration api de test - reformat code - mise à jour des licenses, ...
- - - - -
30 changed files:
- .gitignore
- pom.xml
- src/site/site.xml
- t3-actions/pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/admin/DeleteTripConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/AbstractLevel0Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeSetDurationAndPositiveSetCountConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeWellPlanWeightCategoriesProportionsConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/Level0Step.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/AbstractLevel1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ComputeWeightOfCategoriesForSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSampleSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ConvertSetSpeciesFrequencyToWeightAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleCountedAndMeasuredAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/ExtrapolateSampleWeightToSetAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/Level1Configuration.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/Level1Step.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level1/RedistributeSampleNumberToSetAction.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/8e373b7d602ee491e2111a69e276966…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/8e373b7d602ee491e2111a69e276966…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][feature/116] Refactor avdth input modules + add missing license header (See #116)
by Tony CHEMIT 04 Mar '18
by Tony CHEMIT 04 Mar '18
04 Mar '18
Tony CHEMIT pushed to branch feature/116 at ultreiaio / ird-t3
Commits:
8e373b7d by Tony CHEMIT at 2018-03-04T09:08:45Z
Refactor avdth input modules + add missing license header (See #116)
- - - - -
25 changed files:
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction_en.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction.ftl
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction_en.ftl
- t3-actions/src/test/java/fr/ird/t3/io/input/fake/v0/T3InputProviderFake0.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
- t3-domain/src/main/java/fr/ird/t3/io/input/T3InputProvider.java
- + t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_3.java
- t3-input-avdthv33/pom.xml
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputProviderAvdth33.java
- t3-input-avdthv35/pom.xml
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
- t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputProviderAvdth35.java
- t3-input-avdthv36/pom.xml
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
- t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputProviderAvdth36.java
Changes:
=====================================
t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.ftl
=====================================
--- a/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.ftl
+++ b/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.ftl
@@ -20,7 +20,7 @@
-->
<#include "/ftl/header.ftl"/>
-Pilote d'acquisition de données : ${configuration.inputProvider.libelle}
+Pilote d'acquisition de données : ${configuration.inputProvider.label}
Source de données : ${configuration.inputFile.name}
Utilisation des plans de cuves : ${configuration.useWells?string}
Type de marées : ${configuration.tripType.label}
=====================================
t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction_en.ftl
=====================================
--- a/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction_en.ftl
+++ b/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction_en.ftl
@@ -20,7 +20,7 @@
-->
<#include "/ftl/header_en.ftl"/>
-Input Pilot: ${configuration.inputProvider.libelle}
+Input Pilot: ${configuration.inputProvider.label}
Input file: ${configuration.inputFile.name}
Use wells: ${configuration.useWells?string}
Trip type: ${configuration.tripType.label}
=====================================
t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction.ftl
=====================================
--- a/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction.ftl
+++ b/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction.ftl
@@ -20,7 +20,7 @@
-->
<#include "/ftl/header.ftl"/>
-Pilote d'acquisition de données : ${configuration.inputProvider.libelle}
+Pilote d'acquisition de données : ${configuration.inputProvider.label}
Source de données : ${configuration.inputFile.name}
Utilisation des plans de cuves : ${configuration.useWells?string}
Type de marées : ${configuration.tripType.label}
=====================================
t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction_en.ftl
=====================================
--- a/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction_en.ftl
+++ b/t3-actions/src/main/resources/ftl/fr/ird/t3/actions/io/input/ImportInputSourceAction_en.ftl
@@ -20,7 +20,7 @@
-->
<#include "/ftl/header_en.ftl"/>
-Input Pilot: ${configuration.inputProvider.libelle}
+Input Pilot: ${configuration.inputProvider.label}
Input file: ${configuration.inputFile.name}
Use wells: ${configuration.useWells?string}
Trip type: ${configuration.tripType.label}
=====================================
t3-actions/src/test/java/fr/ird/t3/io/input/fake/v0/T3InputProviderFake0.java
=====================================
--- a/t3-actions/src/test/java/fr/ird/t3/io/input/fake/v0/T3InputProviderFake0.java
+++ b/t3-actions/src/test/java/fr/ird/t3/io/input/fake/v0/T3InputProviderFake0.java
@@ -63,7 +63,7 @@ public class T3InputProviderFake0 implements T3InputProvider {
}
@Override
- public String getLibelle() {
+ public String getLabel() {
return getName() + " - v." + getVersion() + " (" + getInputType() + ")";
}
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
@@ -1,5 +1,26 @@
package fr.ird.t3.entities.data;
+/*-
+ * #%L
+ * T3 :: Domain
+ * %%
+ * 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%
+ */
+
import fr.ird.t3.t3.domain.I18nEnumHelper;
import static org.nuiton.i18n.I18n.t;
=====================================
t3-domain/src/main/java/fr/ird/t3/io/input/T3InputProvider.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputProvider.java
+++ b/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputProvider.java
@@ -71,7 +71,7 @@ public interface T3InputProvider extends Serializable {
*
* @return the description of the provider
*/
- String getLibelle();
+ String getLabel();
/**
* To instanciate a new {@link T3Input} for a given {@code inputFile} to
=====================================
t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
=====================================
--- /dev/null
+++ b/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
@@ -0,0 +1,202 @@
+package fr.ird.t3.io.input.access;
+
+/*-
+ * #%L
+ * T3 :: Domain
+ * %%
+ * 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%
+ */
+
+import fr.ird.t3.entities.ReferenceEntityMap;
+import fr.ird.t3.entities.T3EntityEnum;
+import fr.ird.t3.entities.data.Activity;
+import fr.ird.t3.entities.data.ElementaryCatch;
+import fr.ird.t3.entities.data.ElementaryLanding;
+import fr.ird.t3.entities.data.Sample;
+import fr.ird.t3.entities.data.SampleSet;
+import fr.ird.t3.entities.data.Trip;
+import fr.ird.t3.entities.data.Well;
+import fr.ird.t3.entities.data.WellPlan;
+import fr.ird.t3.entities.reference.WeightCategoryLanding;
+import fr.ird.t3.entities.reference.WeightCategoryLogBook;
+import fr.ird.t3.io.input.MissingForeignKeyInT3;
+import fr.ird.type.CoordinateHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.io.Serializable;
+
+/**
+ * Created by tchemit on 04/03/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public abstract class T3AvdthDataEntityVisitor extends T3DataEntityVisitor {
+
+ private static final Log log = LogFactory.getLog(T3AvdthDataEntityVisitor.class);
+
+
+ private final ReverseAssociationGetter<Trip, WellPlan, Activity> wellPlanReverse;
+ private final ReverseAssociationGetter<Trip, Sample, Well> sampleReverse;
+ private final ReverseAssociationGetter<Trip, SampleSet, Activity> sampleSetReverse;
+
+ protected T3AvdthDataEntityVisitor(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) {
+ super(dataSource, referentiel);
+ wellPlanReverse = newReverseAssociationGetter(
+ Trip.class,
+ WellPlan.class,
+ Activity.class,
+ Trip.PROPERTY_ACTIVITY,
+ WellPlan.PROPERTY_ACTIVITY);
+ sampleReverse = newReverseAssociationGetter(
+ Trip.class,
+ Sample.class,
+ Well.class,
+ Trip.PROPERTY_WELL,
+ Sample.PROPERTY_WELL);
+ sampleSetReverse = newReverseAssociationGetter(
+ Trip.class,
+ SampleSet.class,
+ Activity.class,
+ Trip.PROPERTY_ACTIVITY,
+ SampleSet.PROPERTY_ACTIVITY);
+ }
+
+
+ @Override
+ public void onEnd(T3AccessEntity entity, T3AccessEntityMeta meta) {
+ super.onEnd(entity, meta);
+ if (!deepVisit) {
+ return;
+ }
+ endActivity(entity, meta);
+ }
+
+ @Override
+ public void onVisitReverseAssociation(String propertyName, T3AccessEntity entity, T3AccessEntityMeta meta) {
+ if (!deepVisit) {
+ return;
+ }
+ if (SampleSet.PROPERTY_ACTIVITY.equals(propertyName) && entity instanceof SampleSet) {
+ // special case, must obtain the activity from the trip
+ sampleSetReverse.attachReverseAssociation(entity);
+ return;
+ }
+ if (WellPlan.PROPERTY_ACTIVITY.equals(propertyName) && entity instanceof WellPlan) {
+ // special case, must obtain the activity from the trip
+ wellPlanReverse.attachReverseAssociation(entity);
+ return;
+ }
+ if (Sample.PROPERTY_WELL.equals(propertyName) && entity instanceof Sample) {
+ // special case, must obtain the well from the trip
+ sampleReverse.attachReverseAssociation(entity);
+ return;
+ }
+ super.onVisitReverseAssociation(propertyName, entity, meta);
+ }
+
+ @Override
+ public void onVisitComposition(String propertyName, Class<?> type, T3AccessEntity entity, T3AccessEntityMeta meta) {
+ if (onVisitElementaryLanding(propertyName, entity)) {
+ return;
+ }
+ if (onVisitElementaryCatch(propertyName, entity)) {
+ return;
+ }
+ super.onVisitComposition(propertyName, type, entity, meta);
+ }
+
+ private void endActivity(T3AccessEntity entity, T3AccessEntityMeta meta) {
+ T3EntityEnum type = meta.getType();
+ if (type == T3EntityEnum.Activity) {
+ Activity a = (Activity) entity;
+ Integer quadrant = a.getQuadrant();
+ Float latitude = CoordinateHelper.getSignedLatitude(quadrant, a.getLatitude());
+ Float longitude = CoordinateHelper.getSignedLongitude(quadrant, a.getLongitude());
+ a.setLatitude(latitude);
+ a.setLongitude(longitude);
+ log.debug(String.format("Will use for activity %s coordinates <%s,%s>", entity, a.getLongitude(), a.getLatitude()));
+ }
+ }
+
+ protected boolean onVisitElementaryLanding(String propertyName, T3AccessEntity entity) {
+ if (!(ElementaryLanding.PROPERTY_WEIGHT_CATEGORY_LANDING.equals(propertyName) && entity instanceof ElementaryLanding)) {
+ return false;
+ }
+ Serializable codeEspece = getProperty("C_ESP", row);
+ Serializable codeCate = getProperty("C_CAT_C", row);
+
+ // must found the species
+ T3AccessEntityMeta specieMeta = dataSource.getMeta(T3EntityEnum.Species);
+ TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
+ T3AccessEntityMeta categoryMeta = dataSource.getMeta(T3EntityEnum.WeightCategoryLanding);
+
+ // special case : need to find a reference with two primary keys...
+ TopiaEntity ref = getReferenceEntity(
+ categoryMeta,
+ new String[]{WeightCategoryLanding.PROPERTY_CODE, WeightCategoryLanding.PROPERTY_SPECIES},
+ codeCate, specie);
+ if (ref == null) {
+ log.warn(String.format("Can't find WeightCategoryLanding for speciesCode / categoryCode: %s/%s", codeEspece, codeCate));
+ getMissingForeignKeys().add(new MissingForeignKeyInT3(
+ T3EntityEnum.ElementaryLanding,
+ T3EntityEnum.WeightCategoryLanding,
+ getPKey(T3EntityEnum.ElementaryLanding),
+ new Object[]{codeEspece, codeCate}));
+ } else {
+ log.debug(String.format("Detected landing catch weight category : %s", ref));
+ entity.setProperty(ElementaryLanding.PROPERTY_WEIGHT_CATEGORY_LANDING, ref);
+ }
+ return true;
+ }
+
+ protected boolean onVisitElementaryCatch(String propertyName, T3AccessEntity entity) {
+ if (!(ElementaryCatch.PROPERTY_WEIGHT_CATEGORY_LOG_BOOK.equals(propertyName) && entity instanceof ElementaryCatch)) {
+ return false;
+ }
+
+ // special case : need to find a reference with two primary keys...
+ Serializable codeEspece = getProperty("C_ESP", row);
+ Serializable codeCate = getProperty("C_CAT_T", row);
+
+ // must found the species
+ T3AccessEntityMeta specieMeta = dataSource.getMeta(T3EntityEnum.Species);
+ TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
+ T3AccessEntityMeta categoryMeta = dataSource.getMeta(T3EntityEnum.WeightCategoryLogBook);
+
+ // special case : need to find a reference with two primary keys...
+ TopiaEntity ref = getReferenceEntity(
+ categoryMeta,
+ new String[]{WeightCategoryLogBook.PROPERTY_CODE, WeightCategoryLogBook.PROPERTY_SPECIES},
+ codeCate, specie);
+
+ if (ref == null) {
+ log.warn(String.format("Can't find weightCategoryLogBook for speciesCode / categoryCode: %s/%s", codeEspece, codeCate));
+ getMissingForeignKeys().add(new MissingForeignKeyInT3(
+ T3EntityEnum.ElementaryCatch,
+ T3EntityEnum.WeightCategoryLogBook,
+ getPKey(T3EntityEnum.ElementaryCatch),
+ new Object[]{codeCate, codeEspece}));
+ } else {
+ log.debug(String.format("Detected logBook catch weight category : %s", ref));
+ entity.setProperty(propertyName, ref);
+ }
+ return true;
+ }
+
+}
=====================================
t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
+++ b/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3DataEntityVisitor.java
@@ -8,41 +8,42 @@
* 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 fr.ird.t3.io.input.access;
-import com.google.common.collect.Lists;
import fr.ird.msaccess.importer.AbstractAccessEntityMeta;
import fr.ird.t3.entities.ReferenceEntityMap;
import fr.ird.t3.entities.T3EntityEnum;
import fr.ird.t3.entities.T3EntityMap;
import fr.ird.t3.entities.reference.T3ReferenceEntity;
import fr.ird.t3.io.input.MissingForeignKey;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.util.EntityOperator;
+
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Stack;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.util.EntityOperator;
/**
* To visit and fill properly an data entity.
* <p/>
* If visitor has the flag {@link #deepVisit} is set to {@code false}, then
- * only the pkey will be filled, otherwise all fields, compositions or
+ * only the pKey will be filled, otherwise all fields, compositions or
* associations are filled.
*
* @author Tony Chemit - dev(a)tchemit.fr
@@ -50,7 +51,6 @@ import org.nuiton.topia.persistence.util.EntityOperator;
*/
public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
- /** Logger. */
private static final Log log = LogFactory.getLog(T3DataEntityVisitor.class);
/** la pile des objets en cours de construction. */
@@ -60,14 +60,14 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
private final Stack<Map<String, Object>> rows;
/** Universe of touched references while visiting a data. */
- protected T3EntityMap entitiesTouched;
+ private T3EntityMap entitiesTouched;
private List<MissingForeignKey> missingForeignKeys;
protected T3DataEntityVisitor(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) {
super(dataSource, referentiel);
- rows = new Stack<Map<String, Object>>();
- stack = new Stack<T3AccessEntity>();
+ rows = new Stack<>();
+ stack = new Stack<>();
}
public T3EntityMap getEntitiesTouched() {
@@ -84,20 +84,15 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
@Override
public void onStart(T3AccessEntity entity, T3AccessEntityMeta meta) {
-
super.onStart(entity, meta);
-
stack.push(entity);
rows.push(row);
-
getEntitiesTouched().addEntity(entity);
}
@Override
public void onEnd(T3AccessEntity entity, T3AccessEntityMeta meta) {
-
super.onEnd(entity, meta);
-
stack.pop();
rows.pop();
if (!rows.isEmpty()) {
@@ -105,60 +100,40 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
}
}
- @SuppressWarnings({"RawUseOfParameterizedType", "unchecked"})
+ @SuppressWarnings("unchecked")
@Override
- protected TopiaEntity getReferenceEntity(T3AccessEntityMeta compoMeta,
- Serializable newValue) {
-
- T3ReferenceEntity e = (T3ReferenceEntity)
- super.getReferenceEntity(compoMeta, newValue);
-
+ protected TopiaEntity getReferenceEntity(T3AccessEntityMeta compoMeta, Serializable newValue) {
+ T3ReferenceEntity e = (T3ReferenceEntity) super.getReferenceEntity(compoMeta, newValue);
if (e == null) {
-
// reference entity not found
// add the entity in touched refs (to be able to know it is
// missing...)
try {
- T3ReferenceEntity e2 =
- (T3ReferenceEntity) compoMeta.getType().getImplementation().getConstructor().newInstance();
+ T3ReferenceEntity e2 = (T3ReferenceEntity) compoMeta.getType().getImplementation().getConstructor().newInstance();
EntityOperator operator = T3EntityEnum.getOperator(compoMeta.getType().getContract());
operator.set("code", e2, newValue);
getEntitiesTouched().addUniqueEntity(e2);
} catch (Exception eee) {
- if (log.isErrorEnabled()) {
- log.error("Could not create dummy reference entity", eee);
- }
+ log.error("Could not create dummy reference entity", eee);
}
-
// still returns null entity
return null;
}
-
boolean added = getEntitiesTouched().addUniqueEntity(e);
-
if (added && log.isDebugEnabled()) {
- log.debug("Touched reference " + e.getTopiaId() + " : " +
- e.getCode());
+ log.debug(String.format("Touched reference %s : %d", e.getTopiaId(), e.getCode()));
}
return e;
}
@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
-
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);
}
@@ -166,145 +141,91 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
@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) {
-
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) {
throw new IllegalStateException(
- "Skip composition [" + meta.getType() + " - " +
- propertyName + ":" + type + "], meta of type [" +
- compositionType + "] not found...");
+ String.format("Skip composition [%s - %s:%s], meta of type [%s] not found...", meta.getType(), propertyName, type, compositionType));
}
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];
-
TopiaEntity compoEntity = getReferenceEntity(compoMeta, newValue);
-
if (compoEntity == null) {
// could not find the correct composition entity
- if (log.isDebugEnabled()) {
- log.debug("Could not find referentiel entity for composition [" +
- propertyName + ":" + compoMeta.getType() + ":" + newValue +
- "] to " + entity);
- }
+ log.debug(String.format("Could not find referentiel entity for composition [%s:%s:%s] to %s", propertyName, compoMeta.getType(), newValue, entity));
return;
}
-
- if (log.isDebugEnabled()) {
- log.debug("Will add composition [" +
- propertyName + ":" + compoEntity + "] to " + entity);
- }
-
+ log.debug(String.format("Will add composition [%s:%s] to %s", propertyName, compoEntity, entity));
// then affect it to this entity for the given property
entity.setProperty(propertyName, compoEntity);
}
+ @SuppressWarnings("unchecked")
@Override
- public void onVisitReverseAssociation(String propertyName,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
+ public void onVisitReverseAssociation(String propertyName, T3AccessEntity entity, T3AccessEntityMeta meta) {
if (!deepVisit) {
return;
}
-
// on recherche dans la pile des objets en cours de construction
- // l'objet maitre de l'association y est forcement puisque la création
- // de l'entité en cours en dépend.
- T3AccessEntityMeta.AssociationMapping reverse =
- meta.getReverseAssociationMapping(propertyName);
-
- Class<? extends TopiaEntity> type =
- (Class<? extends TopiaEntity>) reverse.getType();
+ // l'objet maitre de l'association y est forcement puisque la création de l'entité en cours en dépend.
+ T3AccessEntityMeta.AssociationMapping reverse = meta.getReverseAssociationMapping(propertyName);
+ Class<? extends TopiaEntity> type = (Class<? extends TopiaEntity>) reverse.getType();
TopiaEntity parent = getEntityFromStack(type);
-
if (parent == null) {
// ce cas ne devrait jamais arrivé
throw new IllegalStateException(
- "Could not find reverse association [" + propertyName
- + ":" + type + "] for one of his child " + entity);
- }
- if (log.isDebugEnabled()) {
- log.debug("Will add reverse composition [" + propertyName + ":" +
- parent + "] to " + entity);
+ String.format("Could not find reverse association [%s:%s] for one of his child %s", propertyName, type, entity));
}
+ log.debug(String.format("Will add reverse composition [%s:%s] to %s", propertyName, parent, entity));
entity.setProperty(propertyName, parent);
}
@Override
- public void onVisitAssociation(String propertyName,
- Class<?> type,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
+ public void onVisitAssociation(String propertyName, Class<?> type, T3AccessEntity entity, T3AccessEntityMeta meta) {
if (!deepVisit) {
return;
}
-
T3EntityEnum constant = T3EntityEnum.valueOf(type);
+ T3AccessEntityMeta[] childMeta = dataSource.getMetaForType(constant.getContract());
+ List<TopiaEntity> childs = new ArrayList<>();
TopiaEntity[] tmp;
-
- List<TopiaEntity> childs = Lists.newArrayList();
-
- T3AccessEntityMeta[] childMeta =
- dataSource.getMetaForType(constant.getContract());
-
for (T3AccessEntityMeta accessEntityMeta : childMeta) {
-
tmp = getAssociation(entity, propertyName, meta, accessEntityMeta);
- if (log.isDebugEnabled()) {
- log.debug(toString(entity) + " load association [" + constant + "] (meta:" +
- accessEntityMeta + ") : " + tmp.length);
- }
+ log.debug(String.format("%s load association [%s] (meta:%s) : %d", toString(entity), constant, accessEntityMeta, tmp.length));
if (tmp.length > 0) {
childs.addAll(Arrays.asList(tmp));
}
}
-
if (childs.isEmpty()) {
return;
}
for (TopiaEntity child : childs) {
- if (log.isDebugEnabled()) {
- log.debug("Add association " + child);
- }
-
+ log.debug(String.format("Add association %s", child));
// on lance la découverte du fils
acceptEntity(child);
}
@@ -318,8 +239,24 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
rows.clear();
}
- @SuppressWarnings({"unchecked"})
- protected <T extends TopiaEntity> T getEntityFromStack(Class<T> type) {
+ protected <P extends TopiaEntity, E extends TopiaEntity, C extends TopiaEntity> ReverseAssociationGetter<P, E, C> newReverseAssociationGetter(
+ Class<P> parentType,
+ Class<E> type,
+ Class<C> childType,
+ String reverseAssociation,
+ String parentAssociation
+ ) {
+ return new ReverseAssociationGetter<>(parentType, type, childType, parentAssociation, reverseAssociation);
+ }
+
+ public List<MissingForeignKey> getMissingForeignKeys() {
+ if (missingForeignKeys == null) {
+ missingForeignKeys = new ArrayList<>();
+ }
+ return missingForeignKeys;
+ }
+
+ private <T extends TopiaEntity> T getEntityFromStack(Class<T> type) {
TopiaEntity entity = null;
for (TopiaEntity e : stack) {
if (type.isAssignableFrom(e.getClass())) {
@@ -327,69 +264,36 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
break;
}
}
- return (T) entity;
+ return type.cast(entity);
}
- protected TopiaEntity[] getAssociation(TopiaEntity entity,
- String propertyName,
- T3AccessEntityMeta meta,
- T3AccessEntityMeta childMeta) {
+ private TopiaEntity[] getAssociation(TopiaEntity entity, String propertyName, T3AccessEntityMeta meta, T3AccessEntityMeta childMeta) {
TopiaEntity[] childs;
try {
- childs = dataSource.loadAssociation(
- childMeta,
- meta,
- ((T3AccessEntity) entity).getPkey()
- );
+ childs = dataSource.loadAssociation(childMeta, meta, ((T3AccessEntity) entity).getPkey());
} catch (Exception e) {
- throw new IllegalStateException(
- "Could not obtain association [" + propertyName + "]", e);
+ throw new IllegalStateException(String.format("Could not obtain association [%s]", propertyName), e);
}
return childs;
}
- protected <P extends TopiaEntity, E extends TopiaEntity, C extends TopiaEntity> ReverseAssociationGetter<P, E, C> newReverseAssociationGetter(
- Class<P> parentType,
- Class<E> type,
- Class<C> childType,
- String reverseAssociation,
- String parentAssociation
- ) {
- return new ReverseAssociationGetter<P, E, C>(parentType, type, childType, parentAssociation, reverseAssociation);
- }
-
- public List<MissingForeignKey> getMissingForeignKeys() {
- if (missingForeignKeys == null) {
- missingForeignKeys = Lists.newArrayList();
- }
- return missingForeignKeys;
- }
-
protected class ReverseAssociationGetter<P extends TopiaEntity, E extends TopiaEntity, C extends TopiaEntity> {
protected final Class<E> type;
-
- protected final Class<P> parentType;
-
- protected final Class<C> childType;
-
+ final Class<P> parentType;
+ final Class<C> childType;
private final T3EntityEnum typeEnum;
-
private final T3EntityEnum childTypeEnum;
-
private final EntityOperator<P> parentOperator;
-
private final EntityOperator<E> operator;
-
private final String parentAssociation;
-
private final String reverseAssociation;
- protected ReverseAssociationGetter(Class<P> parentType,
- Class<E> type,
- Class<C> childType,
- String parentAssociation,
- String reverseAssociation) {
+ ReverseAssociationGetter(Class<P> parentType,
+ Class<E> type,
+ Class<C> childType,
+ String parentAssociation,
+ String reverseAssociation) {
this.parentType = parentType;
this.type = type;
this.childType = childType;
@@ -402,49 +306,27 @@ public class T3DataEntityVisitor extends AbstractT3EntityVisitor {
}
@SuppressWarnings({"unchecked"})
- public void attachReverseAssocation(T3AccessEntity entity) {
-
- // get child pkey from the pkey of the current entity
+ public void attachReverseAssociation(T3AccessEntity entity) {
+ // get child pKey from the pKey of the current entity
Object[] pKey = getPKey(childTypeEnum);
-
// get the parent entity which contains the association
P parent = getEntityFromStack(parentType);
-
// get the association from the given parent
- Collection<? extends TopiaEntity> childs =
- (Collection<? extends TopiaEntity>)
- parentOperator.get(parentAssociation, parent);
-
+ Collection<? extends TopiaEntity> children = (Collection<? extends TopiaEntity>) parentOperator.get(parentAssociation, parent);
// get the exact reverse association found by his pKey
- TopiaEntity reverse = getEntityForPKey(pKey, childs);
-
+ TopiaEntity reverse = getEntityForPKey(pKey, children);
if (reverse == null) {
-
onReverseNotFound(entity, pKey);
} else {
-
- E topiaEntity = (E) entity;
-
+ E topiaEntity = type.cast(entity);
operator.set(reverseAssociation, topiaEntity, reverse);
}
}
- protected void onReverseNotFound(T3AccessEntity entity, Object[] pKey) {
-
- String message = "Could not find " + childType.getSimpleName() +
- " " +
- Arrays.toString(pKey) + " for " +
- type.getSimpleName() + " " +
- Arrays.toString(entity.getPkey());
- if (log.isDebugEnabled()) {
- log.debug(message);
- }
- MissingForeignKey missingFK = new MissingForeignKey(
- typeEnum,
- childTypeEnum,
- entity.getPkey(),
- pKey
- );
+ void onReverseNotFound(T3AccessEntity entity, Object[] pKey) {
+ String message = String.format("Could not find %s %s for %s %s", childType.getSimpleName(), Arrays.toString(pKey), type.getSimpleName(), Arrays.toString(entity.getPkey()));
+ log.debug(message);
+ MissingForeignKey missingFK = new MissingForeignKey(typeEnum, childTypeEnum, entity.getPkey(), pKey);
getMissingForeignKeys().add(missingFK);
}
}
=====================================
t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_3.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_3.java
+++ b/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_3.java
@@ -1,5 +1,26 @@
package fr.ird.t3.services.migration;
+/*-
+ * #%L
+ * T3 :: Domain
+ * %%
+ * 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%
+ */
+
import com.google.auto.service.AutoService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
=====================================
t3-input-avdthv33/pom.xml
=====================================
--- a/t3-input-avdthv33/pom.xml
+++ b/t3-input-avdthv33/pom.xml
@@ -93,10 +93,6 @@
<groupId>org.nuiton</groupId>
<artifactId>nuiton-version</artifactId>
</dependency>
- <dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-persistence</artifactId>
- </dependency>
<!-- test dependencies -->
=====================================
t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
=====================================
--- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
+++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java
@@ -8,12 +8,12 @@
* 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%
@@ -69,9 +69,7 @@ import java.util.Set;
*/
public class T3AccessEntityMetaProviderAvdth33 implements T3AccessEntityMetaProvider {
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(T3AccessEntityMetaProviderAvdth33.class);
+ private static final Log log = LogFactory.getLog(T3AccessEntityMetaProviderAvdth33.class);
@Override
public Set<T3AccessEntityMeta> getMetas() {
@@ -463,64 +461,32 @@ public class T3AccessEntityMetaProviderAvdth33 implements T3AccessEntityMetaProv
WeightCategoryWellPlan.PROPERTY_CODE, Integer.class, "C_CAT_POIDS",
WeightCategoryWellPlan.PROPERTY_LABEL1, String.class, "L_CAT_POIDS"
);
-
return result;
}
-// protected void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
-// T3EntityEnum type,
-// String tableName,
-// String pkey) {
-// registerReferentielMeta(universe,
-// type,
-// tableName,
-// new String[]{pkey},
-// "code",
-// String.class,
-// pkey
-// );
-// }
-
- protected void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(
- type,
- tableName,
- pkeys,
- properties
- );
+ private void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(type, tableName, pKeys, properties);
registerMeta(universe, meta);
-
}
- protected void registerDataMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object[] association,
- Object[] reverseProperties,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessDataEntityMeta(
- type,
- tableName,
- pkeys,
- association,
- reverseProperties,
- properties
- );
+ private void registerDataMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object[] association,
+ Object[] reverseProperties,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessDataEntityMeta(type, tableName, pKeys, association, reverseProperties, properties);
registerMeta(universe, meta);
}
- protected void registerMeta(Set<T3AccessEntityMeta> universe,
- T3AccessEntityMeta meta) {
- if (log.isDebugEnabled()) {
- log.debug("add " + meta.getType() + ":" + meta.getTableName() +
- " to universe");
- }
+ private void registerMeta(Set<T3AccessEntityMeta> universe, T3AccessEntityMeta meta) {
+ log.debug(String.format("add %s:%s to universe", meta.getType(), meta.getTableName()));
universe.add(meta);
}
}
=====================================
t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
=====================================
--- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
+++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3DataEntityVisitorAvdth33.java
@@ -8,12 +8,12 @@
* 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%
@@ -21,28 +21,9 @@
package fr.ird.t3.io.input.avdth.v33;
import fr.ird.t3.entities.ReferenceEntityMap;
-import fr.ird.t3.entities.T3EntityEnum;
-import fr.ird.t3.entities.T3TopiaApplicationContext;
-import fr.ird.t3.entities.data.Activity;
-import fr.ird.t3.entities.data.ElementaryCatch;
-import fr.ird.t3.entities.data.ElementaryLanding;
-import fr.ird.t3.entities.data.Sample;
-import fr.ird.t3.entities.data.SampleSet;
-import fr.ird.t3.entities.data.Trip;
-import fr.ird.t3.entities.data.Well;
-import fr.ird.t3.entities.data.WellPlan;
-import fr.ird.t3.entities.reference.WeightCategoryLanding;
-import fr.ird.t3.entities.reference.WeightCategoryLogBook;
-import fr.ird.t3.io.input.MissingForeignKeyInT3;
+import fr.ird.t3.io.input.access.T3AvdthDataEntityVisitor;
import fr.ird.t3.io.input.access.T3AccessDataSource;
-import fr.ird.t3.io.input.access.T3AccessEntity;
-import fr.ird.t3.io.input.access.T3AccessEntityMeta;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
-import fr.ird.type.CoordinateHelper;
-import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
/**
* Implementation of {@link T3DataEntityVisitor} for the avdth v33 db.
@@ -50,218 +31,10 @@ import org.nuiton.topia.persistence.TopiaEntity;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public class T3DataEntityVisitorAvdth33 extends T3DataEntityVisitor {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(T3DataEntityVisitorAvdth33.class);
-
- protected final ReverseAssociationGetter<Trip, WellPlan, Activity> wellPlanReverse;
+class T3DataEntityVisitorAvdth33 extends T3AvdthDataEntityVisitor {
- protected final ReverseAssociationGetter<Trip, Sample, Well> sampleReverse;
-
- protected final ReverseAssociationGetter<Trip, SampleSet, Activity> sampleSetReverse;
-
- public T3DataEntityVisitorAvdth33(T3TopiaApplicationContext topiaApplicationContext,
- T3AccessDataSource dataSource,
- ReferenceEntityMap referentiel) {
+ T3DataEntityVisitorAvdth33(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) {
super(dataSource, referentiel);
-
- wellPlanReverse = newReverseAssociationGetter(
- Trip.class,
- WellPlan.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- WellPlan.PROPERTY_ACTIVITY
- );
-
- sampleReverse = newReverseAssociationGetter(
- Trip.class,
- Sample.class,
- Well.class,
- Trip.PROPERTY_WELL,
- Sample.PROPERTY_WELL
- );
-
- sampleSetReverse = newReverseAssociationGetter(
- Trip.class,
- SampleSet.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- SampleSet.PROPERTY_ACTIVITY
- );
- }
-
- @Override
- public void onEnd(T3AccessEntity entity, T3AccessEntityMeta meta) {
-
- super.onEnd(entity, meta);
-
- if (!deepVisit) {
- return;
- }
-
- T3EntityEnum type = meta.getType();
-
- if (type == T3EntityEnum.Activity) {
-
- Activity a = (Activity) entity;
-
- Integer quadrant = a.getQuadrant();
- Float latitude = CoordinateHelper.getSignedLatitude(
- quadrant, a.getLatitude());
- Float longitude = CoordinateHelper.getSignedLongitude(
- quadrant, a.getLongitude());
- a.setLatitude(latitude);
- a.setLongitude(longitude);
-
- if (log.isDebugEnabled()) {
- log.debug("Will use for activity " + entity +
- " coordinates <" + a.getLongitude() + "," +
- a.getLatitude() + ">");
- }
- }
- }
-
- @Override
- public void onVisitReverseAssociation(String propertyName,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (!deepVisit) {
- return;
- }
-
- if (SampleSet.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof SampleSet) {
-
- // special case, must obtain the activity from the trip
-
- sampleSetReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (WellPlan.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof WellPlan) {
-
- // special case, must obtain the activity from the trip
-
- wellPlanReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (Sample.PROPERTY_WELL.equals(propertyName) &&
- entity instanceof Sample) {
-
- // special case, must obtain the well from the trip
-
- sampleReverse.attachReverseAssocation(entity);
- return;
- }
-
- super.onVisitReverseAssociation(propertyName, entity, meta);
}
- @Override
- public void onVisitComposition(String propertyName,
- Class<?> type,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (ElementaryLanding.PROPERTY_WEIGHT_CATEGORY_LANDING.equals(propertyName)
- && entity instanceof ElementaryLanding) {
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_C", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLanding);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLanding.PROPERTY_CODE, WeightCategoryLanding.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find WeightCategoryLanding for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryLanding,
- T3EntityEnum.WeightCategoryLanding,
- getPKey(T3EntityEnum.ElementaryLanding),
- new Object[]{codeEspece, codeCate}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected landing catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- if (ElementaryCatch.PROPERTY_WEIGHT_CATEGORY_LOG_BOOK.equals(propertyName)
- && entity instanceof ElementaryCatch) {
-
- // special case : need to find a reference with two primary keys...
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_T", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLogBook);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLogBook.PROPERTY_CODE, WeightCategoryLogBook.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find weightCategoryLogBook for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryCatch,
- T3EntityEnum.WeightCategoryLogBook,
- getPKey(T3EntityEnum.ElementaryCatch),
- new Object[]{codeCate, codeEspece}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected logBook catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- super.onVisitComposition(propertyName, type, entity, meta);
- }
}
=====================================
t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
=====================================
--- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
+++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
@@ -8,12 +8,12 @@
* 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%
@@ -27,6 +27,7 @@ import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.access.AbstractT3InputMSAccess;
import fr.ird.t3.io.input.access.T3AccessDataSource;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
+
import java.io.File;
/**
@@ -37,18 +38,7 @@ import java.io.File;
*/
public class T3InputAvdth33 extends AbstractT3InputMSAccess {
- @Override
- public T3AccessDataSource newDataSource(File inputFile) {
- return new T3AccessDataSource(inputFile, T3AccessEntityMetaProviderAvdth33.class);
- }
-
- @Override
- public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource, ReferenceEntityMap safeReferences) {
-
- return new T3DataEntityVisitorAvdth33(getConfiguration().getTopiaApplicationContext(), dataSource, safeReferences);
- }
-
- public static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
+ private static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
ImmutableSet.of(
T3EntityEnum.VesselActivity,
T3EntityEnum.VesselSizeCategory,
@@ -66,18 +56,12 @@ public class T3InputAvdth33 extends AbstractT3InputMSAccess {
T3EntityEnum.WeightCategoryLogBook,
T3EntityEnum.WellDestiny,
T3EntityEnum.WeightCategoryWellPlan);
-
- @Override
- public ImmutableSet<T3EntityEnum> getReferenceTypes() {
- return REFERENCE_TYPES;
- }
-
/**
* Set of all importable data types from ms-access.
*
* @since 2.0
*/
- public static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
+ private static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
ImmutableSet.of(
T3EntityEnum.Activity,
T3EntityEnum.ActivityFishingContext,
@@ -92,6 +76,22 @@ public class T3InputAvdth33 extends AbstractT3InputMSAccess {
T3EntityEnum.WellPlan);
@Override
+ public T3AccessDataSource newDataSource(File inputFile) {
+ return new T3AccessDataSource(inputFile, T3AccessEntityMetaProviderAvdth33.class);
+ }
+
+ @Override
+ public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource, ReferenceEntityMap safeReferences) {
+
+ return new T3DataEntityVisitorAvdth33(dataSource, safeReferences);
+ }
+
+ @Override
+ public ImmutableSet<T3EntityEnum> getReferenceTypes() {
+ return REFERENCE_TYPES;
+ }
+
+ @Override
public ImmutableSet<T3EntityEnum> getDataTypes() {
return IMPORTABLE_DATA_TYPES;
}
=====================================
t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputProviderAvdth33.java
=====================================
--- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputProviderAvdth33.java
+++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputProviderAvdth33.java
@@ -8,12 +8,12 @@
* 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%
@@ -23,10 +23,11 @@ package fr.ird.t3.io.input.avdth.v33;
import com.google.auto.service.AutoService;
import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.T3InputProvider;
-import java.io.File;
import org.nuiton.version.Version;
import org.nuiton.version.Versions;
+import java.io.File;
+
/**
* Provides input for avdth.
*
@@ -37,11 +38,8 @@ import org.nuiton.version.Versions;
public class T3InputProviderAvdth33 implements T3InputProvider {
private static final long serialVersionUID = 1L;
-
- public static final Version VERSION = Versions.valueOf("3.3");
-
- public static final String NAME = "AVDTH";
-
+ private static final Version VERSION = Versions.valueOf("3.3");
+ private static final String NAME = "AVDTH";
public static final String ID = NAME + "__" + VERSION;
@Override
@@ -65,8 +63,8 @@ public class T3InputProviderAvdth33 implements T3InputProvider {
}
@Override
- public String getLibelle() {
- return getName() + " - v." + getVersion() + " (" + getInputType() + ")";
+ public String getLabel() {
+ return String.format("%s - v.%s (%s)", getName(), getVersion(), getInputType());
}
@Override
@@ -82,9 +80,7 @@ public class T3InputProviderAvdth33 implements T3InputProvider {
if (!(o instanceof T3InputProvider)) {
return false;
}
-
T3InputProvider that = (T3InputProvider) o;
-
return ID.equals(that.getId());
}
=====================================
t3-input-avdthv35/pom.xml
=====================================
--- a/t3-input-avdthv35/pom.xml
+++ b/t3-input-avdthv35/pom.xml
@@ -94,11 +94,6 @@
<artifactId>nuiton-version</artifactId>
</dependency>
- <dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-persistence</artifactId>
- </dependency>
-
<!-- test dependencies -->
<dependency>
=====================================
t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
=====================================
--- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
+++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java
@@ -20,7 +20,6 @@
*/
package fr.ird.t3.io.input.avdth.v35;
-import com.google.common.collect.Sets;
import fr.ird.msaccess.type.IntToCoordonne;
import fr.ird.t3.entities.T3EntityEnum;
import fr.ird.t3.entities.data.Activity;
@@ -71,6 +70,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Date;
+import java.util.LinkedHashSet;
import java.util.Set;
/**
@@ -81,12 +81,11 @@ import java.util.Set;
*/
public class T3AccessEntityMetaProviderAvdth35 implements T3AccessEntityMetaProvider {
- /** Logger. */
private static final Log log = LogFactory.getLog(T3AccessEntityMetaProviderAvdth35.class);
@Override
public Set<T3AccessEntityMeta> getMetas() {
- Set<T3AccessEntityMeta> result = Sets.newLinkedHashSet();
+ Set<T3AccessEntityMeta> result = new LinkedHashSet<>();
// ACTIVITE : [C_BAT, C_OCEA, C_OPERA, C_TBANC, D_ACT, D_DBQ, F_CUVE_C, F_DON_ORG, F_EXPERT, F_OBS, F_POS_COR, F_POS_VMS_D, H_ACT, N_ACT, Q_ACT, V_COUR_DIR, V_COUR_VIT, V_LAT, V_LON, V_NB_OP, V_POIDS_CAP, V_TEMP_S, V_TMER, V_TPEC]
registerDataMeta(
@@ -655,45 +654,30 @@ public class T3AccessEntityMetaProviderAvdth35 implements T3AccessEntityMetaProv
return result;
}
- protected void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(
- type,
- tableName,
- pkeys,
- properties
- );
+ private void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(type, tableName, pKeys, properties);
registerMeta(universe, meta);
}
- protected void registerDataMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object[] association,
- Object[] reverseProperties,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessDataEntityMeta(
- type,
- tableName,
- pkeys,
- association,
- reverseProperties,
- properties
- );
+ private void registerDataMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object[] association,
+ Object[] reverseProperties,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessDataEntityMeta(type, tableName, pKeys, association, reverseProperties, properties);
registerMeta(universe, meta);
}
- protected void registerMeta(Set<T3AccessEntityMeta> universe,
- T3AccessEntityMeta meta) {
- if (log.isDebugEnabled()) {
- log.debug("add " + meta.getType() + ":" + meta.getTableName() + " to universe");
- }
+ private void registerMeta(Set<T3AccessEntityMeta> universe, T3AccessEntityMeta meta) {
+ log.debug(String.format("add %s:%s to universe", meta.getType(), meta.getTableName()));
universe.add(meta);
}
}
=====================================
t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
=====================================
--- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
+++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3DataEntityVisitorAvdth35.java
@@ -8,12 +8,12 @@
* 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%
@@ -21,28 +21,9 @@
package fr.ird.t3.io.input.avdth.v35;
import fr.ird.t3.entities.ReferenceEntityMap;
-import fr.ird.t3.entities.T3EntityEnum;
-import fr.ird.t3.entities.T3TopiaApplicationContext;
-import fr.ird.t3.entities.data.Activity;
-import fr.ird.t3.entities.data.ElementaryCatch;
-import fr.ird.t3.entities.data.ElementaryLanding;
-import fr.ird.t3.entities.data.Sample;
-import fr.ird.t3.entities.data.SampleSet;
-import fr.ird.t3.entities.data.Trip;
-import fr.ird.t3.entities.data.Well;
-import fr.ird.t3.entities.data.WellPlan;
-import fr.ird.t3.entities.reference.WeightCategoryLanding;
-import fr.ird.t3.entities.reference.WeightCategoryLogBook;
-import fr.ird.t3.io.input.MissingForeignKeyInT3;
+import fr.ird.t3.io.input.access.T3AvdthDataEntityVisitor;
import fr.ird.t3.io.input.access.T3AccessDataSource;
-import fr.ird.t3.io.input.access.T3AccessEntity;
-import fr.ird.t3.io.input.access.T3AccessEntityMeta;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
-import fr.ird.type.CoordinateHelper;
-import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
/**
* Implementation of {@link T3DataEntityVisitor} for the avdth v35 db.
@@ -50,217 +31,9 @@ import org.nuiton.topia.persistence.TopiaEntity;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public class T3DataEntityVisitorAvdth35 extends T3DataEntityVisitor {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(T3DataEntityVisitorAvdth35.class);
-
- protected final ReverseAssociationGetter<Trip, WellPlan, Activity> wellPlanReverse;
+class T3DataEntityVisitorAvdth35 extends T3AvdthDataEntityVisitor {
- protected final ReverseAssociationGetter<Trip, Sample, Well> sampleReverse;
-
- protected final ReverseAssociationGetter<Trip, SampleSet, Activity> sampleSetReverse;
-
- public T3DataEntityVisitorAvdth35(T3TopiaApplicationContext topiaApplicationContext,
- T3AccessDataSource dataSource,
- ReferenceEntityMap referentiel) {
+ T3DataEntityVisitorAvdth35(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) {
super(dataSource, referentiel);
-
- wellPlanReverse = newReverseAssociationGetter(
- Trip.class,
- WellPlan.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- WellPlan.PROPERTY_ACTIVITY
- );
-
- sampleReverse = newReverseAssociationGetter(
- Trip.class,
- Sample.class,
- Well.class,
- Trip.PROPERTY_WELL,
- Sample.PROPERTY_WELL
- );
-
- sampleSetReverse = newReverseAssociationGetter(
- Trip.class,
- SampleSet.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- SampleSet.PROPERTY_ACTIVITY
- );
- }
-
- @Override
- public void onEnd(T3AccessEntity entity, T3AccessEntityMeta meta) {
-
- super.onEnd(entity, meta);
-
- if (!deepVisit) {
- return;
- }
-
- T3EntityEnum type = meta.getType();
-
- if (type == T3EntityEnum.Activity) {
-
- Activity a = (Activity) entity;
-
- Integer quadrant = a.getQuadrant();
- Float latitude = CoordinateHelper.getSignedLatitude(
- quadrant, a.getLatitude());
- Float longitude = CoordinateHelper.getSignedLongitude(
- quadrant, a.getLongitude());
- a.setLatitude(latitude);
- a.setLongitude(longitude);
-
- if (log.isDebugEnabled()) {
- log.debug("Will use for activity " + entity +
- " coordinates <" + a.getLongitude() + "," +
- a.getLatitude() + ">");
- }
- }
- }
-
- @Override
- public void onVisitReverseAssociation(String propertyName,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (!deepVisit) {
- return;
- }
-
- if (SampleSet.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof SampleSet) {
-
- // special case, must obtain the activity from the trip
-
- sampleSetReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (WellPlan.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof WellPlan) {
-
- // special case, must obtain the activity from the trip
-
- wellPlanReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (Sample.PROPERTY_WELL.equals(propertyName) &&
- entity instanceof Sample) {
-
- // special case, must obtain the well from the trip
-
- sampleReverse.attachReverseAssocation(entity);
- return;
- }
-
- super.onVisitReverseAssociation(propertyName, entity, meta);
- }
-
- @Override
- public void onVisitComposition(String propertyName,
- Class<?> type,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (ElementaryLanding.PROPERTY_WEIGHT_CATEGORY_LANDING.equals(propertyName)
- && entity instanceof ElementaryLanding) {
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_C", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLanding);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLanding.PROPERTY_CODE, WeightCategoryLanding.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find WeightCategoryLanding for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryLanding,
- T3EntityEnum.WeightCategoryLanding,
- getPKey(T3EntityEnum.ElementaryLanding),
- new Object[]{codeEspece, codeCate}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected landing catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- if (ElementaryCatch.PROPERTY_WEIGHT_CATEGORY_LOG_BOOK.equals(propertyName)
- && entity instanceof ElementaryCatch) {
-
- // special case : need to find a reference with two primary keys...
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_T", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLogBook);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLogBook.PROPERTY_CODE, WeightCategoryLogBook.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find weightCategoryLogBook for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryCatch,
- T3EntityEnum.WeightCategoryLogBook,
- getPKey(T3EntityEnum.ElementaryCatch),
- new Object[]{codeCate, codeEspece}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected logBook catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- super.onVisitComposition(propertyName, type, entity, meta);
}
}
=====================================
t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
=====================================
--- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
+++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputAvdth35.java
@@ -27,6 +27,7 @@ import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.access.AbstractT3InputMSAccess;
import fr.ird.t3.io.input.access.T3AccessDataSource;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
+
import java.io.File;
/**
@@ -37,21 +38,7 @@ import java.io.File;
*/
public class T3InputAvdth35 extends AbstractT3InputMSAccess {
- @Override
- public T3AccessDataSource newDataSource(File inputFile) {
- return new T3AccessDataSource(inputFile,
- T3AccessEntityMetaProviderAvdth35.class
- );
- }
-
- @Override
- public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource,
- ReferenceEntityMap safeReferences) {
-
- return new T3DataEntityVisitorAvdth35(getConfiguration().getTopiaApplicationContext(), dataSource, safeReferences);
- }
-
- public static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
+ private static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
ImmutableSet.of(
T3EntityEnum.VesselActivity,
T3EntityEnum.VesselSizeCategory,
@@ -75,19 +62,12 @@ public class T3InputAvdth35 extends AbstractT3InputMSAccess {
T3EntityEnum.FpaZone,
T3EntityEnum.LocalMarketPackagingType,
T3EntityEnum.LocalMarketPackaging);
-
-
- @Override
- public ImmutableSet<T3EntityEnum> getReferenceTypes() {
- return REFERENCE_TYPES;
- }
-
/**
* Set of all importable data types from ms-access.
*
* @since 2.0
*/
- public static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
+ private static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
ImmutableSet.of(
T3EntityEnum.Activity,
T3EntityEnum.ActivityFishingContext,
@@ -108,6 +88,21 @@ public class T3InputAvdth35 extends AbstractT3InputMSAccess {
T3EntityEnum.LocalMarketSurvey);
@Override
+ public T3AccessDataSource newDataSource(File inputFile) {
+ return new T3AccessDataSource(inputFile, T3AccessEntityMetaProviderAvdth35.class);
+ }
+
+ @Override
+ public ImmutableSet<T3EntityEnum> getReferenceTypes() {
+ return REFERENCE_TYPES;
+ }
+
+ @Override
+ public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource, ReferenceEntityMap safeReferences) {
+ return new T3DataEntityVisitorAvdth35(dataSource, safeReferences);
+ }
+
+ @Override
public ImmutableSet<T3EntityEnum> getDataTypes() {
return IMPORTABLE_DATA_TYPES;
}
=====================================
t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputProviderAvdth35.java
=====================================
--- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputProviderAvdth35.java
+++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3InputProviderAvdth35.java
@@ -8,12 +8,12 @@
* 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%
@@ -23,10 +23,11 @@ package fr.ird.t3.io.input.avdth.v35;
import com.google.auto.service.AutoService;
import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.T3InputProvider;
-import java.io.File;
import org.nuiton.version.Version;
import org.nuiton.version.Versions;
+import java.io.File;
+
/**
* Provides input for avdth.
*
@@ -38,9 +39,9 @@ public class T3InputProviderAvdth35 implements T3InputProvider {
private static final long serialVersionUID = 1L;
- public static final Version VERSION = Versions.valueOf("3.5");
+ private static final Version VERSION = Versions.valueOf("3.5");
- public static final String NAME = "AVDTH";
+ private static final String NAME = "AVDTH";
public static final String ID = NAME + "__" + VERSION;
@@ -65,8 +66,8 @@ public class T3InputProviderAvdth35 implements T3InputProvider {
}
@Override
- public String getLibelle() {
- return getName() + " - v." + getVersion() + " (" + getInputType() + ")";
+ public String getLabel() {
+ return String.format("%s - v.%s (%s)", getName(), getVersion(), getInputType());
}
@Override
=====================================
t3-input-avdthv36/pom.xml
=====================================
--- a/t3-input-avdthv36/pom.xml
+++ b/t3-input-avdthv36/pom.xml
@@ -88,11 +88,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-persistence</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<scope>provided</scope>
=====================================
t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
=====================================
--- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
+++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java
@@ -8,19 +8,18 @@
* 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 fr.ird.t3.io.input.avdth.v36;
-import com.google.common.collect.Sets;
import fr.ird.msaccess.type.IntToCoordonne;
import fr.ird.t3.entities.T3EntityEnum;
import fr.ird.t3.entities.data.Activity;
@@ -73,6 +72,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Date;
+import java.util.LinkedHashSet;
import java.util.Set;
/**
@@ -83,12 +83,11 @@ import java.util.Set;
*/
public class T3AccessEntityMetaProviderAvdth36 implements T3AccessEntityMetaProvider {
- /** Logger. */
private static final Log log = LogFactory.getLog(T3AccessEntityMetaProviderAvdth36.class);
@Override
public Set<T3AccessEntityMeta> getMetas() {
- Set<T3AccessEntityMeta> result = Sets.newLinkedHashSet();
+ Set<T3AccessEntityMeta> result = new LinkedHashSet<>();
// ACTIVITE : [C_BAT, C_OCEA, C_OPERA, C_TBANC, D_ACT, D_DBQ, F_CUVE_C, F_DON_ORG, F_EXPERT, F_OBS, F_POS_COR, F_POS_VMS_D, H_ACT, N_ACT, Q_ACT, V_COUR_DIR, V_COUR_VIT, V_LAT, V_LON, V_NB_OP, V_POIDS_CAP, V_TEMP_S, V_TMER, V_TPEC]
registerDataMeta(
@@ -681,45 +680,30 @@ public class T3AccessEntityMetaProviderAvdth36 implements T3AccessEntityMetaProv
return result;
}
- protected void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(
- type,
- tableName,
- pkeys,
- properties
- );
+ private void registerReferentielMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessReferentielEntityMeta(type, tableName, pKeys, properties);
registerMeta(universe, meta);
}
- protected void registerDataMeta(Set<T3AccessEntityMeta> universe,
- T3EntityEnum type,
- String tableName,
- String[] pkeys,
- Object[] association,
- Object[] reverseProperties,
- Object... properties) {
- T3AccessEntityMeta meta = new T3AccessDataEntityMeta(
- type,
- tableName,
- pkeys,
- association,
- reverseProperties,
- properties
- );
+ private void registerDataMeta(Set<T3AccessEntityMeta> universe,
+ T3EntityEnum type,
+ String tableName,
+ String[] pKeys,
+ Object[] association,
+ Object[] reverseProperties,
+ Object... properties) {
+ T3AccessEntityMeta meta = new T3AccessDataEntityMeta(type, tableName, pKeys, association, reverseProperties, properties);
registerMeta(universe, meta);
}
- protected void registerMeta(Set<T3AccessEntityMeta> universe,
- T3AccessEntityMeta meta) {
- if (log.isDebugEnabled()) {
- log.debug("add " + meta.getType() + ":" + meta.getTableName() + " to universe");
- }
+ private void registerMeta(Set<T3AccessEntityMeta> universe, T3AccessEntityMeta meta) {
+ log.debug(String.format("add %s:%s to universe", meta.getType(), meta.getTableName()));
universe.add(meta);
}
}
=====================================
t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
=====================================
--- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
+++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3DataEntityVisitorAvdth36.java
@@ -8,12 +8,12 @@
* 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%
@@ -21,28 +21,9 @@
package fr.ird.t3.io.input.avdth.v36;
import fr.ird.t3.entities.ReferenceEntityMap;
-import fr.ird.t3.entities.T3EntityEnum;
-import fr.ird.t3.entities.T3TopiaApplicationContext;
-import fr.ird.t3.entities.data.Activity;
-import fr.ird.t3.entities.data.ElementaryCatch;
-import fr.ird.t3.entities.data.ElementaryLanding;
-import fr.ird.t3.entities.data.Sample;
-import fr.ird.t3.entities.data.SampleSet;
-import fr.ird.t3.entities.data.Trip;
-import fr.ird.t3.entities.data.Well;
-import fr.ird.t3.entities.data.WellPlan;
-import fr.ird.t3.entities.reference.WeightCategoryLanding;
-import fr.ird.t3.entities.reference.WeightCategoryLogBook;
-import fr.ird.t3.io.input.MissingForeignKeyInT3;
import fr.ird.t3.io.input.access.T3AccessDataSource;
-import fr.ird.t3.io.input.access.T3AccessEntity;
-import fr.ird.t3.io.input.access.T3AccessEntityMeta;
+import fr.ird.t3.io.input.access.T3AvdthDataEntityVisitor;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
-import fr.ird.type.CoordinateHelper;
-import java.io.Serializable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
/**
* Implementation of {@link T3DataEntityVisitor} for the avdth v36 db.
@@ -50,216 +31,8 @@ import org.nuiton.topia.persistence.TopiaEntity;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 2.0
*/
-public class T3DataEntityVisitorAvdth36 extends T3DataEntityVisitor {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(T3DataEntityVisitorAvdth36.class);
-
- protected final ReverseAssociationGetter<Trip, WellPlan, Activity> wellPlanReverse;
-
- protected final ReverseAssociationGetter<Trip, Sample, Well> sampleReverse;
-
- protected final ReverseAssociationGetter<Trip, SampleSet, Activity> sampleSetReverse;
-
- public T3DataEntityVisitorAvdth36(T3TopiaApplicationContext topiaApplicationContext,
- T3AccessDataSource dataSource,
- ReferenceEntityMap referentiel) {
+class T3DataEntityVisitorAvdth36 extends T3AvdthDataEntityVisitor {
+ T3DataEntityVisitorAvdth36(T3AccessDataSource dataSource, ReferenceEntityMap referentiel) {
super(dataSource, referentiel);
-
- wellPlanReverse = newReverseAssociationGetter(
- Trip.class,
- WellPlan.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- WellPlan.PROPERTY_ACTIVITY
- );
-
- sampleReverse = newReverseAssociationGetter(
- Trip.class,
- Sample.class,
- Well.class,
- Trip.PROPERTY_WELL,
- Sample.PROPERTY_WELL
- );
-
- sampleSetReverse = newReverseAssociationGetter(
- Trip.class,
- SampleSet.class,
- Activity.class,
- Trip.PROPERTY_ACTIVITY,
- SampleSet.PROPERTY_ACTIVITY
- );
- }
-
- @Override
- public void onEnd(T3AccessEntity entity, T3AccessEntityMeta meta) {
-
- super.onEnd(entity, meta);
-
- if (!deepVisit) {
- return;
- }
-
- T3EntityEnum type = meta.getType();
-
- if (type == T3EntityEnum.Activity) {
-
- Activity a = (Activity) entity;
-
- Integer quadrant = a.getQuadrant();
- Float latitude = CoordinateHelper.getSignedLatitude(
- quadrant, a.getLatitude());
- Float longitude = CoordinateHelper.getSignedLongitude(
- quadrant, a.getLongitude());
- a.setLatitude(latitude);
- a.setLongitude(longitude);
-
- if (log.isDebugEnabled()) {
- log.debug("Will use for activity " + entity +
- " coordinates <" + a.getLongitude() + "," + a.getLatitude() + ">");
- }
- }
- }
-
- @Override
- public void onVisitReverseAssociation(String propertyName,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (!deepVisit) {
- return;
- }
-
- if (SampleSet.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof SampleSet) {
-
- // special case, must obtain the activity from the trip
-
- sampleSetReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (WellPlan.PROPERTY_ACTIVITY.equals(propertyName) &&
- entity instanceof WellPlan) {
-
- // special case, must obtain the activity from the trip
-
- wellPlanReverse.attachReverseAssocation(entity);
- return;
- }
-
- if (Sample.PROPERTY_WELL.equals(propertyName) &&
- entity instanceof Sample) {
-
- // special case, must obtain the well from the trip
-
- sampleReverse.attachReverseAssocation(entity);
- return;
- }
-
- super.onVisitReverseAssociation(propertyName, entity, meta);
- }
-
- @Override
- public void onVisitComposition(String propertyName,
- Class<?> type,
- T3AccessEntity entity,
- T3AccessEntityMeta meta) {
-
- if (ElementaryLanding.PROPERTY_WEIGHT_CATEGORY_LANDING.equals(propertyName)
- && entity instanceof ElementaryLanding) {
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_C", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLanding);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLanding.PROPERTY_CODE, WeightCategoryLanding.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find WeightCategoryLanding for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryLanding,
- T3EntityEnum.WeightCategoryLanding,
- getPKey(T3EntityEnum.ElementaryLanding),
- new Object[]{codeEspece, codeCate}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected landing catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- if (ElementaryCatch.PROPERTY_WEIGHT_CATEGORY_LOG_BOOK.equals(propertyName)
- && entity instanceof ElementaryCatch) {
-
- // special case : need to find a reference with two primary keys...
-
- Serializable codeEspece = getProperty("C_ESP", row);
- Serializable codeCate = getProperty("C_CAT_T", row);
-
- // must found the species
- T3AccessEntityMeta specieMeta =
- dataSource.getMeta(T3EntityEnum.Species);
-
- TopiaEntity specie = getReferenceEntity(specieMeta, codeEspece);
-
- T3AccessEntityMeta categoryMeta =
- dataSource.getMeta(T3EntityEnum.WeightCategoryLogBook);
-
- // special case : need to find a reference with two primary keys...
- TopiaEntity ref = getReferenceEntity(
- categoryMeta,
- new String[]{WeightCategoryLogBook.PROPERTY_CODE, WeightCategoryLogBook.PROPERTY_SPECIES},
- codeCate, specie
- );
-
- if (ref == null) {
-
- if (log.isWarnEnabled()) {
- log.warn("Can't find weightCategoryLogBook for speciesCode / categoryCode: " + codeEspece + "/" + codeCate);
- }
- getMissingForeignKeys().add(new MissingForeignKeyInT3(
- T3EntityEnum.ElementaryCatch,
- T3EntityEnum.WeightCategoryLogBook,
- getPKey(T3EntityEnum.ElementaryCatch),
- new Object[]{codeCate, codeEspece}
- ));
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Detected logBook catch weight category : " + ref);
- }
- entity.setProperty(propertyName, ref);
-
- }
-
- return;
- }
-
- super.onVisitComposition(propertyName, type, entity, meta);
}
}
=====================================
t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
=====================================
--- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
+++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputAvdth36.java
@@ -8,12 +8,12 @@
* 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%
@@ -27,6 +27,7 @@ import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.access.AbstractT3InputMSAccess;
import fr.ird.t3.io.input.access.T3AccessDataSource;
import fr.ird.t3.io.input.access.T3DataEntityVisitor;
+
import java.io.File;
/**
@@ -37,21 +38,7 @@ import java.io.File;
*/
public class T3InputAvdth36 extends AbstractT3InputMSAccess {
- @Override
- public T3AccessDataSource newDataSource(File inputFile) {
- return new T3AccessDataSource(inputFile, T3AccessEntityMetaProviderAvdth36.class);
- }
-
- @Override
- public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource,
- ReferenceEntityMap safeReferences) {
-
- return new T3DataEntityVisitorAvdth36(getConfiguration().getTopiaApplicationContext(),
- dataSource,
- safeReferences);
- }
-
- public static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
+ private static final ImmutableSet<T3EntityEnum> REFERENCE_TYPES =
ImmutableSet.of(
T3EntityEnum.VesselActivity,
T3EntityEnum.VesselSizeCategory,
@@ -77,19 +64,12 @@ public class T3InputAvdth36 extends AbstractT3InputMSAccess {
T3EntityEnum.LocalMarketPackaging,
T3EntityEnum.ElementaryCatchFate,
T3EntityEnum.Company);
-
-
- @Override
- public ImmutableSet<T3EntityEnum> getReferenceTypes() {
- return REFERENCE_TYPES;
- }
-
/**
* Set of all importable data types from ms-access.
*
* @since 2.0
*/
- public static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
+ private static final ImmutableSet<T3EntityEnum> IMPORTABLE_DATA_TYPES =
ImmutableSet.of(
T3EntityEnum.Activity,
T3EntityEnum.ActivityFishingContext,
@@ -110,6 +90,21 @@ public class T3InputAvdth36 extends AbstractT3InputMSAccess {
T3EntityEnum.LocalMarketSurvey);
@Override
+ public T3AccessDataSource newDataSource(File inputFile) {
+ return new T3AccessDataSource(inputFile, T3AccessEntityMetaProviderAvdth36.class);
+ }
+
+ @Override
+ public T3DataEntityVisitor newDataVisitor(T3AccessDataSource dataSource, ReferenceEntityMap safeReferences) {
+ return new T3DataEntityVisitorAvdth36(dataSource, safeReferences);
+ }
+
+ @Override
+ public ImmutableSet<T3EntityEnum> getReferenceTypes() {
+ return REFERENCE_TYPES;
+ }
+
+ @Override
public ImmutableSet<T3EntityEnum> getDataTypes() {
return IMPORTABLE_DATA_TYPES;
}
=====================================
t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputProviderAvdth36.java
=====================================
--- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputProviderAvdth36.java
+++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3InputProviderAvdth36.java
@@ -8,12 +8,12 @@
* 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%
@@ -23,10 +23,11 @@ package fr.ird.t3.io.input.avdth.v36;
import com.google.auto.service.AutoService;
import fr.ird.t3.io.input.T3Input;
import fr.ird.t3.io.input.T3InputProvider;
-import java.io.File;
import org.nuiton.version.Version;
import org.nuiton.version.Versions;
+import java.io.File;
+
/**
* Provides input for avdth.
*
@@ -37,11 +38,8 @@ import org.nuiton.version.Versions;
public class T3InputProviderAvdth36 implements T3InputProvider {
private static final long serialVersionUID = 1L;
-
- public static final Version VERSION = Versions.valueOf("3.6");
-
- public static final String NAME = "AVDTH";
-
+ private static final Version VERSION = Versions.valueOf("3.6");
+ private static final String NAME = "AVDTH";
public static final String ID = NAME + "__" + VERSION;
@Override
@@ -65,8 +63,8 @@ public class T3InputProviderAvdth36 implements T3InputProvider {
}
@Override
- public String getLibelle() {
- return getName() + " - v." + getVersion() + " (" + getInputType() + ")";
+ public String getLabel() {
+ return String.format("%s - v.%s (%s)", getName(), getVersion(), getInputType());
}
@Override
@@ -82,9 +80,7 @@ public class T3InputProviderAvdth36 implements T3InputProvider {
if (!(o instanceof T3InputProvider)) {
return false;
}
-
T3InputProvider that = (T3InputProvider) o;
-
return ID.equals(that.getId());
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/8e373b7d602ee491e2111a69e2769663…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/8e373b7d602ee491e2111a69e2769663…
You're receiving this email because of your account on gitlab.com.
1
0
Tony CHEMIT pushed new branch feature/116 at ultreiaio / ird-t3
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/tree/feature/116
You're receiving this email because of your account on gitlab.com.
1
0