Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

16 changed files:

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
    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;
    

  • 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
    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???
    

  • models/persistence/definition/pom.xml
    ... ... @@ -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>

  • models/persistence/definition/src/main/models/Observe/persistence/attribute/naturalId.properties deleted
    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

  • models/persistence/definition/src/main/models/Observe/persistence/class/naturalIdMutable.properties deleted
    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

  • models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-H2.sql
    ... ... @@ -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;
    

  • models/persistence/migration/src/main/resources/db/migration/8.0/observe_create-schema-PG.sql
    ... ... @@ -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;
    

  • models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-H2.sql
    ... ... @@ -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;
    

  • models/persistence/migration/src/main/resources/db/migration/8.0/observe_full-schema-PG.sql
    ... ... @@ -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;
    

  • tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/empty_h2.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/empty_pg.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/referentiel.sql.gz
    No preview for this file type
  • 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
    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
     
    

  • toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/io/TagValuesExtractor.java
    ... ... @@ -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;