Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
November 2016
- 1 participants
- 84 discussions
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
from 4a38a22 Gestion plus perfectionnée des calculs taille-poids (Fixes #8404) Merge branch 'feature/8404' into develop
new ab2e912 Ajout d'une nouvelle option à la configuration pour le fichier de sauvegarde des états des ui
new 831f205 Mise en place de SwingSession dans ObServe
new 10ee9e9 Réglage par défaut des proportions des volets de la fenêtre (Fixes #2841) Merge branch 'feature/2841' into develop
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 10ee9e9a4311b6a10a8653d6ab847164a9fd384d
Merge: 4a38a22 831f205
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Mon Nov 7 08:34:16 2016 +0100
Réglage par défaut des proportions des volets de la fenêtre (Fixes #2841)
Merge branch 'feature/2841' into develop
commit 831f2050ffa6fcdcd17651ad22105c9d8e64f21f
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Mon Nov 7 08:34:14 2016 +0100
Mise en place de SwingSession dans ObServe
commit ab2e9125f3fd5c53f160b8f4bbfda8dfaec9c1ad
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Mon Nov 7 08:34:01 2016 +0100
Ajout d'une nouvelle option à la configuration pour le fichier de sauvegarde des états des ui
Summary of changes:
.../src/main/config/ObserveSwingApplication.ini | 8 ++++
...pplication-swing-configuration_en_GB.properties | 1 +
...pplication-swing-configuration_es_ES.properties | 1 +
...pplication-swing-configuration_fr_FR.properties | 1 +
.../observe/application/swing/ObserveRunner.java | 2 +
.../swing/ObserveSwingApplicationContext.java | 9 ++++
.../swing/ObserveSwingSessionHelper.java | 52 ++++++++++++++++++++++
.../swing/ui/content/ContentUIManager.java | 7 ++-
8 files changed, 80 insertions(+), 1 deletion(-)
create mode 100644 application-swing/src/main/java/fr/ird/observe/application/swing/ObserveSwingSessionHelper.java
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
3
This is an automated email from the git hooks/post-receive script.
New change to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
from 18a9780 [PS] Limiter l'usage du formulaire DCP (Fixes #8376) Merge branch 'feature/8376' into develop
new 63eb6c0 Ajout LengthLengthParameter et revue de LWParameter (persistence)
new 0ecbc31 Ajout LengthLengthParameter et revue de LWParameter (service)
new 30ae2b5 Ajout LengthLengthParameter et revue de LWParameter (ui)
new 3b9e046 mise à jour validation
new b10613f il se peut que la date max n'existe pas.
new 3a0dca4 mise à jour des tests
new 6ad0fd7 correction scripts de migration
new 587b746 la date de début peut-être nulle
new af93bf1 ajout d'un icon
new aa8b3b3 Ajout sizeMeasureType sur nonTargetSample et mise en place type de mensuration par défaut
new f6609dd Ajout validation de sizeMeasureType sur NonTargetLength
new 5833257 Introduction de deux nouveaux modules services-dto-reference et services-dto-gson
new b9f1339 Utilisation de la conversion taille - taille quand requis
new 4a38a22 Gestion plus perfectionnée des calculs taille-poids (Fixes #8404) Merge branch 'feature/8404' into develop
The 14 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 4a38a2237880e4cfde839a607f7f91328fe61fc4
Merge: 18a9780 b9f1339
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Mon Nov 7 08:06:50 2016 +0100
Gestion plus perfectionnée des calculs taille-poids (Fixes #8404)
Merge branch 'feature/8404' into develop
commit b9f1339edaf1a4f82f44d8f21489a9cd4f36f642
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Nov 6 15:48:25 2016 +0100
Utilisation de la conversion taille - taille quand requis
commit 58332577f889bd7e2844fcfdc6757b02f534c2cb
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Nov 6 12:39:47 2016 +0100
Introduction de deux nouveaux modules services-dto-reference et services-dto-gson
commit f6609dd61769b259529ed0ba0282a65117479549
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Nov 6 12:03:03 2016 +0100
Ajout validation de sizeMeasureType sur NonTargetLength
commit aa8b3b337dbd8957f9e15ee0fec0f511b56b93cf
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Nov 6 12:02:43 2016 +0100
Ajout sizeMeasureType sur nonTargetSample et mise en place type de mensuration par défaut
commit af93bf166e2c43b254aeae34b0c3bae3b79d1ad6
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sun Nov 6 12:01:44 2016 +0100
ajout d'un icon
commit 587b746d6fef5efae1f9cc711fd623815e92ddae
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:45:07 2016 +0100
la date de début peut-être nulle
commit 6ad0fd792a750f9ee834aee4ed45d6f67efe69d8
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:44:50 2016 +0100
correction scripts de migration
commit 3a0dca45be6215eb830a5e7702fb753f332e0460
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:43:52 2016 +0100
mise à jour des tests
commit b10613f57eca0986bdea7ce9fcf5bc924e0397c4
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:43:17 2016 +0100
il se peut que la date max n'existe pas.
commit 3b9e046579fcbffe042908cdb8d45b64d788a621
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:46:01 2016 +0100
mise à jour validation
commit 30ae2b5f97dd1da5007d387b404e508fa0dab75b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:30:32 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (ui)
commit 0ecbc3191808377a593577ad538f277bc1d8e423
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:29:58 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (service)
commit 63eb6c05c52a3fd8f43f7c44b65adad9a8b2da79
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:29:23 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (persistence)
Summary of changes:
.../swing/decoration/DecoratorService.java | 11 +-
...or.java => LengthLengthParameterDecorator.java} | 29 +-
.../application-swing-decoration_en_GB.properties | 5 +-
.../application-swing-decoration_es_ES.properties | 3 +
.../application-swing-decoration_fr_FR.properties | 3 +
...ngthParameterDto-ui-create-error-validation.xml | 108 +++++++
...hParameterDto-ui-create-warning-validation.xml} | 14 +-
...gthParameterDto-ui-update-error-validation.xml} | 58 ++--
...hParameterDto-ui-update-warning-validation.xml} | 0
...ightParameterDto-ui-create-error-validation.xml | 17 +-
...htParameterDto-ui-create-warning-validation.xml | 8 +
...nTargetLengthDto-ui-update-error-validation.xml | 17 ++
.../application-swing-validation_en_GB.properties | 16 +
.../application-swing-validation_es_ES.properties | 16 +
.../application-swing-validation_fr_FR.properties | 18 +-
.../validation/BeanValidatorDetectorTest.java | 10 +-
application-swing/pom.xml | 5 +
.../src/main/filters/observe-ui.properties | 1 +
...rameterUI.jaxx => LengthLengthParameterUI.jaxx} | 139 ++-------
...rameterUI.jcss => LengthLengthParameterUI.jcss} | 100 ++-----
...er.java => LengthLengthParameterUIHandler.java} | 22 +-
...odel.java => LengthLengthParameterUIModel.java} | 55 ++--
.../content/ref/impl/LengthWeightParameterUI.jaxx | 38 +--
.../content/ref/impl/LengthWeightParameterUI.jcss | 17 ++
.../ref/impl/LengthWeightParameterUIModel.java | 3 +
.../content/table/impl/seine/AbstractSampleUI.jcss | 49 +++
.../table/impl/seine/AbstractSampleUIHandler.java | 36 ++-
.../table/impl/seine/NonTargetSampleUI.jaxx | 37 ++-
.../table/impl/seine/NonTargetSampleUI.jcss | 25 --
.../table/impl/seine/NonTargetSampleUIHandler.java | 72 ++++-
.../table/impl/seine/NonTargetSampleUIModel.java | 26 +-
.../content/table/impl/seine/TargetSampleUI.jaxx | 4 +-
.../content/table/impl/seine/TargetSampleUI.jcss | 45 ---
.../table/impl/seine/TargetSampleUIHandler.java | 100 +++++--
.../table/impl/seine/TargetSampleUIModel.java | 20 +-
.../i18n/application-swing_en_GB.properties | 9 +
.../i18n/application-swing_es_ES.properties | 9 +
.../i18n/application-swing_fr_FR.properties | 9 +
application-web/pom.xml | 5 +
.../DataSourceMigrationForVersion_5_1.java | 1 +
.../V5_1_13_evol_7901_add_armateur_table-H2.sql | 2 +-
.../V5_1_13_evol_7901_add_armateur_table-PG.sql | 2 +-
.../V5_1_18_evol_8404_lengthLengthParameter-H2.sql | 14 +
.../V5_1_18_evol_8404_lengthLengthParameter-PG.sql | 14 +
.../java/fr/ird/observe/entities/Entities.java | 1 +
.../observe/entities/LengthWeightComputable.java | 5 +-
.../AbstractObserveMigrationCallBack.java | 2 +-
.../entities/referentiel/FormulaHelper.java | 169 +++++++++++
.../entities/referentiel/FormulaSupportImpl.java | 88 ++++++
.../referentiel/LengthLengthParameterImpl.java | 55 ++++
.../referentiel/LengthLengthParameterTopiaDao.java | 16 +
.../referentiel/LengthLengthParameters.java | 21 ++
.../referentiel/LengthWeightParameterImpl.java | 110 +------
.../referentiel/LengthWeightParameters.java | 260 +++-------------
.../referentiel/LengthWeightParemeterHelper.java | 332 ---------------------
.../observe/entities/seine/NonTargetCatchImpl.java | 6 +
entities/src/main/xmi/observe-common.zargo | Bin 42084 -> 45678 bytes
entities/src/main/xmi/observe-seine.zargo | Bin 86910 -> 87124 bytes
entities/src/main/xmi/observe.ini | 9 +-
.../entities/referentiel/FormulaHelperTest.java | 27 ++
.../LengthWeightParemeterHelperTest.java | 48 ---
pom.xml | 2 +
.../LICENSE.txt | 0
.../README.md | 0
.../pom.xml | 48 +--
.../ird/observe/services/dto/gson/BlobAdapter.java | 0
.../observe/services/dto/gson/ClassAdapter.java | 0
.../ird/observe/services/dto/gson/DateAdapter.java | 0
.../ird/observe/services/dto/gson/FormAdapter.java | 0
.../services/dto/gson/ImmutableListAdapter.java | 0
.../services/dto/gson/ImmutableMapAdapter.java | 0
.../dto/gson/ImmutableMultimapAdapter.java | 0
.../services/dto/gson/ImmutableSetAdapter.java | 0
.../observe/services/dto/gson/IntegerAdapter.java | 0
.../services/dto/gson/ObserveDtoGsonSupplier.java | 0
.../dto/gson/ReferentialMultimapAdapter.java | 0
.../services/dto/gson/ReportVariableAdapter.java | 0
.../observe/services/dto/gson/VersionAdapter.java | 0
.../gson/reference/AbstractReferenceAdapter.java | 0
.../reference/AbstractReferenceSetAdapter.java | 0
.../dto/gson/reference/DataReferenceAdapter.java | 0
.../gson/reference/DataReferenceSetAdapter.java | 0
.../reference/ReferentialReferenceAdapter.java | 0
.../reference/ReferentialReferenceSetAdapter.java | 0
.../gson/reference/UnknownReferenceAdapter.java | 0
.../LICENSE.txt | 0
.../README.md | 0
.../pom.xml | 42 +--
.../dto/reference/DataReferenceSetDefinitions.java | 0
.../dto/reference/ReferenceBinderEngine.java | 0
.../reference/ReferenceBinderEngineSupplier.java | 0
.../dto/reference/ReferenceSetDefinition.java | 0
.../ReferentialReferenceSetDefinitions.java | 12 +-
.../request/ReferenceSetRequestDefinition.java | 0
.../request/ReferenceSetRequestDefinitions.java | 11 +-
.../request/ReferenceSetRequestKeyDefinition.java | 0
services-dto/pom.xml | 13 -
.../services/dto/referential/FormulaHelper.java | 134 +++++++++
.../dto/referential/LengthLengthParameterDto.java | 48 +++
.../dto/referential/LengthWeightParameterDto.java | 48 +++
.../dto/referential/ReferentialHelper.java | 1 +
.../dto/referential/SizeMeasureTypeHelper.java | 17 --
.../src/main/xmi/observe-services-dto-common.zargo | Bin 46149 -> 48945 bytes
.../src/main/xmi/observe-services-dto-seine.zargo | Bin 60743 -> 60919 bytes
services-dto/src/main/xmi/observe-services-dto.ini | 12 +-
services-rest/pom.xml | 11 +
services-runner/pom.xml | 6 +
services-topia-binder/pom.xml | 5 +
.../topia/binder/BinderEngineInitializer.java | 17 +-
.../services/topia/binder/BinderSupport.java | 10 +
.../topia/binder/data/ActivityLonglineBinder.java | 4 +-
.../topia/binder/data/ActivitySeineBinder.java | 4 +-
.../topia/binder/data/NonTargetLengthBinder.java | 4 +
.../topia/binder/data/TripLonglineBinder.java | 8 +-
.../topia/binder/data/TripSeineBinder.java | 4 +-
.../referential/LengthLengthParameterBinder.java | 92 ++++++
.../referential/LengthWeightParameterBinder.java | 2 +
.../topia/binder/referential/SpeciesBinder.java | 4 +-
.../topia/binder/BinderEngineMetadataTest.java | 4 +-
...thLengthParameter-service-error-validation.xml} | 61 ++--
...LengthParameter-service-warning-validation.xml} | 0
...gthWeightParameter-service-error-validation.xml | 10 +-
.../services-topia-validation_en_GB.properties | 7 +
.../services-topia-validation_es_ES.properties | 7 +
.../services-topia-validation_fr_FR.properties | 7 +
.../validation/BeanValidatorDetectorTest.java | 4 +-
services-topia/pom.xml | 11 +
.../topia/service/LastUpdateDateServiceTopia.java | 2 +-
.../consolidate/ConsolidateDataServiceTopia.java | 39 ++-
.../topia/entity/LengthWeightParemetersTest.java | 26 +-
.../UnidirectionalSynchronizeReferentialTest.java | 4 +
services/pom.xml | 9 +
.../java/fr/ird/observe/test/ObserveFixtures.java | 3 +-
.../resources/db/5.1/dataForTestLongline.sql.gz | Bin 1626691 -> 1626811 bytes
.../main/resources/db/5.1/dataForTestSeine.sql.gz | Bin 455040 -> 455518 bytes
test/src/main/resources/db/5.1/empty_h2.sql.gz | Bin 6193 -> 6302 bytes
test/src/main/resources/db/5.1/empty_pg.sql.gz | Bin 6188 -> 6293 bytes
test/src/main/resources/db/5.1/referentiel.sql.gz | Bin 181714 -> 182328 bytes
138 files changed, 1773 insertions(+), 1321 deletions(-)
copy application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/{NonTargetCatchDecorator.java => LengthLengthParameterDecorator.java} (52%)
create mode 100644 application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-error-validation.xml
copy application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/{LengthWeightParameterDto-ui-update-warning-validation.xml => LengthLengthParameterDto-ui-create-warning-validation.xml} (82%)
copy application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/{OrganismDto-ui-create-warning-validation.xml => LengthLengthParameterDto-ui-update-error-validation.xml} (54%)
copy application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/{VesselSizeCategoryDto-ui-update-warning-validation.xml => LengthLengthParameterDto-ui-update-warning-validation.xml} (100%)
copy application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/{LengthWeightParameterUI.jaxx => LengthLengthParameterUI.jaxx} (55%)
copy application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/{LengthWeightParameterUI.jcss => LengthLengthParameterUI.jcss} (52%)
copy application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/{LengthWeightParameterUIHandler.java => LengthLengthParameterUIHandler.java} (84%)
copy application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/{LengthWeightParameterUIModel.java => LengthLengthParameterUIModel.java} (53%)
create mode 100644 entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
create mode 100644 entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
create mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaHelper.java
create mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaSupportImpl.java
create mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterImpl.java
create mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterTopiaDao.java
create mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java
delete mode 100644 entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelper.java
create mode 100644 entities/src/test/java/fr/ird/observe/entities/referentiel/FormulaHelperTest.java
delete mode 100644 entities/src/test/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelperTest.java
copy {topia-templates-extension => services-dto-gson}/LICENSE.txt (100%)
copy {topia-templates-extension => services-dto-gson}/README.md (100%)
copy {services-topia-validators => services-dto-gson}/pom.xml (62%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/BlobAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ClassAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/DateAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/FormAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ImmutableListAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMapAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ImmutableSetAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/IntegerAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ReferentialMultimapAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/ReportVariableAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/VersionAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceSetAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceSetAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceSetAdapter.java (100%)
rename {services-dto => services-dto-gson}/src/main/java/fr/ird/observe/services/dto/gson/reference/UnknownReferenceAdapter.java (100%)
copy {topia-templates-extension => services-dto-reference}/LICENSE.txt (100%)
copy {topia-templates-extension => services-dto-reference}/README.md (100%)
copy {services-topia-validators => services-dto-reference}/pom.xml (65%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/DataReferenceSetDefinitions.java (100%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngine.java (100%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngineSupplier.java (100%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/ReferenceSetDefinition.java (100%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java (94%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinition.java (100%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java (97%)
rename {services-dto => services-dto-reference}/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestKeyDefinition.java (100%)
create mode 100644 services-dto/src/main/java/fr/ird/observe/services/dto/referential/FormulaHelper.java
create mode 100644 services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthLengthParameterDto.java
create mode 100644 services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthWeightParameterDto.java
create mode 100644 services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthLengthParameterBinder.java
copy services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/{Person-service-error-validation.xml => LengthLengthParameter-service-error-validation.xml} (57%)
copy services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/{VesselSizeCategory-service-warning-validation.xml => LengthLengthParameter-service-warning-validation.xml} (100%)
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
7
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 6ad0fd792a750f9ee834aee4ed45d6f67efe69d8
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:44:50 2016 +0100
correction scripts de migration
---
.../db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-H2.sql | 2 +-
.../db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-PG.sql | 2 +-
.../db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql | 2 +-
.../db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-H2.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-H2.sql
index 48fb398..b489d99 100644
--- a/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-H2.sql
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-H2.sql
@@ -52,7 +52,7 @@ INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, la
INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, lastupdatedate, status, code, label, country, needComment) values ('fr.ird.observe.entities.referentiel.ShipOwner#0#25', 0, CURRENT_DATE, CURRENT_TIMESTAMP, 1, '26','NICRA', 'fr.ird.observe.entities.referentiel.Country#1239832675584#0.0783072255559325', false);
INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, lastupdatedate, status, code, label, needComment) values ('fr.ird.observe.entities.referentiel.ShipOwner#0#26', 0, CURRENT_DATE, CURRENT_TIMESTAMP, 1, '999','UND', true);
-INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#1', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.ShipOwner', CURRENT_TIMESTAMP);
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#1', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.ShipOwner', CURRENT_TIMESTAMP);
ALTER TABLE observe_common.vessel ADD COLUMN shipOwner VARCHAR(255);
ALTER TABLE observe_common.vessel ADD CONSTRAINT FK_VESSEL_SHIP_OWNER FOREIGN KEY(shipOwner) REFERENCES observe_common.shipOwner(topiaid);
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-PG.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-PG.sql
index 4093e02..c97f4e4 100644
--- a/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-PG.sql
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_13_evol_7901_add_armateur_table-PG.sql
@@ -52,7 +52,7 @@ INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, la
INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, lastupdatedate, status, code, label, country) values ('fr.ird.observe.entities.referentiel.ShipOwner#0#25', 0, CURRENT_DATE, CURRENT_TIMESTAMP, 1, '26','NICRA', 'fr.ird.observe.entities.referentiel.Country#1239832675584#0.0783072255559325');
INSERT INTO observe_common.shipOwner (topiaid, topiaversion, topiacreatedate, lastupdatedate, status, code, label, needComment) values ('fr.ird.observe.entities.referentiel.ShipOwner#0#26', 0, CURRENT_DATE, CURRENT_TIMESTAMP, 1, '999','UND', true);
-INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#1', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.ShipOwner', CURRENT_TIMESTAMP);
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#1', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.ShipOwner', CURRENT_TIMESTAMP);
ALTER TABLE observe_common.vessel ADD COLUMN shipOwner character varying(255);
ALTER TABLE observe_common.vessel ADD CONSTRAINT FK_VESSEL_SHIP_OWNER FOREIGN KEY(shipOwner) REFERENCES observe_common.shipOwner(topiaid);
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
index 0f7a390..a69fca5 100644
--- a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
@@ -11,4 +11,4 @@ ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthp
CREATE INDEX index_observe_common_lengthlengthparameter_lastupdatedate ON observe_common.lengthlengthparameter (lastupdatedate);
-INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
index 54f8d18..eee685e 100644
--- a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
@@ -11,4 +11,4 @@ ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthp
CREATE INDEX index_observe_common_lengthlengthparameter_lastupdatedate ON lengthlengthparameter (lastupdatedate);
-INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 3a0dca45be6215eb830a5e7702fb753f332e0460
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:43:52 2016 +0100
mise à jour des tests
---
.../topia/binder/BinderEngineMetadataTest.java | 4 ++--
.../topia/entity/LengthWeightParemetersTest.java | 22 +++++++++++----------
.../UnidirectionalSynchronizeReferentialTest.java | 4 ++++
.../java/fr/ird/observe/test/ObserveFixtures.java | 3 ++-
.../resources/db/5.1/dataForTestLongline.sql.gz | Bin 1626691 -> 1626811 bytes
.../main/resources/db/5.1/dataForTestSeine.sql.gz | Bin 455040 -> 455518 bytes
test/src/main/resources/db/5.1/empty_h2.sql.gz | Bin 6193 -> 6302 bytes
test/src/main/resources/db/5.1/empty_pg.sql.gz | Bin 6188 -> 6293 bytes
test/src/main/resources/db/5.1/referentiel.sql.gz | Bin 181714 -> 182328 bytes
9 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/services-topia-binder/src/test/java/fr/ird/observe/services/topia/binder/BinderEngineMetadataTest.java b/services-topia-binder/src/test/java/fr/ird/observe/services/topia/binder/BinderEngineMetadataTest.java
index 7381d05..b7507e9 100644
--- a/services-topia-binder/src/test/java/fr/ird/observe/services/topia/binder/BinderEngineMetadataTest.java
+++ b/services-topia-binder/src/test/java/fr/ird/observe/services/topia/binder/BinderEngineMetadataTest.java
@@ -83,7 +83,7 @@ public class BinderEngineMetadataTest {
ImmutableMap<Class<? extends ReferentialDto>, Class<? extends ObserveReferentialEntity>> referentialDtoToEntityTypes = binderEngine.getReferentialDtoToEntityTypes();
Assert.assertNotNull(referentialDtoToEntityTypes);
- Assert.assertEquals(60, referentialDtoToEntityTypes.size());
+ Assert.assertEquals(61, referentialDtoToEntityTypes.size());
Set<Class<? extends ObserveReferentialEntity>> entityTypesFromEngine = Sets.newHashSet(referentialDtoToEntityTypes.values());
Set<Class<? extends ObserveReferentialEntity>> referentialEntityTypesFromTopia = getReferentialEntityTypes();
@@ -124,7 +124,7 @@ public class BinderEngineMetadataTest {
ImmutableMap<Class<? extends ObserveReferentialEntity>, Class<? extends ReferentialDto>> referentialDtoToEntityTypes = binderEngine.getReferentialEntityToDtoTypes();
Assert.assertNotNull(referentialDtoToEntityTypes);
- Assert.assertEquals(2 * 60, referentialDtoToEntityTypes.size());
+ Assert.assertEquals(2 * 61, referentialDtoToEntityTypes.size());
for (Class<? extends ObserveReferentialEntity> entityType : referentialDtoToEntityTypes.keySet()) {
diff --git a/services-topia/src/test/java/fr/ird/observe/services/topia/entity/LengthWeightParemetersTest.java b/services-topia/src/test/java/fr/ird/observe/services/topia/entity/LengthWeightParemetersTest.java
index 052c97c..67db9a1 100644
--- a/services-topia/src/test/java/fr/ird/observe/services/topia/entity/LengthWeightParemetersTest.java
+++ b/services-topia/src/test/java/fr/ird/observe/services/topia/entity/LengthWeightParemetersTest.java
@@ -198,18 +198,18 @@ public class LengthWeightParemetersTest extends AbstractServiceTopiaTest {
assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2011, date2011);
assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2011, date1970);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, date2009);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, date2009);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, date2009);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, date2009);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, null, undeterminedSex, date2009, date1970);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, null, undeterminedSex, date2009, date1970);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex,undeterminedSex, date2009, date1970);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2009, date1970);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, date2010);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, null, undeterminedSex, date2010,date2010);
assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2010, date2010);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, date2010);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex,undeterminedSex, date2010,date2010);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, date2011);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, null, undeterminedSex, date2011,date2011);
assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2011, date2011);
- assertNotFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, date2011);
+ assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex,undeterminedSex, date2011,date2011);
assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, undeterminedSex, date2010);
assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, maleSex, date2010);
@@ -226,8 +226,10 @@ public class LengthWeightParemetersTest extends AbstractServiceTopiaTest {
Assert.assertNotNull("length weith parameter not found for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date, lengthWeightParameter);
Assert.assertEquals("Expected sex is " + expectedSex.getLabel1() + " but the one found was " + lengthWeightParameter.getSex().getLabel1(), expectedSex, lengthWeightParameter.getSex());
- Date startDate = new Date(lengthWeightParameter.getStartDate().getTime());
- Assert.assertEquals("Expected startDate is " + expectedStartDate + " but the one found was " + startDate, expectedStartDate, startDate);
+ if (lengthWeightParameter.getStartDate()!=null) {
+ Date startDate = new Date(lengthWeightParameter.getStartDate().getTime());
+ Assert.assertEquals("Expected startDate is " + expectedStartDate + " but the one found was " + startDate, expectedStartDate, startDate);
+ }
}
protected void assertNotFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Date date) {
diff --git a/services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java b/services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java
index 0b9f5ed..e49e341 100644
--- a/services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java
+++ b/services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java
@@ -103,6 +103,10 @@ public class UnidirectionalSynchronizeReferentialTest extends AbstractServiceTop
if (ObserveEntityEnum.LastUpdateDate.equals(referenceEntity)) {
continue;
}
+ if (ObserveEntityEnum.LengthLengthParameter.equals(referenceEntity)) {
+ //empty
+ continue;
+ }
Class<? extends ReferentialDto> dtoType = BinderEngine.get().getReferentialDtoType(referenceEntity);
Assert.assertTrue(referentialNames.contains(dtoType));
Assert.assertTrue(result.getReferentialUpdated(dtoType).isEmpty());
diff --git a/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java b/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java
index e0b2cf8..feb894d 100644
--- a/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java
+++ b/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java
@@ -71,7 +71,8 @@ public class ObserveFixtures {
.put("observe_common.gearcaracteristic", 22L)
.put("observe_common.gearcaracteristictype", 6L)
.put("observe_common.harbour", 74L)
- .put("observe_common.lastupdatedate", 96L)
+ .put("observe_common.lastupdatedate", 97L)
+ .put("observe_common.lengthlengthparameter", 3L)
.put("observe_common.lengthweightparameter", 365L)
.put("observe_common.ocean", 3L)
.put("observe_common.ocean_species", 500L)
diff --git a/test/src/main/resources/db/5.1/dataForTestLongline.sql.gz b/test/src/main/resources/db/5.1/dataForTestLongline.sql.gz
index 98ee166..94732f8 100644
Binary files a/test/src/main/resources/db/5.1/dataForTestLongline.sql.gz and b/test/src/main/resources/db/5.1/dataForTestLongline.sql.gz differ
diff --git a/test/src/main/resources/db/5.1/dataForTestSeine.sql.gz b/test/src/main/resources/db/5.1/dataForTestSeine.sql.gz
index 8d0247c..cd9a1d2 100644
Binary files a/test/src/main/resources/db/5.1/dataForTestSeine.sql.gz and b/test/src/main/resources/db/5.1/dataForTestSeine.sql.gz differ
diff --git a/test/src/main/resources/db/5.1/empty_h2.sql.gz b/test/src/main/resources/db/5.1/empty_h2.sql.gz
index a97a1d4..54ee2ef 100644
Binary files a/test/src/main/resources/db/5.1/empty_h2.sql.gz and b/test/src/main/resources/db/5.1/empty_h2.sql.gz differ
diff --git a/test/src/main/resources/db/5.1/empty_pg.sql.gz b/test/src/main/resources/db/5.1/empty_pg.sql.gz
index e7126b2..d1579c9 100644
Binary files a/test/src/main/resources/db/5.1/empty_pg.sql.gz and b/test/src/main/resources/db/5.1/empty_pg.sql.gz differ
diff --git a/test/src/main/resources/db/5.1/referentiel.sql.gz b/test/src/main/resources/db/5.1/referentiel.sql.gz
index 65c8038..c2a7842 100644
Binary files a/test/src/main/resources/db/5.1/referentiel.sql.gz and b/test/src/main/resources/db/5.1/referentiel.sql.gz differ
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit b10613f57eca0986bdea7ce9fcf5bc924e0397c4
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 16:43:17 2016 +0100
il se peut que la date max n'existe pas.
---
.../ird/observe/services/topia/service/LastUpdateDateServiceTopia.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services-topia/src/main/java/fr/ird/observe/services/topia/service/LastUpdateDateServiceTopia.java b/services-topia/src/main/java/fr/ird/observe/services/topia/service/LastUpdateDateServiceTopia.java
index 354d8b5..8c2312c 100644
--- a/services-topia/src/main/java/fr/ird/observe/services/topia/service/LastUpdateDateServiceTopia.java
+++ b/services-topia/src/main/java/fr/ird/observe/services/topia/service/LastUpdateDateServiceTopia.java
@@ -99,7 +99,7 @@ public class LastUpdateDateServiceTopia extends ObserveServiceTopia implements L
}
});
- if (lastUpdateDate.getLastUpdateDate().before(maxLastUpdateDate)) {
+ if (maxLastUpdateDate != null && lastUpdateDate.getLastUpdateDate().before(maxLastUpdateDate)) {
if (log.isInfoEnabled()) {
log.info("Update LastUpdateDate for " + entityType.getName() + " with value: " + maxLastUpdateDate);
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 3b9e046579fcbffe042908cdb8d45b64d788a621
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:46:01 2016 +0100
mise à jour validation
---
.../validation/BeanValidatorDetectorTest.java | 10 ++-
...gthLengthParameter-service-error-validation.xml | 87 ++++++++++++++++++++++
...hLengthParameter-service-warning-validation.xml | 46 ++++++++++++
...gthWeightParameter-service-error-validation.xml | 10 +--
.../services-topia-validation_en_GB.properties | 7 ++
.../services-topia-validation_es_ES.properties | 7 ++
.../services-topia-validation_fr_FR.properties | 7 ++
.../validation/BeanValidatorDetectorTest.java | 4 +-
8 files changed, 168 insertions(+), 10 deletions(-)
diff --git a/application-swing-validation/src/test/java/fr/ird/observe/application/swing/validation/BeanValidatorDetectorTest.java b/application-swing-validation/src/test/java/fr/ird/observe/application/swing/validation/BeanValidatorDetectorTest.java
index e9dbb8f..a1661af 100644
--- a/application-swing-validation/src/test/java/fr/ird/observe/application/swing/validation/BeanValidatorDetectorTest.java
+++ b/application-swing-validation/src/test/java/fr/ird/observe/application/swing/validation/BeanValidatorDetectorTest.java
@@ -47,12 +47,14 @@ import fr.ird.observe.services.dto.referential.GearCaracteristicDto;
import fr.ird.observe.services.dto.referential.GearCaracteristicTypeDto;
import fr.ird.observe.services.dto.referential.GearDto;
import fr.ird.observe.services.dto.referential.HarbourDto;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.services.dto.referential.OceanDto;
import fr.ird.observe.services.dto.referential.OrganismDto;
import fr.ird.observe.services.dto.referential.PersonDto;
import fr.ird.observe.services.dto.referential.ProgramDto;
import fr.ird.observe.services.dto.referential.SexDto;
+import fr.ird.observe.services.dto.referential.ShipOwnerDto;
import fr.ird.observe.services.dto.referential.SpeciesDto;
import fr.ird.observe.services.dto.referential.SpeciesGroupDto;
import fr.ird.observe.services.dto.referential.SpeciesListDto;
@@ -196,6 +198,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
HookTypeDto.class,
ItemHorizontalPositionDto.class,
ItemVerticalPositionDto.class,
+ LengthLengthParameterDto.class,
LengthWeightParameterDto.class,
LightsticksColorDto.class,
LightsticksTypeDto.class,
@@ -233,6 +236,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
SetSeineTargetCatchDto.class,
SettingShapeDto.class,
SexDto.class,
+ ShipOwnerDto.class,
SizeMeasureTypeDto.class,
SpeciesDto.class,
SpeciesFateDto.class,
@@ -274,7 +278,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
SortedSet<NuitonValidator<?>> validators = detectValidators(ALL_TYPES);
assertFalse(validators.isEmpty());
- assertEquals(175, validators.size());
+ assertEquals(179, validators.size());
}
@@ -306,6 +310,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
HookTypeDto.class,
ItemHorizontalPositionDto.class,
ItemVerticalPositionDto.class,
+ LengthLengthParameterDto.class,
LengthWeightParameterDto.class,
LightsticksColorDto.class,
LightsticksTypeDto.class,
@@ -331,6 +336,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
SetSeineDto.class,
SettingShapeDto.class,
SexDto.class,
+ ShipOwnerDto.class,
SizeMeasureTypeDto.class,
SpeciesDto.class,
SpeciesFateDto.class,
@@ -410,6 +416,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
HooksCompositionDto.class,
ItemHorizontalPositionDto.class,
ItemVerticalPositionDto.class,
+ LengthLengthParameterDto.class,
LengthWeightParameterDto.class,
LightsticksColorDto.class,
LightsticksTypeDto.class,
@@ -444,6 +451,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
SetSeineSchoolEstimateDto.class,
SettingShapeDto.class,
SexDto.class,
+ ShipOwnerDto.class,
SizeMeasureTypeDto.class,
SpeciesDto.class,
SpeciesFateDto.class,
diff --git a/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-error-validation.xml b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-error-validation.xml
new file mode 100644
index 0000000..82e4b13
--- /dev/null
+++ b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-error-validation.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ ObServe :: Services ToPIA validation
+ %%
+ Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="code">
+
+ <!-- clef unique sur le code -->
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">editingReferentielListEntity</param>
+ <param name="keys">code</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>validator.service.referentiel.invalid.code.uniqueKey##${code}</message>
+ </field-validator>
+
+ </field>
+
+ <field name="inputOutputFormula">
+ <!-- pas de relation weight renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.service.lengthLengthParameter.required.inputOutputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation weight invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ formulaOneValid ]]>
+ </param>
+ <message>validator.service.lengthLengthParameter.invalid.inputOutputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="outputInputFormula">
+ <!-- pas de relation taille renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.service.lengthLengthParameter.required.outputInputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation taille invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ formulaTwoValid ]]>
+ </param>
+ <message>validator.service.lengthLengthParameter.invalid.outputInputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="coefficients">
+ <!-- pas de coefficients renseigne -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.service.lengthLengthParameter.required.coefficients
+ </message>
+ </field-validator>
+
+ </field>
+
+</validators>
diff --git a/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-warning-validation.xml b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-warning-validation.xml
new file mode 100644
index 0000000..0f6299c
--- /dev/null
+++ b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthLengthParameter-service-warning-validation.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ ObServe :: Services ToPIA validation
+ %%
+ Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="status">
+ <!-- objet desactive -->
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ enabled ]]>
+ </param>
+ <message>validator.service.referentiel.status.desactivated</message>
+ </field-validator>
+ </field>
+
+ <field name="uri">
+ <!-- pas d'uri selectionne -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.service.referentiel.null.uri</message>
+ </field-validator>
+ </field>
+
+</validators>
diff --git a/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthWeightParameter-service-error-validation.xml b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthWeightParameter-service-error-validation.xml
index e9ceb68..6ad004e 100644
--- a/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthWeightParameter-service-error-validation.xml
+++ b/services-topia-validation/src/main/resources/fr/ird/observe/entities/referentiel/LengthWeightParameter-service-error-validation.xml
@@ -94,7 +94,7 @@
<!-- relation weight invalide -->
<field-validator type="fieldexpression">
<param name="expression">
- <![CDATA[ lengthWeightFormulaValid ]]>
+ <![CDATA[ formulaOneValid ]]>
</param>
<message>validator.service.lengthWeightParameter.invalid.lengthWeightFormula
</message>
@@ -112,7 +112,7 @@
<!-- relation taille invalide -->
<field-validator type="fieldexpression">
<param name="expression">
- <![CDATA[ weightLengthFormulaValid ]]>
+ <![CDATA[ formulaTwoValid ]]>
</param>
<message>validator.service.lengthWeightParameter.invalid.weightLengthFormula
</message>
@@ -127,12 +127,6 @@
</message>
</field-validator>
- <!-- syntaxe coefficients invalide FIXME chemit 2010_08-21 Il faut autoriser les ecritures scientifique E[+-][0-9]+-->
- <!--field-validator type="regex">
- <param name="expression">\w+=[0-9]+(\.[0-9]+(E[+-]*[0-9]+)*)*(:\w+=[0-9]+(\.[0-9]+(E[+-]*[0-9]+)*)*)*</param>
- <message>validator.service.lengthWeightParameter.invalid.coefficients</message>
- </field-validator-->
-
</field>
</validators>
diff --git a/services-topia-validation/src/main/resources/i18n/services-topia-validation_en_GB.properties b/services-topia-validation/src/main/resources/i18n/services-topia-validation_en_GB.properties
index 8638a44..7305465 100644
--- a/services-topia-validation/src/main/resources/i18n/services-topia-validation_en_GB.properties
+++ b/services-topia-validation/src/main/resources/i18n/services-topia-validation_en_GB.properties
@@ -79,6 +79,7 @@ observe.common.hooksComposition=hooks composition
observe.common.hooksCompositionProportionSum=hooks composition proportion sum
observe.common.individualSize=Individual size
observe.common.individualWeight=Individual weight
+observe.common.inputOutputFormula=Input to Ouput formula
observe.common.iso2Code=Iso 2 code
observe.common.iso3Code=Iso 3 code
observe.common.itemHorizontalPosition=Item horizontal position
@@ -115,6 +116,7 @@ observe.common.observedSystemDistance=Observed system distance
observe.common.observer=Observed
observe.common.ocean=Ocean
observe.common.organism=Organism
+observe.common.outputInputFormula=Ouput to Input formula
observe.common.power=Power
observe.common.proportion=Proportion
observe.common.quadrant=Quadrant
@@ -320,6 +322,11 @@ validator.service.hooksComposition.desactivated.hookType=Selected hook type is d
validator.service.hooksComposition.required.hookSize=Hook size must be filled.
validator.service.hooksComposition.required.hookType=Hook type must be filled.
validator.service.hooksComposition.required.proportion=Proportion must be filled.
+validator.service.lengthLengthParameter.invalid.inputOutputFormula=Formula is invalid.
+validator.service.lengthLengthParameter.invalid.outputInputFormula=Formula is invalid.
+validator.service.lengthLengthParameter.required.coefficients=Coefficients are mandatory.
+validator.service.lengthLengthParameter.required.inputOutputFormula=Formula is mandatory.
+validator.service.lengthLengthParameter.required.outputInputFormula=Formula is mandatory.
validator.service.lengthWeightParameter.invalid.lengthWeightFormula=Formula is not valid.
validator.service.lengthWeightParameter.invalid.uniqueKey=Tuple (gender/ocean/species/startDate) must be unique.
validator.service.lengthWeightParameter.invalid.weightLengthFormula=Formula is not valid.
diff --git a/services-topia-validation/src/main/resources/i18n/services-topia-validation_es_ES.properties b/services-topia-validation/src/main/resources/i18n/services-topia-validation_es_ES.properties
index 1e73e96..e637828 100644
--- a/services-topia-validation/src/main/resources/i18n/services-topia-validation_es_ES.properties
+++ b/services-topia-validation/src/main/resources/i18n/services-topia-validation_es_ES.properties
@@ -79,6 +79,7 @@ observe.common.hooksComposition=Anzuelos
observe.common.hooksCompositionProportionSum=Suma de los proporciónes de anzuelos (%)
observe.common.individualSize=Tamaño (cm)
observe.common.individualWeight=Peso (kg)
+observe.common.inputOutputFormula=Formule Entrée vers Sortie \#TODO
observe.common.iso2Code=Código ISO-2
observe.common.iso3Code=Código ISO-3
observe.common.itemHorizontalPosition=Localización del elemento sobre la línea principal
@@ -115,6 +116,7 @@ observe.common.observedSystemDistance=Distancia al sistema observado (millas con
observe.common.observer=Observador
observe.common.ocean=Oceano
observe.common.organism=Organismo
+observe.common.outputInputFormula=Formule Sortie vers Entrée \#TODO
observe.common.power=Potencia del motor principal
observe.common.proportion=Proporción (%)
observe.common.quadrant=Quadrant
@@ -320,6 +322,11 @@ validator.service.hooksComposition.desactivated.hookType=El tipo de avanzuelo se
validator.service.hooksComposition.required.hookSize=La selección de un tamaño de avanzuelo es mandatoria.
validator.service.hooksComposition.required.hookType=La selección de un tipo de avanzuelo es mandatoria.
validator.service.hooksComposition.required.proportion=La proporción está vacía.
+validator.service.lengthLengthParameter.invalid.inputOutputFormula=La formule n'est pas valide. \#TODO
+validator.service.lengthLengthParameter.invalid.outputInputFormula=La formule n'est pas valide. \#TODO
+validator.service.lengthLengthParameter.required.coefficients=Les coefficients sont obligatoires. \#TODO
+validator.service.lengthLengthParameter.required.inputOutputFormula=La formule est obligatoire. \#TODO
+validator.service.lengthLengthParameter.required.outputInputFormula=La formule est obligatoire. \#TODO
validator.service.lengthWeightParameter.invalid.lengthWeightFormula=Relación de peso introducida no es coherente.
validator.service.lengthWeightParameter.invalid.uniqueKey=Tupla (sexo/océano/especie) debe ser única, la tupla ya se ha usado.
validator.service.lengthWeightParameter.invalid.weightLengthFormula=Relación de talla introducida no es coherente.
diff --git a/services-topia-validation/src/main/resources/i18n/services-topia-validation_fr_FR.properties b/services-topia-validation/src/main/resources/i18n/services-topia-validation_fr_FR.properties
index 6546d85..a7f1759 100644
--- a/services-topia-validation/src/main/resources/i18n/services-topia-validation_fr_FR.properties
+++ b/services-topia-validation/src/main/resources/i18n/services-topia-validation_fr_FR.properties
@@ -79,6 +79,7 @@ observe.common.hooksComposition=Hameçons
observe.common.hooksCompositionProportionSum=Somme des proportions d'hameçons (%)
observe.common.individualSize=Taille (cm)
observe.common.individualWeight=Poids (kg)
+observe.common.inputOutputFormula=Formule Entrée vers Sortie
observe.common.iso2Code=code ISO-2
observe.common.iso3Code=Code ISO-3
observe.common.itemHorizontalPosition=Position sur la ligne
@@ -115,6 +116,7 @@ observe.common.observedSystemDistance=Distance système observé (en milles avec
observe.common.observer=Observateur
observe.common.ocean=Océan
observe.common.organism=Organisme
+observe.common.outputInputFormula=Formule Sortie vers Entrée
observe.common.power=Puissance moteur principal
observe.common.proportion=Proportion (%)
observe.common.quadrant=Quadrant
@@ -320,6 +322,11 @@ validator.service.hooksComposition.desactivated.hookType=Le type d'hameçon sél
validator.service.hooksComposition.required.hookSize=La sélection d'une taille d'hameçon est obligatoire.
validator.service.hooksComposition.required.hookType=La sélection d'un type d'hameçon est obligatoire.
validator.service.hooksComposition.required.proportion=Proportion non renseignée.
+validator.service.lengthLengthParameter.invalid.inputOutputFormula=La formule n'est pas valide.
+validator.service.lengthLengthParameter.invalid.outputInputFormula=La formule n'est pas valide.
+validator.service.lengthLengthParameter.required.coefficients=Les coefficients sont obligatoires.
+validator.service.lengthLengthParameter.required.inputOutputFormula=La formule est obligatoire.
+validator.service.lengthLengthParameter.required.outputInputFormula=La formule est obligatoire.
validator.service.lengthWeightParameter.invalid.lengthWeightFormula=La relation poids saisie n'est pas cohérente.
validator.service.lengthWeightParameter.invalid.uniqueKey=Le tuple (sexe/ocean/espèce/date de début) doit être unique, le tuple est déjà utilisé.
validator.service.lengthWeightParameter.invalid.weightLengthFormula=La relation taille saisie n'est pas cohérente.
diff --git a/services-topia-validation/src/test/java/fr/ird/observe/services/topia/validation/BeanValidatorDetectorTest.java b/services-topia-validation/src/test/java/fr/ird/observe/services/topia/validation/BeanValidatorDetectorTest.java
index 1166079..8316fdb 100644
--- a/services-topia-validation/src/test/java/fr/ird/observe/services/topia/validation/BeanValidatorDetectorTest.java
+++ b/services-topia-validation/src/test/java/fr/ird/observe/services/topia/validation/BeanValidatorDetectorTest.java
@@ -43,6 +43,7 @@ import fr.ird.observe.entities.referentiel.Gear;
import fr.ird.observe.entities.referentiel.GearCaracteristic;
import fr.ird.observe.entities.referentiel.GearCaracteristicType;
import fr.ird.observe.entities.referentiel.Harbour;
+import fr.ird.observe.entities.referentiel.LengthLengthParameter;
import fr.ird.observe.entities.referentiel.LengthWeightParameter;
import fr.ird.observe.entities.referentiel.Ocean;
import fr.ird.observe.entities.referentiel.Organism;
@@ -154,7 +155,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
SortedSet<NuitonValidator<?>> validators = detectValidators(ALL_TYPES);
assertFalse(validators.isEmpty());
- assertEquals(109, validators.size());
+ assertEquals(110, validators.size());
}
@@ -196,6 +197,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
HooksComposition.class,
ItemHorizontalPosition.class,
ItemVerticalPosition.class,
+ LengthLengthParameter.class,
LengthWeightParameter.class,
LightsticksColor.class,
LightsticksType.class,
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
07 Nov '16
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 30ae2b5f97dd1da5007d387b404e508fa0dab75b
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:30:32 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (ui)
---
.../swing/decoration/DecoratorService.java | 11 +-
.../decorators/LengthLengthParameterDecorator.java | 54 ++++++++
.../application-swing-decoration_en_GB.properties | 5 +-
.../application-swing-decoration_es_ES.properties | 3 +
.../application-swing-decoration_fr_FR.properties | 3 +
...ngthParameterDto-ui-create-error-validation.xml | 108 ++++++++++++++++
...hParameterDto-ui-create-warning-validation.xml} | 21 +---
...ngthParameterDto-ui-update-error-validation.xml | 72 +++++++++++
...hParameterDto-ui-update-warning-validation.xml} | 23 ----
...ightParameterDto-ui-create-error-validation.xml | 17 ++-
...htParameterDto-ui-create-warning-validation.xml | 8 ++
.../application-swing-validation_en_GB.properties | 14 +++
.../application-swing-validation_es_ES.properties | 14 +++
.../application-swing-validation_fr_FR.properties | 14 +++
...rameterUI.jaxx => LengthLengthParameterUI.jaxx} | 139 ++++-----------------
...rameterUI.jcss => LengthLengthParameterUI.jcss} | 100 +++++----------
.../ref/impl/LengthLengthParameterUIHandler.java | 102 +++++++++++++++
...odel.java => LengthLengthParameterUIModel.java} | 55 ++++----
.../content/ref/impl/LengthWeightParameterUI.jaxx | 38 +++---
.../content/ref/impl/LengthWeightParameterUI.jcss | 17 +++
.../ref/impl/LengthWeightParameterUIModel.java | 3 +
.../i18n/application-swing_en_GB.properties | 8 ++
.../i18n/application-swing_es_ES.properties | 8 ++
.../i18n/application-swing_fr_FR.properties | 8 ++
24 files changed, 573 insertions(+), 272 deletions(-)
diff --git a/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/DecoratorService.java b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/DecoratorService.java
index a924d6c..9190d0f 100644
--- a/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/DecoratorService.java
+++ b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/DecoratorService.java
@@ -22,6 +22,7 @@
package fr.ird.observe.application.swing.decoration;
import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator;
+import fr.ird.observe.application.swing.decoration.decorators.LengthLengthParameterDecorator;
import fr.ird.observe.application.swing.decoration.decorators.LengthWeightParameterDecorator;
import fr.ird.observe.application.swing.decoration.decorators.NonTargetCatchDecorator;
import fr.ird.observe.application.swing.decoration.decorators.NonTargetLengthDecorator;
@@ -54,6 +55,7 @@ import fr.ird.observe.services.dto.referential.GearCaracteristicDto;
import fr.ird.observe.services.dto.referential.GearCaracteristicTypeDto;
import fr.ird.observe.services.dto.referential.GearDto;
import fr.ird.observe.services.dto.referential.HarbourDto;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.services.dto.referential.OceanDto;
import fr.ird.observe.services.dto.referential.OrganismDto;
@@ -265,6 +267,11 @@ public class DecoratorService extends DecoratorProvider {
registerDecorator(new SpeciesDecorator());
registerReferentialReferenceDecorator(SpeciesDto.class, "${faoCode}$s##${scientificLabel}$s");
+ // LengthLengthParameter decorator
+ registerDecorator(new LengthLengthParameterDecorator());
+ registerReferentialReferenceDecorator(LengthLengthParameterDto.class,"${inputSizeMeasureType}$s##${outputSizeMeasureType}$s##"+
+ t("observe.common.inputOutputFormula") + " ${inputOutputFormula}$s");
+
// LengthWeightParameter decorator
registerDecorator(new LengthWeightParameterDecorator());
registerReferentialReferenceDecorator(LengthWeightParameterDto.class,
@@ -423,8 +430,8 @@ public class DecoratorService extends DecoratorProvider {
" - ");
registerDataAndDataReferenceDecorator(SensorUsedDto.class,
- "${sensorType/label}$s",
- "${sensorType}$s");
+ "${sensorType/label}$s",
+ "${sensorType}$s");
// gps decorators
diff --git a/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/LengthLengthParameterDecorator.java b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/LengthLengthParameterDecorator.java
new file mode 100644
index 0000000..92d1530
--- /dev/null
+++ b/application-swing-decoration/src/main/java/fr/ird/observe/application/swing/decoration/decorators/LengthLengthParameterDecorator.java
@@ -0,0 +1,54 @@
+/*
+ * #%L
+ * ObServe :: Application Swing Decoration
+ * %%
+ * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+package fr.ird.observe.application.swing.decoration.decorators;
+
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Decorator of {@link LengthLengthParameterDto}.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 2.4
+ */
+public class LengthLengthParameterDecorator extends ObserveDecorator<LengthLengthParameterDto> {
+
+ private static final long serialVersionUID = 1L;
+
+ public LengthLengthParameterDecorator() throws IllegalArgumentException, NullPointerException {
+ super(LengthLengthParameterDto.class, "${inputSizeMeasureType}$s##${outputSizeMeasureType}$s##" +
+ t("observe.common.inputOutputFormula") + " ${inputOutputFormula}$s"
+ );
+ }
+
+ @Override
+ protected Comparable<?> getDefaultUndefinedValue(String token) {
+ if (token.startsWith(LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE)
+ || token.startsWith(LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE)
+ ) {
+ return t("observe.common.inconnu");
+ }
+ return super.getDefaultUndefinedValue(token);
+ }
+
+}
diff --git a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_en_GB.properties b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_en_GB.properties
index ef91476..663fdae 100644
--- a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_en_GB.properties
+++ b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_en_GB.properties
@@ -4,6 +4,7 @@ observe.common.gps.gpsPoint=Gps point
observe.common.haulingIdentifier=Hauling identifier
observe.common.homeId=Home id
observe.common.inconnu=Unknown
+observe.common.inputOutputFormula=Input to Output formula
observe.common.label=Label
observe.common.lengthWeightFormula=Length weight formula
observe.common.nocode=Nocode
@@ -121,8 +122,10 @@ observe.type.keptTargetCatch=Target catch
observe.type.keptTargetCatches=Target catches
observe.type.keptTargetSample=Target sample
observe.type.keptTargetSamples=Target samples
+observe.type.lengthLengthParameter=Length length parameter
+observe.type.lengthLengthParameters=Length length parameters
observe.type.lengthWeightParameter=Length weight parameter
-observe.type.lengthWeightParameters=Lengths weight parameter
+observe.type.lengthWeightParameters=Length weight parameters
observe.type.lightsticksColor=Lightsticks color
observe.type.lightsticksColors=Lightstickss color
observe.type.lightsticksType=Lightsticks type
diff --git a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties
index e459f93..306751d 100644
--- a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties
+++ b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties
@@ -4,6 +4,7 @@ observe.common.gps.gpsPoint=Punto GPS
observe.common.haulingIdentifier=Arrastre
observe.common.homeId=Identificador
observe.common.inconnu=desconocido
+observe.common.inputOutputFormula=Formule Entrée vers Sortie \#TODO
observe.common.label=Título
observe.common.lengthWeightFormula=Relación Peso
observe.common.nocode=codigo ausente
@@ -121,6 +122,8 @@ observe.type.keptTargetCatch=Captura de atún
observe.type.keptTargetCatches=Capturas de atún
observe.type.keptTargetSample=Muestreo de atún capturado
observe.type.keptTargetSamples=Muestreos de atún capturado
+observe.type.lengthLengthParameter=Relación Tamaño-Tamaño
+observe.type.lengthLengthParameters=Relaciones Tamaño-Tamaño
observe.type.lengthWeightParameter=Relación Tamaño-Peso
observe.type.lengthWeightParameters=Relaciones Tamaño-Peso
observe.type.lightsticksColor=Color de barrita de luz
diff --git a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_fr_FR.properties b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_fr_FR.properties
index 84164e5..60b1621 100644
--- a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_fr_FR.properties
+++ b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_fr_FR.properties
@@ -4,6 +4,7 @@ observe.common.gps.gpsPoint=Point GPS
observe.common.haulingIdentifier=Virage
observe.common.homeId=Identifiant
observe.common.inconnu=inconnu
+observe.common.inputOutputFormula=Formule Entrée vers Sortie
observe.common.label=Libellé
observe.common.lengthWeightFormula=Relation Poids
observe.common.nocode=code absent
@@ -121,6 +122,8 @@ observe.type.keptTargetCatch=Capture cible
observe.type.keptTargetCatches=Captures cible
observe.type.keptTargetSample=Echantillon thon capturé
observe.type.keptTargetSamples=Echantillons thon capturés
+observe.type.lengthLengthParameter=Relation Taille-Taille
+observe.type.lengthLengthParameters=Relations Taille-Taille
observe.type.lengthWeightParameter=Relation Taille-Poids
observe.type.lengthWeightParameters=Relations Taille-Poids
observe.type.lightsticksColor=Couleur de baton lumineux
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-error-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-error-validation.xml
new file mode 100644
index 0000000..54b0e35
--- /dev/null
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-error-validation.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ ObServe :: Application Swing Validation
+ %%
+ Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="code">
+
+ <!-- clef unique sur le code -->
+ <field-validator type="collectionUniqueKeyDto" short-circuit="true">
+ <param name="collectionFieldName">editingReferentielListEntity</param>
+ <param name="keys">code</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>validator.ui.referentiel.invalid.code.uniqueKey##${code}</message>
+ </field-validator>
+
+ </field>
+
+ <field name="inputSizeMeasureType">
+
+ <!-- intputSizeMeasureType desactive -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ intputSizeMeasureType == null || intputSizeMeasureType.enabled ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.disabled.inputSizeMeasureType</message>
+ </field-validator>
+ </field>
+
+
+ <field name="outputSizeMeasureType">
+
+ <!-- outputSizeMeasureType desactive -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ outputSizeMeasureType == null || outputSizeMeasureType.enabled ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.disabled.inputSizeMeasureType</message>
+ </field-validator>
+ </field>
+
+ <field name="inputOutputFormula">
+ <!-- pas de relation inputOutputFormula renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.inputOutputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation inputOutputFormula invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ inputOutputFormulaValid ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.invalid.inputOutputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="outputInputFormula">
+ <!-- pas de relation outputInputFormula renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.outputInputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation outputInputFormula invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ outputInputFormulaValid ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.invalid.outputInputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="coefficients">
+ <!-- pas de coefficients renseigne -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.coefficients
+ </message>
+ </field-validator>
+ </field>
+</validators>
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-warning-validation.xml
similarity index 76%
copy from application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
copy to application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-warning-validation.xml
index 097c4dc..b325b75 100644
--- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-create-warning-validation.xml
@@ -43,26 +43,17 @@
</field-validator>
</field>
- <field name="ocean">
- <!-- pas de ocean renseigne -->
+ <field name="inputSizeMeasureType">
+ <!-- pas de inputSizeMeasureType renseigne -->
<field-validator type="required">
- <message>validator.ui.lengthWeightParameter.null.ocean</message>
+ <message>validator.ui.lengthLengthParameter.null.inputSizeMeasureType</message>
</field-validator>
</field>
- <field name="startDate">
- <!-- pas de startDate renseigne -->
+ <field name="outputSizeMeasureType">
+ <!-- pas de outputSizeMeasureType renseigne -->
<field-validator type="required">
- <message>validator.ui.lengthWeightParameter.required.startDate
- </message>
- </field-validator>
- </field>
-
- <field name="endDate">
- <!-- pas de endDate renseigne -->
- <field-validator type="required">
- <message>validator.ui.lengthWeightParameter.required.endDate
- </message>
+ <message>validator.ui.lengthLengthParameter.null.outputSizeMeasureType</message>
</field-validator>
</field>
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-error-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-error-validation.xml
new file mode 100644
index 0000000..d335ede
--- /dev/null
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-error-validation.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ ObServe :: Application Swing Validation
+ %%
+ Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="inputOutputFormula">
+ <!-- pas de relation inputOutputFormula renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.inputOutputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation inputOutputFormula invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ inputOutputFormulaValid ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.invalid.inputOutputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="outputInputFormula">
+ <!-- pas de relation outputInputFormula renseignee -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.outputInputFormula
+ </message>
+ </field-validator>
+
+ <!-- relation outputInputFormula invalide -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ outputInputFormulaValid ]]>
+ </param>
+ <message>validator.ui.lengthLengthParameter.invalid.outputInputFormula
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="coefficients">
+ <!-- pas de coefficients renseigne -->
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>validator.ui.lengthLengthParameter.required.coefficients
+ </message>
+ </field-validator>
+ </field>
+</validators>
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-warning-validation.xml
similarity index 69%
copy from application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
copy to application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-warning-validation.xml
index 097c4dc..75a6bc1 100644
--- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthLengthParameterDto-ui-update-warning-validation.xml
@@ -43,27 +43,4 @@
</field-validator>
</field>
- <field name="ocean">
- <!-- pas de ocean renseigne -->
- <field-validator type="required">
- <message>validator.ui.lengthWeightParameter.null.ocean</message>
- </field-validator>
- </field>
-
- <field name="startDate">
- <!-- pas de startDate renseigne -->
- <field-validator type="required">
- <message>validator.ui.lengthWeightParameter.required.startDate
- </message>
- </field-validator>
- </field>
-
- <field name="endDate">
- <!-- pas de endDate renseigne -->
- <field-validator type="required">
- <message>validator.ui.lengthWeightParameter.required.endDate
- </message>
- </field-validator>
- </field>
-
</validators>
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-error-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-error-validation.xml
index 258ca27..40f6fef 100644
--- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-error-validation.xml
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-error-validation.xml
@@ -54,6 +54,17 @@
</field-validator>
</field>
+ <field name="sizeMeasureType">
+
+ <!-- sizeMeasureType desactive -->
+ <field-validator type="fieldexpression">
+ <param name="expression">
+ <![CDATA[ sizeMeasureType == null || sizeMeasureType.enabled ]]>
+ </param>
+ <message>validator.ui.lengthWeightParameter.disabled.sizeMeasureType</message>
+ </field-validator>
+ </field>
+
<field name="ocean">
<!-- clef unique species - gender - ocean - startDate -->
<field-validator type="observeCollectionUniqueKeyDto" short-circuit="true">
@@ -126,12 +137,6 @@
<message>validator.ui.lengthWeightParameter.required.coefficients
</message>
</field-validator>
-
- <!-- syntaxe coefficients invalide FIXME chemit 2010_08-21 Il faut autoriser les ecritures scientifique E[+-][0-9]+-->
- <!--field-validator type="regex">
- <param name="expression">\w+=[0-9]+(\.[0-9]+(E[+-]*[0-9]+)*)*(:\w+=[0-9]+(\.[0-9]+(E[+-]*[0-9]+)*)*)*</param>
- <message>validator.ui.lengthWeightParameter.invalid.coefficients</message>
- </field-validator-->
</field>
</validators>
diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
index 097c4dc..431020a 100644
--- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
+++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/referential/LengthWeightParameterDto-ui-create-warning-validation.xml
@@ -50,6 +50,14 @@
</field-validator>
</field>
+ <field name="sizeMeasureType">
+ <!-- pas de sizeMeasureType renseigne -->
+ <field-validator type="required">
+ <message>validator.ui.lengthWeightParameter.null.sizeMeasureType</message>
+ </field-validator>
+ </field>
+
+
<field name="startDate">
<!-- pas de startDate renseigne -->
<field-validator type="required">
diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties
index bd95896..9f9426d 100644
--- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties
+++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties
@@ -83,6 +83,8 @@ observe.common.hooksComposition=hooks composition
observe.common.hooksCompositionProportionSum=hooks composition proportion sum
observe.common.individualSize=Individual size
observe.common.individualWeight=Individual weight
+observe.common.inputOutputFormula=Input to Output formula
+observe.common.inputSizeMeasureType=Input size measure type
observe.common.iso2Code=Iso 2 code
observe.common.iso3Code=Iso 3 code
observe.common.itemHorizontalPosition=Item horizontal position
@@ -120,6 +122,8 @@ observe.common.observedSystemDistance=Observed system distance
observe.common.observer=Observed
observe.common.ocean=Ocean
observe.common.organism=Organism
+observe.common.outputInputFormula=Output to Input formula
+observe.common.outputSizeMeasureType=Ouput size measure type
observe.common.power=Power
observe.common.previousFpaZone=Previous fpa zone
observe.common.proportion=Proportion
@@ -330,10 +334,20 @@ validator.ui.hooksComposition.desactivated.hookSize=Selected hook size is disabl
validator.ui.hooksComposition.desactivated.hookType=Selected hook type is disabled.
validator.ui.hooksComposition.required.hookType=Hook type must be filled.
validator.ui.hooksComposition.required.proportion=Proportion must be filled.
+validator.ui.lengthLengthParameter.disabled.inputSizeMeasureType=Selected Input Size measure type is disabled
+validator.ui.lengthLengthParameter.invalid.inputOutputFormula=Formula is not valid.
+validator.ui.lengthLengthParameter.invalid.outputInputFormula=Formula is not valid.
+validator.ui.lengthLengthParameter.null.inputSizeMeasureType=Input size measure type is not filled.
+validator.ui.lengthLengthParameter.null.outputSizeMeasureType=Output size measure type is not filled.
+validator.ui.lengthLengthParameter.required.coefficients=Coefficiens are required.
+validator.ui.lengthLengthParameter.required.inputOutputFormula=Formula is required.
+validator.ui.lengthLengthParameter.required.outputInputFormula=Formula is required.
+validator.ui.lengthWeightParameter.disabled.sizeMeasureType=Selected size measure type is disabled.
validator.ui.lengthWeightParameter.invalid.lengthWeightFormula=Formula is not valid.
validator.ui.lengthWeightParameter.invalid.uniqueKey=Tuple (gender/ocean/species/startDate) must be unique.
validator.ui.lengthWeightParameter.invalid.weightLengthFormula=Formula is not valid.
validator.ui.lengthWeightParameter.null.ocean=Ocean is not filled.
+validator.ui.lengthWeightParameter.null.sizeMeasureType=Size measure type is not filled.
validator.ui.lengthWeightParameter.required.coefficients=Coefficients must be filled.
validator.ui.lengthWeightParameter.required.endDate=End date must be filled.
validator.ui.lengthWeightParameter.required.lengthWeightFormula=Length weight formula must be filled.
diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties
index 0c96771..51bdabd 100644
--- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties
+++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties
@@ -83,6 +83,8 @@ observe.common.hooksComposition=Anzuelos
observe.common.hooksCompositionProportionSum=Suma de los proporciónes de anzuelos (%)
observe.common.individualSize=Tamaño (cm)
observe.common.individualWeight=Peso (kg)
+observe.common.inputOutputFormula=Formule Entrée vers Sortie \#TODO
+observe.common.inputSizeMeasureType=Type de mensuration d'entrée \#TODO
observe.common.iso2Code=Código ISO-2
observe.common.iso3Code=Código ISO-3
observe.common.itemHorizontalPosition=Localización del elemento sobre la línea principal
@@ -120,6 +122,8 @@ observe.common.observedSystemDistance=Distancia al sistema observado (millas con
observe.common.observer=Observador
observe.common.ocean=Oceano
observe.common.organism=Organismo
+observe.common.outputInputFormula=Formule Sortie vers Entrée \#TODO
+observe.common.outputSizeMeasureType=Type de mensuration de sortie \#TODO
observe.common.power=Potencia del motor principal
observe.common.previousFpaZone=La zona FPA de que se salió
observe.common.proportion=Proporción (%)
@@ -330,10 +334,20 @@ validator.ui.hooksComposition.desactivated.hookSize=El tamaño de avanzuelo sele
validator.ui.hooksComposition.desactivated.hookType=El tipo de avanzuelo seleccionado está desactivado.
validator.ui.hooksComposition.required.hookType=La selección de un tipo de avanzuelo es mandatoria.
validator.ui.hooksComposition.required.proportion=La proporción está vacía.
+validator.ui.lengthLengthParameter.disabled.inputSizeMeasureType=Le type de mensuration d'entrée sélectionné est désactivé. \#TODO
+validator.ui.lengthLengthParameter.invalid.inputOutputFormula=La formule n'est pas valide. \#TODO
+validator.ui.lengthLengthParameter.invalid.outputInputFormula=La formule n'est pas valide. \#TODO
+validator.ui.lengthLengthParameter.null.inputSizeMeasureType=Le type de mensuration d'entrée n'est pas renseigné. \#TODO
+validator.ui.lengthLengthParameter.null.outputSizeMeasureType=Le type de mensuration de sortie n'est pas renseigné. \#TODO
+validator.ui.lengthLengthParameter.required.coefficients=Les coefficients sont obligatoires. \#TODO
+validator.ui.lengthLengthParameter.required.inputOutputFormula=La formule est obligatoire. \#TODO
+validator.ui.lengthLengthParameter.required.outputInputFormula=La formule est obligatoire. \#TODO
+validator.ui.lengthWeightParameter.disabled.sizeMeasureType=Le type de mensuration sélectionné est désactivé. \#TODO
validator.ui.lengthWeightParameter.invalid.lengthWeightFormula=Relación de peso introducida no es coherente.
validator.ui.lengthWeightParameter.invalid.uniqueKey=Tupla (sexo/océano/especie) debe ser única, la tupla ya se ha usado.
validator.ui.lengthWeightParameter.invalid.weightLengthFormula=Relación de talla introducida no es coherente.
validator.ui.lengthWeightParameter.null.ocean=No se ha seleccionado oceano.
+validator.ui.lengthWeightParameter.null.sizeMeasureType=Type de mensuration non renseigné. \#TODO
validator.ui.lengthWeightParameter.required.coefficients=Coeficientes deben ser especificados.
validator.ui.lengthWeightParameter.required.endDate=Fecha de fin de validez debe ser especificada.
validator.ui.lengthWeightParameter.required.lengthWeightFormula=Relación de peso debe ser especificada.
diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties
index 4dbebdf..fb6e9ea 100644
--- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties
+++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties
@@ -83,6 +83,8 @@ observe.common.hooksComposition=Hameçons
observe.common.hooksCompositionProportionSum=Somme des proportions d'hameçons (%)
observe.common.individualSize=Taille (cm)
observe.common.individualWeight=Poids (kg)
+observe.common.inputOutputFormula=Formule Entrée vers Sortie
+observe.common.inputSizeMeasureType=Type de mensuration d'entrée
observe.common.iso2Code=code ISO-2
observe.common.iso3Code=Code ISO-3
observe.common.itemHorizontalPosition=Position sur la ligne
@@ -120,6 +122,8 @@ observe.common.observedSystemDistance=Distance système observé (en milles avec
observe.common.observer=Observateur
observe.common.ocean=Océan
observe.common.organism=Organisme
+observe.common.outputInputFormula=Formule Sortie vers Entrée
+observe.common.outputSizeMeasureType=Type de mensuration de sortie
observe.common.power=Puissance moteur principal
observe.common.previousFpaZone=Zone Fpa précédente
observe.common.proportion=Proportion (%)
@@ -330,10 +334,20 @@ validator.ui.hooksComposition.desactivated.hookSize=La taille d'hameçon sélect
validator.ui.hooksComposition.desactivated.hookType=Le type d'hameçon sélectionné est désactivée.
validator.ui.hooksComposition.required.hookType=La sélection d'un type d'hameçon est obligatoire.
validator.ui.hooksComposition.required.proportion=Proportion non renseignée.
+validator.ui.lengthLengthParameter.disabled.inputSizeMeasureType=Le type de mensuration d'entrée sélectionné est désactivé.
+validator.ui.lengthLengthParameter.invalid.inputOutputFormula=La formule n'est pas valide.
+validator.ui.lengthLengthParameter.invalid.outputInputFormula=La formule n'est pas valide.
+validator.ui.lengthLengthParameter.null.inputSizeMeasureType=Le type de mensuration d'entrée n'est pas renseigné.
+validator.ui.lengthLengthParameter.null.outputSizeMeasureType=Le type de mensuration de sortie n'est pas renseigné.
+validator.ui.lengthLengthParameter.required.coefficients=Les coefficients sont obligatoires.
+validator.ui.lengthLengthParameter.required.inputOutputFormula=La formule est obligatoire.
+validator.ui.lengthLengthParameter.required.outputInputFormula=La formule est obligatoire.
+validator.ui.lengthWeightParameter.disabled.sizeMeasureType=Le type de mensuration sélectionné est désactivé.
validator.ui.lengthWeightParameter.invalid.lengthWeightFormula=La relation poids saisie n'est pas cohérente.
validator.ui.lengthWeightParameter.invalid.uniqueKey=Le tuple (gender/ocean/species/startDate) doit être unique, le tuple est déjà utilisé.
validator.ui.lengthWeightParameter.invalid.weightLengthFormula=La relation taille saisie n'est pas cohérente.
validator.ui.lengthWeightParameter.null.ocean=Aucun océan sélectionné.
+validator.ui.lengthWeightParameter.null.sizeMeasureType=Type de mensuration non renseigné.
validator.ui.lengthWeightParameter.required.coefficients=Les coefficients ne sont pas renseignés.
validator.ui.lengthWeightParameter.required.endDate=Date de fin de validité non renseignée.
validator.ui.lengthWeightParameter.required.lengthWeightFormula=La relation poids n'est pas renseignée.
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jaxx
similarity index 55%
copy from application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx
copy to application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jaxx
index 8ffa384..860bf89 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jaxx
@@ -20,25 +20,21 @@
#L%
-->
-<fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUI superGenericType='LengthWeightParameterDto'>
+<fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUI superGenericType='LengthLengthParameterDto'>
<style source="ReferenceEntity.jcss"/>
<import>
fr.ird.observe.services.dto.constants.ReferenceStatus
fr.ird.observe.services.dto.referential.ReferentialReference
- fr.ird.observe.services.dto.referential.SexDto
- fr.ird.observe.services.dto.referential.SpeciesDto
- fr.ird.observe.services.dto.referential.OceanDto
- fr.ird.observe.services.dto.referential.LengthWeightParameterDto
+ fr.ird.observe.services.dto.referential.SizeMeasureTypeDto
+ fr.ird.observe.services.dto.referential.LengthLengthParameterDto
fr.ird.observe.application.swing.ui.UIHelper
fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUIModel
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.bean.BeanComboBox
- org.jdesktop.swingx.JXDatePicker
-
javax.swing.JScrollPane
javax.swing.JTable
javax.swing.table.TableCellRenderer
@@ -48,37 +44,17 @@
</import>
<!-- validator -->
- <BeanValidator id='validator' autoField='true'
- beanClass='fr.ird.observe.services.dto.referential.LengthWeightParameterDto'
- context='ui-create'
- errorTableModel='{getErrorTableModel()}'/>
+ <BeanValidator id='validator' autoField='true' context='ui-create' errorTableModel='{getErrorTableModel()}'
+ beanClass='fr.ird.observe.services.dto.referential.LengthLengthParameterDto'/>
<!-- model -->
- <LengthWeightParameterUIModel id='model'/>
+ <LengthLengthParameterUIModel id='model'/>
<!-- handler -->
- <LengthWeightParameterUIHandler id='handler' constructorParams="this"/>
+ <LengthLengthParameterUIHandler id='handler' constructorParams="this"/>
<!-- edit bean -->
- <LengthWeightParameterDto id='bean'/>
-
- <script><![CDATA[
-@Override
-public void decorateUniqueKeyTable(JTable table,
- TableCellRenderer renderer,
- JScrollPane pane) {
-
- UIHelper.fixTableColumnWidth(table, 0, 250);
- UIHelper.fixTableColumnWidth(table, 1, 100);
- UIHelper.fixTableColumnWidth(table, 2, 100);
- UIHelper.fixTableColumnWidth(table, 3, 200);
-
- table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
- UIHelper.setTableColumnRenderer(table, 1,
- UIHelper.newDecorateTableCellRenderer(renderer, SexDto.class));
-}
-]]></script>
+ <LengthLengthParameterDto id='bean'/>
<Table id="editView" insets="0" fill="both">
<row>
@@ -87,51 +63,25 @@ public void decorateUniqueKeyTable(JTable table,
<tab id='generalTab'>
<Table fill="both">
- <!-- sex -->
- <row>
- <cell anchor="west">
- <JLabel id='sexLabel'/>
- </cell>
- <cell anchor='east' weightx="1" fill="both">
- <BeanComboBox id='sex' constructorParams='this'
- genericType='ReferentialReference<SexDto>' _entityClass='SexDto.class'/>
- </cell>
- </row>
-
- <!-- species -->
+ <!-- inputSizeMeasureType -->
<row>
<cell anchor='west'>
- <JLabel id='speciesLabel'/>
+ <JLabel id='inputSizeMeasureTypeLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <BeanComboBox id='species' constructorParams='this'
- genericType='ReferentialReference<SpeciesDto>' _entityClass='SpeciesDto.class'/>
+ <BeanComboBox id='inputSizeMeasureType' constructorParams='this'
+ genericType='ReferentialReference<SizeMeasureTypeDto>'/>
</cell>
</row>
- <!-- ocean -->
+ <!-- outputSizeMeasureType -->
<row>
<cell anchor='west'>
- <JLabel id='oceanLabel'/>
+ <JLabel id='outputSizeMeasureTypeLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <BeanComboBox id='ocean' constructorParams='this'
- genericType='ReferentialReference<OceanDto>' _entityClass='OceanDto.class'/>
- </cell>
- </row>
-
- <!-- date debut - fin de validite -->
- <row>
- <cell anchor='west'>
- <JLabel id='startDateFinValiditeLabel'/>
- </cell>
- <cell anchor='west' weightx="1" fill="both">
- <JPanel layout='{new GridLayout()}'>
- <JXDatePicker id='startDate'
- onActionPerformed='getBean().setStartDate(startDate.getDate())'/>
- <JXDatePicker id='endDate'
- onActionPerformed='getBean().setEndDate(endDate.getDate())'/>
- </JPanel>
+ <BeanComboBox id='outputSizeMeasureType' constructorParams='this'
+ genericType='ReferentialReference<SizeMeasureTypeDto>'/>
</cell>
</row>
@@ -151,8 +101,7 @@ public void decorateUniqueKeyTable(JTable table,
<JLabel id='statusLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <EnumEditor id='status' constructorParams='ReferenceStatus.class'
- genericType='ReferenceStatus'
+ <EnumEditor id='status' constructorParams='ReferenceStatus.class' genericType='ReferenceStatus'
onItemStateChanged='getBean().setStatus((ReferenceStatus)status.getSelectedItem())'/>
</cell>
</row>
@@ -160,8 +109,7 @@ public void decorateUniqueKeyTable(JTable table,
<!-- needComment -->
<row>
<cell anchor='east' weightx="1" fill="both" columns="2">
- <JCheckBox id='needComment'
- onItemStateChanged='getBean().setNeedComment(needComment.isSelected())'/>
+ <JCheckBox id='needComment' onItemStateChanged='getBean().setNeedComment(needComment.isSelected())'/>
</cell>
</row>
@@ -210,34 +158,34 @@ public void decorateUniqueKeyTable(JTable table,
<!-- relation weight -->
<row>
<cell anchor='west' columns="2">
- <JLabel id='lengthWeightFormulaInformation'/>
+ <JLabel id='inputOutputFormulaInformation'/>
</cell>
</row>
<row>
<cell anchor='west'>
- <JLabel id='lengthWeightFormulaLabel'/>
+ <JLabel id='inputOutputFormulaLabel'/>
</cell>
<cell weightx="1" fill="both">
- <JTextField id='lengthWeightFormula'
- onKeyReleased='getBean().setLengthWeightFormula(lengthWeightFormula.getText())'/>
+ <JTextField id='inputOutputFormula'
+ onKeyReleased='getBean().setInputOutputFormula(inputOutputFormula.getText())'/>
</cell>
</row>
<!-- relation taille -->
<row>
<cell anchor='west' columns="2">
- <JLabel id='weightLengthFormulaInformation'/>
+ <JLabel id='outputInputFormulaInformation'/>
</cell>
</row>
<row>
<cell anchor='west'>
- <JLabel id='weightLengthFormulaLabel'/>
+ <JLabel id='outputInputFormulaLabel'/>
</cell>
<cell weightx="1" fill="both">
- <JTextField id='weightLengthFormula'
- onKeyReleased='getBean().setWeightLengthFormula(weightLengthFormula.getText())'/>
+ <JTextField id='outputInputFormula'
+ onKeyReleased='getBean().setOutputInputFormula(outputInputFormula.getText())'/>
</cell>
</row>
</Table>
@@ -245,41 +193,6 @@ public void decorateUniqueKeyTable(JTable table,
</row>
<row>
- <cell weightx="1">
-
- <Table id='meanValuesTable' fill='both' insets="1">
-
- <!-- tailleMoyen -->
- <row>
- <cell anchor="west">
- <JLabel id='meanLengthLabel'/>
- </cell>
- <cell anchor='east' weightx="1" fill="both">
- <NumberEditor id='meanLength' constructorParams='this' styleClass="float2"/>
- </cell>
- </row>
-
- <!-- meanWeight -->
- <row>
- <cell anchor="west">
- <JLabel id='meanWeightLabel'/>
- </cell>
- <cell anchor='east' weightx="1" fill="both">
- <NumberEditor id='meanWeight' constructorParams='this' styleClass="float2"/>
- </cell>
- </row>
- <row>
- <cell>
- <javax.swing.Box.Filler id='filler'
- constructorParams='UIHelper.newMinDimension(), UIHelper.newMinDimension(), UIHelper.newMaxXDimension()'/>
- </cell>
- </row>
- </Table>
-
- </cell>
- </row>
-
- <row>
<cell columns="2" weighty="1">
<JLabel/>
</cell>
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jcss
similarity index 52%
copy from application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss
copy to application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jcss
index 2657acf..e247d52 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUI.jcss
@@ -21,12 +21,12 @@
*/
#generalTab {
- title:{t("observe.content.lengthWeightParameter.tab.general")};
+ title:{t("observe.content.lengthLengthParameter.tab.general")};
icon:{getHandler().getErrorIconIfFalse(model.isGeneralTabValid())};
}
#otherTab {
- title:{t("observe.content.lengthWeightParameter.tab.other")};
+ title:{t("observe.content.lengthLengthParameter.tab.other")};
icon:{getHandler().getErrorIconIfFalse(model.isOtherTabValid())};
}
@@ -36,80 +36,70 @@
labelFor:{species};
}
-#sexLabel {
- text:"observe.common.sex";
- font-style:"italic";
- labelFor:{sex};
-}
-
-#sex {
- property:{LengthWeightParameterDto.PROPERTY_SEX};
- selectedItem:{bean.getSex()};
- enabled:{model.isCreatingMode()};
-}
-
#species {
- property:{LengthWeightParameterDto.PROPERTY_SPECIES};
+ property:{LengthLengthParameterDto.PROPERTY_SPECIES};
selectedItem:{bean.getSpecies()};
enabled:{model.isCreatingMode()};
+ _entityClass:{SpeciesDto.class};
}
-#oceanLabel {
- text:"observe.common.ocean";
+#inputSizeMeasureTypeLabel {
+ text:"observe.common.inputSizeMeasureType";
font-style:"italic";
- labelFor:{ocean};
+ labelFor:{inputSizeMeasureType};
}
-#ocean {
- property:{LengthWeightParameterDto.PROPERTY_OCEAN};
- selectedItem:{bean.getOcean()};
+#inputSizeMeasureType {
+ property:{LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE};
+ selectedItem:{getBean().getInputSizeMeasureType()};
enabled:{model.isCreatingMode()};
+ _entityClass:{SizeMeasureTypeDto.class};
}
-#startDateFinValiditeLabel {
- text:"observe.common.startDateFinValidite";
+#outputSizeMeasureTypeLabel {
+ text:"observe.common.outputSizeMeasureType";
font-style:"italic";
+ labelFor:{outputSizeMeasureType};
}
-#startDate {
- date:{bean.getStartDate()};
-}
-
-#endDate {
- date:{bean.getEndDate()};
+#outputSizeMeasureType {
+ property:{LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE};
+ selectedItem:{getBean().getOutputSizeMeasureType()};
+ enabled:{model.isCreatingMode()};
+ _entityClass:{SizeMeasureTypeDto.class};
}
#relationTable {
border:{new TitledBorder(t("observe.common.equation"))};
}
-#lengthWeightFormulaInformation {
+#inputOutputFormulaInformation {
font-size:11;
- text:"observe.content.label.lengthWeightFormula.info";
+ text:"observe.content.label.inputOutputFormula.info";
actionIcon:"information";
}
-#lengthWeightFormulaLabel {
- text:"observe.common.lengthWeightFormula";
- labelFor:{lengthWeightFormula};
+#inputOutputFormulaLabel {
+ text:"observe.common.inputOutputFormula";
+ labelFor:{inputOutputFormula};
}
-#lengthWeightFormula {
- text:{getStringValue(bean.getLengthWeightFormula())};
+#inputOutputFormula {
+ text:{getStringValue(getBean().getInputOutputFormula())};
}
-#weightLengthFormulaInformation {
+#outputInputFormulaInformation {
font-size:11;
- text:"observe.content.label.weightLengthFormula.info";
+ text:"observe.content.label.outputInputFormula.info";
actionIcon:"information";
}
-#weightLengthFormulaLabel {
- text:"observe.common.weightLengthFormula";
- labelFor:{weightLengthFormula};
+#outputInputFormulaLabel {
+ text:"observe.common.outputInputFormula";
+ labelFor:{outputInputFormula};
}
-#weightLengthFormula {
- text:{getStringValue(bean.getWeightLengthFormula())};
+#outputInputFormula {
+ text:{getStringValue(getBean().getOutputInputFormula())};
}
#coefficientsInformation {
@@ -126,30 +116,6 @@
text:{getStringValue(bean.getCoefficients())};
}
-#meanValuesTable {
- border:{new TitledBorder(t("observe.common.meanValues"))};
-}
-
-#meanLengthLabel {
- text:"observe.common.meanLength";
- labelFor:{meanLength};
-}
-
-#meanLength {
- property:{LengthWeightParameterDto.PROPERTY_MEAN_LENGTH};
- model:{bean.getMeanLength()};
-}
-
-#meanWeightLabel {
- text:"observe.common.meanWeight";
- labelFor:{meanWeight};
-}
-
-#meanWeight {
- property:{LengthWeightParameterDto.PROPERTY_MEAN_WEIGHT};
- model:{bean.getMeanWeight()};
-}
-
#sourceLabel {
text:"observe.common.source";
labelFor:{sourceField};
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIHandler.java
new file mode 100644
index 0000000..b0a645b
--- /dev/null
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIHandler.java
@@ -0,0 +1,102 @@
+package fr.ird.observe.application.swing.ui.content.ref.impl;
+
+/*
+ * #%L
+ * ObServe :: Application Swing
+ * %%
+ * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUI;
+import fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUIHandler;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
+import fr.ird.observe.services.dto.referential.ReferentialReference;
+import jaxx.runtime.validator.swing.SwingValidatorMessage;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableModel;
+import org.nuiton.validator.NuitonValidatorScope;
+
+import javax.swing.event.TableModelListener;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Created on 9/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class LengthLengthParameterUIHandler extends ContentReferenceUIHandler<LengthLengthParameterDto> {
+
+ // Compute valid state of tab from the error table
+ protected final TableModelListener computeTabValidStateListener;
+
+ public LengthLengthParameterUIHandler(ContentReferenceUI<LengthLengthParameterDto> ui) {
+ super(ui);
+ computeTabValidStateListener = e -> {
+
+ SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource();
+ computeTabValidState(source);
+
+ };
+ }
+
+ @Override
+ public void initUI() {
+
+ super.initUI();
+
+ // To be sure always remove listener (could prevent some leaks)
+ getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener);
+ // listen messages to see if required to add
+ getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener);
+
+ }
+
+ @Override
+ public void selectBean(ReferentialReference<LengthLengthParameterDto> selectedBean) {
+
+ super.selectBean(selectedBean);
+
+ SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel();
+ computeTabValidState(errorTableModel);
+
+ ((LengthLengthParameterUI) getUi()).getTabPane().setSelectedIndex(0);
+
+ }
+
+ protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) {
+
+ Set<String> errorProperties = new HashSet<>();
+ int rowCount = errorTableModel.getRowCount();
+ for (int i = 0; i < rowCount; i++) {
+
+ SwingValidatorMessage row = errorTableModel.getRow(i);
+ if (NuitonValidatorScope.ERROR.equals(row.getScope())) {
+ errorProperties.add(row.getField());
+ }
+ }
+
+ boolean generalTabValid = !errorProperties.removeAll(LengthLengthParameterUIModel.GENERAL_TAB_PROPERTIES);
+ boolean otherTabValid = !errorProperties.removeAll(LengthLengthParameterUIModel.OTHER_TAB_PROPERTIES);
+
+ LengthLengthParameterUIModel model = (LengthLengthParameterUIModel) getModel();
+ model.setGeneralTabValid(generalTabValid);
+ model.setOtherTabValid(otherTabValid);
+
+ }
+}
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIModel.java
similarity index 53%
copy from application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java
copy to application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIModel.java
index 505551c..cb487f5 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthLengthParameterUIModel.java
@@ -23,43 +23,38 @@ package fr.ird.observe.application.swing.ui.content.ref.impl;
*/
import com.google.common.collect.ImmutableSet;
-import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUIModel;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import java.util.Set;
/**
- * Created on 9/27/14.
+ * Created on 11/5/16.
*
* @author Tony Chemit - chemit(a)codelutin.com
- * @since XXX
+ * @since 5.1
*/
-public class LengthWeightParameterUIModel extends ContentReferenceUIModel<LengthWeightParameterDto> {
+public class LengthLengthParameterUIModel extends ContentReferenceUIModel<LengthLengthParameterDto> {
public static final String PROPERTY_GENERAL_TAB_VALID = "generalTabValid";
public static final String PROPERTY_OTHER_TAB_VALID = "otherTabValid";
public static final Set<String> GENERAL_TAB_PROPERTIES =
- ImmutableSet.<String>builder().add(LengthWeightParameterDto.PROPERTY_URI,
- LengthWeightParameterDto.PROPERTY_CODE,
- LengthWeightParameterDto.PROPERTY_STATUS,
- LengthWeightParameterDto.PROPERTY_SEX,
- LengthWeightParameterDto.PROPERTY_OCEAN,
- LengthWeightParameterDto.PROPERTY_SPECIES,
- LengthWeightParameterDto.PROPERTY_NEED_COMMENT,
- LengthWeightParameterDto.PROPERTY_SOURCE,
- LengthWeightParameterDto.PROPERTY_START_DATE,
- LengthWeightParameterDto.PROPERTY_END_DATE).build();
+ ImmutableSet.<String>builder().add(LengthLengthParameterDto.PROPERTY_URI,
+ LengthLengthParameterDto.PROPERTY_CODE,
+ LengthLengthParameterDto.PROPERTY_STATUS,
+ LengthLengthParameterDto.PROPERTY_NEED_COMMENT,
+ LengthLengthParameterDto.PROPERTY_SOURCE,
+ LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE,
+ LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE).build();
public static final Set<String> OTHER_TAB_PROPERTIES =
- ImmutableSet.<String>builder().add(LengthWeightParameterDto.PROPERTY_MEAN_LENGTH,
- LengthWeightParameterDto.PROPERTY_MEAN_WEIGHT,
- LengthWeightParameterDto.PROPERTY_WEIGHT_LENGTH_FORMULA,
- LengthWeightParameterDto.PROPERTY_WEIGHT_LENGTH_FORMULA_VALID,
- LengthWeightParameterDto.PROPERTY_LENGTH_WEIGHT_FORMULA,
- LengthWeightParameterDto.PROPERTY_LENGTH_WEIGHT_FORMULA_VALID,
- LengthWeightParameterDto.PROPERTY_COEFFICIENTS).build();
+ ImmutableSet.<String>builder().add(LengthLengthParameterDto.PROPERTY_INPUT_OUTPUT_FORMULA,
+ LengthLengthParameterDto.PROPERTY_INPUT_OUTPUT_FORMULA_VALID,
+ LengthLengthParameterDto.PROPERTY_OUTPUT_INPUT_FORMULA,
+ LengthLengthParameterDto.PROPERTY_OUTPUT_INPUT_FORMULA_VALID,
+ LengthLengthParameterDto.PROPERTY_COEFFICIENTS).build();
private static final long serialVersionUID = 1L;
@@ -67,16 +62,20 @@ public class LengthWeightParameterUIModel extends ContentReferenceUIModel<Length
protected boolean otherTabValid;
- public LengthWeightParameterUIModel() {
- super(LengthWeightParameterDto.class,
+ public LengthLengthParameterUIModel() {
+ super(LengthLengthParameterDto.class,
null,
new String[]{
- LengthWeightParameterDto.PROPERTY_SEX,
- LengthWeightParameterDto.PROPERTY_OCEAN,
- LengthWeightParameterDto.PROPERTY_SPECIES,
- LengthWeightParameterDto.PROPERTY_START_DATE,
+ LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE,
+ LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE,
},
- null
+ new String[]{
+ LengthLengthParameterUI.BINDING_INPUT_SIZE_MEASURE_TYPE_SELECTED_ITEM,
+ LengthLengthParameterUI.BINDING_INPUT_OUTPUT_FORMULA_TEXT,
+ LengthLengthParameterUI.BINDING_OUTPUT_SIZE_MEASURE_TYPE_SELECTED_ITEM,
+ LengthLengthParameterUI.BINDING_OUTPUT_INPUT_FORMULA_TEXT,
+ }
+
);
}
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx
index 8ffa384..f6bf375 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jaxx
@@ -28,6 +28,7 @@
fr.ird.observe.services.dto.constants.ReferenceStatus
fr.ird.observe.services.dto.referential.ReferentialReference
fr.ird.observe.services.dto.referential.SexDto
+ fr.ird.observe.services.dto.referential.SizeMeasureTypeDto
fr.ird.observe.services.dto.referential.SpeciesDto
fr.ird.observe.services.dto.referential.OceanDto
fr.ird.observe.services.dto.referential.LengthWeightParameterDto
@@ -48,10 +49,8 @@
</import>
<!-- validator -->
- <BeanValidator id='validator' autoField='true'
- beanClass='fr.ird.observe.services.dto.referential.LengthWeightParameterDto'
- context='ui-create'
- errorTableModel='{getErrorTableModel()}'/>
+ <BeanValidator id='validator' autoField='true' context='ui-create' errorTableModel='{getErrorTableModel()}'
+ beanClass='fr.ird.observe.services.dto.referential.LengthWeightParameterDto'/>
<!-- model -->
<LengthWeightParameterUIModel id='model'/>
@@ -93,8 +92,7 @@ public void decorateUniqueKeyTable(JTable table,
<JLabel id='sexLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <BeanComboBox id='sex' constructorParams='this'
- genericType='ReferentialReference<SexDto>' _entityClass='SexDto.class'/>
+ <BeanComboBox id='sex' constructorParams='this' genericType='ReferentialReference<SexDto>'/>
</cell>
</row>
@@ -105,7 +103,7 @@ public void decorateUniqueKeyTable(JTable table,
</cell>
<cell anchor='east' weightx="1" fill="both">
<BeanComboBox id='species' constructorParams='this'
- genericType='ReferentialReference<SpeciesDto>' _entityClass='SpeciesDto.class'/>
+ genericType='ReferentialReference<SpeciesDto>'/>
</cell>
</row>
@@ -115,8 +113,18 @@ public void decorateUniqueKeyTable(JTable table,
<JLabel id='oceanLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <BeanComboBox id='ocean' constructorParams='this'
- genericType='ReferentialReference<OceanDto>' _entityClass='OceanDto.class'/>
+ <BeanComboBox id='ocean' constructorParams='this' genericType='ReferentialReference<OceanDto>'/>
+ </cell>
+ </row>
+
+ <!-- sizeMeasuretype -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='sizeMeasureTypeLabel'/>
+ </cell>
+ <cell anchor='east' weightx="1" fill="both">
+ <BeanComboBox id='sizeMeasureType' constructorParams='this'
+ genericType='ReferentialReference<SizeMeasureTypeDto>'/>
</cell>
</row>
@@ -127,10 +135,8 @@ public void decorateUniqueKeyTable(JTable table,
</cell>
<cell anchor='west' weightx="1" fill="both">
<JPanel layout='{new GridLayout()}'>
- <JXDatePicker id='startDate'
- onActionPerformed='getBean().setStartDate(startDate.getDate())'/>
- <JXDatePicker id='endDate'
- onActionPerformed='getBean().setEndDate(endDate.getDate())'/>
+ <JXDatePicker id='startDate' onActionPerformed='getBean().setStartDate(startDate.getDate())'/>
+ <JXDatePicker id='endDate' onActionPerformed='getBean().setEndDate(endDate.getDate())'/>
</JPanel>
</cell>
</row>
@@ -151,8 +157,7 @@ public void decorateUniqueKeyTable(JTable table,
<JLabel id='statusLabel'/>
</cell>
<cell anchor='east' weightx="1" fill="both">
- <EnumEditor id='status' constructorParams='ReferenceStatus.class'
- genericType='ReferenceStatus'
+ <EnumEditor id='status' constructorParams='ReferenceStatus.class' genericType='ReferenceStatus'
onItemStateChanged='getBean().setStatus((ReferenceStatus)status.getSelectedItem())'/>
</cell>
</row>
@@ -160,8 +165,7 @@ public void decorateUniqueKeyTable(JTable table,
<!-- needComment -->
<row>
<cell anchor='east' weightx="1" fill="both" columns="2">
- <JCheckBox id='needComment'
- onItemStateChanged='getBean().setNeedComment(needComment.isSelected())'/>
+ <JCheckBox id='needComment' onItemStateChanged='getBean().setNeedComment(needComment.isSelected())'/>
</cell>
</row>
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss
index 2657acf..0857dbd 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUI.jcss
@@ -46,12 +46,14 @@
property:{LengthWeightParameterDto.PROPERTY_SEX};
selectedItem:{bean.getSex()};
enabled:{model.isCreatingMode()};
+ _entityClass:{SexDto.class};
}
#species {
property:{LengthWeightParameterDto.PROPERTY_SPECIES};
selectedItem:{bean.getSpecies()};
enabled:{model.isCreatingMode()};
+ _entityClass:{SpeciesDto.class};
}
#oceanLabel {
@@ -64,8 +66,23 @@
property:{LengthWeightParameterDto.PROPERTY_OCEAN};
selectedItem:{bean.getOcean()};
enabled:{model.isCreatingMode()};
+ _entityClass:{OceanDto.class};
}
+#sizeMeasureTypeLabel {
+ text:"observe.common.sizeMeasureType";
+ font-style:"italic";
+ labelFor:{sizeMeasureType};
+}
+
+#sizeMeasureType {
+ property:{LengthWeightParameterDto.PROPERTY_SIZE_MEASURE_TYPE};
+ selectedItem:{bean.getSizeMeasureType()};
+ enabled:{model.isCreatingMode()};
+ _entityClass:{SizeMeasureTypeDto.class};
+}
+
+
#startDateFinValiditeLabel {
text:"observe.common.startDateFinValidite";
font-style:"italic";
diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java
index 505551c..49a61c1 100644
--- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java
+++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ref/impl/LengthWeightParameterUIModel.java
@@ -25,6 +25,7 @@ package fr.ird.observe.application.swing.ui.content.ref.impl;
import com.google.common.collect.ImmutableSet;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.application.swing.ui.content.ref.ContentReferenceUIModel;
+import fr.ird.observe.services.dto.referential.SpeciesDto;
import java.util.Set;
@@ -49,6 +50,7 @@ public class LengthWeightParameterUIModel extends ContentReferenceUIModel<Length
LengthWeightParameterDto.PROPERTY_SPECIES,
LengthWeightParameterDto.PROPERTY_NEED_COMMENT,
LengthWeightParameterDto.PROPERTY_SOURCE,
+ LengthWeightParameterDto.PROPERTY_SIZE_MEASURE_TYPE,
LengthWeightParameterDto.PROPERTY_START_DATE,
LengthWeightParameterDto.PROPERTY_END_DATE).build();
@@ -74,6 +76,7 @@ public class LengthWeightParameterUIModel extends ContentReferenceUIModel<Length
LengthWeightParameterDto.PROPERTY_SEX,
LengthWeightParameterDto.PROPERTY_OCEAN,
LengthWeightParameterDto.PROPERTY_SPECIES,
+ LengthWeightParameterDto.PROPERTY_SIZE_MEASURE_TYPE,
LengthWeightParameterDto.PROPERTY_START_DATE,
},
null
diff --git a/application-swing/src/main/resources/i18n/application-swing_en_GB.properties b/application-swing/src/main/resources/i18n/application-swing_en_GB.properties
index 7427f4e..c8d7047 100644
--- a/application-swing/src/main/resources/i18n/application-swing_en_GB.properties
+++ b/application-swing/src/main/resources/i18n/application-swing_en_GB.properties
@@ -401,6 +401,8 @@ observe.common.homeId=Home id
observe.common.homeIdFAOWormsId=Home id / Fao / Worms
observe.common.iattcId=ICCAT Id
observe.common.imoId=IMO Id
+observe.common.inputOutputFormula=Input to Output formula
+observe.common.inputSizeMeasureType=Input size measure type
observe.common.iso2Code=Iso 2 code
observe.common.iso3Code=Iso 3 code
observe.common.keelCodeFlotte=Keel / Flotte
@@ -462,6 +464,8 @@ observe.common.ocean=Ocean
observe.common.oceanForSpecies=oceans list
observe.common.operation.resume=Summary of operations
observe.common.organism=Organism
+observe.common.outputInputFormula=Ouput to Input formula
+observe.common.outputSizeMeasureType=output size measure type
observe.common.ownership=Ownership
observe.common.picturesReferences=Pictures references
observe.common.power=Power
@@ -906,10 +910,14 @@ observe.content.hooksComposition.table.proportion=Proportion
observe.content.hooksComposition.table.proportion.tip=Proportion
observe.content.hooksComposition.title=Hooks
observe.content.label.coefficients.info=Coefficients of relations msut follow the syntax name\=value and are separated by \: (example \: a\=1\:b\=2\:c\=3)
+observe.content.label.inputOutputFormula.info=Input to Ouput formula permits to compute output length from the input length, must contains variable I
observe.content.label.lengthWeightFormula.info=Length weight formula permits to compute weight from the length, must contains variable L
+observe.content.label.outputInputFormula.info=Ouput to Input formula permits to compute input length from the output length, must contains variable O
observe.content.label.usage.data.title=Data '%1$s' (%2$d occurrences)
observe.content.label.usage.referentiel.title=Referentiel '%1$s' (%2$d occurrences)
observe.content.label.weightLengthFormula.info=Weight length formula permits to compute length from the weight, must contains variable P
+observe.content.lengthLengthParameter.tab.general=General caracteristics
+observe.content.lengthLengthParameter.tab.other=Other caracteristics
observe.content.lengthWeightParameter.tab.general=General caracteristics
observe.content.lengthWeightParameter.tab.other=Other caracteristics
observe.content.longlineDetailComposition.action.deleteAllSections=Remove all
diff --git a/application-swing/src/main/resources/i18n/application-swing_es_ES.properties b/application-swing/src/main/resources/i18n/application-swing_es_ES.properties
index d4ee3ba..ebc5a15 100644
--- a/application-swing/src/main/resources/i18n/application-swing_es_ES.properties
+++ b/application-swing/src/main/resources/i18n/application-swing_es_ES.properties
@@ -401,6 +401,8 @@ observe.common.homeId=Identificador
observe.common.homeIdFAOWormsId=Código 3L / FAO / Worms
observe.common.iattcId=Id CICAA
observe.common.imoId=Id IMO
+observe.common.inputOutputFormula=Formule entrée -> sortie \#TODO
+observe.common.inputSizeMeasureType=Type de mensuration d'entrée \#TODO
observe.common.iso2Code=Código ISO-2
observe.common.iso3Code=Código ISO-3
observe.common.keelCodeFlotte=Código de Quilla / Flota
@@ -462,6 +464,8 @@ observe.common.ocean=Océano
observe.common.oceanForSpecies=Lista de los oceanos
observe.common.operation.resume=Resumen de operaciones
observe.common.organism=Organismo
+observe.common.outputInputFormula=Formule sortie -> entrée \#TODO
+observe.common.outputSizeMeasureType=Type de mensuration de sortie \#TODO
observe.common.ownership=Pertenece a
observe.common.picturesReferences=Referencia de foto
observe.common.power=Potencia del motor principal
@@ -906,10 +910,14 @@ observe.content.hooksComposition.table.proportion=Proporción (%)
observe.content.hooksComposition.table.proportion.tip=Proporción (%)
observe.content.hooksComposition.title=Composición de los anzuelos
observe.content.label.coefficients.info=Los coeficientes de relaciones son de la forma lastName\=valor y están separados por \: (ejemplo \: a\=1\:b\=2\:c\=3)
+observe.content.label.inputOutputFormula.info=La relation poids permet de calculer la taille de sortie à partir de la taille d'entrée, elle doit contenir la variable I \#TODO
observe.content.label.lengthWeightFormula.info=La relación talla-peso permite calcular el peso a partir de la talla, debe contener la variable L
+observe.content.label.outputInputFormula.info=La relation poids permet de calculer la taille d'entrée à partir de la taille de sortie, elle doit contenir la variable O \#TODO
observe.content.label.usage.data.title=Datos '%1$s' (%2$d ocurrencias)
observe.content.label.usage.referentiel.title=Referencial '%1$s' (%2$d ocurrencias)
observe.content.label.weightLengthFormula.info=la relación talla-peso permite calcular la talla a partir del peso, debe contener la varible P
+observe.content.lengthLengthParameter.tab.general=Características generales
+observe.content.lengthLengthParameter.tab.other=Otras características
observe.content.lengthWeightParameter.tab.general=Características generales
observe.content.lengthWeightParameter.tab.other=Otras características
observe.content.longlineDetailComposition.action.deleteAllSections=Eliminar todo
diff --git a/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties b/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties
index 0212c82..e629cda 100644
--- a/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties
+++ b/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties
@@ -401,6 +401,8 @@ observe.common.homeId=Identifiant
observe.common.homeIdFAOWormsId=Code 3L / FAO / Worms
observe.common.iattcId=Id CICTA
observe.common.imoId=Id IMO
+observe.common.inputOutputFormula=Formule entrée -> sortie
+observe.common.inputSizeMeasureType=Type de mensuration d'entrée
observe.common.iso2Code=code ISO-2
observe.common.iso3Code=Code ISO-3
observe.common.keelCodeFlotte=Code quille /Code flotte
@@ -462,6 +464,8 @@ observe.common.ocean=Océan
observe.common.oceanForSpecies=Liste des océans
observe.common.operation.resume=Résumé des opérations
observe.common.organism=Organisme
+observe.common.outputInputFormula=Formule sortie -> entrée
+observe.common.outputSizeMeasureType=Type de mensuration de sortie
observe.common.ownership=Appartenance
observe.common.picturesReferences=Référence Photo
observe.common.power=Puissance moteur principal
@@ -906,10 +910,14 @@ observe.content.hooksComposition.table.proportion=Proportion (%)
observe.content.hooksComposition.table.proportion.tip=Proportion (%)
observe.content.hooksComposition.title=Composition des hameçons
observe.content.label.coefficients.info=Les coefficients des relations sont de la forme nom\=valeur et sont séparé par des \: (exemple \: a\=1\:b\=2\:c\=3)
+observe.content.label.inputOutputFormula.info=La relation poids permet de calculer la taille de sortie à partir de la taille d'entrée, elle doit contenir la variable I
observe.content.label.lengthWeightFormula.info=La relation poids permet de calculer le poids à partir de la taille, elle doit contenir la variable L
+observe.content.label.outputInputFormula.info=La relation poids permet de calculer la taille d'entrée à partir de la taille de sortie, elle doit contenir la variable O
observe.content.label.usage.data.title=Donnée '%1$s' (%2$d occurrences)
observe.content.label.usage.referentiel.title=Référentiel '%1$s' (%2$d occurrences)
observe.content.label.weightLengthFormula.info=La relation taille permet de calculer la taille à partir du poids, elle doit contenir la variable P
+observe.content.lengthLengthParameter.tab.general=Caractéristiques générales
+observe.content.lengthLengthParameter.tab.other=Autres caractéristiques
observe.content.lengthWeightParameter.tab.general=Caractéristiques générales
observe.content.lengthWeightParameter.tab.other=Autres caractéristiques
observe.content.longlineDetailComposition.action.deleteAllSections=Tout supprimer
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
02/14: Ajout LengthLengthParameter et revue de LWParameter (service)
by codelutin.com scm 07 Nov '16
by codelutin.com scm 07 Nov '16
07 Nov '16
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 0ecbc3191808377a593577ad538f277bc1d8e423
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:29:58 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (service)
---
.../ReferentialReferenceSetDefinitions.java | 8 ++
.../request/ReferenceSetRequestDefinitions.java | 11 +-
.../services/dto/referential/FormulaHelper.java | 134 +++++++++++++++++++++
.../dto/referential/LengthLengthParameterDto.java | 48 ++++++++
.../dto/referential/LengthWeightParameterDto.java | 48 ++++++++
.../dto/referential/ReferentialHelper.java | 1 +
.../src/main/xmi/observe-services-dto-common.zargo | Bin 46149 -> 48945 bytes
.../src/main/xmi/observe-services-dto-seine.zargo | Bin 60743 -> 60919 bytes
services-dto/src/main/xmi/observe-services-dto.ini | 12 +-
.../topia/binder/BinderEngineInitializer.java | 17 ++-
.../referential/LengthLengthParameterBinder.java | 92 ++++++++++++++
.../referential/LengthWeightParameterBinder.java | 2 +
.../consolidate/ConsolidateDataServiceTopia.java | 8 +-
13 files changed, 369 insertions(+), 12 deletions(-)
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java b/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java
index 1844180..c05a711 100644
--- a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java
@@ -30,6 +30,7 @@ import fr.ird.observe.services.dto.referential.GearCaracteristicTypeDto;
import fr.ird.observe.services.dto.referential.GearDto;
import fr.ird.observe.services.dto.referential.HarbourDto;
import fr.ird.observe.services.dto.referential.I18nReferentialDto;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.services.dto.referential.OceanDto;
import fr.ird.observe.services.dto.referential.OrganismDto;
@@ -122,6 +123,13 @@ public enum ReferentialReferenceSetDefinitions {
SHIP_OWNER(newDefaultDefinitionBuilder(ShipOwnerDto.class)
.addProperty(String.class, ShipOwnerDto.PROPERTY_LABEL)),
+ LENGTH_LENGTH_PARAMETER(newDefinitionBuilder(LengthLengthParameterDto.class)
+ .addProperty(String.class, LengthLengthParameterDto.PROPERTY_CODE)
+ .addProperty(String.class, LengthLengthParameterDto.PROPERTY_INPUT_OUTPUT_FORMULA)
+ .addProperty(String.class, LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE)
+ .addProperty(String.class, LengthLengthParameterDto.PROPERTY_OUTPUT_INPUT_FORMULA)
+ .addProperty(String.class, LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE)),
+
LENGTH_WEIGHT_PARAMETER(newDefinitionBuilder(LengthWeightParameterDto.class)
.addProperty(String.class, LengthWeightParameterDto.PROPERTY_CODE)
.addProperty(String.class, LengthWeightParameterDto.PROPERTY_OCEAN)
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java b/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java
index 448732d..c8d18e3 100644
--- a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java
@@ -48,6 +48,7 @@ import fr.ird.observe.services.dto.referential.GearCaracteristicDto;
import fr.ird.observe.services.dto.referential.GearCaracteristicTypeDto;
import fr.ird.observe.services.dto.referential.GearDto;
import fr.ird.observe.services.dto.referential.HarbourDto;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.services.dto.referential.OceanDto;
import fr.ird.observe.services.dto.referential.OrganismDto;
@@ -135,6 +136,7 @@ import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefin
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.HOOK_TYPE;
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.ITEM_HORIZONTAL_POSITION;
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.ITEM_VERTICAL_POSITION;
+import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.LENGTH_LENGTH_PARAMETER;
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.LENGTH_WEIGHT_PARAMETER;
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.LIGHTSTICKS_COLOR;
import static fr.ird.observe.services.dto.reference.ReferentialReferenceSetDefinitions.LIGHTSTICKS_TYPE;
@@ -345,7 +347,8 @@ public enum ReferenceSetRequestDefinitions {
newBuilder(NonTargetLengthDto.class)
.addKey(NonTargetLengthDto.PROPERTY_SPECIES, SPECIES)
.addKey(NonTargetLengthDto.PROPERTY_SPECIES_FATE, SPECIES_FATE)
- .addKey(NonTargetLengthDto.PROPERTY_SEX, SEX)),
+ .addKey(NonTargetLengthDto.PROPERTY_SEX, SEX)
+ .addKey(TargetLengthDto.PROPERTY_SIZE_MEASURE_TYPE, SIZE_MEASURE_TYPE)),
FLOATING_OBJECT_FORM(
newBuilder(FloatingObjectDto.class)
@@ -386,9 +389,15 @@ public enum ReferenceSetRequestDefinitions {
newReferentialBuilder(ShipOwnerDto.class, SHIP_OWNER)
.addKey(HarbourDto.PROPERTY_COUNTRY, COUNTRY)),
+ LENGTH_LENGTH_PARAMETER_FORM(
+ newReferentialBuilder(LengthLengthParameterDto.class, LENGTH_LENGTH_PARAMETER)
+ .addKey(LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE, SIZE_MEASURE_TYPE)
+ .addKey(LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE, SIZE_MEASURE_TYPE)),
+
LENGTH_WEIGHT_PARAMETER_FORM(
newReferentialBuilder(LengthWeightParameterDto.class, LENGTH_WEIGHT_PARAMETER)
.addKey(LengthWeightParameterDto.PROPERTY_SPECIES, SPECIES)
+ .addKey(LengthWeightParameterDto.PROPERTY_SIZE_MEASURE_TYPE, SIZE_MEASURE_TYPE)
.addKey(LengthWeightParameterDto.PROPERTY_OCEAN, OCEAN)
.addKey(LengthWeightParameterDto.PROPERTY_SEX, SEX)),
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/FormulaHelper.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/FormulaHelper.java
new file mode 100644
index 0000000..e763bf3
--- /dev/null
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/FormulaHelper.java
@@ -0,0 +1,134 @@
+package fr.ird.observe.services.dto.referential;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class FormulaHelper {
+
+ public interface FormulaSupport {
+
+ String getCoefficients();
+
+ Map<String, Double> getCoefficientValues();
+
+ } //FormulaSupport
+
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(FormulaHelper.class);
+
+ private static final Pattern COEFFICIENTS_PATTERN = Pattern.compile("(.+)=(.+)");
+
+ /** variable weight à utiliser dans la relation taille */
+ public static final String VARIABLE_WEIGHT = "P";
+
+ /** variable taille à utiliser dans la relation weight */
+ public static final String VARIABLE_LENGTH = "L";
+
+ public static final String VARIABLE_INPUT = "I";
+
+ public static final String VARIABLE_OUTPUT = "O";
+
+ public static final String COEFFICIENT_A = "a";
+
+ public static final String COEFFICIENT_B = "b";
+
+ /** moteur d'évaluation d'expression */
+ protected static ScriptEngine scriptEngine;
+
+
+ protected static ScriptEngine getScriptEngine() {
+ if (scriptEngine == null) {
+ ScriptEngineManager factory = new ScriptEngineManager();
+
+ scriptEngine = factory.getEngineByExtension("js");
+ }
+ return scriptEngine;
+ }
+
+ public static Map<String, Double> getCoefficientValues(FormulaSupport parametrage) {
+
+ Map<String, Double> result = new TreeMap<>();
+ String coefficients = parametrage.getCoefficients();
+ if (coefficients != null) {
+ for (String coefficientDef : coefficients.split(":")) {
+ Matcher matcher = COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
+ if (log.isDebugEnabled()) {
+ log.debug("constant to test = " + coefficientDef);
+ }
+ if (matcher.matches()) {
+
+ String key = matcher.group(1);
+ String val = matcher.group(2);
+ try {
+ Double d = Double.valueOf(val);
+ result.put(key, d);
+ if (log.isDebugEnabled()) {
+ log.debug("detects coefficient " + key + '=' + val);
+ }
+ } catch (NumberFormatException e) {
+ // pas pu recupere le count...
+ if (log.isWarnEnabled()) {
+ log.warn("could not parse double " + val + " for coefficient " + key);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ protected static boolean validateRelation(FormulaSupport parametrage, String relation, String variable) {
+ boolean result = false;
+ if (!StringUtils.isEmpty(relation)) {
+
+ Map<String, Double> coeffs = parametrage.getCoefficientValues();
+
+ ScriptEngine engine = getScriptEngine();
+ Bindings bindings = engine.createBindings();
+ for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
+ String key = entry.getKey();
+ Double value = entry.getValue();
+ bindings.put(key, value);
+
+ if (log.isDebugEnabled()) {
+ log.debug("add constant " + key + '=' + value);
+ }
+ }
+ bindings.put(variable, 1);
+
+ try {
+ engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
+ Double o = (Double) engine.eval("parseFloat(" + relation + ")");
+ if (log.isDebugEnabled()) {
+ log.debug("evaluation ok : " + relation + " (" + variable + "=1) = " + o);
+ }
+ result = true;
+ } catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug("evalution ko : " + relation + ", reason : " + e.getMessage());
+ }
+ }
+ }
+ return result;
+ }
+
+
+}
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthLengthParameterDto.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthLengthParameterDto.java
new file mode 100644
index 0000000..7de2353
--- /dev/null
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthLengthParameterDto.java
@@ -0,0 +1,48 @@
+package fr.ird.observe.services.dto.referential;
+
+import java.util.Map;
+
+public class LengthLengthParameterDto extends GeneratedLengthLengthParameterDto implements FormulaHelper.FormulaSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, Double> coefficients;
+
+ @Override
+ public void setCoefficients(String coefficients) {
+ super.setCoefficients(coefficients);
+ this.coefficients = null;
+ revalidateFormulaOne();
+ revalidateFormulaTwo();
+ }
+
+ @Override
+ public void setInputOutputFormula(String inputOutputFormula) {
+ super.setInputOutputFormula(inputOutputFormula);
+ revalidateFormulaOne();
+ }
+
+ @Override
+ public void setOutputInputFormula(String outputInputFormula) {
+ super.setOutputInputFormula(outputInputFormula);
+ revalidateFormulaTwo();
+ }
+
+ public void revalidateFormulaOne() {
+ boolean result = FormulaHelper.validateRelation(this, inputOutputFormula, FormulaHelper.VARIABLE_INPUT);
+ setInputOutputFormulaValid(result);
+ }
+
+ public void revalidateFormulaTwo() {
+ boolean result = FormulaHelper.validateRelation(this, outputInputFormula, FormulaHelper.VARIABLE_OUTPUT);
+ setOutputInputFormulaValid(result);
+ }
+
+ @Override
+ public Map<String, Double> getCoefficientValues() {
+ if (coefficients == null) {
+ coefficients = FormulaHelper.getCoefficientValues(this);
+ }
+ return coefficients;
+ }
+}
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthWeightParameterDto.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthWeightParameterDto.java
new file mode 100644
index 0000000..37ddde3
--- /dev/null
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/LengthWeightParameterDto.java
@@ -0,0 +1,48 @@
+package fr.ird.observe.services.dto.referential;
+
+import java.util.Map;
+
+public class LengthWeightParameterDto extends GeneratedLengthWeightParameterDto implements FormulaHelper.FormulaSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, Double> coefficients;
+
+ @Override
+ public void setCoefficients(String coefficients) {
+ super.setCoefficients(coefficients);
+ this.coefficients = null;
+ revalidateFormulaOne();
+ revalidateFormulaTwo();
+ }
+
+ @Override
+ public void setLengthWeightFormula(String value) {
+ super.setLengthWeightFormula(value);
+ revalidateFormulaOne();
+ }
+
+ @Override
+ public void setWeightLengthFormula(String value) {
+ super.setWeightLengthFormula(value);
+ revalidateFormulaTwo();
+ }
+
+ public void revalidateFormulaOne() {
+ boolean result = FormulaHelper.validateRelation(this, lengthWeightFormula, FormulaHelper.VARIABLE_LENGTH);
+ setLengthWeightFormulaValid(result);
+ }
+
+ public void revalidateFormulaTwo() {
+ boolean result = FormulaHelper.validateRelation(this, weightLengthFormula, FormulaHelper.VARIABLE_WEIGHT);
+ setWeightLengthFormulaValid(result);
+ }
+
+ @Override
+ public Map<String, Double> getCoefficientValues() {
+ if (coefficients == null) {
+ coefficients = FormulaHelper.getCoefficientValues(this);
+ }
+ return coefficients;
+ }
+}
diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialHelper.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialHelper.java
index d50f683..8bce538 100644
--- a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialHelper.java
+++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/ReferentialHelper.java
@@ -82,6 +82,7 @@ public class ReferentialHelper extends GeneratedReferentialHelper {
PersonDto.class,
OceanDto.class,
OrganismDto.class,
+ LengthLengthParameterDto.class,
LengthWeightParameterDto.class,
ProgramDto.class,
GearCaracteristicTypeDto.class,
diff --git a/services-dto/src/main/xmi/observe-services-dto-common.zargo b/services-dto/src/main/xmi/observe-services-dto-common.zargo
index 75fc35e..9a4b98d 100644
Binary files a/services-dto/src/main/xmi/observe-services-dto-common.zargo and b/services-dto/src/main/xmi/observe-services-dto-common.zargo differ
diff --git a/services-dto/src/main/xmi/observe-services-dto-seine.zargo b/services-dto/src/main/xmi/observe-services-dto-seine.zargo
index 5e95186..1530f0d 100644
Binary files a/services-dto/src/main/xmi/observe-services-dto-seine.zargo and b/services-dto/src/main/xmi/observe-services-dto-seine.zargo differ
diff --git a/services-dto/src/main/xmi/observe-services-dto.ini b/services-dto/src/main/xmi/observe-services-dto.ini
index 7d799cf..716637e 100644
--- a/services-dto/src/main/xmi/observe-services-dto.ini
+++ b/services-dto/src/main/xmi/observe-services-dto.ini
@@ -149,10 +149,15 @@ gearCaracteristicType.attributeGeneric = fr.ird.observe.services.dto.referential
[class fr.ird.observe.services.dto.referential.Harbour]
country.attributeGeneric = fr.ird.observe.services.dto.referential.Country
+[class fr.ird.observe.services.dto.referential.LengthLengthParameter]
+inpuSizeMeasureType.attributeGeneric = fr.ird.observe.services.dto.referential.SizeMeasureType
+outputSizeMeasureType.attributeGeneric = fr.ird.observe.services.dto.referential.SizeMeasureType
+
[class fr.ird.observe.services.dto.referential.LengthWeightParameter]
ocean.attributeGeneric = fr.ird.observe.services.dto.referential.Ocean
sex.attributeGeneric = fr.ird.observe.services.dto.referential.Sex
species.attributeGeneric = fr.ird.observe.services.dto.referential.Species
+sizeMeasureType.attributeGeneric = fr.ird.observe.services.dto.referential.SizeMeasureType
[class fr.ird.observe.services.dto.referential.Organism]
country.attributeGeneric = fr.ird.observe.services.dto.referential.Country
@@ -215,9 +220,10 @@ species.attributeGeneric = fr.ird.observe.services.dto.referential.SpeciesDto
speciesFate.attributeGeneric = fr.ird.observe.services.dto.referential.seine.SpeciesFateDto
[class fr.ird.observe.services.dto.seine.NonTargetLength]
-sex.attributeGeneric = fr.ird.observe.services.dto.referential.SexDto
-species.attributeGeneric = fr.ird.observe.services.dto.referential.SpeciesDto
-speciesFate.attributeGeneric = fr.ird.observe.services.dto.referential.seine.SpeciesFateDto
+sex.attributeGeneric = fr.ird.observe.services.dto.referential.Sex
+species.attributeGeneric = fr.ird.observe.services.dto.referential.Species
+speciesFate.attributeGeneric = fr.ird.observe.services.dto.referential.seine.SpeciesFate
+sizeMeasureType.attributeGeneric = fr.ird.observe.services.dto.referential.SizeMeasureType
[class fr.ird.observe.services.dto.seine.NonTargetSample]
nonTargetLength.unique = true
diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderEngineInitializer.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderEngineInitializer.java
index cae8aa9..c3cd0dd 100644
--- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderEngineInitializer.java
+++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderEngineInitializer.java
@@ -49,6 +49,7 @@ import fr.ird.observe.entities.referentiel.Gear;
import fr.ird.observe.entities.referentiel.GearCaracteristic;
import fr.ird.observe.entities.referentiel.GearCaracteristicType;
import fr.ird.observe.entities.referentiel.Harbour;
+import fr.ird.observe.entities.referentiel.LengthLengthParameter;
import fr.ird.observe.entities.referentiel.LengthWeightParameter;
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
import fr.ird.observe.entities.referentiel.Ocean;
@@ -57,12 +58,14 @@ import fr.ird.observe.entities.referentiel.Person;
import fr.ird.observe.entities.referentiel.Program;
import fr.ird.observe.entities.referentiel.Sex;
import fr.ird.observe.entities.referentiel.ShipOwner;
+import fr.ird.observe.entities.referentiel.SizeMeasureType;
import fr.ird.observe.entities.referentiel.Species;
import fr.ird.observe.entities.referentiel.SpeciesGroup;
import fr.ird.observe.entities.referentiel.SpeciesList;
import fr.ird.observe.entities.referentiel.Vessel;
import fr.ird.observe.entities.referentiel.VesselSizeCategory;
import fr.ird.observe.entities.referentiel.VesselType;
+import fr.ird.observe.entities.referentiel.WeightMeasureType;
import fr.ird.observe.entities.referentiel.longline.BaitHaulingStatus;
import fr.ird.observe.entities.referentiel.longline.BaitSettingStatus;
import fr.ird.observe.entities.referentiel.longline.BaitType;
@@ -83,11 +86,9 @@ import fr.ird.observe.entities.referentiel.longline.SensorBrand;
import fr.ird.observe.entities.referentiel.longline.SensorDataFormat;
import fr.ird.observe.entities.referentiel.longline.SensorType;
import fr.ird.observe.entities.referentiel.longline.SettingShape;
-import fr.ird.observe.entities.referentiel.SizeMeasureType;
import fr.ird.observe.entities.referentiel.longline.StomacFullness;
import fr.ird.observe.entities.referentiel.longline.TripType;
import fr.ird.observe.entities.referentiel.longline.VesselActivityLongline;
-import fr.ird.observe.entities.referentiel.WeightMeasureType;
import fr.ird.observe.entities.referentiel.seine.DetectionMode;
import fr.ird.observe.entities.referentiel.seine.ObjectFate;
import fr.ird.observe.entities.referentiel.seine.ObjectOperation;
@@ -159,6 +160,7 @@ import fr.ird.observe.services.dto.referential.GearCaracteristicDto;
import fr.ird.observe.services.dto.referential.GearCaracteristicTypeDto;
import fr.ird.observe.services.dto.referential.GearDto;
import fr.ird.observe.services.dto.referential.HarbourDto;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
import fr.ird.observe.services.dto.referential.LengthWeightParameterDto;
import fr.ird.observe.services.dto.referential.OceanDto;
import fr.ird.observe.services.dto.referential.OrganismDto;
@@ -167,12 +169,14 @@ import fr.ird.observe.services.dto.referential.ProgramDto;
import fr.ird.observe.services.dto.referential.ReferentialDto;
import fr.ird.observe.services.dto.referential.SexDto;
import fr.ird.observe.services.dto.referential.ShipOwnerDto;
+import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto;
import fr.ird.observe.services.dto.referential.SpeciesDto;
import fr.ird.observe.services.dto.referential.SpeciesGroupDto;
import fr.ird.observe.services.dto.referential.SpeciesListDto;
import fr.ird.observe.services.dto.referential.VesselDto;
import fr.ird.observe.services.dto.referential.VesselSizeCategoryDto;
import fr.ird.observe.services.dto.referential.VesselTypeDto;
+import fr.ird.observe.services.dto.referential.WeightMeasureTypeDto;
import fr.ird.observe.services.dto.referential.longline.BaitHaulingStatusDto;
import fr.ird.observe.services.dto.referential.longline.BaitSettingStatusDto;
import fr.ird.observe.services.dto.referential.longline.BaitTypeDto;
@@ -193,11 +197,9 @@ import fr.ird.observe.services.dto.referential.longline.SensorBrandDto;
import fr.ird.observe.services.dto.referential.longline.SensorDataFormatDto;
import fr.ird.observe.services.dto.referential.longline.SensorTypeDto;
import fr.ird.observe.services.dto.referential.longline.SettingShapeDto;
-import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto;
import fr.ird.observe.services.dto.referential.longline.StomacFullnessDto;
import fr.ird.observe.services.dto.referential.longline.TripTypeDto;
import fr.ird.observe.services.dto.referential.longline.VesselActivityLonglineDto;
-import fr.ird.observe.services.dto.referential.WeightMeasureTypeDto;
import fr.ird.observe.services.dto.referential.seine.DetectionModeDto;
import fr.ird.observe.services.dto.referential.seine.ObjectFateDto;
import fr.ird.observe.services.dto.referential.seine.ObjectOperationDto;
@@ -312,6 +314,7 @@ import fr.ird.observe.services.topia.binder.referential.HookSizeBinder;
import fr.ird.observe.services.topia.binder.referential.HookTypeBinder;
import fr.ird.observe.services.topia.binder.referential.ItemHorizontalPositionBinder;
import fr.ird.observe.services.topia.binder.referential.ItemVerticalPositionBinder;
+import fr.ird.observe.services.topia.binder.referential.LengthLengthParameterBinder;
import fr.ird.observe.services.topia.binder.referential.LengthWeightParameterBinder;
import fr.ird.observe.services.topia.binder.referential.LightsticksColorBinder;
import fr.ird.observe.services.topia.binder.referential.LightsticksTypeBinder;
@@ -483,6 +486,12 @@ class BinderEngineInitializer implements ObserveModelInitializer {
}
@Override
+ public void initLengthLengthParameterDto() {
+ referentialDtoToEntityTypeBuilder.put(LengthLengthParameterDto.class, LengthLengthParameter.class);
+ referentialBinderBuilder.put(LengthLengthParameterDto.class, new LengthLengthParameterBinder());
+ }
+
+ @Override
public void initSaveResultDto() {
}
diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthLengthParameterBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthLengthParameterBinder.java
new file mode 100644
index 0000000..4e1ec7b
--- /dev/null
+++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthLengthParameterBinder.java
@@ -0,0 +1,92 @@
+package fr.ird.observe.services.topia.binder.referential;
+
+/*-
+ * #%L
+ * ObServe :: Services ToPIA Implementation
+ * %%
+ * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ird.observe.entities.referentiel.LengthLengthParameter;
+import fr.ird.observe.entities.referentiel.SizeMeasureType;
+import fr.ird.observe.services.dto.constants.ReferentialLocale;
+import fr.ird.observe.services.dto.referential.LengthLengthParameterDto;
+import fr.ird.observe.services.dto.referential.ReferentialReference;
+import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto;
+
+/**
+ * Created on 24/11/15.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ */
+public class LengthLengthParameterBinder extends ReferentialBinderSupport<LengthLengthParameter, LengthLengthParameterDto> {
+
+ public LengthLengthParameterBinder() {
+ super(LengthLengthParameter.class, LengthLengthParameterDto.class);
+ }
+
+ @Override
+ public void copyToEntity(ReferentialLocale referentialLocale, LengthLengthParameterDto dto, LengthLengthParameter entity) {
+
+ copyDtoReferentialFieldsToEntity(dto, entity);
+ entity.setInputOutputFormula(dto.getInputOutputFormula());
+ entity.setOutputInputFormula(dto.getOutputInputFormula());
+ entity.setInputSizeMeasureType(toEntity(dto.getInputSizeMeasureType(), SizeMeasureType.class));
+ entity.setOutputSizeMeasureType(toEntity(dto.getOutputSizeMeasureType(), SizeMeasureType.class));
+ entity.setCoefficients(dto.getCoefficients());
+ entity.setSource(dto.getSource());
+
+ }
+
+ @Override
+ public void copyToDto(ReferentialLocale referentialLocale, LengthLengthParameter entity, LengthLengthParameterDto dto) {
+
+ copyEntityReferentialFieldsToDto(entity, dto);
+ dto.setInputOutputFormula(entity.getInputOutputFormula());
+ dto.setOutputInputFormula(entity.getOutputInputFormula());
+ dto.setInputSizeMeasureType(toReferentialReference(referentialLocale, entity.getInputSizeMeasureType(), SizeMeasureTypeDto.class));
+ dto.setOutputSizeMeasureType(toReferentialReference(referentialLocale, entity.getOutputSizeMeasureType(), SizeMeasureTypeDto.class));
+ dto.setCoefficients(entity.getCoefficients());
+ dto.setSource(entity.getSource());
+
+ }
+
+ @Override
+ public ReferentialReference<LengthLengthParameterDto> toReferentialReference(ReferentialLocale referentialLocale, LengthLengthParameter entity) {
+
+ return toReferentialReference(entity,
+ entity.getCode(),
+ getLabel(referentialLocale, entity.getInputSizeMeasureType()),
+ getLabel(referentialLocale, entity.getOutputSizeMeasureType()),
+ entity.getInputOutputFormula(),
+ entity.getOutputInputFormula());
+
+ }
+
+ @Override
+ public ReferentialReference<LengthLengthParameterDto> toReferentialReference(ReferentialLocale referentialLocale, LengthLengthParameterDto dto) {
+
+ return toReferentialReference(dto,
+ dto.getCode(),
+ getLabel(referentialLocale, dto.getInputSizeMeasureType()),
+ getLabel(referentialLocale, dto.getOutputSizeMeasureType()),
+ dto.getInputOutputFormula(),
+ dto.getOutputInputFormula());
+
+ }
+}
diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthWeightParameterBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthWeightParameterBinder.java
index 6984921..c3b1201 100644
--- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthWeightParameterBinder.java
+++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/LengthWeightParameterBinder.java
@@ -53,6 +53,7 @@ public class LengthWeightParameterBinder extends ReferentialBinderSupport<Length
entity.setSpecies(toEntity(dto.getSpecies(), Species.class));
entity.setOcean(toEntity(dto.getOcean(), Ocean.class));
entity.setSex(toEntity(dto.getSex(), Sex.class));
+ entity.setCoefficients(dto.getCoefficients());
entity.setSource(dto.getSource());
}
@@ -66,6 +67,7 @@ public class LengthWeightParameterBinder extends ReferentialBinderSupport<Length
dto.setSpecies(toReferentialReference(referentialLocale, entity.getSpecies(), SpeciesDto.class));
dto.setOcean(toReferentialReference(referentialLocale, entity.getOcean(), OceanDto.class));
dto.setSex(toReferentialReference(referentialLocale, entity.getSex(), SexDto.class));
+ dto.setCoefficients(entity.getCoefficients());
dto.setSource(entity.getSource());
}
diff --git a/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java b/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java
index 8b84360..303240c 100644
--- a/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java
+++ b/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java
@@ -551,7 +551,7 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements
}
if (computeLength) {
- Float newLength = lengthWeightParameter.computeLength(weight);
+ Float newLength = lengthWeightParameter.computeFromFomulaTwo(weight);
if (newLength != null) {
lengthWeightComputable.setLength(newLength);
@@ -567,7 +567,7 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements
}
// on cherche obligatoirement a calculer le poids
- Float newWeight = lengthWeightParameter.computeWeight(length);
+ Float newWeight = lengthWeightParameter.computeFromFomulaOne(length);
if (newWeight != null) {
lengthWeightComputable.setWeight(newWeight);
@@ -612,7 +612,7 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements
}
if (computeLength) {
- Float newLength = lengthWeightParameter.computeLength(weight);
+ Float newLength = lengthWeightParameter.computeFromFomulaTwo(weight);
if (newLength != null) {
lengthWeightComputable.setLength(newLength);
@@ -626,7 +626,7 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements
}
// on cherche obligatoirement a calculer le poids
- Float newWeight = lengthWeightParameter.computeWeight(length);
+ Float newWeight = lengthWeightParameter.computeFromFomulaOne(length);
if (newWeight != null) {
lengthWeightComputable.setWeight(newWeight);
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
01/14: Ajout LengthLengthParameter et revue de LWParameter (persistence)
by codelutin.com scm 07 Nov '16
by codelutin.com scm 07 Nov '16
07 Nov '16
This is an automated email from the git hooks/post-receive script.
New commit to branch develop in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
commit 63eb6c05c52a3fd8f43f7c44b65adad9a8b2da79
Author: Tony CHEMIT <chemit(a)codelutin.com>
Date: Sat Nov 5 15:29:23 2016 +0100
Ajout LengthLengthParameter et revue de LWParameter (persistence)
---
.../DataSourceMigrationForVersion_5_1.java | 1 +
.../V5_1_18_evol_8404_lengthLengthParameter-H2.sql | 14 +
.../V5_1_18_evol_8404_lengthLengthParameter-PG.sql | 14 +
.../java/fr/ird/observe/entities/Entities.java | 1 +
.../AbstractObserveMigrationCallBack.java | 2 +-
.../entities/referentiel/FormulaHelper.java | 169 +++++++++++
.../entities/referentiel/FormulaSupportImpl.java | 88 ++++++
.../referentiel/LengthLengthParameterImpl.java | 55 ++++
.../referentiel/LengthLengthParameters.java | 12 +
.../referentiel/LengthWeightParameterImpl.java | 110 +------
.../referentiel/LengthWeightParameters.java | 199 +-----------
.../referentiel/LengthWeightParemeterHelper.java | 332 ---------------------
entities/src/main/xmi/observe-common.zargo | Bin 42084 -> 45678 bytes
entities/src/main/xmi/observe-seine.zargo | Bin 86910 -> 87124 bytes
entities/src/main/xmi/observe.ini | 9 +-
.../entities/referentiel/FormulaHelperTest.java | 27 ++
.../LengthWeightParemeterHelperTest.java | 48 ---
17 files changed, 414 insertions(+), 667 deletions(-)
diff --git a/entities-migration/src/main/java/fr/ird/observe/entities/migration/DataSourceMigrationForVersion_5_1.java b/entities-migration/src/main/java/fr/ird/observe/entities/migration/DataSourceMigrationForVersion_5_1.java
index 4b2ce80..683af4d 100644
--- a/entities-migration/src/main/java/fr/ird/observe/entities/migration/DataSourceMigrationForVersion_5_1.java
+++ b/entities-migration/src/main/java/fr/ird/observe/entities/migration/DataSourceMigrationForVersion_5_1.java
@@ -83,6 +83,7 @@ public class DataSourceMigrationForVersion_5_1 extends AbstractObserveMigrationC
addScript("15", "evol_8578_nonTargetLength_add_speciesFate", queries);
addScript("16", "evol_8377_speciesFate_add_discard", queries);
addScript("17", "evol_8376_vesselActivitySeine_add_allowFad", queries);
+ addScript("18", "evol_8404_lengthLengthParameter", queries);
}
private void evol8391(TopiaSqlSupport topiaSqlSupport, List<String> queries) {
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
new file mode 100644
index 0000000..0f7a390
--- /dev/null
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-H2.sql
@@ -0,0 +1,14 @@
+ALTER TABLE observe_seine.nontargetlength ADD COLUMN sizeMeasureType VARCHAR(255);
+ALTER TABLE observe_seine.nontargetlength ADD CONSTRAINT FK_NON_TARGET_LENGTH_SIZE_MEASURE_TYPE FOREIGN KEY(sizeMeasureType) REFERENCES OBSERVE_COMMON.sizemeasuretype(topiaid);
+
+ALTER TABLE observe_common.lengthweightparameter ADD COLUMN sizeMeasureType VARCHAR(255);
+ALTER TABLE observe_common.lengthweightparameter ADD CONSTRAINT FK_LENGTH_WEIGHT_PARAMETER_SIZE_MEASURE_TYPE FOREIGN KEY(sizeMeasureType) REFERENCES OBSERVE_COMMON.sizemeasuretype(topiaid);
+UPDATE observe_common.lengthweightparameter SET sizeMeasureType = ( SELECT sizeMeasureType FROM observe_common.species s WHERE s.topiaId = species);
+
+CREATE TABLE observe_common.lengthlengthparameter ( topiaid VARCHAR(255) PRIMARY KEY NOT NULL, topiaversion BIGINT NOT NULL, inputSizeMeasureType VARCHAR(255) NOT NULL, outputSizeMeasureType VARCHAR(255) NOT NULL, topiacreatedate TIMESTAMP, uri VARCHAR(255), status INTEGER DEFAULT 1, coefficients VARCHAR(255), inputOutputFormula VARCHAR(255), outputInputFormula VARCHAR(255), code VARCHAR(255) DEFAULT 0, needcomment BOOLEAN DEFAULT false, lastupdatedate TIMESTAMP DEFAULT CURRENT_TIMESTAMP [...]
+ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthparameter_inputSizeMeasureType FOREIGN KEY (inputSizeMeasureType) REFERENCES observe_common.sizeMeasureType (topiaid);
+ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthparameter_outputSizeMeasureType FOREIGN KEY (outputSizeMeasureType) REFERENCES observe_common.sizeMeasureType (topiaid);
+
+CREATE INDEX index_observe_common_lengthlengthparameter_lastupdatedate ON observe_common.lengthlengthparameter (lastupdatedate);
+
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
diff --git a/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
new file mode 100644
index 0000000..54f8d18
--- /dev/null
+++ b/entities-migration/src/main/resources/db/migration/5.1/V5_1_18_evol_8404_lengthLengthParameter-PG.sql
@@ -0,0 +1,14 @@
+ALTER TABLE observe_seine.nontargetlength ADD COLUMN sizeMeasureType character varying(255);
+ALTER TABLE observe_seine.nontargetlength ADD CONSTRAINT FK_NON_TARGET_LENGTH_SIZE_MEASURE_TYPE FOREIGN KEY(sizeMeasureType) REFERENCES OBSERVE_COMMON.sizemeasuretype(topiaid);
+
+ALTER TABLE observe_common.lengthweightparameter ADD COLUMN sizeMeasureType character varying(255);
+ALTER TABLE observe_common.lengthweightparameter ADD CONSTRAINT FK_LENGTH_WEIGHT_PARAMETER_SIZE_MEASURE_TYPE FOREIGN KEY(sizeMeasureType) REFERENCES OBSERVE_COMMON.sizemeasuretype(topiaid);
+UPDATE observe_common.lengthweightparameter SET sizeMeasureType = ( SELECT sizeMeasureType FROM observe_common.species s WHERE s.topiaId = species);
+
+CREATE TABLE observe_common.lengthlengthparameter ( topiaid character varying(255) PRIMARY KEY NOT NULL, topiaversion BIGINT NOT NULL, inputSizeMeasureType character varying(255) NOT NULL, outputSizeMeasureType character varying(255) NOT NULL, topiacreatedate TIMESTAMP, uri character varying(255), status INTEGER DEFAULT 1, coefficients character varying(255), inputOutputFormula character varying(255), outputInputFormula character varying(255), code character varying(255) DEFAULT 0, needc [...]
+ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthparameter_inputSizeMeasureType FOREIGN KEY (inputSizeMeasureType) REFERENCES observe_common.sizeMeasureType (topiaid);
+ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthparameter_outputSizeMeasureType FOREIGN KEY (outputSizeMeasureType) REFERENCES observe_common.sizeMeasureType (topiaid);
+
+CREATE INDEX index_observe_common_lengthlengthparameter_lastupdatedate ON lengthlengthparameter (lastupdatedate);
+
+INSERT INTO observe_common.LASTUPDATEDATE (topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.referentiel.LastUpdateDate#666#2', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.LengthLengthParameter', CURRENT_TIMESTAMP);
diff --git a/entities/src/main/java/fr/ird/observe/entities/Entities.java b/entities/src/main/java/fr/ird/observe/entities/Entities.java
index bf66220..33f3682 100644
--- a/entities/src/main/java/fr/ird/observe/entities/Entities.java
+++ b/entities/src/main/java/fr/ird/observe/entities/Entities.java
@@ -65,6 +65,7 @@ public class Entities {
ObserveEntityEnum.SpeciesList,
ObserveEntityEnum.Person,
ObserveEntityEnum.Organism,
+ ObserveEntityEnum.LengthLengthParameter,
ObserveEntityEnum.LengthWeightParameter,
ObserveEntityEnum.Program,
ObserveEntityEnum.GearCaracteristicType,
diff --git a/entities/src/main/java/fr/ird/observe/entities/migration/AbstractObserveMigrationCallBack.java b/entities/src/main/java/fr/ird/observe/entities/migration/AbstractObserveMigrationCallBack.java
index 7dfdcfa..f5838ab 100644
--- a/entities/src/main/java/fr/ird/observe/entities/migration/AbstractObserveMigrationCallBack.java
+++ b/entities/src/main/java/fr/ird/observe/entities/migration/AbstractObserveMigrationCallBack.java
@@ -92,7 +92,7 @@ public abstract class AbstractObserveMigrationCallBack extends TopiaMigrationCal
String migrationScript = prefix + "-" + scriptSuffix + ".sql";
String scriptPath = "/db/migration/";
if (getClass().getName().contains(".old.")) {
- scriptPath += "/old/";
+ scriptPath += "old/";
}
scriptPath += this.version + "/V" + version.getValidName() + "_" + rank + "_" + migrationScript;
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaHelper.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaHelper.java
new file mode 100644
index 0000000..10ea378
--- /dev/null
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaHelper.java
@@ -0,0 +1,169 @@
+package fr.ird.observe.entities.referentiel;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.NumberUtil;
+
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class FormulaHelper {
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(FormulaHelper.class);
+
+ private static final Pattern COEFFICIENTS_PATTERN = Pattern.compile("(.+)=(.+)");
+
+ /** variable weight à utiliser dans la relation taille */
+ public static final String VARIABLE_WEIGHT = "P";
+
+ /** variable taille à utiliser dans la relation weight */
+ public static final String VARIABLE_LENGTH = "L";
+
+ public static final String VARIABLE_INPUT = "I";
+
+ public static final String VARIABLE_OUTPUT = "O";
+
+ public static final String COEFFICIENT_A = "a";
+
+ public static final String COEFFICIENT_B = "b";
+
+ /** moteur d'évaluation d'expression */
+ protected static ScriptEngine scriptEngine;
+
+
+ protected static ScriptEngine getScriptEngine() {
+ if (scriptEngine == null) {
+ ScriptEngineManager factory = new ScriptEngineManager();
+
+ scriptEngine = factory.getEngineByExtension("js");
+ }
+ return scriptEngine;
+ }
+
+ public static Map<String, Double> getCoefficientValues(FormulaSupport parametrage) {
+
+ Map<String, Double> result = new TreeMap<>();
+ String coefficients = parametrage.getCoefficients();
+ if (coefficients != null) {
+ for (String coefficientDef : coefficients.split(":")) {
+ Matcher matcher = COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
+ if (log.isDebugEnabled()) {
+ log.debug("constant to test = " + coefficientDef);
+ }
+ if (matcher.matches()) {
+
+ String key = matcher.group(1);
+ String val = matcher.group(2);
+ try {
+ Double d = Double.valueOf(val);
+ result.put(key, d);
+ if (log.isDebugEnabled()) {
+ log.debug("detects coefficient " + key + '=' + val);
+ }
+ } catch (NumberFormatException e) {
+ // pas pu recupere le count...
+ if (log.isWarnEnabled()) {
+ log.warn("could not parse double " + val + " for coefficient " + key);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ protected static boolean validateRelation(FormulaSupport parametrage, String relation, String variable) {
+ boolean result = false;
+ if (!StringUtils.isEmpty(relation)) {
+
+ Map<String, Double> coeffs = parametrage.getCoefficientValues();
+
+ ScriptEngine engine = getScriptEngine();
+ Bindings bindings = engine.createBindings();
+ for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
+ String key = entry.getKey();
+ Double value = entry.getValue();
+ bindings.put(key, value);
+
+ if (log.isDebugEnabled()) {
+ log.debug("add constant " + key + '=' + value);
+ }
+ }
+ bindings.put(variable, 1);
+
+ try {
+ engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
+ Double o = (Double) engine.eval("parseFloat(" + relation + ")");
+ if (log.isDebugEnabled()) {
+ log.debug("evaluation ok : " + relation + " (" + variable + "=1) = " + o);
+ }
+ result = true;
+ } catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug("evalution ko : " + relation + ", reason : " + e.getMessage());
+ }
+ }
+ }
+ return result;
+ }
+
+ public static Float computeValue(FormulaSupport parametrage, String formula, String coefficientName, String variableName, float data) {
+ if (coefficientName!=null) {
+ Double b = parametrage.getCoefficientValue(coefficientName);
+ if (b == 0) {
+
+ // ce cas limite ne permet pas de calculer la taille a partir du weight
+ return null;
+ }
+ }
+ Float o = computeValue(parametrage, formula, variableName, data);
+
+ if (o != null) {
+ o = NumberUtil.roundOneDigit(o);
+ }
+ return o;
+ }
+
+ private static Float computeValue(FormulaSupport parametrage, String relation, String variable, float taille) {
+ Map<String, Double> coeffs = parametrage.getCoefficientValues();
+ ScriptEngine engine = getScriptEngine();
+ Bindings bindings = engine.createBindings();
+ for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
+ String key = entry.getKey();
+ Double value = entry.getValue();
+ bindings.put(key, value);
+
+ if (log.isDebugEnabled()) {
+ log.debug("add constant " + key + '=' + value);
+ }
+ }
+ bindings.put(variable, taille);
+ engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
+ Double o = null;
+ try {
+ o = (Double) engine.eval("parseFloat(" + relation + ")");
+ } catch (ScriptException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not compute value from " + relation);
+ }
+ }
+ return o == null ? null : o.floatValue();
+ }
+
+
+}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaSupportImpl.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaSupportImpl.java
new file mode 100644
index 0000000..e724013
--- /dev/null
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/FormulaSupportImpl.java
@@ -0,0 +1,88 @@
+package fr.ird.observe.entities.referentiel;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public abstract class FormulaSupportImpl extends FormulaSupportAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, Double> coefficientValues;
+ private Boolean formulaOneValid;
+ private Boolean formulaTwoValid;
+
+ @Override
+ public String getCode() {
+ // pas utilise
+ return null;
+ }
+
+ @Override
+ public void setCode(String code) {
+ // pas utilise
+ }
+
+ @Override
+ public void setCoefficients(String value) {
+ super.setCoefficients(value);
+ coefficientValues = null;
+ revalidateFormulaOne();
+ revalidateFormulaTwo();
+ }
+
+ @Override
+ public Set<String> getCoefficientNames() {
+ return getCoefficientValues().keySet();
+ }
+
+ @Override
+ public Double getCoefficientValue(String coefficientName) {
+ return getCoefficientValues().get(coefficientName);
+ }
+
+ @Override
+ public Map<String, Double> getCoefficientValues() {
+ if (coefficientValues == null) {
+ coefficientValues = FormulaHelper.getCoefficientValues(this);
+ }
+ return coefficientValues;
+ }
+
+
+ @Override
+ public boolean isFormulaOneValid() {
+ if (formulaOneValid == null) {
+ revalidateFormulaOne();
+ }
+ return BooleanUtils.isTrue(formulaOneValid);
+ }
+
+ @Override
+ public boolean isFormulaTwoValid() {
+ if (formulaTwoValid == null) {
+ revalidateFormulaTwo();
+ }
+ return BooleanUtils.isTrue(formulaTwoValid);
+ }
+
+ @Override
+ public void setFormulaOneValid(boolean formulaOneValid) {
+ this.formulaOneValid = formulaOneValid;
+ fireOnPostWrite(PROPERTY_FORMULA_ONE_VALID, null, formulaOneValid);
+ }
+
+ @Override
+ public void setFormulaTwoValid(boolean formulaTwoValid) {
+ this.formulaTwoValid = formulaTwoValid;
+ fireOnPostWrite(PROPERTY_FORMULA_TWO_VALID, null, formulaTwoValid);
+ }
+
+}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterImpl.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterImpl.java
new file mode 100644
index 0000000..4be7a2f
--- /dev/null
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterImpl.java
@@ -0,0 +1,55 @@
+package fr.ird.observe.entities.referentiel;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class LengthLengthParameterImpl extends LengthLengthParameterAbstract {
+
+ @Override
+ public void setInputOutputFormula(String inputOutputFormula) {
+ super.setInputOutputFormula(inputOutputFormula);
+ revalidateFormulaOne();
+ }
+
+ @Override
+ public void setOutputInputFormula(String outputInputFormula) {
+ super.setOutputInputFormula(outputInputFormula);
+ revalidateFormulaTwo();
+ }
+
+ @Override
+ public Float computeFromFomulaOne(float data) {
+ return FormulaHelper.computeValue(this, inputOutputFormula, null, FormulaHelper.VARIABLE_INPUT, data);
+ }
+
+ @Override
+ public Float computeFromFomulaTwo(float data) {
+ return FormulaHelper.computeValue(this, outputInputFormula, FormulaHelper.COEFFICIENT_B, FormulaHelper.VARIABLE_OUTPUT, data);
+ }
+
+ @Override
+ public String getFormulaOne() {
+ return inputOutputFormula;
+ }
+
+ @Override
+ public String getFormulaTwo() {
+ return outputInputFormula;
+ }
+
+ @Override
+ public void revalidateFormulaOne() {
+ boolean result = FormulaHelper.validateRelation(this, inputOutputFormula, FormulaHelper.VARIABLE_INPUT);
+ setFormulaOneValid(result);
+ }
+
+ @Override
+ public void revalidateFormulaTwo() {
+ boolean result = FormulaHelper.validateRelation(this, outputInputFormula, FormulaHelper.VARIABLE_OUTPUT);
+ setFormulaTwoValid(result);
+ }
+
+}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java
new file mode 100644
index 0000000..d24f086
--- /dev/null
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java
@@ -0,0 +1,12 @@
+package fr.ird.observe.entities.referentiel;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class LengthLengthParameters {
+
+
+}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameterImpl.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameterImpl.java
index 72ba143..8b1c687 100644
--- a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameterImpl.java
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameterImpl.java
@@ -21,127 +21,49 @@
*/
package fr.ird.observe.entities.referentiel;
-import java.util.Map;
-import java.util.Set;
-
public class LengthWeightParameterImpl extends LengthWeightParameterAbstract {
- private static final long serialVersionUID = 1L;
-
- protected Map<String, Double> coefficientValues;
-
- protected Boolean lengthWeightFormulaValid;
-
- protected Boolean weightLengthFormulaValid;
-
- //FIXME not generated with maven-release ?
- public static final String PROPERTY_LENGTH_WEIGHT_FORMULA_VALID = "lengthWeightFormulaValid";
-
- //FIXME not generated with maven-release ?
- public static final String PROPERTY_WEIGHT_LENGTH_FORMULA_VALID = "weightLengthFormulaValid";
-
- @Override
- public String getCode() {
- // pas utilise
- return null;
- }
-
- @Override
- public void setCode(String code) {
- // pas utilise
- }
-
- @Override
- public void setCoefficients(String value) {
- super.setCoefficients(value);
- coefficientValues = null;
- revalidateRelationPoids();
- revalidateRelationTaille();
- }
-
- @Override
- public Set<String> getCoefficientNames() {
- return getCoefficientValues().keySet();
- }
-
- @Override
- public Double getCoefficientValue(String coefficientName) {
- return getCoefficientValues().get(coefficientName);
- }
-
- @Override
- public Map<String, Double> getCoefficientValues() {
- if (coefficientValues == null) {
- coefficientValues =
- LengthWeightParemeterHelper.getCoefficientValues(this);
- }
- return coefficientValues;
- }
-
@Override
public void setLengthWeightFormula(String value) {
super.setLengthWeightFormula(value);
- revalidateRelationPoids();
+ revalidateFormulaOne();
}
@Override
public void setWeightLengthFormula(String value) {
super.setWeightLengthFormula(value);
- revalidateRelationTaille();
+ revalidateFormulaTwo();
}
@Override
- public boolean isLengthWeightFormulaValid() {
- if (lengthWeightFormulaValid == null) {
- revalidateRelationPoids();
- }
- return lengthWeightFormulaValid != null && lengthWeightFormulaValid;
+ public void revalidateFormulaOne() {
+ boolean result = FormulaHelper.validateRelation(this, getLengthWeightFormula(), FormulaHelper.VARIABLE_LENGTH);
+ setFormulaOneValid(result);
}
@Override
- public boolean isWeightLengthFormulaValid() {
- if (weightLengthFormulaValid == null) {
- revalidateRelationTaille();
- }
- return weightLengthFormulaValid != null && weightLengthFormulaValid;
+ public void revalidateFormulaTwo() {
+ boolean result = FormulaHelper.validateRelation(this, getWeightLengthFormula(), FormulaHelper.VARIABLE_WEIGHT);
+ setFormulaTwoValid(result);
}
@Override
- public void setLengthWeightFormulaValid(boolean lengthWeightFormulaValid) {
- this.lengthWeightFormulaValid = lengthWeightFormulaValid;
- fireOnPostWrite(PROPERTY_LENGTH_WEIGHT_FORMULA_VALID, null, lengthWeightFormulaValid);
+ public String getFormulaOne() {
+ return lengthWeightFormula;
}
@Override
- public void setWeightLengthFormulaValid(boolean weightLengthFormulaValid) {
- this.weightLengthFormulaValid = weightLengthFormulaValid;
- fireOnPostWrite(PROPERTY_WEIGHT_LENGTH_FORMULA_VALID, null, weightLengthFormulaValid);
+ public String getFormulaTwo() {
+ return weightLengthFormula;
}
@Override
- public Float computeWeight(float length) {
- return LengthWeightParemeterHelper.computeWeight(this, length);
+ public Float computeFromFomulaOne(float data) {
+ return FormulaHelper.computeValue(this, lengthWeightFormula, null, FormulaHelper.VARIABLE_LENGTH, data);
}
@Override
- public Float computeLength(float weight) {
- return LengthWeightParemeterHelper.computeLength(this, weight);
- }
-
- protected void revalidateRelationPoids() {
- lengthWeightFormulaValid = null;
-
- // validate equation
- boolean result = LengthWeightParemeterHelper.validateWeightRelation(this);
- setLengthWeightFormulaValid(result);
+ public Float computeFromFomulaTwo(float data) {
+ return FormulaHelper.computeValue(this, weightLengthFormula, FormulaHelper.COEFFICIENT_B, FormulaHelper.VARIABLE_WEIGHT, data);
}
-
- protected void revalidateRelationTaille() {
- weightLengthFormulaValid = null;
-
- // validate equation
- boolean result = LengthWeightParemeterHelper.validateLengthRelation(this);
- setWeightLengthFormulaValid(result);
- }
-
}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameters.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameters.java
index 0a83fee..a8c3c76 100644
--- a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameters.java
+++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameters.java
@@ -24,25 +24,12 @@ package fr.ird.observe.entities.referentiel;
import fr.ird.observe.ObserveTopiaDaoSupplier;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.NumberUtil;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* Created on 28/08/15.
@@ -51,33 +38,6 @@ import java.util.regex.Pattern;
*/
public class LengthWeightParameters {
- /** Logger. */
- private static final Log log = LogFactory.getLog(LengthWeightParameters.class);
-
- private static final Pattern COEFFICIENTS_PATTERN = Pattern.compile("(.+)=(.+)");
-
- /** moteur d'évaluation d'expression */
- protected static ScriptEngine scriptEngine;
-
- /** variable weight à utiliser dans la relation taille */
- public static final String VARIABLE_POIDS = "P";
-
- /** variable taille à utiliser dans la relation weight */
- public static final String VARIABLE_TAILLE = "L";
-
- private static final String COEFFICIENT_A = "a";
-
- private static final String COEFFICIENT_B = "b";
-
- protected static ScriptEngine getScriptEngine() {
- if (scriptEngine == null) {
- ScriptEngineManager factory = new ScriptEngineManager();
-
- scriptEngine = factory.getEngineByExtension("js");
- }
- return scriptEngine;
- }
-
/**
* Recherche d'un {@link LengthWeightParameter} à partir des paramètres donnés.
*
@@ -149,6 +109,7 @@ public class LengthWeightParameters {
return list.get(0);
}
+
/**
* Recherche de la liste des {@link LengthWeightParameter} à partir des paramètres donnés.
*
@@ -237,90 +198,7 @@ public class LengthWeightParameters {
return daoSupplier.getSexDao().forCodeEquals("0").findUnique();
}
- public static Map<String, Double> getCoefficientValues(LengthWeightParameter parametrage) {
-
- Map<String, Double> result = new TreeMap<>();
- String coefficients = parametrage.getCoefficients();
- if (coefficients != null) {
- for (String coefficientDef : coefficients.split(":")) {
- Matcher matcher = COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
- if (log.isDebugEnabled()) {
- log.debug("constant to test = " + coefficientDef);
- }
- if (matcher.matches()) {
-
- String key = matcher.group(1);
- String val = matcher.group(2);
- try {
- Double d = Double.valueOf(val);
- result.put(key, d);
- if (log.isDebugEnabled()) {
- log.debug("detects coefficient " + key + '=' + val);
- }
- } catch (NumberFormatException e) {
- // pas pu recupere le count...
- if (log.isWarnEnabled()) {
- log.warn("could not parse dou" + COEFFICIENT_B + "le " + val + " for coefficient " + key);
- }
- }
- }
- }
- }
- return result;
- }
-
- public static boolean validateWeightRelation(LengthWeightParameter parametrage) {
- return validateRelation(parametrage,
- parametrage.getLengthWeightFormula(),
- VARIABLE_TAILLE
- );
- }
-
- public static boolean validateLengthRelation(LengthWeightParameter parametrage) {
- return validateRelation(parametrage,
- parametrage.getWeightLengthFormula(),
- VARIABLE_POIDS
- );
- }
-
- public static Float computeLength(LengthWeightParameter parametrage,
- float weight) {
- Double b = parametrage.getCoefficientValue(COEFFICIENT_B);
- if (b == 0) {
-
- // ce cas limite ne permet pas de calculer la taille a partir du weight
- return null;
- }
- Float o = computeValue(parametrage,
- parametrage.getWeightLengthFormula(),
- VARIABLE_POIDS,
- weight
- );
-
- if (o != null) {
- o = NumberUtil.roundOneDigit(o);
- }
- return o;
- }
-
- public static Float computeWeight(LengthWeightParameter parametrage,
- float taille) {
-
- Float o = computeValue(parametrage,
- parametrage.getLengthWeightFormula(),
- VARIABLE_TAILLE,
- taille
- );
-
- if (o != null) {
- o = NumberUtil.roundTwoDigits(o);
- }
- return o;
- }
-
- @SuppressWarnings({"unchecked"})
- public static List<LengthWeightParameter> findBySpecies(ObserveTopiaDaoSupplier daoSupplier,
- Species species) {
+ public static List<LengthWeightParameter> findBySpecies(ObserveTopiaDaoSupplier daoSupplier, Species species) {
LengthWeightParameterTopiaDao dao = daoSupplier.getLengthWeightParameterDao();
@@ -330,13 +208,13 @@ public class LengthWeightParameters {
Iterator<LengthWeightParameter> itr = list.iterator();
while (itr.hasNext()) {
LengthWeightParameter p = itr.next();
- Double a = p.getCoefficientValue(COEFFICIENT_A);
+ Double a = p.getCoefficientValue(FormulaHelper.COEFFICIENT_A);
if (a == null || a == 0) {
itr.remove();
continue;
}
- Double b = p.getCoefficientValue(COEFFICIENT_B);
+ Double b = p.getCoefficientValue(FormulaHelper.COEFFICIENT_B);
// on autorise d'avoir b à 0 (mais cela ne permet plus de calculer la taille à partir du poids)
// if (b == null || b == 0) {
if (b == null) {
@@ -384,7 +262,7 @@ public class LengthWeightParameters {
for (LengthWeightParameter parametrageLengthWeight : list) {
if (parametrageLengthWeight.getStartDate().before(startDate) ||
- parametrageLengthWeight.getStartDate().equals(startDate)) {
+ parametrageLengthWeight.getStartDate().equals(startDate)) {
result.add(parametrageLengthWeight);
}
}
@@ -412,8 +290,8 @@ public class LengthWeightParameters {
Date date = parametrageLengthWeight.getEndDate();
if (date == null ||
- date.after(endDate) ||
- date.equals(endDate)) {
+ date.after(endDate) ||
+ date.equals(endDate)) {
result.add(parametrageLengthWeight);
}
}
@@ -421,65 +299,4 @@ public class LengthWeightParameters {
return result;
}
- protected static boolean validateRelation(LengthWeightParameter parametrage, String relation, String variable) {
- boolean result = false;
- if (!StringUtils.isEmpty(relation)) {
-
- Map<String, Double> coeffs = parametrage.getCoefficientValues();
-
- ScriptEngine engine = getScriptEngine();
- Bindings bindings = engine.createBindings();
- for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
- String key = entry.getKey();
- Double value = entry.getValue();
- bindings.put(key, value);
-
- if (log.isDebugEnabled()) {
- log.debug("add constant " + key + '=' + value);
- }
- }
- bindings.put(variable, 1);
-
- try {
- engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
- Double o = (Double) engine.eval("parseFloat(" + relation + ")");
- if (log.isDebugEnabled()) {
- log.debug("evaluation ok : " + relation + " (" + variable + "=1) = " + o);
- }
- result = true;
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("evalution ko : " + relation + ", reason : " + e.getMessage());
- }
- }
- }
- return result;
- }
-
- public static Float computeValue(LengthWeightParameter parametrage, String relation, String variable, float taille) {
- Map<String, Double> coeffs = parametrage.getCoefficientValues();
- ScriptEngine engine = getScriptEngine();
- Bindings bindings = engine.createBindings();
- for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
- String key = entry.getKey();
- Double value = entry.getValue();
- bindings.put(key, value);
-
- if (log.isDebugEnabled()) {
- log.debug("add constant " + key + '=' + value);
- }
- }
- bindings.put(variable, taille);
- engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
- Double o = null;
- try {
- o = (Double) engine.eval("parseFloat(" + relation + ")");
- } catch (ScriptException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not compute value from " + relation);
- }
- }
- return o == null ? null : o.floatValue();
- }
-
}
diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelper.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelper.java
deleted file mode 100644
index 7460c18..0000000
--- a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelper.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * #%L
- * ObServe :: Entities
- * %%
- * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package fr.ird.observe.entities.referentiel;
-
-import fr.ird.observe.ObserveTopiaPersistenceContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaDao;
-import org.nuiton.util.NumberUtil;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Classe utilitaire pour les traitements communs des implantations de
- * {@link LengthWeightParameter}.
- *
- * @author Tony Chemit - chemit(a)codelutin.com
- * @since 1.5
- * @deprecated Utiliser à la place LengthWeightParemeters
- */
-@Deprecated
-public class LengthWeightParemeterHelper {
-
- private static final Pattern COEFFICIENTS_PATTERN =
- Pattern.compile("(.+)=(.+)");
-
- /** Logger */
- private static final Log log =
- LogFactory.getLog(LengthWeightParemeterHelper.class);
-
- /** moteur d'évaluation d'expression */
- protected static ScriptEngine scriptEngine;
-
- /** variable weight à utiliser dans la relation taille */
- public static final String VARIABLE_POIDS = "P";
-
- /** variable taille à utiliser dans la relation weight */
- public static final String VARIABLE_TAILLE = "L";
-
- private static final String COEFFICIENT_A = "a";
-
- private static final String COEFFICIENT_B = "b";
-
- protected static ScriptEngine getScriptEngine() {
- if (scriptEngine == null) {
- ScriptEngineManager factory = new ScriptEngineManager();
-
- scriptEngine = factory.getEngineByExtension("js");
- }
- return scriptEngine;
- }
-
- public static Map<String, Double> getCoefficientValues(LengthWeightParameter parametrage) {
-
- Map<String, Double> result = new TreeMap<>();
- String coefficients = parametrage.getCoefficients();
- if (coefficients != null) {
- for (String coefficientDef : coefficients.split(":")) {
- Matcher matcher = COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
- if (log.isDebugEnabled()) {
- log.debug("constant to test = " + coefficientDef);
- }
- if (matcher.matches()) {
-
- String key = matcher.group(1);
- String val = matcher.group(2);
- try {
- Double d = Double.valueOf(val);
- result.put(key, d);
- if (log.isDebugEnabled()) {
- log.debug("detects coefficient " + key + '=' + val);
- }
- } catch (NumberFormatException e) {
- // pas pu recupere le count...
- if (log.isWarnEnabled()) {
- log.warn("could not parse dou" + COEFFICIENT_B + "le " + val + " for coefficient " + key);
- }
- }
- }
- }
- }
- return result;
- }
-
- public static boolean validateWeightRelation(LengthWeightParameter parametrage) {
- return validateRelation(parametrage,
- parametrage.getLengthWeightFormula(),
- VARIABLE_TAILLE
- );
- }
-
- public static boolean validateLengthRelation(LengthWeightParameter parametrage) {
- return validateRelation(parametrage,
- parametrage.getWeightLengthFormula(),
- VARIABLE_POIDS
- );
- }
-
- public static Float computeLength(LengthWeightParameter parametrage,
- float weight) {
- Double b = parametrage.getCoefficientValue(COEFFICIENT_B);
- if (b == 0) {
-
- // ce cas limite ne permet pas de calculer la taille a partir du weight
- return null;
- }
- Float o = computeValue(parametrage,
- parametrage.getWeightLengthFormula(),
- VARIABLE_POIDS,
- weight
- );
-
- if (o != null) {
- o = NumberUtil.roundOneDigit(o);
- }
- return o;
- }
-
- public static Float computeWeight(LengthWeightParameter parametrage,
- float taille) {
-
- Float o = computeValue(parametrage,
- parametrage.getLengthWeightFormula(),
- VARIABLE_TAILLE,
- taille
- );
-
- if (o != null) {
- o = NumberUtil.roundTwoDigits(o);
- }
- return o;
- }
-
- @SuppressWarnings({"unchecked"})
- public static <P extends LengthWeightParameter> List<P> findBySpecies(ObserveTopiaPersistenceContext tx,
- Species taillePoidsAble) {
-
- // le type de resultat recherche
- Class<P> entityClass = (Class<P>) LengthWeightParameter.class;
-
- TopiaDao<P> dao = tx.getDao(entityClass);
-
- List<P> list = dao.forProperties(LengthWeightParameter.PROPERTY_SPECIES, taillePoidsAble).findAll();
-
- // on supprime les paramétrages qui ont a=0 ou a=null ou b=0 ou b = null
- Iterator<P> itr = list.iterator();
- while (itr.hasNext()) {
- P p = itr.next();
- Double a = p.getCoefficientValue(COEFFICIENT_A);
- if (a == null || a == 0) {
- itr.remove();
- continue;
- }
-
- Double b = p.getCoefficientValue(COEFFICIENT_B);
- // on autorise d'avoir b à 0 (mais cela ne permet plus de calculer la taille à partir du poids)
-// if (b == null || b == 0) {
- if (b == null) {
- itr.remove();
- }
- }
- return list;
-
- }
-
- public static <P extends LengthWeightParameter> List<P> filterByOcean(List<P> list, Ocean ocean) {
- List<P> result = new ArrayList<>();
- if (ocean == null) {
-
- // on n'accepte que les parametrage sans ocean
- for (P parametrageLengthWeight : list) {
- if (parametrageLengthWeight.getOcean() == null) {
- result.add(parametrageLengthWeight);
- }
- }
- } else {
- for (P parametrageLengthWeight : list) {
- if (ocean.equals(parametrageLengthWeight.getOcean())) {
- result.add(parametrageLengthWeight);
- }
- }
- }
- return result;
- }
-
- public static <P extends LengthWeightParameter> List<P> filterBySexe(List<P> list, Sex sex) {
- List<P> result = new ArrayList<>();
-
- for (P parametrageLengthWeight : list) {
- if (parametrageLengthWeight.getSex() == sex) {
- result.add(parametrageLengthWeight);
- }
- }
- return result;
- }
-
- public static <P extends LengthWeightParameter> List<P> filterByDateDebutValidite(List<P> list, Date startDate) {
- List<P> result = new ArrayList<>();
-
- for (P parametrageLengthWeight : list) {
-
- if (parametrageLengthWeight.getStartDate().before(startDate) ||
- parametrageLengthWeight.getStartDate().equals(startDate)) {
- result.add(parametrageLengthWeight);
- }
- }
- return result;
- }
-
- public static <P extends LengthWeightParameter> List<P> filterByDateFinValidite(List<P> list, Date endDate) {
- List<P> result = new ArrayList<>();
-
- if (endDate == null) {
- // on n'accepte que les parametrages selon les critères suivants :
- // - sans date de fin (i.e en cours de validite)
- for (P parametrageLengthWeight : list) {
-
- Date date = parametrageLengthWeight.getEndDate();
- if (date == null) {
- result.add(parametrageLengthWeight);
- }
- }
- } else {
- // on n'accepte que les parametrages selon les critères suivants :
- // - sans date de fin (i.e en cours de validite)
- // - ceux dont la date de fin est avant la date de fin donnée
- for (P parametrageLengthWeight : list) {
-
- Date date = parametrageLengthWeight.getEndDate();
- if (date == null ||
- date.after(endDate) ||
- date.equals(endDate)) {
- result.add(parametrageLengthWeight);
- }
- }
- }
- return result;
- }
-
- protected static boolean validateRelation(LengthWeightParameter parametrage, String relation, String variable) {
- boolean result = false;
- if (!StringUtils.isEmpty(relation)) {
-
- Map<String, Double> coeffs = parametrage.getCoefficientValues();
-
- ScriptEngine engine = getScriptEngine();
- Bindings bindings = engine.createBindings();
- for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
- String key = entry.getKey();
- Double value = entry.getValue();
- bindings.put(key, value);
-
- if (log.isDebugEnabled()) {
- log.debug("add constant " + key + '=' + value);
- }
- }
- bindings.put(variable, 1);
-
- try {
- engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
- Double o = (Double) engine.eval("parseFloat(" + relation + ")");
- if (log.isDebugEnabled()) {
- log.debug("evaluation ok : " + relation + " (" + variable + "=1) = " + o);
- }
- result = true;
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("evalution ko : " + relation + ", reason : " + e.getMessage());
- }
- }
- }
- return result;
- }
-
- public static Float computeValue(LengthWeightParameter parametrage, String relation, String variable, float taille) {
- Map<String, Double> coeffs = parametrage.getCoefficientValues();
- ScriptEngine engine = getScriptEngine();
- Bindings bindings = engine.createBindings();
- for (Map.Entry<String, Double> entry : coeffs.entrySet()) {
- String key = entry.getKey();
- Double value = entry.getValue();
- bindings.put(key, value);
-
- if (log.isDebugEnabled()) {
- log.debug("add constant " + key + '=' + value);
- }
- }
- bindings.put(variable, taille);
- engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
- Double o = null;
- try {
- o = (Double) engine.eval("parseFloat(" + relation + ")");
- } catch (ScriptException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not compute value from " + relation);
- }
- }
- return o == null ? null : o.floatValue();
- }
-}
diff --git a/entities/src/main/xmi/observe-common.zargo b/entities/src/main/xmi/observe-common.zargo
index 40415f1..17d14db 100644
Binary files a/entities/src/main/xmi/observe-common.zargo and b/entities/src/main/xmi/observe-common.zargo differ
diff --git a/entities/src/main/xmi/observe-seine.zargo b/entities/src/main/xmi/observe-seine.zargo
index 7886e18..f87b2aa 100644
Binary files a/entities/src/main/xmi/observe-seine.zargo and b/entities/src/main/xmi/observe-seine.zargo differ
diff --git a/entities/src/main/xmi/observe.ini b/entities/src/main/xmi/observe.ini
index f1ca6ad..51d0247 100644
--- a/entities/src/main/xmi/observe.ini
+++ b/entities/src/main/xmi/observe.ini
@@ -152,14 +152,21 @@ gearCaracteristic.lazy = false
[class fr.ird.observe.entities.referentiel.GearCaracteristic]
gearCaracteristicType.lazy = false
+[class fr.ird.observe.entities.referentiel.FormulaSupport]
+source.hibernateAttributeType = text
+
+[class fr.ird.observe.entities.referentiel.LengthLengthParameter]
+inputSizeMeasureType.lazy = false
+outputSizeMeasureType.lazy = false
+
[class fr.ird.observe.entities.referentiel.LengthWeightParameter]
ocean.lazy = false
ocean.notNull = true
sex.lazy = false
sex.notNull = true
-source.hibernateAttributeType = text
species.lazy = false
species.notNull = true
+sizeMeasureType.lazy = false
[class fr.ird.observe.entities.referentiel.ObserveReferentialEntity]
needComment.notNull = true
diff --git a/entities/src/test/java/fr/ird/observe/entities/referentiel/FormulaHelperTest.java b/entities/src/test/java/fr/ird/observe/entities/referentiel/FormulaHelperTest.java
new file mode 100644
index 0000000..18e9195
--- /dev/null
+++ b/entities/src/test/java/fr/ird/observe/entities/referentiel/FormulaHelperTest.java
@@ -0,0 +1,27 @@
+package fr.ird.observe.entities.referentiel;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Created on 05/11/16.
+ *
+ * @author Tony Chemit - chemit(a)codelutin.com
+ * @since 5.1
+ */
+public class FormulaHelperTest {
+
+ @Test
+ public void testComputeValue() {
+
+ LengthWeightParameterImpl parametrage = new LengthWeightParameterImpl();
+ parametrage.setCoefficients("a=3.8e-5:b=2.78 ");
+ parametrage.setLengthWeightFormula("a * Math.pow(L, b)");
+ Assert.assertTrue(parametrage.isFormulaOneValid());
+ Float weight = FormulaHelper.computeValue(parametrage, "a * Math.pow(L, b)", null, "L", 84.0f);
+ Assert.assertNotNull(weight);
+
+ Float excepted = (float) (Math.pow(84.0, 2.78) * 3.8e-5);
+ Assert.assertEquals(excepted, weight, 2);
+ }
+}
diff --git a/entities/src/test/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelperTest.java b/entities/src/test/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelperTest.java
deleted file mode 100644
index 9498cef..0000000
--- a/entities/src/test/java/fr/ird/observe/entities/referentiel/LengthWeightParemeterHelperTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * #%L
- * ObServe :: Entities
- * %%
- * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package fr.ird.observe.entities.referentiel;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test de la classe {@link LengthWeightParemeterHelper}.
- *
- * @author Tony Chemit - chemit(a)codelutin.com
- * @since 1.8
- */
-public class LengthWeightParemeterHelperTest {
-
- @Test
- public void testComputeValue() {
- Float weight;
-
- LengthWeightParameter parametrage = new LengthWeightParameterImpl();
- parametrage.setCoefficients("a=3.8e-5:b=2.78 ");
- parametrage.setLengthWeightFormula("a * Math.pow(L, b)");
- Assert.assertTrue(parametrage.isLengthWeightFormulaValid());
- weight = LengthWeightParemeterHelper.computeWeight(parametrage, 84.0f);
-
- Double excepted = Math.pow(84.0, 2.78) * 3.8e-5;
- Assert.assertEquals(excepted, weight, 2);
- }
-}
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0
This is an automated email from the git hooks/post-receive script.
New change to branch feature/8404 in repository observe.
See https://gitlab.nuiton.org/codelutin/observe.git
was b9f1339 Utilisation de la conversion taille - taille quand requis
This change permanently discards the following revisions:
discards b9f1339 Utilisation de la conversion taille - taille quand requis
discards 5833257 Introduction de deux nouveaux modules services-dto-reference et services-dto-gson
discards f6609dd Ajout validation de sizeMeasureType sur NonTargetLength
discards aa8b3b3 Ajout sizeMeasureType sur nonTargetSample et mise en place type de mensuration par défaut
discards af93bf1 ajout d'un icon
discards 587b746 la date de début peut-être nulle
discards 6ad0fd7 correction scripts de migration
discards 3a0dca4 mise à jour des tests
discards b10613f il se peut que la date max n'existe pas.
discards 3b9e046 mise à jour validation
discards 30ae2b5 Ajout LengthLengthParameter et revue de LWParameter (ui)
discards 0ecbc31 Ajout LengthLengthParameter et revue de LWParameter (service)
discards 63eb6c0 Ajout LengthLengthParameter et revue de LWParameter (persistence)
--
To stop receiving notification emails like this one, please contact
codelutin.com SCM administrator <admin+scm(a)codelutin.com>.
1
0