Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
b655220d
by Tony Chemit at 2021-01-30T10:24:15+01:00
-
6fcc22f0
by Tony Chemit at 2021-01-30T11:03:31+01:00
-
64f4e17c
by Tony Chemit at 2021-01-30T11:03:31+01:00
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:
| ... | ... | @@ -75,7 +75,7 @@ public abstract class ContentTableUIModel<D extends DataDto, C extends Container |
| 75 | 75 |
log.info(String.format("Load Form from id: %s", selectedId));
|
| 76 | 76 |
Form<D> form = loadForm(servicesProvider, selectedId);
|
| 77 | 77 |
if (form.getObject() instanceof ContainerDto) {
|
| 78 |
- getSource().updateCount(((ContainerDto<?>) form.getObject()).getSize());
|
|
| 78 |
+ getSource().updateCount(((ContainerDto<?>) form.getObject()).getChildrenSize());
|
|
| 79 | 79 |
}
|
| 80 | 80 |
getStates().openForm(form);
|
| 81 | 81 |
return form;
|
| ... | ... | @@ -43,7 +43,7 @@ public class SaveContentTableUIAdapter<D extends DataDto, U extends ContentTable |
| 43 | 43 |
ui.getHandler().getResetAction().doReset();
|
| 44 | 44 |
ContentTableUINavigationNode node = ui.getModel().getSource();
|
| 45 | 45 |
if (savedBean instanceof ContainerDto) {
|
| 46 |
- node.updateCount(((ContainerDto<?>) savedBean).getSize());
|
|
| 46 |
+ node.updateCount(((ContainerDto<?>) savedBean).getChildrenSize());
|
|
| 47 | 47 |
}
|
| 48 | 48 |
NavigationNode parent = node.getParent();
|
| 49 | 49 |
//FIXME We should not have to do this: parent data should only be on parent, children should not have to recompute parent data???
|
| ... | ... | @@ -33,4 +33,35 @@ |
| 33 | 33 |
<model.defaultPackage>fr.ird.observe.entities</model.defaultPackage>
|
| 34 | 34 |
<model.fullPackagePath>fr.ird.observe</model.fullPackagePath>
|
| 35 | 35 |
</properties>
|
| 36 |
+ <!--
|
|
| 37 |
+naturalId attribute tagValue (remove now but will be back)
|
|
| 38 |
+ |
|
| 39 |
+referential.common.LengthLengthParameter.attribute.endDate=true
|
|
| 40 |
+referential.common.LengthLengthParameter.attribute.ocean=true
|
|
| 41 |
+referential.common.LengthLengthParameter.attribute.sex=true
|
|
| 42 |
+referential.common.LengthLengthParameter.attribute.species=true
|
|
| 43 |
+referential.common.LengthLengthParameter.attribute.startDate=true
|
|
| 44 |
+referential.common.LengthWeightParameter.attribute.endDate=true
|
|
| 45 |
+referential.common.LengthWeightParameter.attribute.ocean=true
|
|
| 46 |
+referential.common.LengthWeightParameter.attribute.sex=true
|
|
| 47 |
+referential.common.LengthWeightParameter.attribute.species=true
|
|
| 48 |
+referential.common.LengthWeightParameter.attribute.startDate=true
|
|
| 49 |
+referential.common.Person.attribute.firstName=true
|
|
| 50 |
+referential.common.Person.attribute.lastName=true
|
|
| 51 |
+referential.common.ShipOwner.attribute.endDate=true
|
|
| 52 |
+referential.common.ShipOwner.attribute.label=true
|
|
| 53 |
+referential.common.ShipOwner.attribute.startDate=true
|
|
| 54 |
+referential.common.Species.attribute.faoCode=true
|
|
| 55 |
+referential.common.VesselSizeCategory.attribute.capacityLabel=true
|
|
| 56 |
+referential.common.VesselSizeCategory.attribute.gaugeLabel=true
|
|
| 57 |
+ |
|
| 58 |
+naturalIdMutable class tagValue (remove now but will be back)
|
|
| 59 |
+ |
|
| 60 |
+referential.common.LengthLengthParameter=true
|
|
| 61 |
+referential.common.LengthWeightParameter=true
|
|
| 62 |
+referential.common.Person=true
|
|
| 63 |
+referential.common.ShipOwner=true
|
|
| 64 |
+referential.common.Species=true
|
|
| 65 |
+referential.common.VesselSizeCategory=true
|
|
| 66 |
+-->
|
|
| 36 | 67 |
</project>
|
| 1 |
-###
|
|
| 2 |
-# #%L
|
|
| 3 |
-# ObServe Models :: Persistence :: Definition
|
|
| 4 |
-# %%
|
|
| 5 |
-# Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
-# %%
|
|
| 7 |
-# This program is free software: you can redistribute it and/or modify
|
|
| 8 |
-# it under the terms of the GNU General Public License as
|
|
| 9 |
-# published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
-# License, or (at your option) any later version.
|
|
| 11 |
-#
|
|
| 12 |
-# This program is distributed in the hope that it will be useful,
|
|
| 13 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
-# GNU General Public License for more details.
|
|
| 16 |
-#
|
|
| 17 |
-# You should have received a copy of the GNU General Public
|
|
| 18 |
-# License along with this program. If not, see
|
|
| 19 |
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 |
-# #L%
|
|
| 21 |
-###
|
|
| 22 |
-referential.common.LengthLengthParameter.attribute.endDate=true
|
|
| 23 |
-referential.common.LengthLengthParameter.attribute.ocean=true
|
|
| 24 |
-referential.common.LengthLengthParameter.attribute.sex=true
|
|
| 25 |
-referential.common.LengthLengthParameter.attribute.species=true
|
|
| 26 |
-referential.common.LengthLengthParameter.attribute.startDate=true
|
|
| 27 |
-referential.common.LengthWeightParameter.attribute.endDate=true
|
|
| 28 |
-referential.common.LengthWeightParameter.attribute.ocean=true
|
|
| 29 |
-referential.common.LengthWeightParameter.attribute.sex=true
|
|
| 30 |
-referential.common.LengthWeightParameter.attribute.species=true
|
|
| 31 |
-referential.common.LengthWeightParameter.attribute.startDate=true
|
|
| 32 |
-referential.common.Person.attribute.firstName=true
|
|
| 33 |
-referential.common.Person.attribute.lastName=true
|
|
| 34 |
-referential.common.ShipOwner.attribute.endDate=true
|
|
| 35 |
-referential.common.ShipOwner.attribute.label=true
|
|
| 36 |
-referential.common.ShipOwner.attribute.startDate=true
|
|
| 37 |
-referential.common.Species.attribute.faoCode=true
|
|
| 38 |
-referential.common.VesselSizeCategory.attribute.capacityLabel=true
|
|
| 39 |
-referential.common.VesselSizeCategory.attribute.gaugeLabel=true
|
| 1 |
-###
|
|
| 2 |
-# #%L
|
|
| 3 |
-# ObServe Models :: Persistence :: Definition
|
|
| 4 |
-# %%
|
|
| 5 |
-# Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
-# %%
|
|
| 7 |
-# This program is free software: you can redistribute it and/or modify
|
|
| 8 |
-# it under the terms of the GNU General Public License as
|
|
| 9 |
-# published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
-# License, or (at your option) any later version.
|
|
| 11 |
-#
|
|
| 12 |
-# This program is distributed in the hope that it will be useful,
|
|
| 13 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
-# GNU General Public License for more details.
|
|
| 16 |
-#
|
|
| 17 |
-# You should have received a copy of the GNU General Public
|
|
| 18 |
-# License along with this program. If not, see
|
|
| 19 |
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 |
-# #L%
|
|
| 21 |
-###
|
|
| 22 |
-referential.common.LengthLengthParameter=true
|
|
| 23 |
-referential.common.LengthWeightParameter=true
|
|
| 24 |
-referential.common.Person=true
|
|
| 25 |
-referential.common.ShipOwner=true
|
|
| 26 |
-referential.common.Species=true
|
|
| 27 |
-referential.common.VesselSizeCategory=true
|
| ... | ... | @@ -19,8 +19,8 @@ |
| 19 | 19 |
-- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
-- #L%
|
| 21 | 21 |
---
|
| 22 |
-CREATE SCHEMA ps_common;
|
|
| 23 | 22 |
CREATE SCHEMA common;
|
| 23 |
+CREATE SCHEMA ps_common;
|
|
| 24 | 24 |
CREATE SCHEMA ll_observation;
|
| 25 | 25 |
CREATE SCHEMA ll_common;
|
| 26 | 26 |
CREATE SCHEMA ps_observation;
|
| ... | ... | @@ -19,8 +19,8 @@ |
| 19 | 19 |
-- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
-- #L%
|
| 21 | 21 |
---
|
| 22 |
-CREATE SCHEMA ps_common;
|
|
| 23 | 22 |
CREATE SCHEMA common;
|
| 23 |
+CREATE SCHEMA ps_common;
|
|
| 24 | 24 |
CREATE SCHEMA ll_observation;
|
| 25 | 25 |
CREATE SCHEMA ll_common;
|
| 26 | 26 |
CREATE SCHEMA ps_observation;
|
| ... | ... | @@ -19,8 +19,8 @@ |
| 19 | 19 |
-- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
-- #L%
|
| 21 | 21 |
---
|
| 22 |
-CREATE SCHEMA ps_common;
|
|
| 23 | 22 |
CREATE SCHEMA common;
|
| 23 |
+CREATE SCHEMA ps_common;
|
|
| 24 | 24 |
CREATE SCHEMA ll_observation;
|
| 25 | 25 |
CREATE SCHEMA ll_common;
|
| 26 | 26 |
CREATE SCHEMA ps_observation;
|
| ... | ... | @@ -19,8 +19,8 @@ |
| 19 | 19 |
-- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
-- #L%
|
| 21 | 21 |
---
|
| 22 |
-CREATE SCHEMA ps_common;
|
|
| 23 | 22 |
CREATE SCHEMA common;
|
| 23 |
+CREATE SCHEMA ps_common;
|
|
| 24 | 24 |
CREATE SCHEMA ll_observation;
|
| 25 | 25 |
CREATE SCHEMA ll_common;
|
| 26 | 26 |
CREATE SCHEMA ps_observation;
|
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
| ... | ... | @@ -67,7 +67,7 @@ public abstract class ContainerDto<C extends ContainerChildDto> extends DataDto |
| 67 | 67 |
return !isEmpty();
|
| 68 | 68 |
}
|
| 69 | 69 |
|
| 70 |
- public int getSize() {
|
|
| 70 |
+ public int getChildrenSize() {
|
|
| 71 | 71 |
return getChildren() == null ? 0 : getChildren().size();
|
| 72 | 72 |
}
|
| 73 | 73 |
|
| ... | ... | @@ -110,23 +110,44 @@ public class TagValuesExtractor { |
| 110 | 110 |
public Map<String, String> loadFromModel(String tagValuesKey) {
|
| 111 | 111 |
String[] tagParts = tagValuesKey.split("-");
|
| 112 | 112 |
String tagType = tagParts[0];
|
| 113 |
- String tagToReplace = "." + tagParts[1] + "." + tagParts[2];
|
|
| 113 |
+ String middle = tagParts[1];
|
|
| 114 | 114 |
|
| 115 | 115 |
int beginIndex = packageName.length() + 1;
|
| 116 | 116 |
Map<String, String> currentTagValues = new TreeMap<>();
|
| 117 | 117 |
for (String k : tagValueKeysByTagValue.get(tagValuesKey)) {
|
| 118 | 118 |
String value = allTagValues.get(k);
|
| 119 |
- String key = k.replace(tagType + ".", "");
|
|
| 120 |
- key = key.substring(beginIndex);
|
|
| 121 |
- if (key.equals(tagToReplace.substring(1))) {
|
|
| 122 |
- key = "@@";
|
|
| 123 |
- } else {
|
|
| 124 |
- key = key.replace(tagToReplace, "");
|
|
| 119 |
+ String key;
|
|
| 120 |
+ switch (tagType) {
|
|
| 121 |
+ case "package":
|
|
| 122 |
+ // package.fr.ird.observe.dto.data.ll.common.tagValue.xxx → data.ll.common
|
|
| 123 |
+ // package.fr.ird.observe.dto.tagValue.xxx → @@
|
|
| 124 |
+ key = k.substring(tagType.length() + beginIndex, k.indexOf(middle) - 1);
|
|
| 125 |
+ // package.fr.ird.observe.dto.data.ll.common.tagValue.xxx → .data.ll.common
|
|
| 126 |
+ // package.fr.ird.observe.dto.tagValue.xxx → .
|
|
| 127 |
+ if (key.equals("")) {
|
|
| 128 |
+ // empty → @@
|
|
| 129 |
+ key = "@@";
|
|
| 130 |
+ } else {
|
|
| 131 |
+ // .data.ll.common → data.ll.common
|
|
| 132 |
+ key = key.substring(1);
|
|
| 133 |
+ }
|
|
| 134 |
+ break;
|
|
| 135 |
+ case "class":
|
|
| 136 |
+ // fr.ird.observe.dto.result.SaveResult.class.tagValue.skip=true → result.SaveResult
|
|
| 137 |
+ key = k.substring(beginIndex, k.indexOf(tagType) - 1);
|
|
| 138 |
+ break;
|
|
| 139 |
+ case "attribute":
|
|
| 140 |
+ // fr.ird.observe.dto.result.SaveResult.attribute.test.tagValue.skip=true → result.SaveResult.attribute.test
|
|
| 141 |
+ key = k.substring(beginIndex, k.indexOf(middle) - 1);
|
|
| 142 |
+ break;
|
|
| 143 |
+ default:
|
|
| 144 |
+ throw new IllegalStateException("Can't manage value of type: " + tagType);
|
|
| 125 | 145 |
}
|
| 146 |
+ |
|
| 126 | 147 |
currentTagValues.put(key, value);
|
| 127 | 148 |
properties.setProperty(k, value);
|
| 128 | 149 |
}
|
| 129 |
- String index = tagValuesKey.replace("-tagValue", "").replaceAll("-", ".");
|
|
| 150 |
+ String index = tagValuesKey.replace("-" + middle, "").replaceAll("-", ".");
|
|
| 130 | 151 |
list.add(index);
|
| 131 | 152 |
|
| 132 | 153 |
return currentTagValues;
|