Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: b655220d by Tony Chemit at 2021-01-30T10:24:15+01:00 Rename containerDto.getSize to ContainerDto.getChildrenSize (in v9 we got a Sample.size property (and Sample is containerDto...) - - - - - 6fcc22f0 by Tony Chemit at 2021-01-30T11:03:31+01:00 Remove for the moment any natural id (since we do not want to change database model) - - - - - 64f4e17c by Tony Chemit at 2021-01-30T11:03:31+01:00 Fix tag values extractor (for new keys on package) - - - - - 16 changed files: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIModel.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveContentTableUIAdapter.java - models/persistence/definition/pom.xml - − models/persistence/definition/src/main/models/Observe/persistence/attribute/naturalId.properties - − models/persistence/definition/src/main/models/Observe/persistence/class/naturalIdMutable.properties - models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-H2.sql - models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-PG.sql - models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-H2.sql - models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-PG.sql - tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz - tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz - tests/test/src/main/resources/db/8.0/empty_h2.sql.gz - tests/test/src/main/resources/db/8.0/empty_pg.sql.gz - tests/test/src/main/resources/db/8.0/referentiel.sql.gz - toolkit/dto/src/main/java/fr/ird/observe/dto/data/ContainerDto.java - toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/io/TagValuesExtractor.java Changes: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIModel.java ===================================== @@ -75,7 +75,7 @@ public abstract class ContentTableUIModel<D extends DataDto, C extends Container log.info(String.format("Load Form from id: %s", selectedId)); Form<D> form = loadForm(servicesProvider, selectedId); if (form.getObject() instanceof ContainerDto) { - getSource().updateCount(((ContainerDto<?>) form.getObject()).getSize()); + getSource().updateCount(((ContainerDto<?>) form.getObject()).getChildrenSize()); } getStates().openForm(form); return form; ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveContentTableUIAdapter.java ===================================== @@ -43,7 +43,7 @@ public class SaveContentTableUIAdapter<D extends DataDto, U extends ContentTable ui.getHandler().getResetAction().doReset(); ContentTableUINavigationNode node = ui.getModel().getSource(); if (savedBean instanceof ContainerDto) { - node.updateCount(((ContainerDto<?>) savedBean).getSize()); + node.updateCount(((ContainerDto<?>) savedBean).getChildrenSize()); } NavigationNode parent = node.getParent(); //FIXME We should not have to do this: parent data should only be on parent, children should not have to recompute parent data??? ===================================== models/persistence/definition/pom.xml ===================================== @@ -33,4 +33,35 @@ <model.defaultPackage>fr.ird.observe.entities</model.defaultPackage> <model.fullPackagePath>fr.ird.observe</model.fullPackagePath> </properties> + <!-- +naturalId attribute tagValue (remove now but will be back) + +referential.common.LengthLengthParameter.attribute.endDate=true +referential.common.LengthLengthParameter.attribute.ocean=true +referential.common.LengthLengthParameter.attribute.sex=true +referential.common.LengthLengthParameter.attribute.species=true +referential.common.LengthLengthParameter.attribute.startDate=true +referential.common.LengthWeightParameter.attribute.endDate=true +referential.common.LengthWeightParameter.attribute.ocean=true +referential.common.LengthWeightParameter.attribute.sex=true +referential.common.LengthWeightParameter.attribute.species=true +referential.common.LengthWeightParameter.attribute.startDate=true +referential.common.Person.attribute.firstName=true +referential.common.Person.attribute.lastName=true +referential.common.ShipOwner.attribute.endDate=true +referential.common.ShipOwner.attribute.label=true +referential.common.ShipOwner.attribute.startDate=true +referential.common.Species.attribute.faoCode=true +referential.common.VesselSizeCategory.attribute.capacityLabel=true +referential.common.VesselSizeCategory.attribute.gaugeLabel=true + +naturalIdMutable class tagValue (remove now but will be back) + +referential.common.LengthLengthParameter=true +referential.common.LengthWeightParameter=true +referential.common.Person=true +referential.common.ShipOwner=true +referential.common.Species=true +referential.common.VesselSizeCategory=true +--> </project> ===================================== models/persistence/definition/src/main/models/Observe/persistence/attribute/naturalId.properties deleted ===================================== @@ -1,39 +0,0 @@ -### -# #%L -# ObServe Models :: Persistence :: Definition -# %% -# Copyright (C) 2008 - 2021 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% -### -referential.common.LengthLengthParameter.attribute.endDate=true -referential.common.LengthLengthParameter.attribute.ocean=true -referential.common.LengthLengthParameter.attribute.sex=true -referential.common.LengthLengthParameter.attribute.species=true -referential.common.LengthLengthParameter.attribute.startDate=true -referential.common.LengthWeightParameter.attribute.endDate=true -referential.common.LengthWeightParameter.attribute.ocean=true -referential.common.LengthWeightParameter.attribute.sex=true -referential.common.LengthWeightParameter.attribute.species=true -referential.common.LengthWeightParameter.attribute.startDate=true -referential.common.Person.attribute.firstName=true -referential.common.Person.attribute.lastName=true -referential.common.ShipOwner.attribute.endDate=true -referential.common.ShipOwner.attribute.label=true -referential.common.ShipOwner.attribute.startDate=true -referential.common.Species.attribute.faoCode=true -referential.common.VesselSizeCategory.attribute.capacityLabel=true -referential.common.VesselSizeCategory.attribute.gaugeLabel=true ===================================== models/persistence/definition/src/main/models/Observe/persistence/class/naturalIdMutable.properties deleted ===================================== @@ -1,27 +0,0 @@ -### -# #%L -# ObServe Models :: Persistence :: Definition -# %% -# Copyright (C) 2008 - 2021 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% -### -referential.common.LengthLengthParameter=true -referential.common.LengthWeightParameter=true -referential.common.Person=true -referential.common.ShipOwner=true -referential.common.Species=true -referential.common.VesselSizeCategory=true ===================================== models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-H2.sql ===================================== @@ -19,8 +19,8 @@ -- <http://www.gnu.org/licenses/gpl-3.0.html>. -- #L% --- -CREATE SCHEMA ps_common; CREATE SCHEMA common; +CREATE SCHEMA ps_common; CREATE SCHEMA ll_observation; CREATE SCHEMA ll_common; CREATE SCHEMA ps_observation; ===================================== models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-PG.sql ===================================== @@ -19,8 +19,8 @@ -- <http://www.gnu.org/licenses/gpl-3.0.html>. -- #L% --- -CREATE SCHEMA ps_common; CREATE SCHEMA common; +CREATE SCHEMA ps_common; CREATE SCHEMA ll_observation; CREATE SCHEMA ll_common; CREATE SCHEMA ps_observation; ===================================== models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-H2.sql ===================================== @@ -19,8 +19,8 @@ -- <http://www.gnu.org/licenses/gpl-3.0.html>. -- #L% --- -CREATE SCHEMA ps_common; CREATE SCHEMA common; +CREATE SCHEMA ps_common; CREATE SCHEMA ll_observation; CREATE SCHEMA ll_common; CREATE SCHEMA ps_observation; ===================================== models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-PG.sql ===================================== @@ -19,8 +19,8 @@ -- <http://www.gnu.org/licenses/gpl-3.0.html>. -- #L% --- -CREATE SCHEMA ps_common; CREATE SCHEMA common; +CREATE SCHEMA ps_common; CREATE SCHEMA ll_observation; CREATE SCHEMA ll_common; CREATE SCHEMA ps_observation; ===================================== tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz ===================================== Binary files a/tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz and b/tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz differ ===================================== tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz ===================================== Binary files a/tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz and b/tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz differ ===================================== tests/test/src/main/resources/db/8.0/empty_h2.sql.gz ===================================== Binary files a/tests/test/src/main/resources/db/8.0/empty_h2.sql.gz and b/tests/test/src/main/resources/db/8.0/empty_h2.sql.gz differ ===================================== tests/test/src/main/resources/db/8.0/empty_pg.sql.gz ===================================== Binary files a/tests/test/src/main/resources/db/8.0/empty_pg.sql.gz and b/tests/test/src/main/resources/db/8.0/empty_pg.sql.gz differ ===================================== tests/test/src/main/resources/db/8.0/referentiel.sql.gz ===================================== Binary files a/tests/test/src/main/resources/db/8.0/referentiel.sql.gz and b/tests/test/src/main/resources/db/8.0/referentiel.sql.gz differ ===================================== toolkit/dto/src/main/java/fr/ird/observe/dto/data/ContainerDto.java ===================================== @@ -67,7 +67,7 @@ public abstract class ContainerDto<C extends ContainerChildDto> extends DataDto return !isEmpty(); } - public int getSize() { + public int getChildrenSize() { return getChildren() == null ? 0 : getChildren().size(); } ===================================== toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/io/TagValuesExtractor.java ===================================== @@ -110,23 +110,44 @@ public class TagValuesExtractor { public Map<String, String> loadFromModel(String tagValuesKey) { String[] tagParts = tagValuesKey.split("-"); String tagType = tagParts[0]; - String tagToReplace = "." + tagParts[1] + "." + tagParts[2]; + String middle = tagParts[1]; int beginIndex = packageName.length() + 1; Map<String, String> currentTagValues = new TreeMap<>(); for (String k : tagValueKeysByTagValue.get(tagValuesKey)) { String value = allTagValues.get(k); - String key = k.replace(tagType + ".", ""); - key = key.substring(beginIndex); - if (key.equals(tagToReplace.substring(1))) { - key = "@@"; - } else { - key = key.replace(tagToReplace, ""); + String key; + switch (tagType) { + case "package": + // package.fr.ird.observe.dto.data.ll.common.tagValue.xxx → data.ll.common + // package.fr.ird.observe.dto.tagValue.xxx → @@ + key = k.substring(tagType.length() + beginIndex, k.indexOf(middle) - 1); + // package.fr.ird.observe.dto.data.ll.common.tagValue.xxx → .data.ll.common + // package.fr.ird.observe.dto.tagValue.xxx → . + if (key.equals("")) { + // empty → @@ + key = "@@"; + } else { + // .data.ll.common → data.ll.common + key = key.substring(1); + } + break; + case "class": + // fr.ird.observe.dto.result.SaveResult.class.tagValue.skip=true → result.SaveResult + key = k.substring(beginIndex, k.indexOf(tagType) - 1); + break; + case "attribute": + // fr.ird.observe.dto.result.SaveResult.attribute.test.tagValue.skip=true → result.SaveResult.attribute.test + key = k.substring(beginIndex, k.indexOf(middle) - 1); + break; + default: + throw new IllegalStateException("Can't manage value of type: " + tagType); } + currentTagValues.put(key, value); properties.setProperty(k, value); } - String index = tagValuesKey.replace("-tagValue", "").replaceAll("-", "."); + String index = tagValuesKey.replace("-" + middle, "").replaceAll("-", "."); list.add(index); return currentTagValues; View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/1d55e10088a6e574196202e8e... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/1d55e10088a6e574196202e8e... You're receiving this email because of your account on gitlab.com.