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

Commits:

20 changed files:

Changes:

  • client/datasource/editor/common/src/main/java/fr/ird/observe/client/datasource/editor/common/referential/common/LengthLengthParameterUI.jaxx
    ... ... @@ -49,7 +49,7 @@
    49 49
       <LengthLengthParameterDto id='bean'/>
    
    50 50
       <Table id="editView" insets="0" fill="both">
    
    51 51
         <row>
    
    52
    -      <cell anchor="north" weightx="1">
    
    52
    +      <cell anchor="north" weightx="1" weighty="1">
    
    53 53
             <JTabbedPane id='mainTabbedPane'>
    
    54 54
               <tab id='generalTab' i18nProperty="">
    
    55 55
                 <Table id='editTable' styleClass="caracteristic" addToContainer="true" forceOverride="3">
    
    ... ... @@ -168,10 +168,5 @@
    168 168
             </JTabbedPane>
    
    169 169
           </cell>
    
    170 170
         </row>
    
    171
    -    <row>
    
    172
    -      <cell columns="2" weighty="1">
    
    173
    -        <JLabel styleClass="skipI18n"/>
    
    174
    -      </cell>
    
    175
    -    </row>
    
    176 171
       </Table>
    
    177 172
     </fr.ird.observe.client.datasource.editor.api.content.referential.ContentReferentialUI>

  • client/datasource/editor/common/src/main/java/fr/ird/observe/client/datasource/editor/common/referential/common/LengthWeightParameterUI.jaxx
    ... ... @@ -67,7 +67,7 @@ public void decorateUniqueKeyTable(JTable table, TableCellRenderer renderer, JSc
    67 67
     ]]></script>
    
    68 68
       <Table id="editView" insets="0" fill="both">
    
    69 69
         <row>
    
    70
    -      <cell anchor="north" weightx="1">
    
    70
    +      <cell anchor="north" weightx="1" weighty="1">
    
    71 71
             <JTabbedPane id='mainTabbedPane'>
    
    72 72
               <tab id='generalTab' i18nProperty="">
    
    73 73
                 <Table id='editTable' styleClass="caracteristic" addToContainer="true" forceOverride="3">
    
    ... ... @@ -187,12 +187,6 @@ public void decorateUniqueKeyTable(JTable table, TableCellRenderer renderer, JSc
    187 187
                             <NumberEditor id='meanWeight' styleClass="float2"/>
    
    188 188
                           </cell>
    
    189 189
                         </row>
    
    190
    -                    <row>
    
    191
    -                      <cell>
    
    192
    -                        <javax.swing.Box.Filler id='filler'
    
    193
    -                                                constructorParams='UIHelper.newMinDimension(), UIHelper.newMinDimension(), UIHelper.newMaxXDimension()'/>
    
    194
    -                      </cell>
    
    195
    -                    </row>
    
    196 190
                       </Table>
    
    197 191
                     </cell>
    
    198 192
                   </row>
    
    ... ... @@ -206,10 +200,5 @@ public void decorateUniqueKeyTable(JTable table, TableCellRenderer renderer, JSc
    206 200
             </JTabbedPane>
    
    207 201
           </cell>
    
    208 202
         </row>
    
    209
    -    <row>
    
    210
    -      <cell columns="2" weighty="1">
    
    211
    -        <JLabel styleClass="skipI18n"/>
    
    212
    -      </cell>
    
    213
    -    </row>
    
    214 203
       </Table>
    
    215 204
     </fr.ird.observe.client.datasource.editor.api.content.referential.ContentReferentialUI>

  • core/api/dto/src/main/java/fr/ird/observe/dto/referential/common/LengthFormulaSupportDto.java
    ... ... @@ -32,6 +32,16 @@ public abstract class LengthFormulaSupportDto extends GeneratedLengthFormulaSupp
    32 32
     
    
    33 33
         private Map<String, Double> coefficientsValues;
    
    34 34
     
    
    35
    +    @Override
    
    36
    +    public String getSpeciesFaoCode() {
    
    37
    +        return getSpecies() == null ? null : getSpecies().getFaoCode();
    
    38
    +    }
    
    39
    +
    
    40
    +    @Override
    
    41
    +    public SpeciesReference getSpeciesLabel() {
    
    42
    +        return (SpeciesReference) super.getSpeciesLabel();
    
    43
    +    }
    
    44
    +
    
    35 45
         @Override
    
    36 46
         public final void setCoefficients(String coefficients) {
    
    37 47
             super.setCoefficients(coefficients);
    

  • core/api/dto/src/main/java/fr/ird/observe/dto/referential/common/LengthLengthParameterReference.java
    1
    +package fr.ird.observe.dto.referential.common;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe Core :: API :: Dto
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    26
    +
    
    27
    +/**
    
    28
    + * Created on 18/10/2022.
    
    29
    + *
    
    30
    + * @author Tony Chemit - dev@tchemit.fr
    
    31
    + * @since 9.0.14
    
    32
    + */
    
    33
    +@GenerateJavaBeanDefinition
    
    34
    +public class LengthLengthParameterReference extends GeneratedLengthLengthParameterReference {
    
    35
    +
    
    36
    +    @Override
    
    37
    +    public String getSpeciesFaoCode() {
    
    38
    +        return getSpecies() == null ? null : getSpecies().getFaoCode();
    
    39
    +    }
    
    40
    +
    
    41
    +    @Override
    
    42
    +    public SpeciesReference getSpeciesLabel() {
    
    43
    +        return (SpeciesReference) super.getSpeciesLabel();
    
    44
    +    }
    
    45
    +}

  • core/api/dto/src/main/java/fr/ird/observe/dto/referential/common/LengthWeightParameterReference.java
    1
    +package fr.ird.observe.dto.referential.common;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe Core :: API :: Dto
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    26
    +
    
    27
    +/**
    
    28
    + * Created on 18/10/2022.
    
    29
    + *
    
    30
    + * @author Tony Chemit - dev@tchemit.fr
    
    31
    + * @since 9.0.14
    
    32
    + */
    
    33
    +@GenerateJavaBeanDefinition
    
    34
    +public class LengthWeightParameterReference extends GeneratedLengthWeightParameterReference {
    
    35
    +
    
    36
    +    @Override
    
    37
    +    public String getSpeciesFaoCode() {
    
    38
    +        return getSpecies() == null ? null : getSpecies().getFaoCode();
    
    39
    +    }
    
    40
    +
    
    41
    +    @Override
    
    42
    +    public SpeciesReference getSpeciesLabel() {
    
    43
    +        return (SpeciesReference) super.getSpeciesLabel();
    
    44
    +    }
    
    45
    +}

  • core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveDefaultDecoratorRenderer.java
    ... ... @@ -41,6 +41,13 @@ public interface ObserveDefaultDecoratorRenderer {
    41 41
             return String.format("%s - %s - %s", faoCode, scientificLabel, label);
    
    42 42
         }
    
    43 43
     
    
    44
    +    default String speciesSimpleLabel(String scientificLabel, String label) {
    
    45
    +        if ("xx".equals(scientificLabel)) {
    
    46
    +            return String.format("%s", label);
    
    47
    +        }
    
    48
    +        return String.format("%s (%s)", scientificLabel, label);
    
    49
    +    }
    
    50
    +
    
    44 51
         default String fieldEnabler(Locale locale, boolean fieldEnabler) {
    
    45 52
             return fieldEnabler ? I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldEnabled") : I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldDisabled");
    
    46 53
         }
    

  • core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoDecoratorRenderer.java
    ... ... @@ -49,4 +49,13 @@ public class ObserveDtoDecoratorRenderer<O extends BusinessDto> extends DtoDecor
    49 49
             String label = label(locale, species);
    
    50 50
             return speciesLabel(faoCode, scientificLabel, label);
    
    51 51
         }
    
    52
    +
    
    53
    +    public String speciesSimpleLabel(Locale locale, SpeciesReference species) {
    
    54
    +        if (species == null) {
    
    55
    +            return onNullValue(locale, null);
    
    56
    +        }
    
    57
    +        String scientificLabel = species.getScientificLabel();
    
    58
    +        String label = label(locale, species);
    
    59
    +        return speciesSimpleLabel(scientificLabel, label);
    
    60
    +    }
    
    52 61
     }

  • core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoReferenceDecoratorRenderer.java
    ... ... @@ -49,4 +49,13 @@ public class ObserveDtoReferenceDecoratorRenderer<O extends DtoReference> extend
    49 49
             String label = label(locale, species);
    
    50 50
             return speciesLabel(faoCode, scientificLabel, label);
    
    51 51
         }
    
    52
    +
    
    53
    +    public String speciesSimpleLabel(Locale locale, SpeciesReference species) {
    
    54
    +        if (species == null) {
    
    55
    +            return onNullValue(locale, null);
    
    56
    +        }
    
    57
    +        String scientificLabel = species.getScientificLabel();
    
    58
    +        String label = label(locale, species);
    
    59
    +        return speciesSimpleLabel(scientificLabel, label);
    
    60
    +    }
    
    52 61
     }

  • core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveI18nLabelsBuilder.java
    ... ... @@ -47,6 +47,7 @@ import fr.ird.observe.dto.referential.MinMaxWeightAware;
    47 47
     import fr.ird.observe.dto.referential.ReferentialDto;
    
    48 48
     import fr.ird.observe.dto.referential.WithFormula;
    
    49 49
     import fr.ird.observe.dto.referential.WithI18n;
    
    50
    +import fr.ird.observe.dto.referential.WithSpeciesFaoCode;
    
    50 51
     import fr.ird.observe.dto.referential.common.SpeciesDto;
    
    51 52
     import fr.ird.observe.dto.referential.common.VesselSizeCategoryDto;
    
    52 53
     import io.ultreia.java4all.i18n.spi.bean.BeanPropertyI18nKeyProducerSupport;
    
    ... ... @@ -144,6 +145,7 @@ import static io.ultreia.java4all.i18n.I18n.n;
    144 145
             @RegisterI18nLabel(target = BusinessDto.class, properties = {"homeId"}),
    
    145 146
             @RegisterI18nLabel(target = OpenableDto.class, offers = {"action.close.tip", "action.create.tip", "action.editable.tip", "action.notEditable.tip", "action.reopen.tip", "action.update.tip"}),
    
    146 147
             @RegisterI18nLabel(target = WithStartEndDate.class, properties = {"startDate", "endDate", "validityRangeLabel"}),
    
    148
    +        @RegisterI18nLabel(target = WithSpeciesFaoCode.class, properties = {"speciesFaoCode", "speciesLabel"}),
    
    147 149
             @RegisterI18nLabel(target = WithDataFile.class, properties = {"dataLocation", "dataLocation.tip", "data", "hasData.short", "hasData", "action.deleteDataFile", "action.deleteDataFile.tip", "action.exportDataFile", "action.exportDataFile.filter", "action.exportDataFile.tip", "action.importData", "action.importDataFile", "action.importDataFile.tip", "action.replace.data.file.message", "choose.title.exportDataFile", "choose.title.importData", "delete.data.file.message"}),
    
    148 150
             @RegisterI18nLabel(target = LonglineElementAware.class, properties = {"haulingIdentifier", "haulingIdentifier.short", "settingIdentifier", "settingIdentifier.short"}),
    
    149 151
             @RegisterI18nLabel(target = InlineDataDto.class, offers = {"action.add", "action.add.tip", "action.delete", "action.delete.message", "action.delete.tip"}),
    

  • core/api/services/src/main/resources/META-INF/i18n/Observe-labels.properties
    ... ... @@ -20,7 +20,7 @@
    20 20
     # #L%
    
    21 21
     ###
    
    22 22
     #Generated by org.nuiton.i18n.plugin.GenerateI18nLabelsMojo
    
    23
    -#Mon Oct 17 14:55:03 CEST 2022
    
    23
    +#Tue Oct 18 08:15:15 CEST 2022
    
    24 24
     observe.Business.createDate=observe.Common.createDate
    
    25 25
     observe.Business.homeId=observe.Common.homeId
    
    26 26
     observe.Business.id=observe.Common.id
    
    ... ... @@ -1816,6 +1816,8 @@ observe.referential.Referential.status=observe.Common.status
    1816 1816
     observe.referential.Referential.uri=observe.Common.uri
    
    1817 1817
     observe.referential.Referential.version=observe.Common.version
    
    1818 1818
     observe.referential.WithFormula.endDate=observe.Common.endDate
    
    1819
    +observe.referential.WithFormula.speciesFaoCode=observe.Common.speciesFaoCode
    
    1820
    +observe.referential.WithFormula.speciesLabel=observe.Common.speciesLabel
    
    1819 1821
     observe.referential.WithFormula.startDate=observe.Common.startDate
    
    1820 1822
     observe.referential.WithFormula.validityRangeLabel=observe.Common.validityRangeLabel
    
    1821 1823
     observe.referential.WithI18n.label1=observe.Common.label1
    
    ... ... @@ -1826,6 +1828,8 @@ observe.referential.WithI18n.label5=observe.Common.label5
    1826 1828
     observe.referential.WithI18n.label6=observe.Common.label6
    
    1827 1829
     observe.referential.WithI18n.label7=observe.Common.label7
    
    1828 1830
     observe.referential.WithI18n.label8=observe.Common.label8
    
    1831
    +observe.referential.WithSpeciesFaoCode.speciesFaoCode=observe.Common.speciesFaoCode
    
    1832
    +observe.referential.WithSpeciesFaoCode.speciesLabel=observe.Common.speciesLabel
    
    1829 1833
     observe.referential.common.Country.code=observe.referential.Referential.code
    
    1830 1834
     observe.referential.common.Country.codeAndHomeId=observe.referential.Referential.codeAndHomeId
    
    1831 1835
     observe.referential.common.Country.createDate=observe.Common.createDate
    
    ... ... @@ -1996,6 +2000,8 @@ observe.referential.common.LengthFormulaSupport.otherTab=observe.Common.otherTab
    1996 2000
     observe.referential.common.LengthFormulaSupport.sex=observe.Common.sex
    
    1997 2001
     observe.referential.common.LengthFormulaSupport.source=observe.referential.WithFormula.source
    
    1998 2002
     observe.referential.common.LengthFormulaSupport.species=observe.Common.species
    
    2003
    +observe.referential.common.LengthFormulaSupport.speciesFaoCode=observe.Common.speciesFaoCode
    
    2004
    +observe.referential.common.LengthFormulaSupport.speciesLabel=observe.Common.speciesLabel
    
    1999 2005
     observe.referential.common.LengthFormulaSupport.startDate=observe.Common.startDate
    
    2000 2006
     observe.referential.common.LengthFormulaSupport.status=observe.Common.status
    
    2001 2007
     observe.referential.common.LengthFormulaSupport.uri=observe.Common.uri
    
    ... ... @@ -2019,6 +2025,8 @@ observe.referential.common.LengthLengthParameter.otherTab=observe.Common.otherTa
    2019 2025
     observe.referential.common.LengthLengthParameter.sex=observe.Common.sex
    
    2020 2026
     observe.referential.common.LengthLengthParameter.source=observe.referential.WithFormula.source
    
    2021 2027
     observe.referential.common.LengthLengthParameter.species=observe.Common.species
    
    2028
    +observe.referential.common.LengthLengthParameter.speciesFaoCode=observe.Common.speciesFaoCode
    
    2029
    +observe.referential.common.LengthLengthParameter.speciesLabel=observe.Common.speciesLabel
    
    2022 2030
     observe.referential.common.LengthLengthParameter.startDate=observe.Common.startDate
    
    2023 2031
     observe.referential.common.LengthLengthParameter.status=observe.Common.status
    
    2024 2032
     observe.referential.common.LengthLengthParameter.uri=observe.Common.uri
    
    ... ... @@ -2063,6 +2071,8 @@ observe.referential.common.LengthWeightParameter.sex=observe.Common.sex
    2063 2071
     observe.referential.common.LengthWeightParameter.sizeMeasureType=observe.Common.sizeMeasureType
    
    2064 2072
     observe.referential.common.LengthWeightParameter.source=observe.referential.WithFormula.source
    
    2065 2073
     observe.referential.common.LengthWeightParameter.species=observe.Common.species
    
    2074
    +observe.referential.common.LengthWeightParameter.speciesFaoCode=observe.Common.speciesFaoCode
    
    2075
    +observe.referential.common.LengthWeightParameter.speciesLabel=observe.Common.speciesLabel
    
    2066 2076
     observe.referential.common.LengthWeightParameter.startDate=observe.Common.startDate
    
    2067 2077
     observe.referential.common.LengthWeightParameter.status=observe.Common.status
    
    2068 2078
     observe.referential.common.LengthWeightParameter.uri=observe.Common.uri
    

  • core/persistence/java/src/main/java/fr/ird/observe/entities/referential/common/LengthLengthParameterImpl.java
    ... ... @@ -39,6 +39,16 @@ public class LengthLengthParameterImpl extends LengthLengthParameterAbstract {
    39 39
         private Boolean formulaOneValid;
    
    40 40
         private Boolean formulaTwoValid;
    
    41 41
     
    
    42
    +    @Override
    
    43
    +    public String getSpeciesFaoCode() {
    
    44
    +        return getSpecies() == null ? null : getSpecies().getFaoCode();
    
    45
    +    }
    
    46
    +
    
    47
    +    @Override
    
    48
    +    public Species getSpeciesLabel() {
    
    49
    +        return (Species) super.getSpeciesLabel();
    
    50
    +    }
    
    51
    +
    
    42 52
         @Override
    
    43 53
         public void setInputOutputFormula(String inputOutputFormula) {
    
    44 54
             super.setInputOutputFormula(inputOutputFormula);
    

  • core/persistence/java/src/main/java/fr/ird/observe/entities/referential/common/LengthWeightParameterImpl.java
    ... ... @@ -32,6 +32,16 @@ public class LengthWeightParameterImpl extends LengthWeightParameterAbstract {
    32 32
         private Boolean formulaOneValid;
    
    33 33
         private Boolean formulaTwoValid;
    
    34 34
     
    
    35
    +    @Override
    
    36
    +    public String getSpeciesFaoCode() {
    
    37
    +        return getSpecies() == null ? null : getSpecies().getFaoCode();
    
    38
    +    }
    
    39
    +
    
    40
    +    @Override
    
    41
    +    public Species getSpeciesLabel() {
    
    42
    +        return (Species) super.getSpeciesLabel();
    
    43
    +    }
    
    44
    +
    
    35 45
         @Override
    
    36 46
         public void setLengthWeightFormula(String value) {
    
    37 47
             super.setLengthWeightFormula(value);
    

  • core/persistence/java/src/main/java/fr/ird/observe/spi/decoration/ObserveEntityDecoratorRenderer.java
    ... ... @@ -22,6 +22,7 @@ package fr.ird.observe.spi.decoration;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.dto.CommonDto;
    
    25 26
     import fr.ird.observe.entities.Entity;
    
    26 27
     import fr.ird.observe.entities.referential.common.Species;
    
    27 28
     
    
    ... ... @@ -49,4 +50,15 @@ public class ObserveEntityDecoratorRenderer<O extends Entity> extends EntityDeco
    49 50
             String label = label(locale, species);
    
    50 51
             return speciesLabel(faoCode, scientificLabel, label);
    
    51 52
         }
    
    53
    +
    
    54
    +    public String speciesSimpleLabel(Locale locale, CommonDto source) {
    
    55
    +        Species species = (Species) source;
    
    56
    +        if (species == null) {
    
    57
    +            return onNullValue(locale, null);
    
    58
    +        }
    
    59
    +        String scientificLabel = species.getScientificLabel();
    
    60
    +        String label = label(locale, species);
    
    61
    +        return speciesSimpleLabel(scientificLabel, label);
    
    62
    +    }
    
    63
    +
    
    52 64
     }

  • model/src/main/models/Observe/dto/00-common.model
    ... ... @@ -24,6 +24,8 @@ interface referential.WithI18n
    24 24
     
    
    25 25
     interface WithStartEndDate > DtoAndReferenceAware
    
    26 26
     
    
    27
    +interface referential.WithSpeciesFaoCode > DtoAndReferenceAware
    
    28
    +
    
    27 29
     interface WithAtLeastOneSelected
    
    28 30
     atLeastOneSelected() boolean
    
    29 31
     
    

  • model/src/main/models/Observe/dto/01-referential-common.model
    1 1
     package fr.ird.observe.dto.referential.common
    
    2 2
     
    
    3
    -interface referential.WithFormula > WithStartEndDate
    
    3
    +interface referential.WithFormula > WithStartEndDate, referential.WithSpeciesFaoCode
    
    4 4
     
    
    5 5
     interface referential.common.GearCharacteristicTypeAware > DtoAndReferenceAware
    
    6 6
     
    

  • model/src/main/models/Observe/dto/class/decorator.properties
    ... ... @@ -100,8 +100,8 @@ presets.RemoteDataSourceConfiguration=${name}
    100 100
     presets.ServerDataSourceConfiguration=${name}
    
    101 101
     referential.common.FpaZone=${code}##${this::label}
    
    102 102
     referential.common.Harbour=${this::label}##${code}##${locode}
    
    103
    -referential.common.LengthLengthParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${inputSizeMeasureType::labelOrUnknown}##${outputSizeMeasureType::labelOrUnknown}
    
    104
    -referential.common.LengthWeightParameter=${species/faoCode}##${species::label}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${sizeMeasureType::labelOrUnknown}
    
    103
    +referential.common.LengthLengthParameter=${speciesFaoCode}##${speciesLabel::speciesSimpleLabel}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${inputSizeMeasureType::labelOrUnknown}##${outputSizeMeasureType::labelOrUnknown}
    
    104
    +referential.common.LengthWeightParameter=${speciesFaoCode}##${speciesLabel::speciesSimpleLabel}##$(observe.Common.ocean) ${ocean::labelOrUnknown}##$(observe.Common.sex) ${sex::label}##${this::validityRangeLabel}##${sizeMeasureType::labelOrUnknown}
    
    105 105
     referential.common.Person=${lastName}##${firstName}
    
    106 106
     referential.common.ShipOwner=${code}##${label}
    
    107 107
     referential.common.Species=${faoCode}##${scientificLabel}##${this::label}
    

  • pom.xml
    ... ... @@ -23,7 +23,7 @@
    23 23
       <parent>
    
    24 24
         <groupId>io.ultreia.maven</groupId>
    
    25 25
         <artifactId>pom</artifactId>
    
    26
    -    <version>2022.91</version>
    
    26
    +    <version>2022.92</version>
    
    27 27
       </parent>
    
    28 28
       <groupId>fr.ird.observe</groupId>
    
    29 29
       <artifactId>ird-observe</artifactId>
    

  • toolkit/api/src/main/java/fr/ird/observe/dto/referential/WithFormula.java
    ... ... @@ -36,7 +36,7 @@ import java.util.Set;
    36 36
      * @author Tony Chemit - dev@tchemit.fr
    
    37 37
      * @since 6.0
    
    38 38
      */
    
    39
    -public interface WithFormula extends WithStartEndDate {
    
    39
    +public interface WithFormula extends WithStartEndDate, WithSpeciesFaoCode {
    
    40 40
     
    
    41 41
         String PROPERTY_OCEAN = "ocean";
    
    42 42
         String PROPERTY_SPECIES = "species";
    

  • toolkit/api/src/main/java/fr/ird/observe/dto/referential/WithSpeciesFaoCode.java
    1
    +package fr.ird.observe.dto.referential;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe Toolkit :: API
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2022 IRD, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.dto.CommonDto;
    
    26
    +import fr.ird.observe.dto.DtoAndReferenceAware;
    
    27
    +
    
    28
    +/**
    
    29
    + * Created on 18/10/2022.
    
    30
    + *
    
    31
    + * @author Tony Chemit - dev@tchemit.fr
    
    32
    + * @since 9.0.14
    
    33
    + */
    
    34
    +public interface WithSpeciesFaoCode extends DtoAndReferenceAware {
    
    35
    +
    
    36
    +    CommonDto getSpecies();
    
    37
    +
    
    38
    +    default CommonDto getSpeciesLabel() {
    
    39
    +        return getSpecies();
    
    40
    +    }
    
    41
    +
    
    42
    +    String getSpeciesFaoCode();
    
    43
    +}

  • toolkit/api/src/test/java/fr/ird/observe/dto/referential/FormulaHelperTest.java
    ... ... @@ -22,6 +22,7 @@ package fr.ird.observe.dto.referential;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.dto.CommonDto;
    
    25 26
     import org.junit.Assert;
    
    26 27
     import org.junit.Test;
    
    27 28
     
    
    ... ... @@ -40,6 +41,15 @@ public class FormulaHelperTest {
    40 41
         public void testComputeValue() {
    
    41 42
     
    
    42 43
             WithFormula formula = new WithFormula() {
    
    44
    +            @Override
    
    45
    +            public String getSpeciesFaoCode() {
    
    46
    +                return null;
    
    47
    +            }
    
    48
    +
    
    49
    +            @Override
    
    50
    +            public CommonDto getSpecies() {
    
    51
    +                return null;
    
    52
    +            }
    
    43 53
     
    
    44 54
                 @Override
    
    45 55
                 public Date getStartDate() {
    
    ... ... @@ -135,7 +145,7 @@ public class FormulaHelperTest {
    135 145
             Float weight = FormulaHelper.computeValue(formula, "a * Math.pow(L, b)", null, "L", 84.0f);
    
    136 146
             Assert.assertNotNull(weight);
    
    137 147
     
    
    138
    -        Float excepted = (float) (Math.pow(84.0, 2.78) * 3.8e-5);
    
    148
    +        float excepted = (float) (Math.pow(84.0, 2.78) * 3.8e-5);
    
    139 149
             Assert.assertEquals(excepted, weight, 2);
    
    140 150
         }
    
    141 151
     }