Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 1161d56f by tchemit at 2019-07-23T12:56:26Z [LL][LOGBOOKS] Echantillons, ajouter l'unité ° - Closes #1366 - - - - - 4 changed files: - dto/src/main/java/fr/ird/observe/dto/data/ll/logbook/SampleLogbookDto.java - + dto/src/main/java/fr/ird/observe/dto/data/ll/logbook/SampleLogbookReference.java - dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java - dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObserveDecorator.java Changes: ===================================== dto/src/main/java/fr/ird/observe/dto/data/ll/logbook/SampleLogbookDto.java ===================================== @@ -22,11 +22,13 @@ package fr.ird.observe.dto.data.ll.logbook; * #L% */ +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; import org.nuiton.util.DateUtil; import java.util.Date; import java.util.List; +@GenerateJavaBeanDefinition(types = {"fr.ird.observe.dto.data.ll.logbook.SampleLogbookDto"}) public class SampleLogbookDto extends GeneratedSampleLogbookDto { public static final String PROPERTY_DATE = "date"; @@ -55,6 +57,10 @@ public class SampleLogbookDto extends GeneratedSampleLogbookDto { } } + public String getCoordinateStr() { + return String.format("(%s°;%s°)", latitude, longitude); + } + public void setTimeStamp(Date timeStamp) { Date oldDate = getDate(); Date oldTime = getTime(); ===================================== dto/src/main/java/fr/ird/observe/dto/data/ll/logbook/SampleLogbookReference.java ===================================== @@ -0,0 +1,36 @@ +package fr.ird.observe.dto.data.ll.logbook; + +import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; + +/*- + * #%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% + */ +@GenerateJavaBeanDefinition(types = {"fr.ird.observe.dto.data.ll.logbook.SampleLogbookReference"}) +public class SampleLogbookReference extends GeneratedSampleLogbookReference { + + public SampleLogbookReference(fr.ird.observe.dto.reference.DtoReferenceAware dto, java.util.Date timeStamp, java.lang.Float latitude, java.lang.Float longitude) { + super(dto, timeStamp, latitude, longitude); + } + + public String getCoordinateStr() { + return String.format("(%s°;%s°)", getLatitude(), getLongitude()); + } +} ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java ===================================== @@ -386,8 +386,8 @@ public class DecoratorService extends DecoratorProvider { @Override public void initLlLogbookSampleLogbookDto() { registerDataAndDataReferenceDecorator(SampleLogbookDto.class, SampleLogbookReference.class, - "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s", - "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s", + "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${coordinateStr}$s", + "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${coordinateStr}$s", " - "); } ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObserveDecorator.java ===================================== @@ -24,8 +24,8 @@ package fr.ird.observe.dto.decoration.decorators; import fr.ird.observe.dto.reference.DtoReference; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.nuiton.decorator.MultiJXPathDecorator; import java.io.Serializable; @@ -115,6 +115,8 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon String lastToken = tokens[tokens.length - 1]; if (referenceBean.getPropertyNames().contains(lastToken)) { value = referenceBean.getPropertyValue(lastToken); + } else { + value = referenceBean.get(lastToken); } return value; View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1161d56fd676ff1c8b49422cb0b0... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1161d56fd676ff1c8b49422cb0b0... You're receiving this email because of your account on gitlab.com.