Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 8aa658a1 by tchemit at 2019-09-28T11:50:48Z [REFERENTIEL][FOB] Présentation référentiel matériaux - Closes #1344 - - - - - 999fbb95 by tchemit at 2019-09-28T11:50:49Z update toolkit - - - - - 4 changed files: - dto/src/main/i18n/getters/java.getter - + dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObjectMaterialReferenceDecorator.java - dto/src/main/java/fr/ird/observe/dto/decoration/init/ReferentialPsObservationModelDecoratorInitializer.java - pom.xml Changes: ===================================== dto/src/main/i18n/getters/java.getter ===================================== @@ -17,6 +17,7 @@ observe.common.gps.activity observe.common.gps.gpsPoint observe.common.inconnu observe.common.no.unit +observe.common.nocode observe.data.Data.baitHaulingStatus observe.data.Data.captain observe.data.Data.dataQuality ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObjectMaterialReferenceDecorator.java ===================================== @@ -0,0 +1,45 @@ +package fr.ird.observe.dto.decoration.decorators; + +/*- + * #%L + * ObServe :: Dto + * %% + * Copyright (C) 2008 - 2019 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% + */ + +import fr.ird.observe.dto.referential.ReferentialDto; +import fr.ird.observe.dto.referential.ps.observation.ObjectMaterialReference; +import org.apache.commons.jxpath.JXPathContext; + +import static io.ultreia.java4all.i18n.I18n.t; + +public class ObjectMaterialReferenceDecorator extends ReferentialReferenceDecorator<ObjectMaterialReference> { + + public ObjectMaterialReferenceDecorator() { + super(ObjectMaterialReference.class, "${code}$s##${label}$s"); + } + + @Override + protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { + Comparable<Comparable<?>> result = super.getTokenValue(jxcontext, token); + if (ReferentialDto.PROPERTY_CODE.equals(token) && (result == null || (result + "").isEmpty())) { + result = (Comparable) t("observe.common.nocode"); + } + return result; + } +} ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/init/ReferentialPsObservationModelDecoratorInitializer.java ===================================== @@ -23,6 +23,7 @@ package fr.ird.observe.dto.decoration.init; */ import fr.ird.observe.dto.decoration.DecoratorService; +import fr.ird.observe.dto.decoration.decorators.ObjectMaterialReferenceDecorator; import fr.ird.observe.dto.referential.ps.observation.DetectionModeDto; import fr.ird.observe.dto.referential.ps.observation.DetectionModeReference; import fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleaseConformityDto; @@ -32,7 +33,6 @@ import fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleaseStatus import fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeDto; import fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeReference; import fr.ird.observe.dto.referential.ps.observation.ObjectMaterialDto; -import fr.ird.observe.dto.referential.ps.observation.ObjectMaterialReference; import fr.ird.observe.dto.referential.ps.observation.ObservedSystemDto; import fr.ird.observe.dto.referential.ps.observation.ObservedSystemReference; import fr.ird.observe.dto.referential.ps.observation.ReasonForDiscardDto; @@ -76,7 +76,8 @@ public class ReferentialPsObservationModelDecoratorInitializer extends ModelDeco @Override public void initPsObservationObjectMaterialDto() { - registerDefaultReferentialAndReferentialReferenceDecorator(ObjectMaterialDto.class, ObjectMaterialReference.class, libelle); + registerDecorator(new ObjectMaterialReferenceDecorator()); + registerObserveDecorator(ObjectMaterialDto.class, "${code}$s##${" + libelle + "}$s", " "); } @Override ===================================== pom.xml ===================================== @@ -160,7 +160,7 @@ <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> <buildDate>${maven.build.timestamp}</buildDate> - <observeToolkitVersion>4.19-SNAPSHOT</observeToolkitVersion> + <observeToolkitVersion>4.19</observeToolkitVersion> <lib.version.nuiton.validation>3.1</lib.version.nuiton.validation> <!--can't use 1.4.197 (date has changed + blob also)--> <lib.version.h2>1.4.196</lib.version.h2> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/b6d1810eda87639b0faccb9056d... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/b6d1810eda87639b0faccb9056d... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT