branch develop updated (18a9780 -> 4a38a22)
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@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@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@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@codelutin.com> Date: Sun Nov 6 12:03:03 2016 +0100 Ajout validation de sizeMeasureType sur NonTargetLength commit aa8b3b337dbd8957f9e15ee0fec0f511b56b93cf Author: Tony CHEMIT <chemit@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@codelutin.com> Date: Sun Nov 6 12:01:44 2016 +0100 ajout d'un icon commit 587b746d6fef5efae1f9cc711fd623815e92ddae Author: Tony CHEMIT <chemit@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@codelutin.com> Date: Sat Nov 5 16:44:50 2016 +0100 correction scripts de migration commit 3a0dca45be6215eb830a5e7702fb753f332e0460 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Nov 5 16:43:52 2016 +0100 mise à jour des tests commit b10613f57eca0986bdea7ce9fcf5bc924e0397c4 Author: Tony CHEMIT <chemit@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@codelutin.com> Date: Sat Nov 5 15:46:01 2016 +0100 mise à jour validation commit 30ae2b5f97dd1da5007d387b404e508fa0dab75b Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Nov 5 15:30:32 2016 +0100 Ajout LengthLengthParameter et revue de LWParameter (ui) commit 0ecbc3191808377a593577ad538f277bc1d8e423 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Nov 5 15:29:58 2016 +0100 Ajout LengthLengthParameter et revue de LWParameter (service) commit 63eb6c05c52a3fd8f43f7c44b65adad9a8b2da79 Author: Tony CHEMIT <chemit@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@codelutin.com>.
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@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@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@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@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@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@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@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@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@codelutin.com>.
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@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@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@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@codelutin.com>.
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@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@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@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@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@codelutin.com>.
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@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@codelutin.com>.
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@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@codelutin.com>.
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@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@codelutin.com>.
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@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@codelutin.com>.
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 587b746d6fef5efae1f9cc711fd623815e92ddae Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Nov 5 16:45:07 2016 +0100 la date de début peut-être nulle --- .../fr/ird/observe/entities/referentiel/LengthWeightParameters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a8c3c76..197d5e4 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 @@ -261,7 +261,7 @@ public class LengthWeightParameters { for (LengthWeightParameter parametrageLengthWeight : list) { - if (parametrageLengthWeight.getStartDate().before(startDate) || + if (parametrageLengthWeight.getStartDate() == null || parametrageLengthWeight.getStartDate().before(startDate) || parametrageLengthWeight.getStartDate().equals(startDate)) { result.add(parametrageLengthWeight); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 af93bf166e2c43b254aeae34b0c3bae3b79d1ad6 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 6 12:01:44 2016 +0100 ajout d'un icon --- application-swing/src/main/filters/observe-ui.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/application-swing/src/main/filters/observe-ui.properties b/application-swing/src/main/filters/observe-ui.properties index 4c13a7f..45bbae6 100644 --- a/application-swing/src/main/filters/observe-ui.properties +++ b/application-swing/src/main/filters/observe-ui.properties @@ -87,6 +87,7 @@ icon.action.cancel=action-cancel.png icon.action.closeTab=action-closeTab.png icon.action.combobox-sort=action-combobox-sort.png icon.action.combobox-reset=action-combobox-reset.png +icon.action.combobox-reset2=action-combobox-reset2.png icon.action.data-observe=action-data-observe.png icon.action.data-calcule=action-data-calcule.png icon.action.numbereditor-reset=action-numbereditor-reset.png -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 aa8b3b337dbd8957f9e15ee0fec0f511b56b93cf Author: Tony CHEMIT <chemit@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 --- .../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 | 1 + .../i18n/application-swing_es_ES.properties | 1 + .../i18n/application-swing_fr_FR.properties | 1 + .../ReferentialReferenceSetDefinitions.java | 4 +- .../dto/referential/SizeMeasureTypeHelper.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 +- .../topia/binder/referential/SpeciesBinder.java | 4 +- 22 files changed, 303 insertions(+), 173 deletions(-) diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUI.jcss index 2abd16d..8aeb4fc 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUI.jcss +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUI.jcss @@ -59,6 +59,55 @@ JToolBar { selectedItem:{tableEditBean.getSex()}; } +#modeAndCodePanel { + layout:{new GridLayout(1,0)}; +} + +#acquisitionModeGroup { + selectedValue:{ModeSaisieEchantillonEnum.valueOf(tableEditBean.getAcquisitionMode())}; +} + +#acquisitionModePanel { + border:{new TitledBorder(t("observe.common.acquisitionMode"))}; + layout:{new GridLayout(1,0)}; +} + +#acquisitionModeEffectif { + buttonGroup:"acquisitionModeGroup"; + value:{ModeSaisieEchantillonEnum.byEffectif}; + text:{ModeSaisieEchantillonEnum.byEffectif.getI18nKey()}; + selected:{tableEditBean.getAcquisitionMode() == 0}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; +} + +#acquisitionModeIndividu { + buttonGroup:"acquisitionModeGroup"; + value:{ModeSaisieEchantillonEnum.byIndividu}; + text:{ModeSaisieEchantillonEnum.byIndividu.getI18nKey()}; + selected:{tableEditBean.getAcquisitionMode() == 1}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; +} + +#sizeMeasureTypePanel { + border:{new TitledBorder(t("observe.common.sizeMeasureType"))}; +} + +#sizeMeasureTypeLabel { + labelFor:{sizeMeasureType}; +} + +#sizeMeasureType { + _entityClass:{SizeMeasureTypeDto.class}; + property:sizeMeasureType; + bean:{tableEditBean}; + _tablePropertyName:{"sizeMeasureType"}; + selectedItem:{tableEditBean.getSizeMeasureType()}; +} + +#defaultSizeMeasureType { + actionIcon:combobox-reset2; + toolTipText:"observe.content.sample.resetDefaultSizeMeasureType"; +} #lengthLabel { labelFor:{length}; diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUIHandler.java index 147bc54..fbf67dc 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/AbstractSampleUIHandler.java @@ -26,7 +26,8 @@ import fr.ird.observe.application.swing.db.constants.DataContextType; import fr.ird.observe.application.swing.ui.content.table.ContentTableUIHandler; import fr.ird.observe.application.swing.ui.content.table.ObserveContentTableUI; import fr.ird.observe.services.dto.IdDto; -import fr.ird.observe.services.dto.seine.NonTargetLengthDto; +import fr.ird.observe.services.dto.referential.ReferentialReference; +import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.TargetLengthDto; import java.beans.PropertyChangeListener; @@ -57,25 +58,25 @@ public abstract class AbstractSampleUIHandler<E extends IdDto, D extends IdDto> */ protected final PropertyChangeListener lengthChanged; + /** + * Ecoute les modifications de la propriété {@link TargetLengthDto#getLength()}, + * et repasser alors le flag {@link TargetLengthDto#isIsLengthComputed()} à + * {@code false}. + * + * @since 3.0 + */ + protected final PropertyChangeListener speciesChanged; + protected AbstractSampleUIHandler(ObserveContentTableUI<E, D> ui) { super(ui, DataContextType.SetSeine); weightChanged = evt -> { - if (evt.getSource() instanceof TargetLengthDto) { - TargetLengthDto source = (TargetLengthDto) evt.getSource(); - source.setIsWeightComputed(false); - } else if (evt.getSource() instanceof NonTargetLengthDto) { - NonTargetLengthDto source = (NonTargetLengthDto) evt.getSource(); - source.setIsWeightComputed(false); - } + onWeightChanged((Float) evt.getNewValue()); }; lengthChanged = evt -> { - if (evt.getSource() instanceof TargetLengthDto) { - TargetLengthDto source = (TargetLengthDto) evt.getSource(); - source.setIsLengthComputed(false); - } else if (evt.getSource() instanceof NonTargetLengthDto) { - NonTargetLengthDto source = (NonTargetLengthDto) evt.getSource(); - source.setIsLengthComputed(false); - } + onLengthChanged((Float) evt.getNewValue()); + }; + speciesChanged = evt -> { + onSpeciesChanged((ReferentialReference<SpeciesDto>) evt.getNewValue()); }; } @@ -83,4 +84,9 @@ public abstract class AbstractSampleUIHandler<E extends IdDto, D extends IdDto> public abstract void resetIsLengthComputed(); + protected abstract void onSpeciesChanged(ReferentialReference<SpeciesDto> species); + + protected abstract void onWeightChanged(Float newValue); + + protected abstract void onLengthChanged(Float newValue); } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jaxx b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jaxx index 3e6a70f..cc648fa 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jaxx +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jaxx @@ -21,10 +21,10 @@ --> <fr.ird.observe.application.swing.ui.content.table.ContentTableUI - superGenericType='NonTargetSampleDto, NonTargetLengthDto' - contentTitle='{n("observe.common.nonTargetSample")}' - saveNewEntryText='{n("observe.content.action.create.nonTargetSample")}' - saveNewEntryTip='{n("observe.content.action.create.nonTargetSample.tip")}'> + superGenericType='NonTargetSampleDto, NonTargetLengthDto' + contentTitle='{n("observe.common.nonTargetSample")}' + saveNewEntryText='{n("observe.content.action.create.nonTargetSample")}' + saveNewEntryTip='{n("observe.content.action.create.nonTargetSample.tip")}'> <style source="../../CommonTable.jcss"/> <style source="AbstractSampleUI.jcss"/> @@ -32,6 +32,7 @@ <import> fr.ird.observe.services.dto.CommentableDto 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.ReferentialReference fr.ird.observe.services.dto.referential.seine.SpeciesFateDto @@ -110,10 +111,19 @@ public String getSpeciesFauneTypeTaille(ReferentialReference<SpeciesDto> species <!-- mode de saisie --> <row> - <cell columns="2"> - <JPanel id='acquisitionModePanel'> - <JRadioButton id='acquisitionModeEffectif'/> - <JRadioButton id='acquisitionModeIndividu'/> + <cell columns="3"> + <JPanel id="modeAndCodePanel"> + <JPanel id='acquisitionModePanel'> + <JRadioButton id='acquisitionModeEffectif'/> + <JRadioButton id='acquisitionModeIndividu'/> + </JPanel> + <JPanel id='sizeMeasureTypePanel' layout='{new BorderLayout()}'> + <JLabel id='sizeMeasureTypeLabel' constraints="BorderLayout.WEST"/> + <BeanComboBox id='sizeMeasureType' genericType='ReferentialReference<SizeMeasureTypeDto>' + constructorParams='this' constraints="BorderLayout.CENTER"/> + <JButton id="defaultSizeMeasureType" constraints="BorderLayout.EAST" + onActionPerformed="getHandler().resetDefaultSizeMeasureType()"/> + </JPanel> </JPanel> </cell> </row> @@ -128,16 +138,6 @@ public String getSpeciesFauneTypeTaille(ReferentialReference<SpeciesDto> species </cell> </row> - <!-- species faune (type taille) --> - <row> - <cell> - <JLabel id='speciesTypeTailleLabel'/> - </cell> - <cell weightx='1' anchor='east'> - <JLabel id='speciesTypeTaille'/> - </cell> - </row> - <!-- length --> <row> <cell> @@ -199,7 +199,6 @@ public String getSpeciesFauneTypeTaille(ReferentialReference<SpeciesDto> species </cell> </row> - <!-- reference pĥoto --> <row> <cell> diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jcss index a921312..47226c2 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jcss +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUI.jcss @@ -35,31 +35,6 @@ _entityClass:{SpeciesFateDto.class}; } -#acquisitionModeGroup { - selectedValue:{ModeSaisieEchantillonEnum.valueOf(tableEditBean.getAcquisitionMode())}; -} - -#acquisitionModePanel { - border:{new TitledBorder(t("observe.common.acquisitionMode"))}; - layout:{new GridLayout(1,0)}; -} - -#acquisitionModeEffectif { - buttonGroup:"acquisitionModeGroup"; - value:{ModeSaisieEchantillonEnum.byEffectif}; - text:{ModeSaisieEchantillonEnum.byEffectif.getI18nKey()}; - selected:{tableEditBean.getAcquisitionMode() == 0}; - enabled:{!tableModel.isEditable() || tableModel.isCreate()}; -} - -#acquisitionModeIndividu { - buttonGroup:"acquisitionModeGroup"; - value:{ModeSaisieEchantillonEnum.byIndividu}; - text:{ModeSaisieEchantillonEnum.byIndividu.getI18nKey()}; - selected:{tableEditBean.getAcquisitionMode() == 1}; - enabled:{!tableModel.isEditable() || tableModel.isCreate()}; -} - #lengthLabel { text:"observe.common.taille"; } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIHandler.java index 9cdbd92..d3799a8 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIHandler.java @@ -31,6 +31,7 @@ import fr.ird.observe.services.dto.Form; import fr.ird.observe.services.dto.referential.ReferentialDto; import fr.ird.observe.services.dto.referential.ReferentialReference; import fr.ird.observe.services.dto.referential.SexDto; +import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.SpeciesFateDto; import fr.ird.observe.services.dto.result.SaveResultDto; @@ -49,6 +50,7 @@ import javax.swing.table.DefaultTableCellRenderer; import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Optional; import java.util.Set; import static org.nuiton.i18n.I18n.n; @@ -84,6 +86,26 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS getUi().getLength().grabFocus(); } + + @Override + protected void onWeightChanged(Float newValue) { + getTableEditBean().setIsWeightComputed(false); + } + + @Override + protected void onLengthChanged(Float newValue) { + getTableEditBean().setIsLengthComputed(false); + } + + @Override + protected void onSpeciesChanged(ReferentialReference<SpeciesDto> species) { + + // on utilise le code par defaut de l'espèce + Optional<ReferentialReference<SizeMeasureTypeDto>> sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); + + } + @Override protected String getEditBeanIdToLoad() { return getDataContext().getSelectedSetId(); @@ -100,6 +122,12 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS return; } + + NonTargetLengthDto tableEditBean = getTableEditBean(); + tableEditBean.removePropertyChangeListener(NonTargetLengthDto.PROPERTY_WEIGHT, weightChanged); + tableEditBean.removePropertyChangeListener(NonTargetLengthDto.PROPERTY_LENGTH, lengthChanged); + tableEditBean.removePropertyChangeListener(NonTargetLengthDto.PROPERTY_SPECIES, speciesChanged); + ReferentialReference<SpeciesDto> species = bean.getSpecies(); NonTargetSampleUI ui = getUi(); if (log.isDebugEnabled()) { @@ -107,6 +135,7 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS } List<ReferentialReference<SpeciesDto>> availableEspeces; JComponent requestFocus; + Optional<ReferentialReference<SizeMeasureTypeDto>> sizeMeasureType; if (create) { @@ -118,8 +147,12 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS } Set<ReferentialReference<SpeciesDto>> speciesReferences = getModel().getReferentialReferences(NonTargetLengthDto.PROPERTY_SPECIES); - availableEspeces = Lists.newArrayList(speciesReferences); + + // on utilise le code par defaut de l'espèce + sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); + requestFocus = ui.getSpecies(); } else { @@ -133,16 +166,23 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS ui.getAcquisitionModeGroup().setSelectedValue(enumValue); availableEspeces = Lists.newArrayList(species); + + sizeMeasureType = Optional.ofNullable(bean.getSizeMeasureType()); + + } + + ui.getSizeMeasureType().setSelectedItem(null); + if (sizeMeasureType.isPresent()) { + ui.getSizeMeasureType().setSelectedItem(sizeMeasureType.get()); } + ui.getSpecies().setData(availableEspeces); requestFocus.requestFocus(); - NonTargetLengthDto tableEditBean = getTableEditBean(); - tableEditBean.removePropertyChangeListener(NonTargetLengthDto.PROPERTY_WEIGHT, weightChanged); tableEditBean.addPropertyChangeListener(NonTargetLengthDto.PROPERTY_WEIGHT, weightChanged); - - tableEditBean.removePropertyChangeListener(NonTargetLengthDto.PROPERTY_LENGTH, lengthChanged); tableEditBean.addPropertyChangeListener(NonTargetLengthDto.PROPERTY_LENGTH, lengthChanged); + tableEditBean.addPropertyChangeListener(NonTargetLengthDto.PROPERTY_SPECIES, speciesChanged); + } @Override @@ -263,6 +303,11 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS } } + public void resetDefaultSizeMeasureType() { + getUi().getSizeMeasureType().setSelectedItem(null); + getUi().getSizeMeasureType().setSelectedItem(getUi().getModel().getDefaultSizeMeasureType()); + } + @Override protected void doPersist(NonTargetSampleDto bean) { @@ -274,8 +319,13 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS @Override protected void loadEditBean(String beanId) { Form<NonTargetSampleDto> form = getNonTargetSampleService().loadForm(beanId); + // on a besoin du formulaire dans cette méthode getModel().setForm(form); loadReferentialReferenceSetsInModel(form); + // on demande une mises à jour des uis avec les bons référentiels + // normalement cela est fait quand on fait le setForm (mais ici le setForm est fait trop tôt) + updateUiWithReferenceSetsFromModel(); + NonTargetSampleHelper.copyNonTargetSampleDto(form.getObject(), getBean()); } @@ -319,4 +369,16 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS protected NonTargetSampleService getNonTargetSampleService() { return ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newNonTargetSampleService(); } + + protected Optional<ReferentialReference<SizeMeasureTypeDto>> getSpeciesDefaultSizeMeasureType(ReferentialReference<SpeciesDto> species) { + Optional<ReferentialReference<SizeMeasureTypeDto>> result = Optional.empty(); + if (species != null) { + + String sizeMeasureId = (String) species.getPropertyValue(SpeciesDto.PROPERTY_SIZE_MEASURE_TYPE + "Id"); + result = getUi().getSizeMeasureType().getData().stream() + .filter(s -> s.getId().equals(sizeMeasureId)).findFirst(); + } + return result; + } + } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIModel.java index 946b1da..3087dba 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIModel.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetSampleUIModel.java @@ -22,16 +22,18 @@ package fr.ird.observe.application.swing.ui.content.table.impl.seine; * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import fr.ird.observe.services.dto.seine.NonTargetLengthDto; -import fr.ird.observe.services.dto.seine.NonTargetLengthHelper; -import fr.ird.observe.services.dto.seine.NonTargetSampleDto; import fr.ird.observe.application.swing.ui.content.table.ContentTableMeta; import fr.ird.observe.application.swing.ui.content.table.ContentTableModel; import fr.ird.observe.application.swing.ui.content.table.ContentTableUIModel; import fr.ird.observe.application.swing.ui.content.table.ObserveContentTableUI; +import fr.ird.observe.services.dto.referential.ReferentialReference; +import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto; +import fr.ird.observe.services.dto.seine.NonTargetLengthDto; +import fr.ird.observe.services.dto.seine.NonTargetLengthHelper; +import fr.ird.observe.services.dto.seine.NonTargetSampleDto; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -45,6 +47,10 @@ public class NonTargetSampleUIModel extends ContentTableUIModel<NonTargetSampleD private static final long serialVersionUID = 1L; + public static final String PROPERTY_DEFAULT_SIZE_MEASURE_TYPE="defaultSizeMeasureType"; + + private ReferentialReference<SizeMeasureTypeDto> defaultSizeMeasureType; + public NonTargetSampleUIModel(NonTargetSampleUI ui) { super(NonTargetSampleDto.class, @@ -64,7 +70,7 @@ public class NonTargetSampleUIModel extends ContentTableUIModel<NonTargetSampleD NonTargetLengthDto.PROPERTY_PICTURES_REFERENCES }); - List<ContentTableMeta<NonTargetLengthDto>> metas = Lists.newArrayList( + List<ContentTableMeta<NonTargetLengthDto>> metas = Arrays.asList( ContentTableModel.newTableMeta(NonTargetLengthDto.class, NonTargetLengthDto.PROPERTY_SPECIES, false), ContentTableModel.newTableMeta(NonTargetLengthDto.class, NonTargetLengthDto.PROPERTY_LENGTH, false), ContentTableModel.newTableMeta(NonTargetLengthDto.class, NonTargetLengthDto.PROPERTY_WEIGHT, false), @@ -104,4 +110,14 @@ public class NonTargetSampleUIModel extends ContentTableUIModel<NonTargetSampleD } }; } + + public ReferentialReference<SizeMeasureTypeDto> getDefaultSizeMeasureType() { + return defaultSizeMeasureType; + } + + public void setDefaultSizeMeasureType(ReferentialReference<SizeMeasureTypeDto> defaultSizeMeasureType) { + ReferentialReference<SizeMeasureTypeDto> oldValue = getDefaultSizeMeasureType(); + this.defaultSizeMeasureType = defaultSizeMeasureType; + firePropertyChange(PROPERTY_DEFAULT_SIZE_MEASURE_TYPE, oldValue, defaultSizeMeasureType); + } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jaxx b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jaxx index 88c055f..74667d6 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jaxx +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jaxx @@ -103,7 +103,7 @@ public String getLengthDataTip(boolean computed) { <row> <cell columns="3"> <JPanel id="modeAndCodePanel"> - <JPanel id='acquisitionModePanel' constraints="BorderLayout.CENTER"> + <JPanel id='acquisitionModePanel'> <JRadioButton id='acquisitionModeEffectif'/> <JRadioButton id='acquisitionModeIndividu'/> </JPanel> @@ -111,6 +111,8 @@ public String getLengthDataTip(boolean computed) { <JLabel id='sizeMeasureTypeLabel' constraints="BorderLayout.WEST"/> <BeanComboBox id='sizeMeasureType' genericType='ReferentialReference<SizeMeasureTypeDto>' constructorParams='this' constraints="BorderLayout.CENTER"/> + <JButton id="defaultSizeMeasureType" constraints="BorderLayout.EAST" + onActionPerformed="getHandler().resetDefaultSizeMeasureType()"/> </JPanel> </JPanel> </cell> diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jcss index 699dadf..4f7f34d 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jcss +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUI.jcss @@ -30,51 +30,6 @@ _entityClass:{SpeciesDto.class}; } -#modeAndCodePanel { - layout:{new GridLayout(1,0)}; -} - -#acquisitionModeGroup { - selectedValue:{ModeSaisieEchantillonEnum.valueOf(tableEditBean.getAcquisitionMode())}; -} - -#acquisitionModePanel { - border:{new TitledBorder(t("observe.common.acquisitionMode"))}; - layout:{new GridLayout(0,1)}; -} - -#sizeMeasureTypePanel { - border:{new TitledBorder(t("observe.common.sizeMeasureType"))}; -} - -#sizeMeasureTypeLabel { - labelFor:{sizeMeasureType}; -} - -#sizeMeasureType { - _entityClass:{SizeMeasureTypeDto.class}; - _tablePropertyName:{TargetLengthDto.PROPERTY_SIZE_MEASURE_TYPE}; - property:{TargetLengthDto.PROPERTY_SIZE_MEASURE_TYPE}; - selectedItem:{tableEditBean.getSizeMeasureType()}; - bean:{tableEditBean}; -} - -#acquisitionModeEffectif { - buttonGroup:"acquisitionModeGroup"; - value:{ModeSaisieEchantillonEnum.byEffectif}; - text:{ModeSaisieEchantillonEnum.byEffectif.getI18nKey()}; - selected:{tableEditBean.getAcquisitionMode() == 0}; - enabled:{!tableModel.isEditable() || tableModel.isCreate()}; -} - -#acquisitionModeIndividu { - buttonGroup:"acquisitionModeGroup"; - value:{ModeSaisieEchantillonEnum.byIndividu}; - text:{ModeSaisieEchantillonEnum.byIndividu.getI18nKey()}; - selected:{tableEditBean.getAcquisitionMode() == 1}; - enabled:{!tableModel.isEditable() || tableModel.isCreate()}; -} - #lengthLabel { text:"observe.common.length.inf"; } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIHandler.java index d2a63a2..55a6081 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIHandler.java @@ -6,15 +6,15 @@ * %% * 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 + * 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 + * + * 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% @@ -51,6 +51,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Optional; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -72,8 +73,7 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD */ protected final boolean discarded; - public TargetSampleUIHandler(ContentTableUI<TargetSampleDto, TargetLengthDto> ui, - boolean discarded) { + public TargetSampleUIHandler(ContentTableUI<TargetSampleDto, TargetLengthDto> ui, boolean discarded) { super(ui); this.discarded = discarded; } @@ -100,6 +100,27 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD return getDataContext().getSelectedSetId(); } + @Override + protected void onSpeciesChanged(ReferentialReference<SpeciesDto> species) { + + // on utilise le code par defaut de l'espèce + Optional<ReferentialReference<SizeMeasureTypeDto>> sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); + + } + + @Override + protected void onWeightChanged(Float newValue) { + getTableEditBean().setIsWeightComputed(false); + } + + @Override + protected void onLengthChanged(Float newValue) { + getTableEditBean().setIsLengthComputed(false); + } + + @Override protected void onSelectedRowChanged(int editingRow, TargetLengthDto bean, boolean create) { ContentTableModel<TargetSampleDto, TargetLengthDto> model = getTableModel(); @@ -108,12 +129,18 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD return; } + TargetLengthDto tableEditBean = getTableEditBean(); + + tableEditBean.removePropertyChangeListener(TargetLengthDto.PROPERTY_WEIGHT, weightChanged); + tableEditBean.removePropertyChangeListener(TargetLengthDto.PROPERTY_LENGTH, lengthChanged); + tableEditBean.removePropertyChangeListener(TargetLengthDto.PROPERTY_SPECIES, speciesChanged); + ReferentialReference<SpeciesDto> species = bean.getSpecies(); JComponent requestFocus; ModeSaisieEchantillonEnum modeSaisieEchantillonEnum; - ReferentialReference<SizeMeasureTypeDto> sizeMeasureType = null; + Optional<ReferentialReference<SizeMeasureTypeDto>> sizeMeasureType = Optional.empty(); if (create) { @@ -127,9 +154,13 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD modeSaisieEchantillonEnum = ModeSaisieEchantillonEnum.valueOf(editBean.getAcquisitionMode()); } - // on utilise par défaut le code mesure lf - sizeMeasureType = SizeMeasureTypeHelper.getLf(ui.getSizeMeasureType().getData()); - + // on utilise le code par defaut de l'espèce + sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + if (!sizeMeasureType.isPresent()) { + // au cas où, on repasse toujours sur lf + sizeMeasureType = Optional.of(SizeMeasureTypeHelper.getLf(getUi().getSizeMeasureType().getData())); + } + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); } requestFocus = ui.getSpecies(); @@ -141,20 +172,20 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD int acquisitionMode = bean.getAcquisitionMode(); modeSaisieEchantillonEnum = ModeSaisieEchantillonEnum.valueOf(acquisitionMode); - sizeMeasureType = bean.getSizeMeasureType(); + sizeMeasureType = Optional.ofNullable(bean.getSizeMeasureType()); } - ui.getAcquisitionModeGroup().setSelectedValue(null); ui.getAcquisitionModeGroup().setSelectedValue(modeSaisieEchantillonEnum); ui.getSizeMeasureType().setSelectedItem(null); - ui.getSizeMeasureType().setSelectedItem(sizeMeasureType); + if (sizeMeasureType.isPresent()) { + ui.getSizeMeasureType().setSelectedItem(sizeMeasureType.get()); + } - // on met a jour l'espce + // on met a jour l'espece ui.getSpecies().setSelectedItem(null); - if (species != null) { if (log.isDebugEnabled()) { log.debug("species to use " + species); @@ -163,12 +194,9 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD } requestFocus.requestFocus(); - TargetLengthDto tableEditBean = getTableEditBean(); - tableEditBean.removePropertyChangeListener(TargetLengthDto.PROPERTY_WEIGHT, weightChanged); tableEditBean.addPropertyChangeListener(TargetLengthDto.PROPERTY_WEIGHT, weightChanged); - - tableEditBean.removePropertyChangeListener(TargetLengthDto.PROPERTY_LENGTH, lengthChanged); tableEditBean.addPropertyChangeListener(TargetLengthDto.PROPERTY_LENGTH, lengthChanged); + tableEditBean.addPropertyChangeListener(TargetLengthDto.PROPERTY_SPECIES, speciesChanged); } @Override @@ -308,6 +336,11 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD } } + public void resetDefaultSizeMeasureType() { + getUi().getSizeMeasureType().setSelectedItem(null); + getUi().getSizeMeasureType().setSelectedItem(getUi().getModel().getDefaultSizeMeasureType()); + } + @Override protected void doPersist(TargetSampleDto bean) { @@ -322,12 +355,6 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD loadReferentialReferenceSetsInModel(form); getModel().setForm(form); TargetSampleHelper.copyTargetSampleDto(form.getObject(), getBean()); - for (TargetLengthDto targetLengthDto : getBean().getTargetLength()) { - ReferentialReference<SizeMeasureTypeDto> sizeMeasureType = targetLengthDto.getSizeMeasureType(); - if (sizeMeasureType != null) { - SizeMeasureTypeHelper.filterForSeine(sizeMeasureType); - } - } } @Override @@ -349,8 +376,19 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD break; + case TargetLengthDto.PROPERTY_SIZE_MEASURE_TYPE: { + + result = SizeMeasureTypeHelper.filterForSeine((Collection) incomingReferences); + if (log.isInfoEnabled()) { + log.info("Using " + result.size() + " size measure type(s)."); + } + if (result.size() != 2) { + throw new IllegalStateException("WHY???"); + } + } } + return result; } @@ -358,4 +396,16 @@ public class TargetSampleUIHandler extends AbstractSampleUIHandler<TargetSampleD protected TargetSampleService getTargetSampleService() { return ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newTargetSampleService(); } + + protected Optional<ReferentialReference<SizeMeasureTypeDto>> getSpeciesDefaultSizeMeasureType(ReferentialReference<SpeciesDto> species) { + Optional<ReferentialReference<SizeMeasureTypeDto>> result = Optional.empty(); + if (species != null) { + + String sizeMeasureId = (String) species.getPropertyValue(SpeciesDto.PROPERTY_SIZE_MEASURE_TYPE + "Id"); + result = getUi().getSizeMeasureType().getData().stream() + .filter(s -> s.getId().equals(sizeMeasureId)).findFirst(); + } + return result; + } + } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIModel.java index 6906049..8a3ecbb 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIModel.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetSampleUIModel.java @@ -22,16 +22,18 @@ package fr.ird.observe.application.swing.ui.content.table.impl.seine; * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ird.observe.application.swing.ui.content.table.ContentTableMeta; import fr.ird.observe.application.swing.ui.content.table.ContentTableModel; import fr.ird.observe.application.swing.ui.content.table.ContentTableUIModel; import fr.ird.observe.application.swing.ui.content.table.ObserveContentTableUI; +import fr.ird.observe.services.dto.referential.ReferentialReference; +import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto; import fr.ird.observe.services.dto.seine.TargetLengthDto; import fr.ird.observe.services.dto.seine.TargetLengthHelper; import fr.ird.observe.services.dto.seine.TargetSampleDto; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -45,6 +47,10 @@ public class TargetSampleUIModel extends ContentTableUIModel<TargetSampleDto, Ta private static final long serialVersionUID = 1L; + public static final String PROPERTY_DEFAULT_SIZE_MEASURE_TYPE="defaultSizeMeasureType"; + + private ReferentialReference<SizeMeasureTypeDto> defaultSizeMeasureType; + public TargetSampleUIModel(TargetSampleUI ui) { super(TargetSampleDto.class, @@ -64,7 +70,7 @@ public class TargetSampleUIModel extends ContentTableUIModel<TargetSampleDto, Ta TargetLengthDto.PROPERTY_ACQUISITION_MODE, TargetLengthDto.PROPERTY_TAG_NUMBER}); - List<ContentTableMeta<TargetLengthDto>> metas = Lists.newArrayList( + List<ContentTableMeta<TargetLengthDto>> metas = Arrays.asList( ContentTableModel.newTableMeta(TargetLengthDto.class, TargetLengthDto.PROPERTY_SPECIES, true), ContentTableModel.newTableMeta(TargetLengthDto.class, TargetLengthDto.PROPERTY_SEX, true), ContentTableModel.newTableMeta(TargetLengthDto.class, TargetLengthDto.PROPERTY_SIZE_MEASURE_TYPE, true), @@ -100,4 +106,14 @@ public class TargetSampleUIModel extends ContentTableUIModel<TargetSampleDto, Ta } }; } + + public ReferentialReference<SizeMeasureTypeDto> getDefaultSizeMeasureType() { + return defaultSizeMeasureType; + } + + public void setDefaultSizeMeasureType(ReferentialReference<SizeMeasureTypeDto> defaultSizeMeasureType) { + ReferentialReference<SizeMeasureTypeDto> oldValue = getDefaultSizeMeasureType(); + this.defaultSizeMeasureType = defaultSizeMeasureType; + firePropertyChange(PROPERTY_DEFAULT_SIZE_MEASURE_TYPE, oldValue, defaultSizeMeasureType); + } } 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 c8d7047..3fafe10 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 @@ -1063,6 +1063,7 @@ observe.content.route.message.not.open=Current route is not open, no modificatio observe.content.route.message.updating=Route is in editing mode. observe.content.route.title=Route observe.content.routes.title=Routes +observe.content.sample.resetDefaultSizeMeasureType=Use default size measure type observe.content.schoolEstimate.table.meanWeight=Mean weight (in Kg) observe.content.schoolEstimate.table.meanWeight.tip=Mean weight (in Kg) observe.content.schoolEstimate.table.speciesThon=Species 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 ebc5a15..4424ee0 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 @@ -1063,6 +1063,7 @@ observe.content.route.message.not.open=la ruta actual no está abierta, no se pu observe.content.route.message.updating=Se está modificando la ruta actual. observe.content.route.title=Ruta observe.content.routes.title=Rutas +observe.content.sample.resetDefaultSizeMeasureType=Utiliser le type de mensuration par défaut \#TODO observe.content.schoolEstimate.table.meanWeight=Peso medio (en Kg) observe.content.schoolEstimate.table.meanWeight.tip=Peso medio (en Kg) observe.content.schoolEstimate.table.speciesThon=Especie 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 e629cda..2e7dc31 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 @@ -1063,6 +1063,7 @@ observe.content.route.message.not.open=La route courante n'est pas ouverte, aucu observe.content.route.message.updating=La route est en cours de modification. observe.content.route.title=Route observe.content.routes.title=Routes +observe.content.sample.resetDefaultSizeMeasureType=Utiliser le type de mensuration par défaut observe.content.schoolEstimate.table.meanWeight=Poids moyen (en Kg) observe.content.schoolEstimate.table.meanWeight.tip=Poids moyen (en Kg) observe.content.schoolEstimate.table.speciesThon=Espèce de thon 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 c05a711..730e61c 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 @@ -121,7 +121,7 @@ public enum ReferentialReferenceSetDefinitions { .addProperty(String.class, HarbourDto.PROPERTY_LOCODE)), SHIP_OWNER(newDefaultDefinitionBuilder(ShipOwnerDto.class) - .addProperty(String.class, ShipOwnerDto.PROPERTY_LABEL)), + .addProperty(String.class, ShipOwnerDto.PROPERTY_LABEL)), LENGTH_LENGTH_PARAMETER(newDefinitionBuilder(LengthLengthParameterDto.class) .addProperty(String.class, LengthLengthParameterDto.PROPERTY_CODE) @@ -159,7 +159,7 @@ public enum ReferentialReferenceSetDefinitions { .addProperty(String.class, SpeciesDto.PROPERTY_FAO_CODE) .addProperty(String.class, SpeciesDto.PROPERTY_SCIENTIFIC_LABEL) .addProperty(String.class, SpeciesDto.PROPERTY_HOME_ID) - .addProperty(String.class, SpeciesDto.PROPERTY_SIZE_MEASURE_TYPE)), + .addProperty(String.class, SpeciesDto.PROPERTY_SIZE_MEASURE_TYPE + "Id")), SPECIES_GROUP(newDefaultDefinitionBuilder(SpeciesGroupDto.class)), diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/SizeMeasureTypeHelper.java b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/SizeMeasureTypeHelper.java index d31236d..8acdc5d 100644 --- a/services-dto/src/main/java/fr/ird/observe/services/dto/referential/SizeMeasureTypeHelper.java +++ b/services-dto/src/main/java/fr/ird/observe/services/dto/referential/SizeMeasureTypeHelper.java @@ -36,26 +36,9 @@ public class SizeMeasureTypeHelper extends GeneratedSizeMeasureTypeHelper { public static List<ReferentialReference<SizeMeasureTypeDto>> filterForSeine(Collection<ReferentialReference<SizeMeasureTypeDto>> incoming) { return incoming.stream() .filter(d -> isLd1(d) || isLf(d)) - .map(SizeMeasureTypeHelper::filterForSeine) .collect(Collectors.toList()); - - } - - public static ReferentialReference<SizeMeasureTypeDto> filterForSeine(ReferentialReference<SizeMeasureTypeDto> incoming) { - int index = incoming.getPropertyIndex(SizeMeasureTypeDto.PROPERTY_CODE); - String value; - if (isLd1(incoming)) { - value = "LD1"; - } else if (isLf(incoming)) { - value = "LF"; - } else { - throw new IllegalStateException("Can't manage with code: " + incoming); - } - incoming.getLabelPropertyValues()[index] = value; - return incoming; } - public static boolean isLd1(ReferentialReference<SizeMeasureTypeDto> incoming) { return SEINE_LD1_SIZE_MEASURE_TYPE_ID.contains(incoming.getCode()); } diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderSupport.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderSupport.java index d1c0dbd..f682d56 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderSupport.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/BinderSupport.java @@ -24,6 +24,7 @@ package fr.ird.observe.services.topia.binder; import com.google.common.collect.Iterables; import fr.ird.observe.ObserveEntityEnum; +import fr.ird.observe.entities.ObserveEntity; import fr.ird.observe.entities.constants.GearTypePersist; import fr.ird.observe.entities.constants.ReferenceStatusPersist; import fr.ird.observe.entities.constants.TripMapPointTypePersist; @@ -34,6 +35,7 @@ import fr.ird.observe.entities.constants.seine.TypeTransmittingBuoyOperationPers import fr.ird.observe.entities.referentiel.I18nReferenceEntities; import fr.ird.observe.entities.referentiel.I18nReferentialEntity; import fr.ird.observe.entities.referentiel.ObserveReferentialEntity; +import fr.ird.observe.services.dto.AbstractReference; import fr.ird.observe.services.dto.referential.I18nReferentialHelper; import fr.ird.observe.services.topia.binder.referential.ReferentialBinderSupport; import fr.ird.observe.services.dto.IdDto; @@ -232,4 +234,12 @@ public abstract class BinderSupport<E extends TopiaEntity, D extends IdDto> { } } + + protected <D extends IdDto> String toDtoId(AbstractReference<D> dto) { + return dto == null ? null : dto.getId(); + } + + protected <E extends ObserveEntity> String toEntityId(E entity) { + return entity == null ? null : entity.getTopiaId(); + } } diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivityLonglineBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivityLonglineBinder.java index b9213e7..984f684 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivityLonglineBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivityLonglineBinder.java @@ -77,7 +77,7 @@ public class ActivityLonglineBinder extends DataBinderSupport<ActivityLongline, return toDataReference(entity, entity.getTimeStamp(), - entity.getVesselActivityLongline().getTopiaId(), + toEntityId(entity.getVesselActivityLongline()), getLabel(referentialLocale, entity.getVesselActivityLongline()), toDataReference(referentialLocale, entity.getSetLongline(), SetLonglineDto.class)); @@ -88,7 +88,7 @@ public class ActivityLonglineBinder extends DataBinderSupport<ActivityLongline, return toDataReference(dto, dto.getTimeStamp(), - dto.getVesselActivityLongline().getId(), + toDtoId(dto.getVesselActivityLongline()), getLabel(referentialLocale, dto.getVesselActivityLongline()), dto.getSetLongline()); } diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivitySeineBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivitySeineBinder.java index 4f1a360..9d8b2f7 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivitySeineBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/ActivitySeineBinder.java @@ -109,7 +109,7 @@ public class ActivitySeineBinder extends DataBinderSupport<ActivitySeine, Activi return toDataReference(entity, entity.getTime(), - entity.getVesselActivitySeine().getTopiaId(), + toEntityId(entity.getVesselActivitySeine()), getLabel(referentialLocale, entity.getVesselActivitySeine()), toDataReference(referentialLocale, entity.getSetSeine(), SetSeineDto.class)); @@ -120,7 +120,7 @@ public class ActivitySeineBinder extends DataBinderSupport<ActivitySeine, Activi return toDataReference(dto, dto.getTime(), - dto.getVesselActivitySeine().getId(), + toDtoId(dto.getVesselActivitySeine()), getLabel(referentialLocale, dto.getVesselActivitySeine()), dto.getSetSeine()); diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/NonTargetLengthBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/NonTargetLengthBinder.java index 91e27ce..345dd31 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/NonTargetLengthBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/NonTargetLengthBinder.java @@ -23,12 +23,14 @@ package fr.ird.observe.services.topia.binder.data; */ import fr.ird.observe.entities.referentiel.Sex; +import fr.ird.observe.entities.referentiel.SizeMeasureType; import fr.ird.observe.entities.referentiel.Species; import fr.ird.observe.entities.referentiel.seine.SpeciesFate; import fr.ird.observe.entities.seine.NonTargetLength; import fr.ird.observe.services.dto.DataReference; import fr.ird.observe.services.dto.constants.ReferentialLocale; import fr.ird.observe.services.dto.referential.SexDto; +import fr.ird.observe.services.dto.referential.SizeMeasureTypeDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.SpeciesFateDto; import fr.ird.observe.services.dto.seine.NonTargetLengthDto; @@ -60,6 +62,7 @@ public class NonTargetLengthBinder extends DataBinderSupport<NonTargetLength, No entity.setSpecies(toEntity(dto.getSpecies(), Species.class)); entity.setSex(toEntity(dto.getSex(), Sex.class)); entity.setSpeciesFate(toEntity(dto.getSpeciesFate(), SpeciesFate.class)); + entity.setSizeMeasureType(toEntity(dto.getSizeMeasureType(), SizeMeasureType.class)); entity.setTagNumber(dto.getTagNumber()); } @@ -80,6 +83,7 @@ public class NonTargetLengthBinder extends DataBinderSupport<NonTargetLength, No dto.setSpecies(toReferentialReference(referentialLocale, entity.getSpecies(), SpeciesDto.class)); dto.setSex(toReferentialReference(referentialLocale, entity.getSex(), SexDto.class)); dto.setSpeciesFate(toReferentialReference(referentialLocale, entity.getSpeciesFate(), SpeciesFateDto.class)); + dto.setSizeMeasureType(toReferentialReference(referentialLocale, entity.getSizeMeasureType(), SizeMeasureTypeDto.class)); dto.setTagNumber(entity.getTagNumber()); } diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripLonglineBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripLonglineBinder.java index 8b2eb78..7ab3890 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripLonglineBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripLonglineBinder.java @@ -103,8 +103,8 @@ public class TripLonglineBinder extends DataBinderSupport<TripLongline, TripLong return toDataReference(entity, entity.getStartDate(), entity.getEndDate(), - entity.getProgram().getTopiaId(), - entity.getTripType().getTopiaId(), + toEntityId(entity.getProgram()), + toEntityId(entity.getTripType()), getLabel(referentialLocale, entity.getVessel()), entity.getObserverLabel()); @@ -116,8 +116,8 @@ public class TripLonglineBinder extends DataBinderSupport<TripLongline, TripLong return toDataReference(dto, dto.getStartDate(), dto.getEndDate(), - dto.getProgram().getId(), - dto.getTripType().getId(), + toDtoId(dto.getProgram()), + toDtoId(dto.getTripType()), getLabel(referentialLocale, dto.getVessel()), PersonHelper.getNames(dto.getObserver())); diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripSeineBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripSeineBinder.java index ad5bb84..a4ce727 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripSeineBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/data/TripSeineBinder.java @@ -104,7 +104,7 @@ public class TripSeineBinder extends DataBinderSupport<TripSeine, TripSeineDto> return toDataReference(entity, entity.getStartDate(), entity.getEndDate(), - entity.getProgram().getTopiaId(), + toEntityId(entity.getProgram()), entity.getRouteCount(), getLabel(referentialLocale, entity.getVessel()), entity.getObserverLabel()); @@ -117,7 +117,7 @@ public class TripSeineBinder extends DataBinderSupport<TripSeine, TripSeineDto> return toDataReference(dto, dto.getStartDate(), dto.getEndDate(), - dto.getProgram().getId(), + toDtoId(dto.getProgram()), dto.getRouteCount(), getLabel(referentialLocale, dto.getVessel()), PersonHelper.getNames(dto.getObserver())); diff --git a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/SpeciesBinder.java b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/SpeciesBinder.java index 016258c..b707f21 100644 --- a/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/SpeciesBinder.java +++ b/services-topia-binder/src/main/java/fr/ird/observe/services/topia/binder/referential/SpeciesBinder.java @@ -92,7 +92,7 @@ public class SpeciesBinder extends ReferentialBinderSupport<Species, SpeciesDto> entity.getFaoCode(), entity.getScientificLabel(), entity.getHomeId(), - entity.getSizeMeasureType() == null ? null : getLabel(referentialLocale, entity.getSizeMeasureType())); + toEntityId(entity.getSizeMeasureType())); } @@ -104,7 +104,7 @@ public class SpeciesBinder extends ReferentialBinderSupport<Species, SpeciesDto> dto.getFaoCode(), dto.getScientificLabel(), dto.getHomeId(), - dto.getSizeMeasureType() == null ? null : getLabel(referentialLocale, dto.getSizeMeasureType())); + toDtoId(dto.getSizeMeasureType())); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 f6609dd61769b259529ed0ba0282a65117479549 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 6 12:03:03 2016 +0100 Ajout validation de sizeMeasureType sur NonTargetLength --- .../NonTargetLengthDto-ui-update-error-validation.xml | 17 +++++++++++++++++ .../i18n/application-swing-validation_en_GB.properties | 2 ++ .../i18n/application-swing-validation_es_ES.properties | 2 ++ .../i18n/application-swing-validation_fr_FR.properties | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetLengthDto-ui-update-error-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetLengthDto-ui-update-error-validation.xml index 3e29532..361b885 100644 --- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetLengthDto-ui-update-error-validation.xml +++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetLengthDto-ui-update-error-validation.xml @@ -55,6 +55,23 @@ </field> + <field name="sizeMeasureType"> + + <!-- pas de sizeMeasureType selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.ui.nonTargetLength.required.sizeMeasureType</message> + </field-validator> + + <!-- sizeMeasureType desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ sizeMeasureType.enabled ]]> + </param> + <message>validator.ui.nonTargetLength.desactivated.sizeMeasureType</message> + </field-validator> + + </field> + <field name="length"> <!-- taille obligatoire en mode par count --> 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 9f9426d..6d8aa55 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 @@ -371,7 +371,9 @@ validator.ui.nonTargetCatch.required.speciesFate=Species fate must be filled. validator.ui.nonTargetCatch.required.weightOrNombreEstime=Weight or estimated count must be filled. validator.ui.nonTargetCatch.required.weightOrTailleMoyen=Weight or mean size must be filled. validator.ui.nonTargetCatch.uniqueKey=Tuple (speces - objectFate) muste be unique. +validator.ui.nonTargetLength.desactivated.sizeMeasureType=Selected size measure type is disabled. validator.ui.nonTargetLength.desactivated.speciesFate=Selected species fate is disabled. +validator.ui.nonTargetLength.required.sizeMeasureType=Size measure type is mandatory. validator.ui.nonTargetLength.required.speciesFate=Species fate must be filled. validator.ui.nonTargetSample.bound.length=Length must be bound between %s and %s. validator.ui.nonTargetSample.bound.weight=Weight must be bound between %s and %s. 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 51bdabd..1e0b795 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 @@ -371,7 +371,9 @@ validator.ui.nonTargetCatch.required.speciesFate=Es obligatoiro seleccionar un f validator.ui.nonTargetCatch.required.weightOrNombreEstime=Debe seleccionar uno de los dos valores (peso estimado, número estimado). validator.ui.nonTargetCatch.required.weightOrTailleMoyen=Debe seleccionar uno de los dos valores (peso medio o talla media). validator.ui.nonTargetCatch.uniqueKey=El par (especie - objectFate) debe ser único. +validator.ui.nonTargetLength.desactivated.sizeMeasureType=Selected size mesure type is disabled. \#TODO validator.ui.nonTargetLength.desactivated.speciesFate=El objectFate de fauna seleccionado está desactivado. +validator.ui.nonTargetLength.required.sizeMeasureType=Es obligatoria especificar el size measure type \#TODO validator.ui.nonTargetLength.required.speciesFate=Es obligatoiro seleccionar un futuro de fauna. validator.ui.nonTargetSample.bound.length=La talla para esta especie debe estar comprendida entre %1$s y %2$s. validator.ui.nonTargetSample.bound.weight=La peso para esta especie debe estar comprendida entre %1$s y %2$s. 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 fb6e9ea..801b518 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 @@ -371,7 +371,9 @@ validator.ui.nonTargetCatch.required.speciesFate=La sélection d'un devenir faun validator.ui.nonTargetCatch.required.weightOrNombreEstime=Une des deux valeurs (poids estimé, nombre estimé) doit être renseignée. validator.ui.nonTargetCatch.required.weightOrTailleMoyen=Une des deux valeurs (poids moyen ou taille moyenne) devrait être renseignée. validator.ui.nonTargetCatch.uniqueKey=Le couple (espèce - objectFate) doit être unique. +validator.ui.nonTargetLength.desactivated.sizeMeasureType=Le type de mesure sélectionné est désactivé. validator.ui.nonTargetLength.desactivated.speciesFate=Le devenir faune sélectionné est désactivé. +validator.ui.nonTargetLength.required.sizeMeasureType=Le type de mesure est obligatoire. validator.ui.nonTargetLength.required.speciesFate=La sélection d'un devenir faune est obligatoire. validator.ui.nonTargetSample.bound.length=La taille pour cette espèce doit être comprise entre %1$s et %2$s. validator.ui.nonTargetSample.bound.weight=Le poids pour cette espèce doit être compris entre %1$s et %2$s. @@ -562,7 +564,6 @@ validator.ui.targetLength.desactivated.species=L'espèce sélectionnée est dés validator.ui.targetLength.positive.length=La longueur est un entier strictement positif. validator.ui.targetLength.positive.weight=Le poids est un entier strictement positif. validator.ui.targetLength.required.count=Le nombre effectif est obligatoire. -validator.ui.targetLength.required.sizeMeasureType=Le type de mesure est obligatoire. validator.ui.targetLength.required.species=La sélection d'une espèce de thon est obligatoire. validator.ui.targetLength.required.taille=La taille est obligatoire. validator.ui.targetLength.required.weight.or.taille=Au moins une des valeurs (taille / poids) doit être renseignée. -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 58332577f889bd7e2844fcfdc6757b02f534c2cb Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 6 12:39:47 2016 +0100 Introduction de deux nouveaux modules services-dto-reference et services-dto-gson --- .../application-swing-validation_fr_FR.properties | 1 + application-swing/pom.xml | 5 + application-web/pom.xml | 5 + pom.xml | 2 + services-dto-gson/LICENSE.txt | 674 +++++++++++++++++++++ services-dto-gson/README.md | 0 services-dto-gson/pom.xml | 69 +++ .../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 services-dto-reference/LICENSE.txt | 674 +++++++++++++++++++++ services-dto-reference/README.md | 0 services-dto-reference/pom.xml | 65 ++ .../dto/reference/DataReferenceSetDefinitions.java | 0 .../dto/reference/ReferenceBinderEngine.java | 0 .../reference/ReferenceBinderEngineSupplier.java | 0 .../dto/reference/ReferenceSetDefinition.java | 0 .../ReferentialReferenceSetDefinitions.java | 0 .../request/ReferenceSetRequestDefinition.java | 0 .../request/ReferenceSetRequestDefinitions.java | 0 .../request/ReferenceSetRequestKeyDefinition.java | 0 services-dto/pom.xml | 13 - services-rest/pom.xml | 11 + services-runner/pom.xml | 6 + services-topia-binder/pom.xml | 5 + services-topia/pom.xml | 11 + services/pom.xml | 9 + 44 files changed, 1537 insertions(+), 13 deletions(-) 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 801b518..a04e7e4 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 @@ -564,6 +564,7 @@ validator.ui.targetLength.desactivated.species=L'espèce sélectionnée est dés validator.ui.targetLength.positive.length=La longueur est un entier strictement positif. validator.ui.targetLength.positive.weight=Le poids est un entier strictement positif. validator.ui.targetLength.required.count=Le nombre effectif est obligatoire. +validator.ui.targetLength.required.sizeMeasureType=La sélection d'un type de mensuration est obligatoire. validator.ui.targetLength.required.species=La sélection d'une espèce de thon est obligatoire. validator.ui.targetLength.required.taille=La taille est obligatoire. validator.ui.targetLength.required.weight.or.taille=Au moins une des valeurs (taille / poids) doit être renseignée. diff --git a/application-swing/pom.xml b/application-swing/pom.xml index 88e19be..8e790a8 100644 --- a/application-swing/pom.xml +++ b/application-swing/pom.xml @@ -93,6 +93,11 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-configuration</artifactId> <version>${project.version}</version> </dependency> diff --git a/application-web/pom.xml b/application-web/pom.xml index 8e31dc1..1d8aead 100644 --- a/application-web/pom.xml +++ b/application-web/pom.xml @@ -41,6 +41,11 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-gson</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-configuration</artifactId> <version>${project.version}</version> </dependency> diff --git a/pom.xml b/pom.xml index 4cd0c04..7b883ee 100644 --- a/pom.xml +++ b/pom.xml @@ -119,6 +119,8 @@ <module>services-configuration-topia</module> <module>services-configuration-rest</module> <module>services-dto</module> + <module>services-dto-reference</module> + <module>services-dto-gson</module> <module>services</module> <module>test</module> <module>entities</module> diff --git a/services-dto-gson/LICENSE.txt b/services-dto-gson/LICENSE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/services-dto-gson/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/services-dto-gson/README.md b/services-dto-gson/README.md new file mode 100644 index 0000000..e69de29 diff --git a/services-dto-gson/pom.xml b/services-dto-gson/pom.xml new file mode 100644 index 0000000..9082b1c --- /dev/null +++ b/services-dto-gson/pom.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Business + + $HeadURL$ + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser 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 Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>fr.ird.observe</groupId> + <artifactId>observe</artifactId> + <version>5.1-SNAPSHOT</version> + </parent> + + <artifactId>services-dto-gson</artifactId> + + <name>ObServe :: Services DTO Gson</name> + <description>ObServe services DTO Gson module</description> + + <dependencies> + + <!-- sibling dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>services-dto</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-version</artifactId> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> + + </dependencies> + +</project> diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/BlobAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/BlobAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/BlobAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/BlobAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ClassAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ClassAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ClassAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ClassAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/DateAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/DateAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/DateAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/DateAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/FormAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/FormAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/FormAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/FormAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableListAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableListAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableListAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableListAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMapAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMapAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMapAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMapAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableMultimapAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableSetAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableSetAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ImmutableSetAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ImmutableSetAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/IntegerAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/IntegerAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/IntegerAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/IntegerAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ObserveDtoGsonSupplier.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ReferentialMultimapAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ReferentialMultimapAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ReferentialMultimapAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ReferentialMultimapAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/ReportVariableAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ReportVariableAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/ReportVariableAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/ReportVariableAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/VersionAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/VersionAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/VersionAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/VersionAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceSetAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceSetAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceSetAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/AbstractReferenceSetAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceSetAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceSetAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceSetAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/DataReferenceSetAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceSetAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceSetAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceSetAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/ReferentialReferenceSetAdapter.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/UnknownReferenceAdapter.java b/services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/UnknownReferenceAdapter.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/gson/reference/UnknownReferenceAdapter.java rename to services-dto-gson/src/main/java/fr/ird/observe/services/dto/gson/reference/UnknownReferenceAdapter.java diff --git a/services-dto-reference/LICENSE.txt b/services-dto-reference/LICENSE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/services-dto-reference/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/services-dto-reference/README.md b/services-dto-reference/README.md new file mode 100644 index 0000000..e69de29 diff --git a/services-dto-reference/pom.xml b/services-dto-reference/pom.xml new file mode 100644 index 0000000..882c31f --- /dev/null +++ b/services-dto-reference/pom.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Business + + $HeadURL$ + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser 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 Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>fr.ird.observe</groupId> + <artifactId>observe</artifactId> + <version>5.1-SNAPSHOT</version> + </parent> + + <artifactId>services-dto-reference</artifactId> + + <name>ObServe :: Services DTO References</name> + <description>ObServe services DTO References module</description> + + <dependencies> + + <!-- sibling dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>services-dto</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + </dependencies> + +</project> diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/DataReferenceSetDefinitions.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/DataReferenceSetDefinitions.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/DataReferenceSetDefinitions.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/DataReferenceSetDefinitions.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngine.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngine.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngine.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngine.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngineSupplier.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngineSupplier.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngineSupplier.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceBinderEngineSupplier.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceSetDefinition.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceSetDefinition.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferenceSetDefinition.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferenceSetDefinition.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/ReferentialReferenceSetDefinitions.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinition.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinition.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinition.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinition.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestDefinitions.java diff --git a/services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestKeyDefinition.java b/services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestKeyDefinition.java similarity index 100% rename from services-dto/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestKeyDefinition.java rename to services-dto-reference/src/main/java/fr/ird/observe/services/dto/reference/request/ReferenceSetRequestKeyDefinition.java diff --git a/services-dto/pom.xml b/services-dto/pom.xml index 98564be..5b2baff 100644 --- a/services-dto/pom.xml +++ b/services-dto/pom.xml @@ -48,10 +48,6 @@ <!-- Nuiton --> <dependency> <groupId>org.nuiton</groupId> - <artifactId>nuiton-version</artifactId> - </dependency> - <dependency> - <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> <dependency> @@ -63,11 +59,6 @@ <artifactId>nuiton-config</artifactId> </dependency> - <dependency> - <groupId>org.reflections</groupId> - <artifactId>reflections</artifactId> - </dependency> - <!-- JAXX --> <dependency> <groupId>org.nuiton.jaxx</groupId> @@ -94,10 +85,6 @@ <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> </dependencies> diff --git a/services-rest/pom.xml b/services-rest/pom.xml index 6d6e459..496b5c3 100644 --- a/services-rest/pom.xml +++ b/services-rest/pom.xml @@ -23,6 +23,11 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-configuration</artifactId> <version>${project.version}</version> </dependency> @@ -38,6 +43,12 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-gson</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>test</artifactId> <version>${project.version}</version> <scope>test</scope> diff --git a/services-runner/pom.xml b/services-runner/pom.xml index 9bad970..859040e 100644 --- a/services-runner/pom.xml +++ b/services-runner/pom.xml @@ -38,6 +38,12 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-gson</artifactId> + <version>${project.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-rest</artifactId> <version>${project.version}</version> <scope>runtime</scope> diff --git a/services-topia-binder/pom.xml b/services-topia-binder/pom.xml index 51bb6d8..5f25805 100644 --- a/services-topia-binder/pom.xml +++ b/services-topia-binder/pom.xml @@ -23,6 +23,11 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>entities</artifactId> <version>${project.version}</version> </dependency> diff --git a/services-topia/pom.xml b/services-topia/pom.xml index cc25da3..b39fba5 100644 --- a/services-topia/pom.xml +++ b/services-topia/pom.xml @@ -23,6 +23,17 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>services-dto-gson</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-configuration</artifactId> <version>${project.version}</version> </dependency> diff --git a/services/pom.xml b/services/pom.xml index 05c202b..588816b 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -23,6 +23,15 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>services-dto-reference</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>services-dto-gson</artifactId> + <version>${project.version}</version> + </dependency><dependency> + <groupId>${project.groupId}</groupId> <artifactId>services-configuration</artifactId> <version>${project.version}</version> </dependency> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 b9f1339edaf1a4f82f44d8f21489a9cd4f36f642 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 6 15:48:25 2016 +0100 Utilisation de la conversion taille - taille quand requis --- .../observe/entities/LengthWeightComputable.java | 5 +- .../referentiel/LengthLengthParameterTopiaDao.java | 16 ++++++ .../referentiel/LengthLengthParameters.java | 9 ++++ .../referentiel/LengthWeightParameters.java | 63 ++++++++++------------ .../observe/entities/seine/NonTargetCatchImpl.java | 6 +++ .../consolidate/ConsolidateDataServiceTopia.java | 31 +++++++++-- .../topia/entity/LengthWeightParemetersTest.java | 4 +- 7 files changed, 92 insertions(+), 42 deletions(-) diff --git a/entities/src/main/java/fr/ird/observe/entities/LengthWeightComputable.java b/entities/src/main/java/fr/ird/observe/entities/LengthWeightComputable.java index 0e2a5d6..7d8a60b 100644 --- a/entities/src/main/java/fr/ird/observe/entities/LengthWeightComputable.java +++ b/entities/src/main/java/fr/ird/observe/entities/LengthWeightComputable.java @@ -22,6 +22,7 @@ package fr.ird.observe.entities; * #L% */ +import fr.ird.observe.entities.referentiel.SizeMeasureType; import org.nuiton.topia.persistence.TopiaEntity; public interface LengthWeightComputable extends TopiaEntity { @@ -42,4 +43,6 @@ public interface LengthWeightComputable extends TopiaEntity { void setIsWeightComputed(boolean weightSource); -} //LengthWeightComputable + SizeMeasureType getSizeMeasureType(); + +} diff --git a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterTopiaDao.java b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterTopiaDao.java new file mode 100644 index 0000000..9d21663 --- /dev/null +++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterTopiaDao.java @@ -0,0 +1,16 @@ +package fr.ird.observe.entities.referentiel; + +import java.util.Optional; + +public class LengthLengthParameterTopiaDao extends AbstractLengthLengthParameterTopiaDao<LengthLengthParameter> { + + Optional<LengthLengthParameter> find(SizeMeasureType inputSizeMeasureType, SizeMeasureType outputSizeMeasureType) { + + return Optional.ofNullable( + forProperties(LengthLengthParameter.PROPERTY_INPUT_SIZE_MEASURE_TYPE, inputSizeMeasureType, + LengthLengthParameter.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE, outputSizeMeasureType) + .tryFindAny() + .orNull()); + } +} + 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 index d24f086..89f2506 100644 --- a/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java +++ b/entities/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java @@ -1,5 +1,9 @@ package fr.ird.observe.entities.referentiel; +import fr.ird.observe.ObserveTopiaDaoSupplier; + +import java.util.Optional; + /** * Created on 05/11/16. * @@ -8,5 +12,10 @@ package fr.ird.observe.entities.referentiel; */ public class LengthLengthParameters { + public static Optional<LengthLengthParameter> findLengthLengthParameter(ObserveTopiaDaoSupplier daoSupplier, + SizeMeasureType inputSizeMeasureType, + SizeMeasureType outputSizeMeasureType) { + return daoSupplier.getLengthLengthParameterDao().find(inputSizeMeasureType, outputSizeMeasureType); + } } 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 197d5e4..381826e 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 @@ -30,6 +30,7 @@ import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * Created on 28/08/15. @@ -52,15 +53,17 @@ public class LengthWeightParameters { * Si non trouvé sur le gender (et que le gender n'est pas indéterminé) , alors * on recherche avec le gender indéterminé (gender=0). * - * @param daoSupplier la transaction en cours d'utilisation - * @param species l'espèce sur lequel on recherche le paramétrage - * @param ocean l'ocean recherché (peut être null) - * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé) - * @param date le jour recherché + * @param daoSupplier la transaction en cours d'utilisation + * @param sizeMeasureType le type de mensuration recherché + * @param species l'espèce sur lequel on recherche le paramétrage + * @param ocean l'ocean recherché (peut être null) + * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé) + * @param date le jour recherché * @return le paramétrage adéquate * @since 1.5 */ public static LengthWeightParameter findLengthWeightParameter(ObserveTopiaDaoSupplier daoSupplier, + SizeMeasureType sizeMeasureType, Species species, Ocean ocean, Sex sex, @@ -87,25 +90,25 @@ public class LengthWeightParameters { return null; } + if (sizeMeasureType!=null) { + + // on filtre par le type de mensuration entrant + List<LengthWeightParameter> list2 = filterBySizeMeasureType(list, sizeMeasureType); + + if (!list2.isEmpty()) { + + // ok pas trouvé avec le bon type de mensuration, on fera la conversion plus tard + // on tente cependante d'utiliser la RTP trouvé + list = list2; + } + } + // au final il ne devrait en rester qu'un if (list.size() > 1) { throw new DuplicateLengthWeightParameterException(species, ocean, sex, date, list); } - // if (log.isDebugEnabled()) { -// StringBuilder sb = new StringBuilder("Paramétrage trouvé pour les données suivantes :"); -// sb.append("\nEspece : "); -// sb.append(getDecoratorService().decorate(species)); -// sb.append("\nOcean : "); -// sb.append(getDecoratorService().decorate(ocean)); -// sb.append("\nSex : "); -// sb.append(getDecoratorService().decorate(sex)); -// sb.append("\nDate : ").append(date); -// sb.append("\nParamétrage: ").append(getDecoratorService().decorate(result)); -// log.debug(sb.toString()); -// } - return list.get(0); } @@ -246,27 +249,17 @@ public class LengthWeightParameters { } public static List<LengthWeightParameter> filterBySexe(List<LengthWeightParameter> list, Sex sex) { - List<LengthWeightParameter> result = new ArrayList<>(); + return list.stream().filter(l -> l.getSex() == sex).collect(Collectors.toList()); + } - for (LengthWeightParameter parametrageLengthWeight : list) { - if (parametrageLengthWeight.getSex() == sex) { - result.add(parametrageLengthWeight); - } - } - return result; + public static List<LengthWeightParameter> filterBySizeMeasureType(List<LengthWeightParameter> list, SizeMeasureType sizeMeasureType) { + return list.stream().filter(l -> l.getSizeMeasureType() == sizeMeasureType).collect(Collectors.toList()); } public static List<LengthWeightParameter> filterByDateDebutValidite(List<LengthWeightParameter> list, Date startDate) { - List<LengthWeightParameter> result = new ArrayList<>(); - - for (LengthWeightParameter parametrageLengthWeight : list) { - - if (parametrageLengthWeight.getStartDate() == null || parametrageLengthWeight.getStartDate().before(startDate) || - parametrageLengthWeight.getStartDate().equals(startDate)) { - result.add(parametrageLengthWeight); - } - } - return result; + return list.stream() + .filter(l -> l.getStartDate() == null || l.getStartDate().before(startDate) || l.getStartDate().equals(startDate)) + .collect(Collectors.toList()); } public static List<LengthWeightParameter> filterByDateFinValidite(List<LengthWeightParameter> list, Date endDate) { diff --git a/entities/src/main/java/fr/ird/observe/entities/seine/NonTargetCatchImpl.java b/entities/src/main/java/fr/ird/observe/entities/seine/NonTargetCatchImpl.java index 867bb76..8901543 100644 --- a/entities/src/main/java/fr/ird/observe/entities/seine/NonTargetCatchImpl.java +++ b/entities/src/main/java/fr/ird/observe/entities/seine/NonTargetCatchImpl.java @@ -23,6 +23,7 @@ package fr.ird.observe.entities.seine; import fr.ird.observe.entities.constants.seine.NonTargetCatchComputedValueSourcePersist; import fr.ird.observe.entities.referentiel.LengthWeightParameter; +import fr.ird.observe.entities.referentiel.SizeMeasureType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.NumberUtil; @@ -88,6 +89,11 @@ public class NonTargetCatchImpl extends NonTargetCatchAbstract { } @Override + public SizeMeasureType getSizeMeasureType() { + return null; // pas utilisé pour les captures + } + + @Override public void setMeanWeight(Float meanWeight) { if (meanWeight != null) { 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 303240c..9ce88be 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 @@ -28,11 +28,14 @@ import fr.ird.observe.ObserveTopiaPersistenceContext; import fr.ird.observe.entities.LengthWeightComputable; import fr.ird.observe.entities.constants.seine.NonTargetCatchComputedValueSourcePersist; import fr.ird.observe.entities.constants.seine.SchoolTypePersist; +import fr.ird.observe.entities.referentiel.LengthLengthParameter; +import fr.ird.observe.entities.referentiel.LengthLengthParameters; import fr.ird.observe.entities.referentiel.LengthWeightParameter; import fr.ird.observe.entities.referentiel.LengthWeightParameterNotFoundException; import fr.ird.observe.entities.referentiel.LengthWeightParameters; import fr.ird.observe.entities.referentiel.Ocean; import fr.ird.observe.entities.referentiel.Sex; +import fr.ird.observe.entities.referentiel.SizeMeasureType; import fr.ird.observe.entities.referentiel.Species; import fr.ird.observe.entities.seine.ActivitySeine; import fr.ird.observe.entities.seine.NonTargetCatch; @@ -276,7 +279,7 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements Species species = nonTargetCatch.getSpecies(); // récupération du référentiel - LengthWeightParameter lengthWeightParameter = activityContext.findLengthWeightParameter(species, null /* pas de sexe spécifié*/); + LengthWeightParameter lengthWeightParameter = activityContext.findLengthWeightParameter(null, species, null /* pas de sexe spécifié*/); // -- Cas n°1 (calcul uniquement à partir des relations taille - poids) updateNonTargetCatchByLengthWeightRelation(nonTargetCatch, lengthWeightParameter); @@ -541,7 +544,8 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements } // recherche du parametrage adequate - LengthWeightParameter lengthWeightParameter = activityContext.findLengthWeightParameter(species, sex); + SizeMeasureType inputSizeMeasureType = lengthWeightComputable.getSizeMeasureType(); + LengthWeightParameter lengthWeightParameter = activityContext.findLengthWeightParameter(inputSizeMeasureType, species, sex); if (lengthWeightParameter == null) { @@ -566,6 +570,25 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements } + SizeMeasureType outputSizeMeasureType = lengthWeightParameter.getSizeMeasureType(); + if (!outputSizeMeasureType.equals(inputSizeMeasureType)) { + + // on doit effectuer une conversion taille - taille avant de convertir en poids + Optional<LengthLengthParameter> optionalLengthLengthParameter = LengthLengthParameters.findLengthLengthParameter(activityContext.daoSupplier, inputSizeMeasureType, outputSizeMeasureType); + + if (optionalLengthLengthParameter.isPresent()) { + + length = optionalLengthLengthParameter.get().computeFromFomulaOne(length); + + } else { + + if (log.isWarnEnabled()) { + log.warn("Could not find lengLengthParameter for input: " + inputSizeMeasureType + " - output: " + outputSizeMeasureType); + } + return; + } + } + // on cherche obligatoirement a calculer le poids Float newWeight = lengthWeightParameter.computeFromFomulaOne(length); if (newWeight != null) { @@ -669,10 +692,10 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements return activity.getSetSeine(); } - public LengthWeightParameter findLengthWeightParameter(Species species, Sex sex) { + public LengthWeightParameter findLengthWeightParameter(SizeMeasureType sizeMeasureType, Species species, Sex sex) { Ocean ocean = getOcean(); Date routeDate = getRouteDate(); - LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(daoSupplier, species, ocean, sex, routeDate); + LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(daoSupplier, sizeMeasureType, species, ocean, sex, routeDate); if (lengthWeightParameter == null) { if (failIfLenghtWeightParameterNotFound) { 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 67db9a1..be7d169 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 @@ -222,7 +222,7 @@ public class LengthWeightParemetersTest extends AbstractServiceTopiaTest { if (log.isInfoEnabled()) { log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date); } - LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, ocean, sex, date); + LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, null, species, ocean, sex, date); 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()); @@ -237,7 +237,7 @@ public class LengthWeightParemetersTest extends AbstractServiceTopiaTest { if (log.isInfoEnabled()) { log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date); } - LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, ocean, sex, date); + LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, null, species, ocean, sex, date); Assert.assertNull("length weith parameter should not ne found for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date, lengthWeightParameter); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 4a38a2237880e4cfde839a607f7f91328fe61fc4 Merge: 18a9780 b9f1339 Author: Tony CHEMIT <chemit@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 .../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 + ...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 +-- .../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 + .../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 + services-dto-gson/LICENSE.txt | 674 +++++++++++++++++++++ services-dto-gson/README.md | 0 services-dto-gson/pom.xml | 69 +++ .../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 services-dto-reference/LICENSE.txt | 674 +++++++++++++++++++++ services-dto-reference/README.md | 0 services-dto-reference/pom.xml | 65 ++ .../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 +- ...gthLengthParameter-service-error-validation.xml | 87 +++ ...hLengthParameter-service-warning-validation.xml | 29 +- ...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, 3459 insertions(+), 1231 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm