Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
1161d56f
by tchemit at 2019-07-23T12:56:26Z
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:
| ... | ... | @@ -22,11 +22,13 @@ package fr.ird.observe.dto.data.ll.logbook; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
|
|
| 25 | 26 |
import org.nuiton.util.DateUtil;
|
| 26 | 27 |
|
| 27 | 28 |
import java.util.Date;
|
| 28 | 29 |
import java.util.List;
|
| 29 | 30 |
|
| 31 |
+@GenerateJavaBeanDefinition(types = {"fr.ird.observe.dto.data.ll.logbook.SampleLogbookDto"})
|
|
| 30 | 32 |
public class SampleLogbookDto extends GeneratedSampleLogbookDto {
|
| 31 | 33 |
|
| 32 | 34 |
public static final String PROPERTY_DATE = "date";
|
| ... | ... | @@ -55,6 +57,10 @@ public class SampleLogbookDto extends GeneratedSampleLogbookDto { |
| 55 | 57 |
}
|
| 56 | 58 |
}
|
| 57 | 59 |
|
| 60 |
+ public String getCoordinateStr() {
|
|
| 61 |
+ return String.format("(%s°;%s°)", latitude, longitude);
|
|
| 62 |
+ }
|
|
| 63 |
+ |
|
| 58 | 64 |
public void setTimeStamp(Date timeStamp) {
|
| 59 | 65 |
Date oldDate = getDate();
|
| 60 | 66 |
Date oldTime = getTime();
|
| 1 |
+package fr.ird.observe.dto.data.ll.logbook;
|
|
| 2 |
+ |
|
| 3 |
+import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
|
|
| 4 |
+ |
|
| 5 |
+/*-
|
|
| 6 |
+ * #%L
|
|
| 7 |
+ * ObServe :: Dto
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
|
|
| 10 |
+ * %%
|
|
| 11 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 12 |
+ * it under the terms of the GNU General Public License as
|
|
| 13 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 14 |
+ * License, or (at your option) any later version.
|
|
| 15 |
+ *
|
|
| 16 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 17 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 18 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 19 |
+ * GNU General Public License for more details.
|
|
| 20 |
+ *
|
|
| 21 |
+ * You should have received a copy of the GNU General Public
|
|
| 22 |
+ * License along with this program. If not, see
|
|
| 23 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 24 |
+ * #L%
|
|
| 25 |
+ */
|
|
| 26 |
+@GenerateJavaBeanDefinition(types = {"fr.ird.observe.dto.data.ll.logbook.SampleLogbookReference"})
|
|
| 27 |
+public class SampleLogbookReference extends GeneratedSampleLogbookReference {
|
|
| 28 |
+ |
|
| 29 |
+ public SampleLogbookReference(fr.ird.observe.dto.reference.DtoReferenceAware dto, java.util.Date timeStamp, java.lang.Float latitude, java.lang.Float longitude) {
|
|
| 30 |
+ super(dto, timeStamp, latitude, longitude);
|
|
| 31 |
+ }
|
|
| 32 |
+ |
|
| 33 |
+ public String getCoordinateStr() {
|
|
| 34 |
+ return String.format("(%s°;%s°)", getLatitude(), getLongitude());
|
|
| 35 |
+ }
|
|
| 36 |
+}
|
| ... | ... | @@ -386,8 +386,8 @@ public class DecoratorService extends DecoratorProvider { |
| 386 | 386 |
@Override
|
| 387 | 387 |
public void initLlLogbookSampleLogbookDto() {
|
| 388 | 388 |
registerDataAndDataReferenceDecorator(SampleLogbookDto.class, SampleLogbookReference.class,
|
| 389 |
- "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s",
|
|
| 390 |
- "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s",
|
|
| 389 |
+ "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${coordinateStr}$s",
|
|
| 390 |
+ "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${coordinateStr}$s",
|
|
| 391 | 391 |
" - ");
|
| 392 | 392 |
}
|
| 393 | 393 |
|
| ... | ... | @@ -24,8 +24,8 @@ package fr.ird.observe.dto.decoration.decorators; |
| 24 | 24 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 25 | 25 |
import org.apache.commons.jxpath.JXPathContext;
|
| 26 | 26 |
import org.apache.commons.lang3.StringUtils;
|
| 27 |
-import org.apache.logging.log4j.Logger;
|
|
| 28 | 27 |
import org.apache.logging.log4j.LogManager;
|
| 28 |
+import org.apache.logging.log4j.Logger;
|
|
| 29 | 29 |
import org.nuiton.decorator.MultiJXPathDecorator;
|
| 30 | 30 |
|
| 31 | 31 |
import java.io.Serializable;
|
| ... | ... | @@ -115,6 +115,8 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon |
| 115 | 115 |
String lastToken = tokens[tokens.length - 1];
|
| 116 | 116 |
if (referenceBean.getPropertyNames().contains(lastToken)) {
|
| 117 | 117 |
value = referenceBean.getPropertyValue(lastToken);
|
| 118 |
+ } else {
|
|
| 119 |
+ value = referenceBean.get(lastToken);
|
|
| 118 | 120 |
}
|
| 119 | 121 |
|
| 120 | 122 |
return value;
|