Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 158824b7 by Tony CHEMIT at 2018-05-20T00:27:19Z Ajout du référentiel observe_common.Compagnies - Closes #896 - - - - - 29 changed files: - + client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUIModel.java - + dto/src/main/java/fr/ird/observe/binder/referential/common/CompagniesDtoReferenceBinder.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/common/CompagniesEntityDtoBinder.java - + persistence/src/main/java/fr/ird/observe/binder/referential/common/CompagniesEntityReferenceBinder.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/09_add_compagnies-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/CompagniesDto-create-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-create-warning-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-update-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-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/common/CompagniesUI.jaxx ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUI.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.CompagniesDto.%s" + superGenericType='CompagniesDto, CompagniesReference, CompagniesUI'> + + <style source="../ReferenceEntity.jcss"/> + + <import> + fr.ird.observe.dto.reference.ReferentialDtoReference + fr.ird.observe.dto.referential.CompagniesDto + fr.ird.observe.dto.referential.CompagniesReference + + 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.CompagniesDto' + context='create' errorTableModel='{getErrorTableModel()}'> + <field name='label1' component='label1'/> + <field name='label2' component='label2'/> + <field name='label3' component='label3'/> + </BeanValidator> + + <!-- model --> + <CompagniesUIModel id='model'/> + + <!-- edit bean --> + <CompagniesDto 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/common/CompagniesUIHandler.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUIHandler.java @@ -0,0 +1,37 @@ +package fr.ird.observe.client.ui.content.ref.common; + +/*- + * #%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.CompagniesDto; +import fr.ird.observe.dto.referential.CompagniesReference; +import org.nuiton.jaxx.runtime.spi.UIHandler; + +/** + * Created on 06/12/16. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 6.0 + */ +class CompagniesUIHandler extends ContentReferenceUIHandler<CompagniesDto, CompagniesReference, CompagniesUI> implements UIHandler<CompagniesUI> { +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUIModel.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/CompagniesUIModel.java @@ -0,0 +1,43 @@ +package fr.ird.observe.client.ui.content.ref.common; + +/* + * #%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.CompagniesDto; +import fr.ird.observe.dto.referential.CompagniesReference; + +/** + * Created on 9/27/14. + * + * @author Tony Chemit - dev@tchemit.fr + * @since XXX + */ +public class CompagniesUIModel extends ContentReferenceUIModel<CompagniesDto, CompagniesReference> { + + private static final long serialVersionUID = 1L; + + public CompagniesUIModel() { + super(CompagniesDto.class, CompagniesReference.class); + } + +} ===================================== dto/src/main/java/fr/ird/observe/binder/referential/common/CompagniesDtoReferenceBinder.java ===================================== --- /dev/null +++ b/dto/src/main/java/fr/ird/observe/binder/referential/common/CompagniesDtoReferenceBinder.java @@ -0,0 +1,47 @@ +package fr.ird.observe.binder.referential.common; + +/*- + * #%L + * ObServe :: Dto + * %% + * 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.ReferentialDtoReferenceBinder; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.dto.referential.CompagniesDto; +import fr.ird.observe.dto.referential.CompagniesReference; + +/** + * Created on 24/11/15. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class CompagniesDtoReferenceBinder extends ReferentialDtoReferenceBinder<CompagniesDto, CompagniesReference> { + + public CompagniesDtoReferenceBinder() { + super(CompagniesDto.class, CompagniesReference.class); + } + + @Override + public CompagniesReference toReference(ReferentialLocale referentialLocale, CompagniesDto dto) { + + return new CompagniesReference(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 @@ -108,6 +108,8 @@ import fr.ird.observe.dto.reference.DtoReference; import fr.ird.observe.dto.reference.ReferentialDtoReference; import fr.ird.observe.dto.referential.CountryDto; import fr.ird.observe.dto.referential.CountryReference; +import fr.ird.observe.dto.referential.CompagniesDto; +import fr.ird.observe.dto.referential.CompagniesReference; import fr.ird.observe.dto.referential.DataQualityDto; import fr.ird.observe.dto.referential.DataQualityReference; import fr.ird.observe.dto.referential.FpaZoneDto; @@ -474,6 +476,11 @@ public class DecoratorService extends DecoratorProvider { } @Override + public void initCompagniesDto() { + registerDefaultReferentialAndReferentialReferenceDecorator(CompagniesDto.class, CompagniesReference.class, libelle); + } + + @Override public void initCountryDto() { registerDefaultReferentialAndReferentialReferenceDecorator(CountryDto.class, CountryReference.class, libelle); } ===================================== 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 @@ -78,6 +78,7 @@ import fr.ird.observe.dto.data.seine.TransmittingBuoyDto; import fr.ird.observe.dto.data.seine.TripSeineDto; import fr.ird.observe.dto.data.seine.TripSeineGearUseDto; import fr.ird.observe.dto.referential.CountryDto; +import fr.ird.observe.dto.referential.CompagniesDto; import fr.ird.observe.dto.referential.DataQualityDto; import fr.ird.observe.dto.referential.FpaZoneDto; import fr.ird.observe.dto.referential.GearCaracteristicDto; @@ -169,6 +170,7 @@ public class DtoModelClasses { public static final ImmutableSet<Class<? extends ReferentialDto>> COMMON_REFERENTIAL_TYPES = ImmutableSet.of( VesselSizeCategoryDto.class, CountryDto.class, + CompagniesDto.class, DataQualityDto.class, HarbourDto.class, ShipOwnerDto.class, ===================================== dto/src/main/models/Observe.model ===================================== --- a/dto/src/main/models/Observe.model +++ b/dto/src/main/models/Observe.model @@ -355,6 +355,8 @@ data.longline.WeightMeasure > data.Data | references=weightMeasureTypeLabel,weig weight + {*:1} Float weightMeasureType {*:1} fr.ird.observe.dto.referential.WeightMeasureTypeReference +referential.Compagnies > referential.I18nReferential + referential.Country > referential.I18nReferential iso2Code + {*:1} String iso3Code + {*:1} String ===================================== 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 @@ -26,6 +26,8 @@ observe.common.CatchFateLonglineDto.types=Catch fates observe.common.CatchLonglineDto.title=Catches observe.common.CatchLonglineDto.type=Catch observe.common.CatchLonglineDto.types=Catches +observe.common.CompagniesDto.type=Compagnies +observe.common.CompagniesDto.types=Compagnies observe.common.CountryDto.type=Country observe.common.CountryDto.types=Countries observe.common.DataQualityDto.type=Data quality ===================================== 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 @@ -26,6 +26,8 @@ observe.common.CatchFateLonglineDto.types=Futuros de la captura observe.common.CatchLonglineDto.title=Capturas observe.common.CatchLonglineDto.type=Captura observe.common.CatchLonglineDto.types=Capturas +observe.common.CompagniesDto.type=Compagnies \#TODO +observe.common.CompagniesDto.types=Compagnies \#TODO observe.common.CountryDto.type=País observe.common.CountryDto.types=Países observe.common.DataQualityDto.type=Qualité de donnée \#TODO ===================================== 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 @@ -26,6 +26,8 @@ observe.common.CatchFateLonglineDto.types=Devenirs capture observe.common.CatchLonglineDto.title=Captures observe.common.CatchLonglineDto.type=Capture observe.common.CatchLonglineDto.types=Captures +observe.common.CompagniesDto.type=Compagnies +observe.common.CompagniesDto.types=Compagnies observe.common.CountryDto.type=Pays observe.common.CountryDto.types=Pays observe.common.DataQualityDto.type=Qualité de donnée ===================================== persistence/src/main/java/fr/ird/observe/binder/referential/common/CompagniesEntityDtoBinder.java ===================================== --- /dev/null +++ b/persistence/src/main/java/fr/ird/observe/binder/referential/common/CompagniesEntityDtoBinder.java @@ -0,0 +1,53 @@ +package fr.ird.observe.binder.referential.common; + +/*- + * #%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.CompagniesDto; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.entities.referentiel.Compagnies; + +/** + * Created on 24/11/15. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class CompagniesEntityDtoBinder extends ReferentialEntityDtoBinderSupport<CompagniesDto, Compagnies> { + + public CompagniesEntityDtoBinder() { + super(Compagnies.class, CompagniesDto.class); + } + + @Override + public void copyToEntity(ReferentialLocale referentialLocale, CompagniesDto dto, Compagnies entity) { + copyDtoReferentialFieldsToEntity(dto, entity); + copyDtoI18nFieldsToEntity(dto, entity); + } + + @Override + public void copyToDto(ReferentialLocale referentialLocale, Compagnies entity, CompagniesDto dto) { + copyEntityReferentialFieldsToDto(entity, dto); + copyEntityI18nFieldsToDto(entity, dto); + } + +} ===================================== persistence/src/main/java/fr/ird/observe/binder/referential/common/CompagniesEntityReferenceBinder.java ===================================== --- /dev/null +++ b/persistence/src/main/java/fr/ird/observe/binder/referential/common/CompagniesEntityReferenceBinder.java @@ -0,0 +1,46 @@ +package fr.ird.observe.binder.referential.common; + +/*- + * #%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.CompagniesDto; +import fr.ird.observe.dto.referential.CompagniesReference; +import fr.ird.observe.dto.referential.ReferentialLocale; +import fr.ird.observe.entities.referentiel.Compagnies; + +/** + * Created on 24/11/15. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class CompagniesEntityReferenceBinder extends ReferentialEntityReferenceBinderSupport<CompagniesDto, CompagniesReference, Compagnies> { + + public CompagniesEntityReferenceBinder() { + super(CompagniesDto.class, CompagniesReference.class, Compagnies.class); + } + + @Override + public CompagniesReference toReference(ReferentialLocale referentialLocale, Compagnies dto) { + return new CompagniesReference(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 @@ -48,6 +48,7 @@ public class Entities { new ObserveEntityEnum[]{ ObserveEntityEnum.VesselSizeCategory, ObserveEntityEnum.Country, + ObserveEntityEnum.Compagnies, ObserveEntityEnum.DataQuality, ObserveEntityEnum.ShipOwner, ObserveEntityEnum.Harbour, ===================================== 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 @@ -74,6 +74,7 @@ public class DataSourceMigrationForVersion_8_0 extends MigrationVersionResource } executor.addScript("07", "add_weight_determination_method"); executor.addScript("08", "add_weight_category"); + executor.addScript("09", "add_compagnies"); } } ===================================== persistence/src/main/models/Observe.model ===================================== --- a/persistence/src/main/models/Observe.model +++ b/persistence/src/main/models/Observe.model @@ -421,6 +421,8 @@ longline.WeightMeasure > ObserveDataEntity | entity weight + {*:1} Float | sqlType=numeric weightMeasureType {*:1} referentiel.WeightMeasureType +referentiel.Compagnies > referentiel.I18nReferentialEntity | entity + referentiel.Country > referentiel.I18nReferentialEntity | entity iso2Code + {*:1} String iso3Code + {*:1} String ===================================== persistence/src/main/resources/db/migration/8.0/09_add_compagnies-common.sql ===================================== --- /dev/null +++ b/persistence/src/main/resources/db/migration/8.0/09_add_compagnies-common.sql @@ -0,0 +1,3 @@ +CREATE TABLE observe_common.Compagnies(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_common.Compagnies ADD CONSTRAINT PK_Compagnies PRIMARY KEY(topiaid); +INSERT INTO observe_common.LASTUPDATEDATE(topiaId, topiaversion, topiacreatedate, TYPE , LASTUPDATEDATE) values ('fr.ird.observe.entities.LastUpdateDate#666#1006', 0,CURRENT_DATE, 'fr.ird.observe.entities.referentiel.Compagnies', 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 @@ -113,6 +113,10 @@ public class UnidirectionalSynchronizeReferentialTest extends ServiceLocalTestSu //empty continue; } + if (ObserveEntityEnum.Compagnies.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, WeightDeterminationMethod, WeightCategoryLongline - Assert.assertEquals(DtoModelClasses.REFERENTIAL_TYPES.size() - 3, types.size()); + // no data of LengthLegnthParameter, WeightDeterminationMethod, WeightCategoryLongline, Compagnies + Assert.assertEquals(DtoModelClasses.REFERENTIAL_TYPES.size() - 4, 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"; - private static final int ENTITY_BINDER_REFERENTIAL_COUNT = 68; + private static final int ENTITY_BINDER_REFERENTIAL_COUNT = 69; 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 = 194; + public static final int VALIDATORS_COUNT = 196; 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; @@ -245,6 +245,7 @@ public class ObserveFixtures { private static final ImmutableMap<String, Long> REFERENTIAL_COMMON_TABLES_COUNT = ImmutableMap .<String, Long>builder() .put("observe_common.country", 72L) + .put("observe_common.compagnies", 0L) .put("observe_common.dataquality", 5L) .put("observe_common.fpazone", 42L) .put("observe_common.gear", 26L) @@ -252,7 +253,7 @@ public class ObserveFixtures { .put("observe_common.gearcaracteristic", 22L) .put("observe_common.gearcaracteristictype", 6L) .put("observe_common.harbour", 74L) - .put("observe_common.lastupdatedate", 106L) + .put("observe_common.lastupdatedate", 107L) .put("observe_common.lengthlengthparameter", 0L) .put("observe_common.lengthweightparameter", 365L) .put("observe_common.ocean", 3L) ===================================== 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 @@ -1,6 +1,7 @@ CREATE SCHEMA OBSERVE_LONGLINE; CREATE SCHEMA OBSERVE_COMMON; CREATE SCHEMA OBSERVE_SEINE; +create table OBSERVE_COMMON.compagnies (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_COMMON.country (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), iso2Code varchar(255), iso3Code varchar(255), primary key (topiaId)); create table OBSERVE_COMMON.dataQuality (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_COMMON.fpaZone (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), startDate timestamp, endDate timestamp, primary key (topiaId)); ===================================== 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 @@ -1,6 +1,7 @@ CREATE SCHEMA OBSERVE_LONGLINE; CREATE SCHEMA OBSERVE_COMMON; CREATE SCHEMA OBSERVE_SEINE; +create table OBSERVE_COMMON.compagnies (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_COMMON.country (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), iso2Code varchar(255), iso3Code varchar(255), primary key (topiaId)); create table OBSERVE_COMMON.dataQuality (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_COMMON.fpaZone (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), startDate timestamp, endDate timestamp, primary key (topiaId)); ===================================== 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/CompagniesDto-create-error-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-create-error-validation.xml @@ -0,0 +1,58 @@ +<?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/CompagniesDto-create-warning-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-create-warning-validation.xml @@ -0,0 +1,65 @@ +<?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/CompagniesDto-update-error-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-update-error-validation.xml @@ -0,0 +1,58 @@ +<?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/CompagniesDto-update-warning-validation.xml ===================================== --- /dev/null +++ b/validation/src/main/resources/fr/ird/observe/dto/referential/CompagniesDto-update-warning-validation.xml @@ -0,0 +1,65 @@ +<?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 @@ -66,6 +66,7 @@ import fr.ird.observe.dto.data.seine.TransmittingBuoyDto; import fr.ird.observe.dto.data.seine.TripSeineDto; import fr.ird.observe.dto.data.seine.TripSeineGearUseDto; import fr.ird.observe.dto.referential.CountryDto; +import fr.ird.observe.dto.referential.CompagniesDto; import fr.ird.observe.dto.referential.DataQualityDto; import fr.ird.observe.dto.referential.FpaZoneDto; import fr.ird.observe.dto.referential.GearCaracteristicDto; @@ -206,6 +207,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest { BaitSettingStatusDto.class, BaitTypeDto.class, CatchFateLonglineDto.class, + CompagniesDto.class, CountryDto.class, DataQualityDto.class, DetectionModeDto.class, @@ -301,6 +303,7 @@ public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest { BranchlinesCompositionDto.class, CatchFateLonglineDto.class, CatchLonglineDto.class, + CompagniesDto.class, CountryDto.class, DataQualityDto.class, DetectionModeDto.class, View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/158824b742285657a5d81626f61d... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/158824b742285657a5d81626f61d... You're receiving this email because of your account on gitlab.com.