Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe Commits: 0b0ed727 by tchemit at 2020-03-28T09:45:16+01:00 Réusinage de la table transmittingbuoy - Closes #1456 - - - - - 19 changed files: - client-core/src/main/i18n/getters/jaxx.getter - client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx - client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUI.jcss - client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java - dto/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyDtoReferenceBinder.java - dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java - dto/src/main/models/Observe.model - persistence/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyEntityDtoBinder.java - persistence/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyEntityReferenceBinder.java - + persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_5.java - persistence/src/main/models/Observe.model - + persistence/src/main/resources/db/migration/7.5/01_migrate_TransmittingBuoyOperation_brand-H2.sql - + persistence/src/main/resources/db/migration/7.5/01_migrate_TransmittingBuoyOperation_brand-PG.sql - pom.xml - + test/src/main/resources/db/7.5/dataForTestLongline.sql.gz - + test/src/main/resources/db/7.5/dataForTestSeine.sql.gz - + test/src/main/resources/db/7.5/empty_h2.sql.gz - + test/src/main/resources/db/7.5/empty_pg.sql.gz - + test/src/main/resources/db/7.5/referentiel.sql.gz Changes: ===================================== client-core/src/main/i18n/getters/jaxx.getter ===================================== @@ -639,7 +639,6 @@ observe.common.TdrDto.serialNo observe.common.TdrDto.speciesTab observe.common.TdrDto.timestampTab observe.common.TdrDto.title -observe.common.TransmittingBuoyDto.brand observe.common.TransmittingBuoyDto.noBuoy observe.common.TransmittingBuoyDto.ownership observe.common.TransmittingBuoyDto.title ===================================== client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx ===================================== @@ -177,11 +177,8 @@ </cell> </row> <row> - <cell anchor='west'> - <JLabel id='brand1Label'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JTextField id='brand1' onKeyReleased='transmittingBuoy1.setBrand(brand1.getText())'/> + <cell columns='2' fill="both" weighty="1"> + <JComment id='comment1'/> </cell> </row> </Table> @@ -239,11 +236,8 @@ </cell> </row> <row> - <cell anchor='west'> - <JLabel id='brand2Label'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JTextField id='brand2' onKeyReleased='transmittingBuoy2.setBrand(brand2.getText())'/> + <cell columns='2' weighty="1"> + <JComment id='comment2'/> </cell> </row> </Table> ===================================== client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUI.jcss ===================================== @@ -20,6 +20,10 @@ * #L% */ +JComment { + i18nProperty:comment; +} + #model { editable:true; modified:{validator.isChanged() || validatorBalise1.isChanged() || validatorBalise2.isChanged()}; @@ -106,12 +110,8 @@ text:{getStringValue(transmittingBuoy1.getCode())}; } -#brand1Label { - text:"observe.common.TransmittingBuoyDto.brand"; -} - -#brand1 { - text:{getStringValue(transmittingBuoy1.getBrand())}; +#comment1 { + model:{getTransmittingBuoy1()}; } #transmittingBuoyOperation2Label { @@ -176,12 +176,8 @@ text:{getStringValue(transmittingBuoy2.getCode())}; } -#brand2Label { - text:"observe.common.TransmittingBuoyDto.brand"; -} - -#brand2 { - text:{getStringValue(transmittingBuoy2.getBrand())}; +#comment2 { + model:{getTransmittingBuoy2()}; } #reset { ===================================== client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java ===================================== @@ -163,8 +163,8 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE2_SELECTED_ITEM, - FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND1_TEXT, - FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND2_TEXT, +// FloatingObjectTransmittingBuoyOperationUI.BINDING_COMMENT1_TEXT, +// FloatingObjectTransmittingBuoyOperationUI.BINDING_COMMENT2_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_VESSEL1_SELECTED_ITEM, @@ -198,8 +198,6 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyOperationUI.BINDING_CODE2_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP2_SELECTED_ITEM, - FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND1_TEXT, - FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND2_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_VESSEL1_SELECTED_ITEM, ===================================== dto/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyDtoReferenceBinder.java ===================================== @@ -41,7 +41,7 @@ public class TransmittingBuoyDtoReferenceBinder extends DataDtoReferenceBinder<T @Override public TransmittingBuoyReference toReference(ReferentialLocale referentialLocale, TransmittingBuoyDto dto) { return new TransmittingBuoyReference(dto, dto.getCode(), - dto.getBrand(), + dto.getComment(), dto.getTransmittingBuoyType().getLabel(), dto.getTransmittingBuoyOperation().getLabel()); } ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java ===================================== @@ -1013,8 +1013,8 @@ public class DecoratorService extends DecoratorProvider { @Override public void initTransmittingBuoyDto() { registerDataAndDataReferenceDecorator(TransmittingBuoyDto.class, TransmittingBuoyReference.class, - "${transmittingBuoyType/label}$s##${transmittingBuoyOperation/label}$s##${code}$s", - "${transmittingBuoyTypeLabel}$s##${transmittingBuoyOperationLabel}$s##${code}$s"); + "${transmittingBuoyType/label}$s##${transmittingBuoyOperation/label}$s##${code}$s##${comment}$s", + "${transmittingBuoyTypeLabel}$s##${transmittingBuoyOperationLabel}$s##${code}$s##${comment}$s"); } @Override ===================================== dto/src/main/models/Observe.model ===================================== @@ -801,9 +801,8 @@ nature + {*:1} String discarded + {*:1} Boolean targetLength + {*} data.seine.TargetLength | ordered -data.seine.TransmittingBuoy > data.Data | references=code,brand,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel +data.seine.TransmittingBuoy > data.Commentable | references=code,comment,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel code + {*:1} String | mayNotNull -brand + {*:1} String ownership + {*:1} !fr.ird.observe.dto.data.seine.Ownership transmittingBuoyType {*:1} fr.ird.observe.dto.referential.seine.TransmittingBuoyTypeReference | notNull transmittingBuoyOperation {*:1} fr.ird.observe.dto.referential.seine.TransmittingBuoyOperationReference | notNull ===================================== persistence/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyEntityDtoBinder.java ===================================== @@ -44,7 +44,7 @@ public class TransmittingBuoyEntityDtoBinder extends DataEntityDtoBinderSupport< copyDtoDataFieldsToEntity(dto, entity); entity.setCode(dto.getCode()); - entity.setBrand(dto.getBrand()); + entity.setComment(dto.getComment()); entity.setOwnership(dto.getOwnership()); entity.setTransmittingBuoyOperation(toEntity(dto.getTransmittingBuoyOperation())); entity.setTransmittingBuoyType(toEntity(dto.getTransmittingBuoyType())); @@ -59,7 +59,7 @@ public class TransmittingBuoyEntityDtoBinder extends DataEntityDtoBinderSupport< copyEntityDataFieldsToDto(entity, dto); dto.setCode(entity.getCode()); - dto.setBrand(entity.getBrand()); + dto.setComment(entity.getComment()); dto.setOwnership(entity.getOwnership()); dto.setTransmittingBuoyOperation(toReferentialReference(referentialLocale, entity.getTransmittingBuoyOperation())); dto.setTransmittingBuoyType(toReferentialReference(referentialLocale, entity.getTransmittingBuoyType())); ===================================== persistence/src/main/java/fr/ird/observe/binder/data/seine/TransmittingBuoyEntityReferenceBinder.java ===================================== @@ -42,7 +42,7 @@ public class TransmittingBuoyEntityReferenceBinder extends DataEntityReferenceBi @Override public TransmittingBuoyReference toReference(ReferentialLocale referentialLocale, TransmittingBuoy entity) { return new TransmittingBuoyReference(entity, entity.getCode(), - entity.getBrand(), + entity.getComment(), entity.getTransmittingBuoyType().getLabel(referentialLocale), entity.getTransmittingBuoyOperation().getLabel(referentialLocale)); } ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_5.java ===================================== @@ -0,0 +1,47 @@ +package fr.ird.observe.persistence.migration; + +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2020 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 com.google.auto.service.AutoService; +import org.nuiton.topia.service.migration.resources.MigrationVersionResource; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; +import org.nuiton.version.Versions; + +/** + * @author Tony Chemit - dev@tchemit.fr + * @since 7.5.0 + */ +@AutoService(MigrationVersionResource.class) +public class DataSourceMigrationForVersion_7_5 extends MigrationVersionResource { + + public DataSourceMigrationForVersion_7_5() { + super(Versions.valueOf("7.5")); + } + + @Override + public void generateSqlScript(MigrationVersionResourceExecutor executor) { + executor.addScript("01", "migrate_TransmittingBuoyOperation_brand"); + } + +} + ===================================== persistence/src/main/models/Observe.model ===================================== @@ -837,9 +837,8 @@ nature + {*:1} String discarded + {*:1} Boolean targetLength + {*} seine.TargetLength | ordered -seine.TransmittingBuoy > ObserveDataEntity | entity +seine.TransmittingBuoy > CommentableEntity | entity code + {*:1} String -brand + {*:1} String ownership + {*:1} !fr.ird.observe.dto.data.seine.Ownership transmittingBuoyType {*:1} referentiel.seine.TransmittingBuoyType transmittingBuoyOperation {*:1} referentiel.seine.TransmittingBuoyOperation ===================================== persistence/src/main/resources/db/migration/7.5/01_migrate_TransmittingBuoyOperation_brand-H2.sql ===================================== @@ -0,0 +1,24 @@ +--- +-- #%L +-- ObServe :: Persistence +-- %% +-- Copyright (C) 2008 - 2020 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% +--- +ALTER TABLE observe_seine.TransmittingBuoy ADD COLUMN comment VARCHAR(1024); +UPDATE observe_seine.TransmittingBuoy SET comment = brand, topiaVersion = topiaVersion + 1; +ALTER TABLE observe_seine.TransmittingBuoy DROP COLUMN brand; ===================================== persistence/src/main/resources/db/migration/7.5/01_migrate_TransmittingBuoyOperation_brand-PG.sql ===================================== @@ -0,0 +1,24 @@ +--- +-- #%L +-- ObServe :: Persistence +-- %% +-- Copyright (C) 2008 - 2020 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% +--- +ALTER TABLE observe_seine.TransmittingBuoy ADD COLUMN comment VARCHAR(1024); +UPDATE observe_seine.TransmittingBuoy SET comment = brand, topiaVersion = topiaVersion + 1; +ALTER TABLE observe_seine.TransmittingBuoy DROP COLUMN brand CASCADE ; ===================================== pom.xml ===================================== @@ -149,7 +149,7 @@ <devMode>true</devMode> <!--persistence model version--> - <observe.model.version>7.4</observe.model.version> + <observe.model.version>7.5</observe.model.version> <!-- build timestamp configuration --> <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> ===================================== test/src/main/resources/db/7.5/dataForTestLongline.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.5/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/7.5/dataForTestSeine.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.5/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/7.5/empty_h2.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.5/empty_h2.sql.gz differ ===================================== test/src/main/resources/db/7.5/empty_pg.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.5/empty_pg.sql.gz differ ===================================== test/src/main/resources/db/7.5/referentiel.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.5/referentiel.sql.gz differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/0b0ed7273ecffbc847bce1499d... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/0b0ed7273ecffbc847bce1499d... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT