Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 3486d482 by Tony CHEMIT at 2018-05-19T23:36:38Z Ajout du référentiel observe_longline.WeightDeterminationMethod - Closes #921 - - - - - 29 changed files: - + client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIModel.java - + dto/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodDtoReferenceBinder.java - dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java - dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java - dto/src/main/models/Observe.model - dto/src/main/resources/i18n/dto_en_GB.properties - dto/src/main/resources/i18n/dto_es_ES.properties - dto/src/main/resources/i18n/dto_fr_FR.properties - + persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityDtoBinder.java - + persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityReferenceBinder.java - persistence/src/main/java/fr/ird/observe/persistence/Entities.java - persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_8_0.java - persistence/src/main/models/Observe.model - + persistence/src/main/resources/db/migration/8.0/07_add_weight_determination_method-common.sql - services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java - services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java - test/src/main/java/fr/ird/observe/test/ObserveFixtures.java - test/src/main/resources/db/8.0/dataForTestLongline.sql.gz - test/src/main/resources/db/8.0/dataForTestSeine.sql.gz - test/src/main/resources/db/8.0/empty_h2.sql.gz - test/src/main/resources/db/8.0/empty_pg.sql.gz - test/src/main/resources/db/8.0/referentiel.sql.gz - + validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-warning-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-warning-validation.xml - validation/src/test/java/fr/ird/observe/client/validation/BeanValidatorDetectorTest.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUI.jaxx ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUI.jaxx @@ -0,0 +1,90 @@ +<!-- + #%L + ObServe :: Client + %% + Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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% + --> +<fr.ird.observe.client.ui.content.ref.ContentI18nReferenceUI + i18nFormat="observe.common.WeightDeterminationMethodDto.%s" + superGenericType='WeightDeterminationMethodDto, WeightDeterminationMethodReference, WeightDeterminationMethodUI'> + + <style source="../ReferenceEntity.jcss"/> + + <import> + fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto + fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference + + static fr.ird.observe.client.ui.util.UIHelper.getStringValue + fr.ird.observe.dto.referential.ReferenceStatus + </import> + + <!-- validator --> + <BeanValidator id='validator' autoField='true' + beanClass='fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto' + context='create' errorTableModel='{getErrorTableModel()}'> + <field name='label1' component='label1'/> + <field name='label2' component='label2'/> + <field name='label3' component='label3'/> + </BeanValidator> + + <!-- model --> + <WeightDeterminationMethodUIModel id='model'/> + + <!-- edit bean --> + <WeightDeterminationMethodDto id='bean'/> + + <Table id='editTable'> + + <!-- uri --> + <row> + <cell anchor="west"> + <JLabel id='uriLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JTextField id='uri'/> + </cell> + </row> + + <!-- code / status --> + <row> + <cell anchor="west"> + <JLabel id='codeStatusLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel id='codeStatusPanel' layout='{new BorderLayout()}'> + <JTextField id='code' constraints='BorderLayout.WEST'/> + <EnumEditor id='status' constructorParams='ReferenceStatus.class' genericType='ReferenceStatus' + onItemStateChanged='getBean().setStatus((ReferenceStatus)status.getSelectedItem())' + constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + + <!-- needComment --> + <row> + <cell anchor='east' weightx="1" fill="both" columns="2"> + <JCheckBox id='needComment' onItemStateChanged='getBean().setNeedComment(needComment.isSelected())'/> + </cell> + </row> + </Table> + + <JTextField id='label1'/> + <JTextField id='label2'/> + <JTextField id='label3'/> + +</fr.ird.observe.client.ui.content.ref.ContentI18nReferenceUI> ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIHandler.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIHandler.java @@ -0,0 +1,37 @@ +package fr.ird.observe.client.ui.content.ref.longline; + +/*- + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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.client.ui.content.ref.ContentReferenceUIHandler; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference; +import org.nuiton.jaxx.runtime.spi.UIHandler; + +/** + * Created on 06/12/16. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 6.0 + */ +class WeightDeterminationMethodUIHandler extends ContentReferenceUIHandler<WeightDeterminationMethodDto, WeightDeterminationMethodReference, WeightDeterminationMethodUI> implements UIHandler<WeightDeterminationMethodUI> { +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIModel.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/longline/WeightDeterminationMethodUIModel.java @@ -0,0 +1,43 @@ +package fr.ird.observe.client.ui.content.ref.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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.client.ui.content.ref.ContentReferenceUIModel; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference; + +/** + * Created on 9/28/14. + * + * @author Tony Chemit - dev@tchemit.fr + * @since XXX + */ +public class WeightDeterminationMethodUIModel extends ContentReferenceUIModel<WeightDeterminationMethodDto, WeightDeterminationMethodReference> { + + private static final long serialVersionUID = 1L; + + public WeightDeterminationMethodUIModel() { + super(WeightDeterminationMethodDto.class, WeightDeterminationMethodReference.class); + } + +} ===================================== dto/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodDtoReferenceBinder.java ===================================== --- /dev/null +++ b/dto/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodDtoReferenceBinder.java @@ -0,0 +1,25 @@ +package fr.ird.observe.binder.referential.longline; + +import fr.ird.observe.binder.referential.ReferentialDtoReferenceBinder; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference; + +/** + * Created by tchemit on 20/05/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class WeightDeterminationMethodDtoReferenceBinder extends ReferentialDtoReferenceBinder<WeightDeterminationMethodDto, WeightDeterminationMethodReference> { + + public WeightDeterminationMethodDtoReferenceBinder() { + super(WeightDeterminationMethodDto.class, WeightDeterminationMethodReference.class); + } + + @Override + public WeightDeterminationMethodReference toReference(ReferentialLocale referentialLocale, WeightDeterminationMethodDto dto) { + + return new WeightDeterminationMethodReference(dto, dto.getCode(), dto.getLabel(referentialLocale)); + + } +} ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java ===================================== --- a/dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java +++ b/dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java @@ -201,6 +201,8 @@ import fr.ird.observe.dto.referential.longline.ObservationTripTypeDto; import fr.ird.observe.dto.referential.longline.ObservationTripTypeReference; import fr.ird.observe.dto.referential.longline.VesselActivityLonglineDto; import fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference; import fr.ird.observe.dto.referential.seine.DetectionModeDto; import fr.ird.observe.dto.referential.seine.DetectionModeReference; import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseConformityDto; @@ -804,6 +806,11 @@ public class DecoratorService extends DecoratorProvider { } @Override + public void initWeightDeterminationMethodDto() { + registerDefaultReferentialAndReferentialReferenceDecorator(WeightDeterminationMethodDto.class, WeightDeterminationMethodReference.class, libelle); + } + + @Override public void initWindDto() { registerReferentialAndReferentialReferenceDecorator(WindDto.class, WindReference.class, "${code}$s##${" + libelle + "}$s##${speedRange}$s", ===================================== dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java ===================================== --- a/dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java +++ b/dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java @@ -119,13 +119,14 @@ import fr.ird.observe.dto.referential.longline.LightsticksTypeDto; import fr.ird.observe.dto.referential.longline.LineTypeDto; import fr.ird.observe.dto.referential.longline.MaturityStatusDto; import fr.ird.observe.dto.referential.longline.MitigationTypeDto; +import fr.ird.observe.dto.referential.longline.ObservationTripTypeDto; import fr.ird.observe.dto.referential.longline.SensorBrandDto; import fr.ird.observe.dto.referential.longline.SensorDataFormatDto; import fr.ird.observe.dto.referential.longline.SensorTypeDto; import fr.ird.observe.dto.referential.longline.SettingShapeDto; import fr.ird.observe.dto.referential.longline.StomacFullnessDto; -import fr.ird.observe.dto.referential.longline.ObservationTripTypeDto; import fr.ird.observe.dto.referential.longline.VesselActivityLonglineDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; import fr.ird.observe.dto.referential.seine.DetectionModeDto; import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseConformityDto; import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseStatusDto; @@ -234,7 +235,8 @@ public class DtoModelClasses { SettingShapeDto.class, StomacFullnessDto.class, ObservationTripTypeDto.class, - VesselActivityLonglineDto.class); + VesselActivityLonglineDto.class, + WeightDeterminationMethodDto.class); public static final ImmutableSet<Class<? extends ReferentialDto>> REFERENTIAL_TYPES = ImmutableSet.<Class<? extends ReferentialDto>>builder() .addAll(COMMON_REFERENTIAL_TYPES) ===================================== dto/src/main/models/Observe.model ===================================== --- a/dto/src/main/models/Observe.model +++ b/dto/src/main/models/Observe.model @@ -553,6 +553,8 @@ referential.longline.ObservationTripType > referential.I18nReferential referential.longline.VesselActivityLongline > referential.I18nReferential +referential.longline.WeightDeterminationMethod > referential.I18nReferential + referential.seine.DetectionMode > referential.I18nReferential referential.seine.NonTargetCatchReleaseConformity > referential.I18nReferential ===================================== dto/src/main/resources/i18n/dto_en_GB.properties ===================================== --- a/dto/src/main/resources/i18n/dto_en_GB.properties +++ b/dto/src/main/resources/i18n/dto_en_GB.properties @@ -229,6 +229,8 @@ observe.common.VesselTypeDto.type=Vessel type observe.common.VesselTypeDto.types=Vessel types observe.common.WeightCategoryDto.type=Weight category observe.common.WeightCategoryDto.types=Weight categories +observe.common.WeightDeterminationMethodDto.type=Weight determination method +observe.common.WeightDeterminationMethodDto.types=Weight determination methods observe.common.WeightMeasureDto.title=Weight measures observe.common.WeightMeasureDto.type=Weight measure observe.common.WeightMeasureDto.types=Weight measures ===================================== dto/src/main/resources/i18n/dto_es_ES.properties ===================================== --- a/dto/src/main/resources/i18n/dto_es_ES.properties +++ b/dto/src/main/resources/i18n/dto_es_ES.properties @@ -227,6 +227,8 @@ observe.common.VesselTypeDto.type=Tipo de pesquería observe.common.VesselTypeDto.types=Tipos de pesquería observe.common.WeightCategoryDto.type=Categoría de peso observe.common.WeightCategoryDto.types=Categorías de peso +observe.common.WeightDeterminationMethodDto.type=Weight determination method \#TODO +observe.common.WeightDeterminationMethodDto.types=Weight determination methods \#TODO observe.common.WeightMeasureDto.title=Medidas de peso observe.common.WeightMeasureDto.type=Medida de peso observe.common.WeightMeasureDto.types=Medidas de peso ===================================== dto/src/main/resources/i18n/dto_fr_FR.properties ===================================== --- a/dto/src/main/resources/i18n/dto_fr_FR.properties +++ b/dto/src/main/resources/i18n/dto_fr_FR.properties @@ -229,6 +229,8 @@ observe.common.VesselTypeDto.type=Type de pêcherie observe.common.VesselTypeDto.types=Types de pêcherie observe.common.WeightCategoryDto.type=Catégorie de poids observe.common.WeightCategoryDto.types=Catégories de poids +observe.common.WeightDeterminationMethodDto.type=Méthode d'estimation de poids +observe.common.WeightDeterminationMethodDto.types=Méthodes d'estimation de poids observe.common.WeightMeasureDto.title=Mesures de poids observe.common.WeightMeasureDto.type=Mesure de poids observe.common.WeightMeasureDto.types=Mesures de poids ===================================== persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityDtoBinder.java ===================================== --- /dev/null +++ b/persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityDtoBinder.java @@ -0,0 +1,59 @@ +package fr.ird.observe.binder.referential.longline; + +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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.binder.referential.ReferentialEntityDtoBinderSupport; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.entities.referentiel.longline.WeightDeterminationMethod; + +/** + * Created on 24/11/15. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class WeightDeterminationMethodEntityDtoBinder extends ReferentialEntityDtoBinderSupport<WeightDeterminationMethodDto, WeightDeterminationMethod> { + + public WeightDeterminationMethodEntityDtoBinder() { + super(WeightDeterminationMethod.class, WeightDeterminationMethodDto.class); + } + + @Override + public void copyToEntity(ReferentialLocale referentialLocale, WeightDeterminationMethodDto dto, WeightDeterminationMethod entity) { + + + copyDtoReferentialFieldsToEntity(dto, entity); + copyDtoI18nFieldsToEntity(dto, entity); + + } + + @Override + public void copyToDto(ReferentialLocale referentialLocale, WeightDeterminationMethod entity, WeightDeterminationMethodDto dto) { + + + copyEntityReferentialFieldsToDto(entity, dto); + copyEntityI18nFieldsToDto(entity, dto); + + } + +} ===================================== persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityReferenceBinder.java ===================================== --- /dev/null +++ b/persistence/src/main/java/fr/ird/observe/binder/referential/longline/WeightDeterminationMethodEntityReferenceBinder.java @@ -0,0 +1,48 @@ +package fr.ird.observe.binder.referential.longline; + +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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.binder.referential.ReferentialEntityReferenceBinderSupport; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodReference; +import fr.ird.observe.entities.referentiel.longline.WeightDeterminationMethod; + +/** + * Created on 24/11/15. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class WeightDeterminationMethodEntityReferenceBinder extends ReferentialEntityReferenceBinderSupport<WeightDeterminationMethodDto, WeightDeterminationMethodReference, WeightDeterminationMethod> { + + public WeightDeterminationMethodEntityReferenceBinder() { + super(WeightDeterminationMethodDto.class, WeightDeterminationMethodReference.class, WeightDeterminationMethod.class); + } + + @Override + public WeightDeterminationMethodReference toReference(ReferentialLocale referentialLocale, WeightDeterminationMethod dto) { + + return new WeightDeterminationMethodReference(dto, dto.getCode(), dto.getLabel(referentialLocale)); + + } +} ===================================== persistence/src/main/java/fr/ird/observe/persistence/Entities.java ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/Entities.java +++ b/persistence/src/main/java/fr/ird/observe/persistence/Entities.java @@ -114,6 +114,7 @@ public class Entities { ObserveEntityEnum.SensorType, ObserveEntityEnum.SettingShape, ObserveEntityEnum.StomacFullness, + ObserveEntityEnum.WeightDeterminationMethod, ObserveEntityEnum.VesselActivityLongline }; public static final List<ObserveEntityEnum> REFERENCE_ENTITIES_LIST = ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_8_0.java ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_8_0.java +++ b/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_8_0.java @@ -72,6 +72,7 @@ public class DataSourceMigrationForVersion_8_0 extends MigrationVersionResource if (withIds) { executor.addScript("06", "fill_vessel_activity"); } + executor.addScript("07", "add_weight_determination_method"); } } ===================================== persistence/src/main/models/Observe.model ===================================== --- a/persistence/src/main/models/Observe.model +++ b/persistence/src/main/models/Observe.model @@ -655,6 +655,8 @@ referentiel.longline.ObservationTripType > referentiel.I18nReferentialEntity | e referentiel.longline.VesselActivityLongline > referentiel.I18nReferentialEntity | entity dbName=VesselActivity +referentiel.longline.WeightDeterminationMethod > referentiel.I18nReferentialEntity | entity + referentiel.seine.DetectionMode > referentiel.I18nReferentialEntity | entity referentiel.seine.NonTargetCatchReleaseConformity > referentiel.I18nReferentialEntity | entity ===================================== persistence/src/main/resources/db/migration/8.0/07_add_weight_determination_method-common.sql ===================================== --- /dev/null +++ b/persistence/src/main/resources/db/migration/8.0/07_add_weight_determination_method-common.sql @@ -0,0 +1,3 @@ +CREATE TABLE observe_longline.WeightDeterminationMethod(topiaid VARCHAR(255) NOT NULL,topiaversion BIGINT NOT NULL, topiacreatedate DATE, lastupdatedate TIMESTAMP NOT NULL, code VARCHAR(255), status INTEGER DEFAULT 1, needComment BOOLEAN DEFAULT false, uri VARCHAR(255), label1 VARCHAR(255), label2 VARCHAR(255), label3 VARCHAR(255),label4 VARCHAR(255),label5 VARCHAR(255),label6 VARCHAR(255),label7 VARCHAR(255),label8 VARCHAR(255)); +ALTER TABLE observe_longline.WeightDeterminationMethod ADD CONSTRAINT PK_WeightDeterminationMethod PRIMARY KEY(topiaid); +INSERT INTO observe_common.LASTUPDATEDATE(topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#1004', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.longline.WeightDeterminationMethod', CURRENT_TIMESTAMP); ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java ===================================== --- a/services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java @@ -106,6 +106,10 @@ public class UnidirectionalSynchronizeReferentialTest extends ServiceLocalTestSu //empty continue; } + if (ObserveEntityEnum.WeightDeterminationMethod.equals(referenceEntity)) { + //empty + continue; + } Class<? extends ReferentialDto> dtoType = DbModelHelper.fromReferentialEntity(referenceEntity).toDtoType(); Assert.assertTrue("can't find type " + dtoType, referentialNames.contains(dtoType)); Assert.assertTrue(result.getReferentialUpdated(dtoType).isEmpty()); ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java ===================================== --- a/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java @@ -146,8 +146,8 @@ public class ValidateServiceLocalTest extends ServiceLocalTestSupport { ImmutableSet<ValidationResultDtoMessage> messages = result.getMessagesForType(type); System.out.println("assertValidateResult(result, " + type.getSimpleName() + ".class, " + messages.size() + ");"); } - // no data of LengthLegnthParameter - Assert.assertEquals(DtoModelClasses.REFERENTIAL_TYPES.size() - 1, types.size()); + // no data of LengthLegnthParameter, WeightDeterminationMethod + Assert.assertEquals(DtoModelClasses.REFERENTIAL_TYPES.size() - 2, types.size()); assertValidateResult(result, DataQualityDto.class, 1); assertValidateResult(result, SpeciesGroupReleaseModeDto.class, 2); ===================================== test/src/main/java/fr/ird/observe/test/ObserveFixtures.java ===================================== --- a/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java +++ b/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java @@ -62,13 +62,13 @@ public class ObserveFixtures { public static final String SET_LONGLINE_ID_1 = "fr.ird.observe.entities.longline.SetLongline#1429538714446#0.0876020351424813"; - public static final int ENTITY_BINDER_REFERENTIAL_COUNT = 66; + private static final int ENTITY_BINDER_REFERENTIAL_COUNT = 67; public static final int REFERENCE_DATA_COUNT = 33; public static final int REFERENTIAL_FORM_COUNT = ENTITY_BINDER_REFERENTIAL_COUNT; public static final int DATA_FORM_COUNT = 48; - public static final int VALIDATORS_COUNT = 190; + public static final int VALIDATORS_COUNT = 192; public static final int VALIDATOR_CREATE_DATA_COUNT = 8; public static final int VALIDATOR_UPDATE_DATA_COUNT = 37; public static final int VALIDATOR_UPDATE_ENTITY_DATA_COUNT = 29; @@ -252,7 +252,7 @@ public class ObserveFixtures { .put("observe_common.gearcaracteristic", 22L) .put("observe_common.gearcaracteristictype", 6L) .put("observe_common.harbour", 74L) - .put("observe_common.lastupdatedate", 104L) + .put("observe_common.lastupdatedate", 105L) .put("observe_common.lengthlengthparameter", 0L) .put("observe_common.lengthweightparameter", 365L) .put("observe_common.ocean", 3L) @@ -323,6 +323,7 @@ public class ObserveFixtures { .put("observe_longline.settingshape", 6L) .put("observe_longline.stomacfullness", 7L) .put("observe_longline.vesselactivity", 12L) + .put("observe_longline.weightdeterminationmethod", 0L) .build(); public static final ImmutableMap<String, Long> REFERENTIAL_TABLES_COUNT = mergeResults( ===================================== test/src/main/resources/db/8.0/dataForTestLongline.sql.gz ===================================== The diff for this file was not included because it is too large. ===================================== test/src/main/resources/db/8.0/dataForTestSeine.sql.gz ===================================== The diff for this file was not included because it is too large. ===================================== test/src/main/resources/db/8.0/empty_h2.sql.gz ===================================== --- a/test/src/main/resources/db/8.0/empty_h2.sql.gz +++ b/test/src/main/resources/db/8.0/empty_h2.sql.gz @@ -75,6 +75,7 @@ create table OBSERVE_LONGLINE.tdr (topiaId varchar(255) not null, topiaVersion b create table OBSERVE_LONGLINE.tdrRecord (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, temperature numeric, depth numeric, basket varchar(255), tdr varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.Trip (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, comment varchar(2147483647), startDate timestamp, endDate timestamp, totalFishingOperationsNumber integer, homeId varchar(255), tripType varchar(255), observer varchar(255), vessel varchar(255), captain varchar(255), dataEntryOperator varchar(255), program varchar(255), ocean varchar(255), departureHarbour varchar(255), landingHarbour varchar(255), dataQuality varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.VesselActivity (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); +create table OBSERVE_LONGLINE.weightDeterminationMethod (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.weightMeasure (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, weight numeric, weightMeasureType varchar(255), catch varchar(255), primary key (topiaId)); create table OBSERVE_SEINE.Activity (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, comment varchar(2147483647), time time, latitude numeric, longitude numeric, vesselSpeed numeric, seaSurfaceTemperature numeric, observedSystemDistance numeric, ersId varchar(255), vesselActivity varchar(255), surroundingActivity varchar(255), wind varchar(255), detectionMode varchar(255), reasonForNoFishing varchar(255), set varchar(255), currentFpaZone varchar(255), previousFpaZone varchar(255), nextFpaZone varchar(255), dataQuality varchar(255), route varchar(255), primary key (topiaId)); create table OBSERVE_SEINE.activity_observedsystem (activity varchar(255) not null, observedSystem varchar(255) not null, primary key (activity, observedSystem)); ===================================== test/src/main/resources/db/8.0/empty_pg.sql.gz ===================================== --- a/test/src/main/resources/db/8.0/empty_pg.sql.gz +++ b/test/src/main/resources/db/8.0/empty_pg.sql.gz @@ -75,6 +75,7 @@ create table OBSERVE_LONGLINE.tdr (topiaId varchar(255) not null, topiaVersion i create table OBSERVE_LONGLINE.tdrRecord (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, temperature numeric, depth numeric, basket varchar(255), tdr varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.Trip (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, comment text, startDate timestamp, endDate timestamp, totalFishingOperationsNumber int4, homeId varchar(255), tripType varchar(255), observer varchar(255), vessel varchar(255), captain varchar(255), dataEntryOperator varchar(255), program varchar(255), ocean varchar(255), departureHarbour varchar(255), landingHarbour varchar(255), dataQuality varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.VesselActivity (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); +create table OBSERVE_LONGLINE.weightDeterminationMethod (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.weightMeasure (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, weight numeric, weightMeasureType varchar(255), catch varchar(255), primary key (topiaId)); create table OBSERVE_SEINE.Activity (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, comment text, time time, latitude numeric, longitude numeric, vesselSpeed numeric, seaSurfaceTemperature numeric, observedSystemDistance numeric, ersId varchar(255), vesselActivity varchar(255), surroundingActivity varchar(255), wind varchar(255), detectionMode varchar(255), reasonForNoFishing varchar(255), set varchar(255), currentFpaZone varchar(255), previousFpaZone varchar(255), nextFpaZone varchar(255), dataQuality varchar(255), route varchar(255), primary key (topiaId)); create table OBSERVE_SEINE.activity_observedsystem (activity varchar(255) not null, observedSystem varchar(255) not null, primary key (activity, observedSystem)); ===================================== test/src/main/resources/db/8.0/referentiel.sql.gz ===================================== The diff for this file was not included because it is too large. ===================================== validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-error-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-error-validation.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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="referentialCode" short-circuit="true"> + <message>observe.validation.referentiel.invalid.code.uniqueKey##${code}</message> + </field-validator> + + </field> + + <field name="label1"> <!-- pas de libelle 1 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label1</message> + </field-validator> + </field> + + <field name="label2"> + <!-- pas de libelle 2 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label2</message> + </field-validator> + </field> + + <field name="label3"> + <!-- pas de libelle 3 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label3</message> + </field-validator> + </field> + +</validators> ===================================== validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-warning-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-create-warning-validation.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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>observe.validation.referentiel.status.desactivated</message> + </field-validator> + </field> + + <field name="uri"> + <!-- pas d'uri selectionne --> + <field-validator type="requiredstring" short-circuit="true"> + <message>observe.validation.referentiel.null.uri</message> + </field-validator> + </field> + <field name="label1"> + <!-- libelle 1 non traduit (egal a label2) --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ label1 == null || label1.empty || label1 != label2 ]]> + </param> + <message>observe.validation.referentiel.untranslated.label1</message> + </field-validator> + </field> + + <field name="label3"> + <!-- libelle 3 non traduit (egal a label2) --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ label3 == null || label3.empty || label3 != label2 ]]> + </param> + <message>observe.validation.referentiel.untranslated.label3</message> + </field-validator> + </field> + +</validators> ===================================== validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-error-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-error-validation.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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="referentialCode" short-circuit="true"> + <message>observe.validation.referentiel.invalid.code.uniqueKey##${code}</message> + </field-validator> + + </field> + + <field name="label1"> <!-- pas de libelle 1 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label1</message> + </field-validator> + </field> + + <field name="label2"> + <!-- pas de libelle 2 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label2</message> + </field-validator> + </field> + + <field name="label3"> + <!-- pas de libelle 3 renseigne --> + <field-validator type="requiredstring"> + <message>observe.validation.referentiel.required.label3</message> + </field-validator> + </field> + +</validators> ===================================== validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-warning-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/longline/WeightDeterminationMethodDto-update-warning-validation.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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>observe.validation.referentiel.status.desactivated</message> + </field-validator> + </field> + + <field name="uri"> + <!-- pas d'uri selectionne --> + <field-validator type="requiredstring" short-circuit="true"> + <message>observe.validation.referentiel.null.uri</message> + </field-validator> + </field> + <field name="label1"> + <!-- libelle 1 non traduit (egal a label2) --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ label1 == null || label1.empty || label1 != label2 ]]> + </param> + <message>observe.validation.referentiel.untranslated.label1</message> + </field-validator> + </field> + + <field name="label3"> + <!-- libelle 3 non traduit (egal a label2) --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ label3 == null || label3.empty || label3 != label2 ]]> + </param> + <message>observe.validation.referentiel.untranslated.label3</message> + </field-validator> + </field> + +</validators> ===================================== validation/src/test/java/fr/ird/observe/client/validation/BeanValidatorDetectorTest.java ===================================== --- a/validation/src/test/java/fr/ird/observe/client/validation/BeanValidatorDetectorTest.java +++ b/validation/src/test/java/fr/ird/observe/client/validation/BeanValidatorDetectorTest.java @@ -113,6 +113,7 @@ import fr.ird.observe.dto.referential.longline.SensorTypeDto; import fr.ird.observe.dto.referential.longline.SettingShapeDto; import fr.ird.observe.dto.referential.longline.StomacFullnessDto; import fr.ird.observe.dto.referential.longline.VesselActivityLonglineDto; +import fr.ird.observe.dto.referential.longline.WeightDeterminationMethodDto; import fr.ird.observe.dto.referential.seine.DetectionModeDto; import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseConformityDto; import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseStatusDto; @@ -270,6 +271,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest { VesselSizeCategoryDto.class, VesselTypeDto.class, WeightCategoryDto.class, + WeightDeterminationMethodDto.class, WeightMeasureTypeDto.class, WindDto.class); } @@ -386,6 +388,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest { VesselSizeCategoryDto.class, VesselTypeDto.class, WeightCategoryDto.class, + WeightDeterminationMethodDto.class, WeightMeasureTypeDto.class, WindDto.class); } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3486d482aacebd83e349e3f60209... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3486d482aacebd83e349e3f60209... You're receiving this email because of your account on gitlab.com.