Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
74f5c64d
by Tony CHEMIT at 2018-06-13T12:54:08Z
9 changed files:
- dto/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicDtoReferenceBinder.java
- dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
- + dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GearCaracteristicDtoDecorator.java
- + dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GeatCaracteristicReferenceDecorator.java
- dto/src/main/models/Observe.model
- dto/src/main/resources/i18n/dto_en_GB.properties
- dto/src/main/resources/i18n/dto_es_ES.properties
- dto/src/main/resources/i18n/dto_fr_FR.properties
- persistence/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicEntityReferenceBinder.java
Changes:
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.binder.referential.common; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -43,7 +43,8 @@ public class GearCaracteristicDtoReferenceBinder extends ReferentialDtoReference |
| 43 | 43 |
|
| 44 | 44 |
return new GearCaracteristicReference(dto, dto.getCode(),
|
| 45 | 45 |
dto.getLabel(referentialLocale),
|
| 46 |
- dto.getGearCaracteristicType().getId());
|
|
| 46 |
+ dto.getGearCaracteristicType().getId(),
|
|
| 47 |
+ dto.getUnit());
|
|
| 47 | 48 |
|
| 48 | 49 |
}
|
| 49 | 50 |
}
|
| ... | ... | @@ -89,6 +89,8 @@ import fr.ird.observe.dto.data.seine.TransmittingBuoyDto; |
| 89 | 89 |
import fr.ird.observe.dto.data.seine.TransmittingBuoyReference;
|
| 90 | 90 |
import fr.ird.observe.dto.data.seine.TripSeineReference;
|
| 91 | 91 |
import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator;
|
| 92 |
+import fr.ird.observe.dto.decoration.decorators.GearCaracteristicDtoDecorator;
|
|
| 93 |
+import fr.ird.observe.dto.decoration.decorators.GeatCaracteristicReferenceDecorator;
|
|
| 92 | 94 |
import fr.ird.observe.dto.decoration.decorators.LengthLengthParameterDecorator;
|
| 93 | 95 |
import fr.ird.observe.dto.decoration.decorators.LengthWeightParameterDecorator;
|
| 94 | 96 |
import fr.ird.observe.dto.decoration.decorators.NonTargetCatchDecorator;
|
| ... | ... | @@ -541,7 +543,8 @@ public class DecoratorService extends DecoratorProvider { |
| 541 | 543 |
|
| 542 | 544 |
@Override
|
| 543 | 545 |
public void initGearCaracteristicDto() {
|
| 544 |
- registerDefaultReferentialAndReferentialReferenceDecorator(GearCaracteristicDto.class, GearCaracteristicReference.class, libelle);
|
|
| 546 |
+ registerDecorator(new GearCaracteristicDtoDecorator(libelle));
|
|
| 547 |
+ registerDecorator(null, new GeatCaracteristicReferenceDecorator());
|
|
| 545 | 548 |
}
|
| 546 | 549 |
|
| 547 | 550 |
@Override
|
| 1 |
+package fr.ird.observe.dto.decoration.decorators;
|
|
| 2 |
+ |
|
| 3 |
+import fr.ird.observe.dto.referential.GearCaracteristicDto;
|
|
| 4 |
+ |
|
| 5 |
+import static org.nuiton.i18n.I18n.t;
|
|
| 6 |
+ |
|
| 7 |
+/**
|
|
| 8 |
+ * Created by tchemit on 13/06/2018.
|
|
| 9 |
+ *
|
|
| 10 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 11 |
+ */
|
|
| 12 |
+public class GearCaracteristicDtoDecorator extends ObserveDecorator<GearCaracteristicDto> {
|
|
| 13 |
+ |
|
| 14 |
+ public GearCaracteristicDtoDecorator(String libelle) {
|
|
| 15 |
+ super(GearCaracteristicDto.class, "${code}$s##${" + libelle + "}$s##${unit}$s", " ");
|
|
| 16 |
+ }
|
|
| 17 |
+ |
|
| 18 |
+ @Override
|
|
| 19 |
+ protected Comparable<?> getDefaultNullValue(String token) {
|
|
| 20 |
+ Comparable<?> defaultNullValue = super.getDefaultNullValue(token);
|
|
| 21 |
+ if (defaultNullValue == null && token.equals(GearCaracteristicDto.PROPERTY_UNIT)) {
|
|
| 22 |
+ return t("observe.common.no.unit");
|
|
| 23 |
+ }
|
|
| 24 |
+ return defaultNullValue;
|
|
| 25 |
+ }
|
|
| 26 |
+}
|
| 1 |
+package fr.ird.observe.dto.decoration.decorators;
|
|
| 2 |
+ |
|
| 3 |
+import fr.ird.observe.dto.referential.GearCaracteristicDto;
|
|
| 4 |
+import fr.ird.observe.dto.referential.GearCaracteristicReference;
|
|
| 5 |
+ |
|
| 6 |
+import static org.nuiton.i18n.I18n.t;
|
|
| 7 |
+ |
|
| 8 |
+/**
|
|
| 9 |
+ * Created by tchemit on 13/06/2018.
|
|
| 10 |
+ *
|
|
| 11 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 12 |
+ */
|
|
| 13 |
+public class GeatCaracteristicReferenceDecorator extends ReferentialReferenceDecorator<GearCaracteristicReference> {
|
|
| 14 |
+ public GeatCaracteristicReferenceDecorator( ) {
|
|
| 15 |
+ super(GearCaracteristicReference.class, "${code}$s##${label}$s##${unit}$s");
|
|
| 16 |
+ }
|
|
| 17 |
+ |
|
| 18 |
+ @Override
|
|
| 19 |
+ protected Comparable<?> getDefaultNullValue(String token) {
|
|
| 20 |
+ Comparable<?> defaultNullValue = super.getDefaultNullValue(token);
|
|
| 21 |
+ if (defaultNullValue == null && token.equals(GearCaracteristicDto.PROPERTY_UNIT)) {
|
|
| 22 |
+ return t("observe.common.no.unit");
|
|
| 23 |
+ }
|
|
| 24 |
+ return defaultNullValue;
|
|
| 25 |
+ }
|
|
| 26 |
+}
|
| ... | ... | @@ -368,7 +368,7 @@ endDate + {*:1} Date |
| 368 | 368 |
referential.Gear > referential.I18nReferential
|
| 369 | 369 |
gearCaracteristic {*:*} fr.ird.observe.dto.referential.GearCaracteristicReference | ordered
|
| 370 | 370 |
|
| 371 |
-referential.GearCaracteristic > referential.I18nReferential | references=code,label,gearCaracteristicTypeId
|
|
| 371 |
+referential.GearCaracteristic > referential.I18nReferential | references=code,label,gearCaracteristicTypeId,unit
|
|
| 372 | 372 |
unit + {*:1} String
|
| 373 | 373 |
gearCaracteristicType {*:1} fr.ird.observe.dto.referential.GearCaracteristicTypeReference
|
| 374 | 374 |
|
| ... | ... | @@ -243,6 +243,7 @@ observe.common.haulingIdentifier=Hauling identifier |
| 243 | 243 |
observe.common.homeId=Home id
|
| 244 | 244 |
observe.common.inconnu=Unknown
|
| 245 | 245 |
observe.common.lengthWeightFormula=Length weight formula
|
| 246 |
+observe.common.no.unit=No unit
|
|
| 246 | 247 |
observe.common.nocode=Nocode
|
| 247 | 248 |
observe.common.none=None
|
| 248 | 249 |
observe.common.program=Program
|
| ... | ... | @@ -241,6 +241,7 @@ observe.common.haulingIdentifier=Arrastre |
| 241 | 241 |
observe.common.homeId=Identificador
|
| 242 | 242 |
observe.common.inconnu=desconocido
|
| 243 | 243 |
observe.common.lengthWeightFormula=Relación de peso
|
| 244 |
+observe.common.no.unit=No unit \#TODO
|
|
| 244 | 245 |
observe.common.nocode=codigo ausente
|
| 245 | 246 |
observe.common.none=Ninguno
|
| 246 | 247 |
observe.common.program=Programa
|
| ... | ... | @@ -243,6 +243,7 @@ observe.common.haulingIdentifier=Virage |
| 243 | 243 |
observe.common.homeId=Identifiant
|
| 244 | 244 |
observe.common.inconnu=inconnu
|
| 245 | 245 |
observe.common.lengthWeightFormula=Relation Poids
|
| 246 |
+observe.common.no.unit=Pas d'unité
|
|
| 246 | 247 |
observe.common.nocode=code absent
|
| 247 | 248 |
observe.common.none=Aucun
|
| 248 | 249 |
observe.common.program=Programme
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.binder.referential.common; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -44,7 +44,8 @@ public class GearCaracteristicEntityReferenceBinder extends ReferentialEntityRef |
| 44 | 44 |
|
| 45 | 45 |
return new GearCaracteristicReference(dto, dto.getCode(),
|
| 46 | 46 |
dto.getLabel(referentialLocale),
|
| 47 |
- dto.getGearCaracteristicType().getTopiaId());
|
|
| 47 |
+ dto.getGearCaracteristicType().getTopiaId(),
|
|
| 48 |
+ dto.getUnit());
|
|
| 48 | 49 |
|
| 49 | 50 |
}
|
| 50 | 51 |
}
|