Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
a670d27c
by Tony Chemit at 2020-06-30T12:58:27+02:00
-
2ed828cc
by Tony Chemit at 2020-06-30T12:59:02+02:00
20 changed files:
- client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/trip/map/ObserveMapPaneLegendItem.java
- client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/trip/map/TripMapContentBuilder.java
- client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/trip/map/TripMapUIHandler.java
- client-datasource-editor-common/src/main/map/ll-style.xml
- client-datasource-editor-common/src/main/map/ps-style.xml
- client-datasource-editor-ll/src/main/i18n/getters/java.getter
- client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/common/TripMapContentBuilder.java
- client-datasource-editor-ps/src/main/i18n/getters/java.getter
- client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/common/TripMapContentBuilder.java
- dto/src/main/java/fr/ird/observe/dto/data/TripMapPoint.java
- dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java
- observe-i18n/src/main/i18n/translations/observe_en_GB.properties
- observe-i18n/src/main/i18n/translations/observe_es_ES.properties
- observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
- persistence/src/main/java/fr/ird/observe/entities/Entities.java
- persistence/src/main/java/fr/ird/observe/entities/data/ll/common/TripTopiaDao.java
- persistence/src/main/java/fr/ird/observe/entities/data/ps/common/TripTopiaDao.java
- services-local/src/main/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java
Changes:
| ... | ... | @@ -49,13 +49,13 @@ public class ObserveMapPaneLegendItem { |
| 49 | 49 |
|
| 50 | 50 |
public static Coordinate[] lineCoordinates() {
|
| 51 | 51 |
Coordinate[] coordinates = new Coordinate[2];
|
| 52 |
- coordinates[0] = new Coordinate(LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2);
|
|
| 53 |
- coordinates[1] = new Coordinate(LEGEND_SYMBOL_WIDTH - LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2);
|
|
| 52 |
+ coordinates[0] = new Coordinate(LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2.);
|
|
| 53 |
+ coordinates[1] = new Coordinate(LEGEND_SYMBOL_WIDTH - LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2.);
|
|
| 54 | 54 |
return coordinates;
|
| 55 | 55 |
}
|
| 56 | 56 |
|
| 57 | 57 |
public static Coordinate pointCoordinates() {
|
| 58 |
- return new Coordinate(LEGEND_SYMBOL_WIDTH / 2, LEGEND_ITEM_HEIGHT / 2);
|
|
| 58 |
+ return new Coordinate(LEGEND_SYMBOL_WIDTH / 2., LEGEND_ITEM_HEIGHT / 2.);
|
|
| 59 | 59 |
}
|
| 60 | 60 |
|
| 61 | 61 |
public SimpleFeature getSimpleFeature() {
|
| ... | ... | @@ -62,11 +62,14 @@ import java.io.IOException; |
| 62 | 62 |
import java.text.SimpleDateFormat;
|
| 63 | 63 |
import java.util.ArrayList;
|
| 64 | 64 |
import java.util.HashSet;
|
| 65 |
+import java.util.LinkedList;
|
|
| 65 | 66 |
import java.util.List;
|
| 66 | 67 |
import java.util.Optional;
|
| 67 | 68 |
import java.util.ServiceLoader;
|
| 68 | 69 |
import java.util.Set;
|
| 69 | 70 |
|
| 71 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 72 |
+ |
|
| 70 | 73 |
/**
|
| 71 | 74 |
* @author Tony Chemit - dev@tchemit.fr
|
| 72 | 75 |
*/
|
| ... | ... | @@ -76,12 +79,14 @@ public abstract class TripMapContentBuilder { |
| 76 | 79 |
protected static final String TRIP_LOGBOOK_POINTS_LAYER_NAME = "Trip Logbook points";
|
| 77 | 80 |
protected static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM");
|
| 78 | 81 |
|
| 79 |
- protected MapContent mapContent;
|
|
| 82 |
+ private static ImmutableSet<TripMapContentBuilder> PROVIDERS;
|
|
| 83 |
+ |
|
| 80 | 84 |
protected final List<ObserveMapPaneLegendItem> legendItems;
|
| 85 |
+ protected final List<TripMapPoint> notValidPoints = new LinkedList<>();
|
|
| 81 | 86 |
protected final Set<TripMapPointType> acceptedTripPointTypes;
|
| 87 |
+ protected MapContent mapContent;
|
|
| 82 | 88 |
protected StyledLayerDescriptor styledLayerDescriptor;
|
| 83 | 89 |
|
| 84 |
- private static ImmutableSet<TripMapContentBuilder> PROVIDERS;
|
|
| 85 | 90 |
|
| 86 | 91 |
public abstract boolean accept(TripMapDto tripMapDto);
|
| 87 | 92 |
|
| ... | ... | @@ -121,7 +126,8 @@ public abstract class TripMapContentBuilder { |
| 121 | 126 |
|
| 122 | 127 |
private void reset() {
|
| 123 | 128 |
legendItems.clear();
|
| 124 |
- mapContent=new MapContent();
|
|
| 129 |
+ notValidPoints.clear();
|
|
| 130 |
+ mapContent = new MapContent();
|
|
| 125 | 131 |
}
|
| 126 | 132 |
|
| 127 | 133 |
protected TripMapContentBuilder(Set<TripMapPointType> acceptedTripPointTypes) {
|
| ... | ... | @@ -152,7 +158,7 @@ public abstract class TripMapContentBuilder { |
| 152 | 158 |
mapContent.addLayer(layer);
|
| 153 | 159 |
}
|
| 154 | 160 |
|
| 155 |
- public void addPoints(List<TripMapPoint> tripMapPoints, String layerName) throws FactoryException {
|
|
| 161 |
+ public void addPoints(List<TripMapPoint> tripMapPoints, String layerName, String notValidPointsLabel) throws FactoryException {
|
|
| 156 | 162 |
|
| 157 | 163 |
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
|
| 158 | 164 |
|
| ... | ... | @@ -171,8 +177,11 @@ public abstract class TripMapContentBuilder { |
| 171 | 177 |
Style stylePoints = findStyle(styledLayerDescriptor, layerName, null);
|
| 172 | 178 |
|
| 173 | 179 |
Set<TripMapPointType> pointTypeInLegend = new HashSet<>();
|
| 174 |
- |
|
| 175 | 180 |
for (TripMapPoint tripMapPoint : tripMapPoints) {
|
| 181 |
+ if (!tripMapPoint.isValid()) {
|
|
| 182 |
+ notValidPoints.add(tripMapPoint);
|
|
| 183 |
+ continue;
|
|
| 184 |
+ }
|
|
| 176 | 185 |
Coordinate coordinate = new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude());
|
| 177 | 186 |
|
| 178 | 187 |
TripMapPointType type = tripMapPoint.getType();
|
| ... | ... | @@ -205,6 +214,19 @@ public abstract class TripMapContentBuilder { |
| 205 | 214 |
mapContent.addLayer(pointsLayer);
|
| 206 | 215 |
}
|
| 207 | 216 |
|
| 217 |
+ if (!notValidPoints.isEmpty()) {
|
|
| 218 |
+ Point point = geometryFactory.createPoint(ObserveMapPaneLegendItem.pointCoordinates());
|
|
| 219 |
+ pointBuilder.add(point);
|
|
| 220 |
+ pointBuilder.add("");
|
|
| 221 |
+ pointBuilder.add("notValidPoint");
|
|
| 222 |
+ |
|
| 223 |
+ ObserveMapPaneLegendItem legendPoint = new ObserveMapPaneLegendItem(
|
|
| 224 |
+ pointBuilder.buildFeature(null),
|
|
| 225 |
+ stylePoints,
|
|
| 226 |
+ t(notValidPointsLabel, notValidPoints.size()));
|
|
| 227 |
+ legendItems.add(legendPoint);
|
|
| 228 |
+ }
|
|
| 229 |
+ |
|
| 208 | 230 |
}
|
| 209 | 231 |
|
| 210 | 232 |
|
| ... | ... | @@ -94,7 +94,9 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { |
| 94 | 94 |
// set zoom
|
| 95 | 95 |
tripArea = new ReferencedEnvelope();
|
| 96 | 96 |
for (TripMapPoint point : tripMapPoints) {
|
| 97 |
- tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude()));
|
|
| 97 |
+ if (point.isValid()) {
|
|
| 98 |
+ tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude()));
|
|
| 99 |
+ }
|
|
| 98 | 100 |
}
|
| 99 | 101 |
tripArea.expandBy(1.1);
|
| 100 | 102 |
|
| ... | ... | @@ -118,7 +118,7 @@ |
| 118 | 118 |
<LineSymbolizer>
|
| 119 | 119 |
<Stroke>
|
| 120 | 120 |
<CssParameter name="stroke">#00FF00</CssParameter>
|
| 121 |
- <CssParameter name="stroke-width">1</CssParameter>
|
|
| 121 |
+ <CssParameter name="stroke-width">2</CssParameter>
|
|
| 122 | 122 |
<CssParameter name="stroke-dasharray">5 7</CssParameter>
|
| 123 | 123 |
</Stroke>
|
| 124 | 124 |
</LineSymbolizer>
|
| ... | ... | @@ -404,6 +404,33 @@ |
| 404 | 404 |
</TextSymbolizer>
|
| 405 | 405 |
</Rule>
|
| 406 | 406 |
</FeatureTypeStyle>
|
| 407 |
+ <FeatureTypeStyle>
|
|
| 408 |
+ <Rule>
|
|
| 409 |
+ <Name>Not valid observation point</Name>
|
|
| 410 |
+ <ogc:Filter>
|
|
| 411 |
+ <ogc:PropertyIsEqualTo>
|
|
| 412 |
+ <ogc:PropertyName>pointType</ogc:PropertyName>
|
|
| 413 |
+ <ogc:Literal>notValidPoint</ogc:Literal>
|
|
| 414 |
+ </ogc:PropertyIsEqualTo>
|
|
| 415 |
+ </ogc:Filter>
|
|
| 416 |
+ <PointSymbolizer>
|
|
| 417 |
+ <Graphic>
|
|
| 418 |
+ <Mark>
|
|
| 419 |
+ <WellKnownName>ttf://Serif#U+0021</WellKnownName>
|
|
| 420 |
+ <Fill>
|
|
| 421 |
+ <CssParameter name="fill">#00FF00</CssParameter>
|
|
| 422 |
+ </Fill>
|
|
| 423 |
+ <Stroke>
|
|
| 424 |
+ <CssParameter name="stroke">#000000</CssParameter>
|
|
| 425 |
+ <CssParameter name="stroke-width">1</CssParameter>
|
|
| 426 |
+ </Stroke>
|
|
| 427 |
+ </Mark>
|
|
| 428 |
+ <Size>12</Size>
|
|
| 429 |
+ </Graphic>
|
|
| 430 |
+ </PointSymbolizer>
|
|
| 431 |
+ </Rule>
|
|
| 432 |
+ </FeatureTypeStyle>
|
|
| 433 |
+ |
|
| 407 | 434 |
|
| 408 | 435 |
</UserStyle>
|
| 409 | 436 |
</NamedLayer>
|
| ... | ... | @@ -596,6 +623,33 @@ |
| 596 | 623 |
</Rule>
|
| 597 | 624 |
</FeatureTypeStyle>
|
| 598 | 625 |
|
| 626 |
+ <FeatureTypeStyle>
|
|
| 627 |
+ <Rule>
|
|
| 628 |
+ <Name>Not valid logbook point</Name>
|
|
| 629 |
+ <ogc:Filter>
|
|
| 630 |
+ <ogc:PropertyIsEqualTo>
|
|
| 631 |
+ <ogc:PropertyName>pointType</ogc:PropertyName>
|
|
| 632 |
+ <ogc:Literal>notValidPoint</ogc:Literal>
|
|
| 633 |
+ </ogc:PropertyIsEqualTo>
|
|
| 634 |
+ </ogc:Filter>
|
|
| 635 |
+ <PointSymbolizer>
|
|
| 636 |
+ <Graphic>
|
|
| 637 |
+ <Mark>
|
|
| 638 |
+ <WellKnownName>ttf://Serif#U+0021</WellKnownName>
|
|
| 639 |
+ <Fill>
|
|
| 640 |
+ <CssParameter name="fill">#FF0000</CssParameter>
|
|
| 641 |
+ </Fill>
|
|
| 642 |
+ <Stroke>
|
|
| 643 |
+ <CssParameter name="stroke">#000000</CssParameter>
|
|
| 644 |
+ <CssParameter name="stroke-width">1</CssParameter>
|
|
| 645 |
+ </Stroke>
|
|
| 646 |
+ </Mark>
|
|
| 647 |
+ <Size>12</Size>
|
|
| 648 |
+ </Graphic>
|
|
| 649 |
+ </PointSymbolizer>
|
|
| 650 |
+ </Rule>
|
|
| 651 |
+ </FeatureTypeStyle>
|
|
| 652 |
+ |
|
| 599 | 653 |
</UserStyle>
|
| 600 | 654 |
</NamedLayer>
|
| 601 | 655 |
|
| ... | ... | @@ -196,6 +196,33 @@ |
| 196 | 196 |
</Rule>
|
| 197 | 197 |
</FeatureTypeStyle>
|
| 198 | 198 |
|
| 199 |
+ <FeatureTypeStyle>
|
|
| 200 |
+ <Rule>
|
|
| 201 |
+ <Name>Not valid point</Name>
|
|
| 202 |
+ <ogc:Filter>
|
|
| 203 |
+ <ogc:PropertyIsEqualTo>
|
|
| 204 |
+ <ogc:PropertyName>pointType</ogc:PropertyName>
|
|
| 205 |
+ <ogc:Literal>notValidPoint</ogc:Literal>
|
|
| 206 |
+ </ogc:PropertyIsEqualTo>
|
|
| 207 |
+ </ogc:Filter>
|
|
| 208 |
+ <PointSymbolizer>
|
|
| 209 |
+ <Graphic>
|
|
| 210 |
+ <Mark>
|
|
| 211 |
+ <WellKnownName>ttf://Serif#U+0021</WellKnownName>
|
|
| 212 |
+ <Fill>
|
|
| 213 |
+ <CssParameter name="fill">#00FF00</CssParameter>
|
|
| 214 |
+ </Fill>
|
|
| 215 |
+ <Stroke>
|
|
| 216 |
+ <CssParameter name="stroke">#000000</CssParameter>
|
|
| 217 |
+ <CssParameter name="stroke-width">1</CssParameter>
|
|
| 218 |
+ </Stroke>
|
|
| 219 |
+ </Mark>
|
|
| 220 |
+ <Size>12</Size>
|
|
| 221 |
+ </Graphic>
|
|
| 222 |
+ </PointSymbolizer>
|
|
| 223 |
+ </Rule>
|
|
| 224 |
+ </FeatureTypeStyle>
|
|
| 225 |
+ |
|
| 199 | 226 |
</UserStyle>
|
| 200 | 227 |
</NamedLayer>
|
| 201 | 228 |
|
| ... | ... | @@ -317,6 +317,8 @@ observe.data.ll.observation.WeightMeasure.table.weight.tip |
| 317 | 317 |
observe.data.ll.observation.WeightMeasure.table.weightMeasureType
|
| 318 | 318 |
observe.data.ll.observation.WeightMeasure.table.weightMeasureType.tip
|
| 319 | 319 |
observe.data.ps.common.GearUseFeatures.delete
|
| 320 |
+observe.map.logbook.points.not.valid
|
|
| 321 |
+observe.map.observation.points.not.valid
|
|
| 320 | 322 |
observe.menu.navigation.action.move.activityLongline
|
| 321 | 323 |
observe.menu.navigation.action.move.sample
|
| 322 | 324 |
observe.menu.navigation.action.move.sample.choice
|
| ... | ... | @@ -51,6 +51,7 @@ import java.util.LinkedList; |
| 51 | 51 |
import java.util.List;
|
| 52 | 52 |
import java.util.stream.Collectors;
|
| 53 | 53 |
|
| 54 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 54 | 55 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| 55 | 56 |
|
| 56 | 57 |
/**
|
| ... | ... | @@ -106,8 +107,8 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 106 | 107 |
|
| 107 | 108 |
@Override
|
| 108 | 109 |
protected void addPoints(List<TripMapPoint> tripMapPoints) throws FactoryException {
|
| 109 |
- addPoints(tripMapPoints.stream().filter(f->f.getType().isTrip() || f.getType().isObs()).collect(Collectors.toList()), TRIP_OBS_POINTS_LAYER_NAME);
|
|
| 110 |
- addPoints(tripMapPoints.stream().filter(f->f.getType().isTrip() || f.getType().isLogbook()).collect(Collectors.toList()), TRIP_LOGBOOK_POINTS_LAYER_NAME);
|
|
| 110 |
+ addPoints(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isObs()).collect(Collectors.toList()), TRIP_OBS_POINTS_LAYER_NAME, n("observe.map.observation.points.not.valid"));
|
|
| 111 |
+ addPoints(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isLogbook()).collect(Collectors.toList()), TRIP_LOGBOOK_POINTS_LAYER_NAME, n("observe.map.logbook.points.not.valid"));
|
|
| 111 | 112 |
}
|
| 112 | 113 |
|
| 113 | 114 |
private void addLonglineObsFishingZone(List<TripMapPoint> tripMapPoints) throws FactoryException {
|
| ... | ... | @@ -126,24 +127,31 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 126 | 127 |
DefaultFeatureCollection polygonsFeatures = new DefaultFeatureCollection();
|
| 127 | 128 |
|
| 128 | 129 |
for (int indexPoint = 3; indexPoint < tripMapPoints.size(); indexPoint++) {
|
| 129 |
- if (tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithHaulingEnd)
|
|
| 130 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityObsWithHaulingStart)
|
|
| 131 |
- && tripMapPoints.get(indexPoint - 2).getType().equals(TripMapPointType.llActivityObsWithSettingEnd)
|
|
| 132 |
- && tripMapPoints.get(indexPoint - 3).getType().equals(TripMapPointType.llActivityObsWithSettingStart)) {
|
|
| 130 |
+ TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
|
|
| 131 |
+ TripMapPoint tripMapPoint1 = tripMapPoints.get(indexPoint - 1);
|
|
| 132 |
+ TripMapPoint tripMapPoint2 = tripMapPoints.get(indexPoint - 2);
|
|
| 133 |
+ TripMapPoint tripMapPoint3 = tripMapPoints.get(indexPoint - 3);
|
|
| 134 |
+ if (!(tripMapPoint.isValid()&& tripMapPoint1.isValid() && tripMapPoint2.isValid() && tripMapPoint3.isValid())) {
|
|
| 135 |
+ continue;
|
|
| 136 |
+ }
|
|
| 137 |
+ if (tripMapPoint.getType().equals(TripMapPointType.llActivityObsWithHaulingEnd)
|
|
| 138 |
+ && tripMapPoint1.getType().equals(TripMapPointType.llActivityObsWithHaulingStart)
|
|
| 139 |
+ && tripMapPoint2.getType().equals(TripMapPointType.llActivityObsWithSettingEnd)
|
|
| 140 |
+ && tripMapPoint3.getType().equals(TripMapPointType.llActivityObsWithSettingStart)) {
|
|
| 133 | 141 |
|
| 134 | 142 |
Coordinate[] coordinates = {
|
| 135 |
- new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude()),
|
|
| 136 |
- new Coordinate(tripMapPoints.get(indexPoint - 2).getLongitude(), tripMapPoints.get(indexPoint - 2).getLatitude()),
|
|
| 137 |
- new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()),
|
|
| 138 |
- new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()),
|
|
| 139 |
- new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude())
|
|
| 143 |
+ new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude()),
|
|
| 144 |
+ new Coordinate(tripMapPoint2.getLongitude(), tripMapPoint2.getLatitude()),
|
|
| 145 |
+ new Coordinate(tripMapPoint1.getLongitude(), tripMapPoint1.getLatitude()),
|
|
| 146 |
+ new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
|
|
| 147 |
+ new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude())
|
|
| 140 | 148 |
};
|
| 141 | 149 |
|
| 142 | 150 |
|
| 143 | 151 |
Polygon polygon = geometryFactory.createPolygon(coordinates);
|
| 144 | 152 |
//polygon = (Polygon) polygon.convexHull(); // permet de transformer un poliqgone croisé en polygon convex
|
| 145 | 153 |
polygonBuilder.add(polygon);
|
| 146 |
- polygonBuilder.add(DATE_FORMAT.format(tripMapPoints.get(indexPoint - 3).getTime()));
|
|
| 154 |
+ polygonBuilder.add(DATE_FORMAT.format(tripMapPoint3.getTime()));
|
|
| 147 | 155 |
polygonBuilder.add("longlineFishingZone");
|
| 148 | 156 |
SimpleFeature feature = polygonBuilder.buildFeature(null);
|
| 149 | 157 |
polygonsFeatures.add(feature);
|
| ... | ... | @@ -174,24 +182,31 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 174 | 182 |
DefaultFeatureCollection polygonsFeatures = new DefaultFeatureCollection();
|
| 175 | 183 |
|
| 176 | 184 |
for (int indexPoint = 3; indexPoint < tripMapPoints.size(); indexPoint++) {
|
| 177 |
- if (tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithHaulingEnd)
|
|
| 178 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityLogbookWithHaulingStart)
|
|
| 179 |
- && tripMapPoints.get(indexPoint - 2).getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd)
|
|
| 180 |
- && tripMapPoints.get(indexPoint - 3).getType().equals(TripMapPointType.llActivityLogbookWithSettingStart)) {
|
|
| 185 |
+ TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
|
|
| 186 |
+ TripMapPoint tripMapPoint1 = tripMapPoints.get(indexPoint - 1);
|
|
| 187 |
+ TripMapPoint tripMapPoint2 = tripMapPoints.get(indexPoint - 2);
|
|
| 188 |
+ TripMapPoint tripMapPoint3 = tripMapPoints.get(indexPoint - 3);
|
|
| 189 |
+ if (!(tripMapPoint.isValid()&& tripMapPoint1.isValid() && tripMapPoint2.isValid() && tripMapPoint3.isValid())) {
|
|
| 190 |
+ continue;
|
|
| 191 |
+ }
|
|
| 192 |
+ if (tripMapPoint.getType().equals(TripMapPointType.llActivityLogbookWithHaulingEnd)
|
|
| 193 |
+ && tripMapPoint1.getType().equals(TripMapPointType.llActivityLogbookWithHaulingStart)
|
|
| 194 |
+ && tripMapPoint2.getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd)
|
|
| 195 |
+ && tripMapPoint3.getType().equals(TripMapPointType.llActivityLogbookWithSettingStart)) {
|
|
| 181 | 196 |
|
| 182 | 197 |
Coordinate[] coordinates = {
|
| 183 |
- new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude()),
|
|
| 184 |
- new Coordinate(tripMapPoints.get(indexPoint - 2).getLongitude(), tripMapPoints.get(indexPoint - 2).getLatitude()),
|
|
| 185 |
- new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()),
|
|
| 186 |
- new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()),
|
|
| 187 |
- new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude())
|
|
| 198 |
+ new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude()),
|
|
| 199 |
+ new Coordinate(tripMapPoint2.getLongitude(), tripMapPoint2.getLatitude()),
|
|
| 200 |
+ new Coordinate(tripMapPoint1.getLongitude(), tripMapPoint1.getLatitude()),
|
|
| 201 |
+ new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
|
|
| 202 |
+ new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude())
|
|
| 188 | 203 |
};
|
| 189 | 204 |
|
| 190 | 205 |
|
| 191 | 206 |
Polygon polygon = geometryFactory.createPolygon(coordinates);
|
| 192 | 207 |
//polygon = (Polygon) polygon.convexHull(); // permet de transformer un poliqgone croisé en polygon convex
|
| 193 | 208 |
polygonBuilder.add(polygon);
|
| 194 |
- polygonBuilder.add(DATE_FORMAT.format(tripMapPoints.get(indexPoint - 3).getTime()));
|
|
| 209 |
+ polygonBuilder.add(DATE_FORMAT.format(tripMapPoint3.getTime()));
|
|
| 195 | 210 |
polygonBuilder.add("longlineFishingZone");
|
| 196 | 211 |
SimpleFeature feature = polygonBuilder.buildFeature(null);
|
| 197 | 212 |
polygonsFeatures.add(feature);
|
| ... | ... | @@ -223,35 +238,44 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 223 | 238 |
List<Coordinate> defaultLineCoordinates = new LinkedList<>();
|
| 224 | 239 |
boolean found = false;
|
| 225 | 240 |
for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) {
|
| 226 |
- if (indexPoint > 1 && tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithSettingEnd)
|
|
| 227 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityObsWithSettingStart)
|
|
| 228 |
- || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithHaulingEnd)
|
|
| 229 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityObsWithHaulingStart)) {
|
|
| 230 |
- |
|
| 231 |
- found = true;
|
|
| 232 |
- Coordinate[] coordinates = {
|
|
| 233 |
- new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()),
|
|
| 234 |
- new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()),
|
|
| 235 |
- };
|
|
| 236 |
- |
|
| 237 |
- boolean setting = tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithSettingEnd);
|
|
| 238 |
- LineString lineString = geometryFactory.createLineString(coordinates);
|
|
| 239 |
- lineBuilder.add(lineString);
|
|
| 240 |
- lineBuilder.add(setting ? "setting" : "hauling");
|
|
| 241 |
- SimpleFeature feature = lineBuilder.buildFeature(null);
|
|
| 242 |
- linesFeatures.add(feature);
|
|
| 243 |
- |
|
| 244 |
- defaultLineCoordinates.clear();
|
|
| 241 |
+ TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
|
|
| 242 |
+ TripMapPointType pointType = tripMapPoint.getType();
|
|
| 243 |
+ if (tripMapPoint.isValid() && indexPoint > 1) {
|
|
| 244 |
+ |
|
| 245 |
+ TripMapPoint previousTripMapPoint = tripMapPoints.get(indexPoint - 1);
|
|
| 246 |
+ TripMapPointType previousTripMapPointType = previousTripMapPoint.getType();
|
|
| 247 |
+ if (previousTripMapPoint.isValid()) {
|
|
| 248 |
+ if (
|
|
| 249 |
+ pointType.equals(TripMapPointType.llActivityObsWithSettingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithSettingStart)
|
|
| 250 |
+ ||
|
|
| 251 |
+ pointType.equals(TripMapPointType.llActivityObsWithHaulingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithHaulingStart)) {
|
|
| 252 |
+ |
|
| 253 |
+ found = true;
|
|
| 254 |
+ Coordinate[] coordinates = {
|
|
| 255 |
+ new Coordinate(previousTripMapPoint.getLongitude(), previousTripMapPoint.getLatitude()),
|
|
| 256 |
+ new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
|
|
| 257 |
+ };
|
|
| 258 |
+ |
|
| 259 |
+ boolean setting = pointType.equals(TripMapPointType.llActivityObsWithSettingEnd);
|
|
| 260 |
+ LineString lineString = geometryFactory.createLineString(coordinates);
|
|
| 261 |
+ lineBuilder.add(lineString);
|
|
| 262 |
+ lineBuilder.add(setting ? "setting" : "hauling");
|
|
| 263 |
+ SimpleFeature feature = lineBuilder.buildFeature(null);
|
|
| 264 |
+ linesFeatures.add(feature);
|
|
| 265 |
+ |
|
| 266 |
+ defaultLineCoordinates.clear();
|
|
| 267 |
+ }
|
|
| 268 |
+ }
|
|
| 245 | 269 |
}
|
| 246 | 270 |
|
| 247 |
- if (!(tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithSettingEnd)
|
|
| 248 |
- || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithHaulingStart))) {
|
|
| 271 |
+ if (tripMapPoint.isValid() && !(pointType.equals(TripMapPointType.llActivityObsWithSettingEnd)
|
|
| 272 |
+ || pointType.equals(TripMapPointType.llActivityObsWithHaulingStart))) {
|
|
| 249 | 273 |
|
| 250 |
- defaultLineCoordinates.add(new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()));
|
|
| 274 |
+ defaultLineCoordinates.add(new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()));
|
|
| 251 | 275 |
|
| 252 | 276 |
}
|
| 253 | 277 |
|
| 254 |
- if ((tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityObsWithSettingStart)
|
|
| 278 |
+ if ((pointType.equals(TripMapPointType.llActivityObsWithSettingStart)
|
|
| 255 | 279 |
|| indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
|
| 256 | 280 |
|
| 257 | 281 |
LineString lineString = geometryFactory.createLineString(defaultLineCoordinates.toArray(new Coordinate[0]));
|
| ... | ... | @@ -315,34 +339,40 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 315 | 339 |
List<Coordinate> defaultLineCoordinates = new LinkedList<>();
|
| 316 | 340 |
boolean found = false;
|
| 317 | 341 |
for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) {
|
| 318 |
- if (indexPoint > 1 && tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd)
|
|
| 319 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityLogbookWithSettingStart)
|
|
| 320 |
- || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithHaulingEnd)
|
|
| 321 |
- && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.llActivityLogbookWithHaulingStart)) {
|
|
| 322 |
- found = true;
|
|
| 323 |
- Coordinate[] coordinates = {
|
|
| 324 |
- new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()),
|
|
| 325 |
- new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()),
|
|
| 326 |
- };
|
|
| 327 |
- |
|
| 328 |
- boolean setting = tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd);
|
|
| 329 |
- LineString lineString = geometryFactory.createLineString(coordinates);
|
|
| 330 |
- lineBuilder.add(lineString);
|
|
| 331 |
- lineBuilder.add(setting ? "setting" : "hauling");
|
|
| 332 |
- SimpleFeature feature = lineBuilder.buildFeature(null);
|
|
| 333 |
- linesFeatures.add(feature);
|
|
| 334 |
- |
|
| 335 |
- defaultLineCoordinates.clear();
|
|
| 342 |
+ TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
|
|
| 343 |
+ TripMapPointType tripMapPointType = tripMapPoint.getType();
|
|
| 344 |
+ if (tripMapPoint.isValid() && indexPoint > 1) {
|
|
| 345 |
+ TripMapPoint previousTripMapPoint = tripMapPoints.get(indexPoint - 1);
|
|
| 346 |
+ if (previousTripMapPoint.isValid()) {
|
|
| 347 |
+ TripMapPointType previousTripMapPointType = previousTripMapPoint.getType();
|
|
| 348 |
+ if (tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd)
|
|
| 349 |
+ && previousTripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingStart)
|
|
| 350 |
+ || tripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingEnd)
|
|
| 351 |
+ && previousTripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingStart)) {
|
|
| 352 |
+ found = true;
|
|
| 353 |
+ Coordinate[] coordinates = {
|
|
| 354 |
+ new Coordinate(previousTripMapPoint.getLongitude(), previousTripMapPoint.getLatitude()),
|
|
| 355 |
+ new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
|
|
| 356 |
+ };
|
|
| 357 |
+ |
|
| 358 |
+ boolean setting = tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd);
|
|
| 359 |
+ LineString lineString = geometryFactory.createLineString(coordinates);
|
|
| 360 |
+ lineBuilder.add(lineString);
|
|
| 361 |
+ lineBuilder.add(setting ? "setting" : "hauling");
|
|
| 362 |
+ SimpleFeature feature = lineBuilder.buildFeature(null);
|
|
| 363 |
+ linesFeatures.add(feature);
|
|
| 364 |
+ |
|
| 365 |
+ defaultLineCoordinates.clear();
|
|
| 366 |
+ }
|
|
| 367 |
+ }
|
|
| 336 | 368 |
}
|
| 337 |
- |
|
| 338 |
- if (!(tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd)
|
|
| 339 |
- || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithHaulingStart))) {
|
|
| 340 |
- |
|
| 341 |
- defaultLineCoordinates.add(new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()));
|
|
| 369 |
+ if (tripMapPoint.isValid() &&
|
|
| 370 |
+ !(tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd) || tripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingStart))) {
|
|
| 371 |
+ defaultLineCoordinates.add(new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()));
|
|
| 342 | 372 |
|
| 343 | 373 |
}
|
| 344 | 374 |
|
| 345 |
- if ((tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.llActivityLogbookWithSettingStart)
|
|
| 375 |
+ if ((tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingStart)
|
|
| 346 | 376 |
|| indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
|
| 347 | 377 |
|
| 348 | 378 |
LineString lineString = geometryFactory.createLineString(defaultLineCoordinates.toArray(new Coordinate[0]));
|
| ... | ... | @@ -171,6 +171,7 @@ observe.data.ps.observation.TargetLength.table.species |
| 171 | 171 |
observe.data.ps.observation.TargetLength.table.species.tip
|
| 172 | 172 |
observe.data.ps.observation.TargetLength.table.totalWeight
|
| 173 | 173 |
observe.data.ps.observation.TargetLength.table.totalWeight.tip
|
| 174 |
+observe.map.observation.points.not.valid
|
|
| 174 | 175 |
observe.menu.navigation.action.move.activity
|
| 175 | 176 |
observe.menu.navigation.action.move.route
|
| 176 | 177 |
observe.menu.navigation.action.move.trip
|
| ... | ... | @@ -51,6 +51,7 @@ import java.text.DateFormat; |
| 51 | 51 |
import java.util.LinkedList;
|
| 52 | 52 |
import java.util.List;
|
| 53 | 53 |
|
| 54 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 54 | 55 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| 55 | 56 |
|
| 56 | 57 |
/**
|
| ... | ... | @@ -85,8 +86,7 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit |
| 85 | 86 |
|
| 86 | 87 |
@Override
|
| 87 | 88 |
protected void addPoints(List<TripMapPoint> tripMapPoints) throws FactoryException {
|
| 88 |
- addPoints(tripMapPoints, TRIP_OBS_POINTS_LAYER_NAME);
|
|
| 89 |
-// addPoints(tripMapPoints, TRIP_LOGBOOK_POINTS_LAYER_NAME);
|
|
| 89 |
+ addPoints(tripMapPoints, TRIP_OBS_POINTS_LAYER_NAME, n("observe.map.observation.points.not.valid"));
|
|
| 90 | 90 |
}
|
| 91 | 91 |
|
| 92 | 92 |
@Override
|
| ... | ... | @@ -22,29 +22,33 @@ package fr.ird.observe.dto.data; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import java.io.Serializable;
|
|
| 26 |
-import java.util.Date;
|
|
| 27 |
- |
|
| 28 |
-public class TripMapPoint implements Serializable {
|
|
| 29 |
- |
|
| 30 |
- public static final String PROPERTY_TIME = "time";
|
|
| 31 |
- |
|
| 32 |
- public static final String PROPERTY_LATITUDE = "latitude";
|
|
| 25 |
+import fr.ird.observe.dto.ObserveDto;
|
|
| 33 | 26 |
|
| 34 |
- public static final String PROPERTY_LONGITUDE = "longitude";
|
|
| 35 |
- |
|
| 36 |
- public static final String PROPERTY_TYPE = "type";
|
|
| 37 |
- |
|
| 38 |
- private static final long serialVersionUID = 1L;
|
|
| 27 |
+import java.util.Date;
|
|
| 28 |
+import java.util.Objects;
|
|
| 29 |
+ |
|
| 30 |
+public class TripMapPoint implements ObserveDto {
|
|
| 31 |
+ |
|
| 32 |
+ public static TripMapPoint of(TripMapPointType type, Date time, Float latitude, Float longitude) {
|
|
| 33 |
+ TripMapPoint result = new TripMapPoint();
|
|
| 34 |
+ result.setType(Objects.requireNonNull(type));
|
|
| 35 |
+ result.setTime(time);
|
|
| 36 |
+ result.setLatitude(latitude);
|
|
| 37 |
+ result.setLongitude(longitude);
|
|
| 38 |
+ result.setValid(time != null && latitude != null && longitude != null);
|
|
| 39 |
+ return result;
|
|
| 40 |
+ }
|
|
| 39 | 41 |
|
| 40 | 42 |
protected Date time;
|
| 41 | 43 |
|
| 42 |
- protected float latitude;
|
|
| 44 |
+ protected Float latitude;
|
|
| 43 | 45 |
|
| 44 |
- protected float longitude;
|
|
| 46 |
+ protected Float longitude;
|
|
| 45 | 47 |
|
| 46 | 48 |
protected TripMapPointType type;
|
| 47 | 49 |
|
| 50 |
+ protected boolean valid;
|
|
| 51 |
+ |
|
| 48 | 52 |
public Date getTime() {
|
| 49 | 53 |
return time;
|
| 50 | 54 |
}
|
| ... | ... | @@ -53,19 +57,19 @@ public class TripMapPoint implements Serializable { |
| 53 | 57 |
this.time = time;
|
| 54 | 58 |
}
|
| 55 | 59 |
|
| 56 |
- public float getLatitude() {
|
|
| 60 |
+ public Float getLatitude() {
|
|
| 57 | 61 |
return latitude;
|
| 58 | 62 |
}
|
| 59 | 63 |
|
| 60 |
- public void setLatitude(float latitude) {
|
|
| 64 |
+ public void setLatitude(Float latitude) {
|
|
| 61 | 65 |
this.latitude = latitude;
|
| 62 | 66 |
}
|
| 63 | 67 |
|
| 64 |
- public float getLongitude() {
|
|
| 68 |
+ public Float getLongitude() {
|
|
| 65 | 69 |
return longitude;
|
| 66 | 70 |
}
|
| 67 | 71 |
|
| 68 |
- public void setLongitude(float longitude) {
|
|
| 72 |
+ public void setLongitude(Float longitude) {
|
|
| 69 | 73 |
this.longitude = longitude;
|
| 70 | 74 |
}
|
| 71 | 75 |
|
| ... | ... | @@ -76,4 +80,12 @@ public class TripMapPoint implements Serializable { |
| 76 | 80 |
public void setType(TripMapPointType type) {
|
| 77 | 81 |
this.type = type;
|
| 78 | 82 |
}
|
| 83 |
+ |
|
| 84 |
+ public boolean isValid() {
|
|
| 85 |
+ return valid;
|
|
| 86 |
+ }
|
|
| 87 |
+ |
|
| 88 |
+ public void setValid(boolean valid) {
|
|
| 89 |
+ this.valid = valid;
|
|
| 90 |
+ }
|
|
| 79 | 91 |
}
|
| ... | ... | @@ -28,6 +28,8 @@ import fr.ird.observe.dto.referential.ReferentialDto; |
| 28 | 28 |
import fr.ird.observe.dto.referential.ll.common.HealthStatusDto;
|
| 29 | 29 |
import fr.ird.observe.dto.referential.ll.observation.StomachFullnessDto;
|
| 30 | 30 |
|
| 31 |
+import java.util.function.Predicate;
|
|
| 32 |
+ |
|
| 31 | 33 |
/**
|
| 32 | 34 |
* Created by tchemit on 03/09/17.
|
| 33 | 35 |
*
|
| ... | ... | @@ -35,6 +37,9 @@ import fr.ird.observe.dto.referential.ll.observation.StomachFullnessDto; |
| 35 | 37 |
*/
|
| 36 | 38 |
public class DtoModelClasses {
|
| 37 | 39 |
|
| 40 |
+ public static final Predicate<String> IS_SEINE_ID = DtoModelClasses::isSeineId;
|
|
| 41 |
+ public static final Predicate<String> IS_LONGLINE_ID = DtoModelClasses::isLonglineId;
|
|
| 42 |
+ |
|
| 38 | 43 |
public static final ImmutableSet<Class<? extends ReferentialDto>> COMMON_REFERENTIAL_TYPES = ImmutableSet.of(
|
| 39 | 44 |
fr.ird.observe.dto.referential.common.VesselSizeCategoryDto.class,
|
| 40 | 45 |
fr.ird.observe.dto.referential.common.CountryDto.class,
|
| ... | ... | @@ -87,7 +92,7 @@ public class DtoModelClasses { |
| 87 | 92 |
fr.ird.observe.dto.referential.ps.observation.ReasonForDiscardDto.class,
|
| 88 | 93 |
fr.ird.observe.dto.referential.ps.observation.SpeciesStatusDto.class,
|
| 89 | 94 |
fr.ird.observe.dto.referential.ps.observation.ObservedSystemDto.class
|
| 90 |
- );
|
|
| 95 |
+ );
|
|
| 91 | 96 |
|
| 92 | 97 |
public static final ImmutableSet<Class<? extends ReferentialDto>> SEINE_REFERENTIAL_TYPES = ImmutableSet.<Class<? extends ReferentialDto>>builder()
|
| 93 | 98 |
.addAll(SEINE_COMMON_REFERENTIAL_TYPES)
|
| ... | ... | @@ -141,7 +146,6 @@ public class DtoModelClasses { |
| 141 | 146 |
.addAll(SEINE_REFERENTIAL_TYPES)
|
| 142 | 147 |
.addAll(LONGLINE_REFERENTIAL_TYPES)
|
| 143 | 148 |
.build();
|
| 144 |
- |
|
| 145 | 149 |
private static final ImmutableSet<Class<? extends DataDto>> SEINE_ENTITY_DATA_TYPES = ImmutableSet.of(
|
| 146 | 150 |
fr.ird.observe.dto.data.ps.observation.ActivityDto.class,
|
| 147 | 151 |
fr.ird.observe.dto.data.ps.observation.FloatingObjectDto.class,
|
| ... | ... | @@ -2324,6 +2324,8 @@ observe.init.local.db.error=Could not find local database, will load last backup |
| 2324 | 2324 |
observe.init.no.initial.dump.detected=Internal data source %1$s not detected.
|
| 2325 | 2325 |
observe.init.no.local.db.detected=Local data source %1$s not detected.
|
| 2326 | 2326 |
observe.init.storage.done=Init of Persistent Service done.
|
| 2327 |
+observe.map.logbook.points.not.valid=LogBook - Number of none displayed points\: %d
|
|
| 2328 |
+observe.map.observation.points.not.valid=Observation - Number of none displayed points\: %d
|
|
| 2327 | 2329 |
observe.menu.actions=Actions
|
| 2328 | 2330 |
observe.menu.configuration=Configuration
|
| 2329 | 2331 |
observe.menu.configuration.tip=To configure application
|
| ... | ... | @@ -2324,6 +2324,8 @@ observe.init.local.db.error=Imposible cargar la base local, se cargará el últi |
| 2324 | 2324 |
observe.init.no.initial.dump.detected=fuente de datos interna %1$s no detectada.
|
| 2325 | 2325 |
observe.init.no.local.db.detected=Base local %1$s no detectada.
|
| 2326 | 2326 |
observe.init.storage.done=Inicialización del servicio de persistencia terminado.
|
| 2327 |
+observe.map.logbook.points.not.valid=LogBook - Number of none displayed points\: %d \#TODO
|
|
| 2328 |
+observe.map.observation.points.not.valid=Observation - Number of none displayed points\: %d \#TODO
|
|
| 2327 | 2329 |
observe.menu.actions=Acciones
|
| 2328 | 2330 |
observe.menu.configuration=Configuración
|
| 2329 | 2331 |
observe.menu.configuration.tip=Menú de configuración
|
| ... | ... | @@ -2324,6 +2324,8 @@ observe.init.local.db.error=Impossible de charger la base locale, la dernière s |
| 2324 | 2324 |
observe.init.no.initial.dump.detected=Base embarquée %1$s non détectée.
|
| 2325 | 2325 |
observe.init.no.local.db.detected=Base locale %1$s non détectée.
|
| 2326 | 2326 |
observe.init.storage.done=Initialisation du service de persistance terminé.
|
| 2327 |
+observe.map.logbook.points.not.valid=Libre de bord - Nombre de points non affichés \: %d
|
|
| 2328 |
+observe.map.observation.points.not.valid=Observation - Nombre de points non affichés \: %d
|
|
| 2327 | 2329 |
observe.menu.actions=Actions
|
| 2328 | 2330 |
observe.menu.configuration=Configuration
|
| 2329 | 2331 |
observe.menu.configuration.tip=Menu de configuration
|
| ... | ... | @@ -22,10 +22,17 @@ package fr.ird.observe.entities; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.data.TripMapPoint;
|
|
| 26 |
+import fr.ird.observe.dto.data.TripMapPointType;
|
|
| 27 |
+import fr.ird.observe.entities.referential.common.Harbour;
|
|
| 28 |
+ |
|
| 29 |
+import java.sql.ResultSet;
|
|
| 30 |
+import java.sql.SQLException;
|
|
| 25 | 31 |
import java.util.Arrays;
|
| 26 | 32 |
import java.util.Collections;
|
| 33 |
+import java.util.Date;
|
|
| 27 | 34 |
import java.util.List;
|
| 28 |
-import java.util.function.Predicate;
|
|
| 35 |
+import java.util.Optional;
|
|
| 29 | 36 |
|
| 30 | 37 |
/**
|
| 31 | 38 |
* Created on 8/27/14.
|
| ... | ... | @@ -122,15 +129,28 @@ public class Entities { |
| 122 | 129 |
};
|
| 123 | 130 |
public static final List<ObserveEntityEnum> REFERENCE_ENTITIES_LIST =
|
| 124 | 131 |
Collections.unmodifiableList(Arrays.asList(REFERENCE_ENTITIES));
|
| 125 |
- public static final Predicate<String> IS_SEINE_ID = Entities::isSeineId;
|
|
| 126 |
- public static final Predicate<String> IS_LONGLINE_ID = Entities::isLonglineId;
|
|
| 127 | 132 |
|
| 128 |
- public static boolean isSeineId(String id) {
|
|
| 129 |
- return id.contains(".ps.");
|
|
| 133 |
+ public static Float getFloat(ResultSet resultSet, int columnIndex) throws SQLException {
|
|
| 134 |
+ float result = resultSet.getFloat(columnIndex);
|
|
| 135 |
+ return resultSet.wasNull() ? null : result;
|
|
| 136 |
+ }
|
|
| 137 |
+ |
|
| 138 |
+ public static Optional<TripMapPoint> createHarbourPoint(Harbour harbour, Date date, TripMapPointType tripMapPointType) {
|
|
| 139 |
+ TripMapPoint result = null;
|
|
| 140 |
+ if (harbour != null) {
|
|
| 141 |
+ result = TripMapPoint.of(tripMapPointType, date, harbour.getLatitude(), harbour.getLongitude());
|
|
| 142 |
+ }
|
|
| 143 |
+ return Optional.ofNullable(result);
|
|
| 130 | 144 |
}
|
| 131 | 145 |
|
| 132 |
- public static boolean isLonglineId(String id) {
|
|
| 133 |
- return id.contains(".ll.");
|
|
| 146 |
+ public static TripMapPoint createPoint(TripMapPointType type, Date dateTime, ResultSet resultSet, int columnIndex) throws SQLException {
|
|
| 147 |
+ Float latitude = getFloat(resultSet, columnIndex);
|
|
| 148 |
+ Float longitude = getFloat(resultSet, columnIndex + 1);
|
|
| 149 |
+ return TripMapPoint.of(type, dateTime, latitude, longitude);
|
|
| 134 | 150 |
}
|
| 135 | 151 |
|
| 152 |
+ public static TripMapPoint createPoint(TripMapPointType type, ResultSet resultSet, int dateColumnIndex) throws SQLException {
|
|
| 153 |
+ java.sql.Date date = resultSet.getDate(dateColumnIndex);
|
|
| 154 |
+ return createPoint(type, date, resultSet, dateColumnIndex + 1);
|
|
| 155 |
+ }
|
|
| 136 | 156 |
}
|
| ... | ... | @@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableMap; |
| 26 | 26 |
import fr.ird.observe.dto.data.TripMapConfigDto;
|
| 27 | 27 |
import fr.ird.observe.dto.data.TripMapPoint;
|
| 28 | 28 |
import fr.ird.observe.dto.data.TripMapPointType;
|
| 29 |
-import fr.ird.observe.entities.referential.common.Harbour;
|
|
| 29 |
+import fr.ird.observe.entities.Entities;
|
|
| 30 | 30 |
import org.nuiton.topia.persistence.support.TopiaSqlQuery;
|
| 31 | 31 |
import org.nuiton.topia.persistence.support.TopiaSqlSupport;
|
| 32 | 32 |
import org.nuiton.util.DateUtil;
|
| ... | ... | @@ -42,7 +42,6 @@ import java.util.LinkedHashSet; |
| 42 | 42 |
import java.util.LinkedList;
|
| 43 | 43 |
import java.util.List;
|
| 44 | 44 |
import java.util.Objects;
|
| 45 |
-import java.util.Optional;
|
|
| 46 | 45 |
import java.util.stream.Collectors;
|
| 47 | 46 |
|
| 48 | 47 |
public class TripTopiaDao extends AbstractTripTopiaDao<Trip> {
|
| ... | ... | @@ -57,7 +56,7 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 57 | 56 |
LinkedHashSet<TripMapPoint> tripMapPoints = new LinkedHashSet<>();
|
| 58 | 57 |
|
| 59 | 58 |
// add departure harbour
|
| 60 |
- createPoint(trip.getDepartureHarbour(), trip.getStartDate(), TripMapPointType.llTripDepartureHarbour).map(tripMapPoints::add);
|
|
| 59 |
+ Entities.createHarbourPoint(trip.getDepartureHarbour(), trip.getStartDate(), TripMapPointType.llTripDepartureHarbour).map(tripMapPoints::add);
|
|
| 61 | 60 |
|
| 62 | 61 |
if (addObservation) {
|
| 63 | 62 |
// Add Activities Observation
|
| ... | ... | @@ -73,7 +72,7 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 73 | 72 |
}
|
| 74 | 73 |
|
| 75 | 74 |
// add landing harbour
|
| 76 |
- createPoint(trip.getLandingHarbour(), trip.getEndDate(), TripMapPointType.llTripLandingHarbour).map(tripMapPoints::add);
|
|
| 75 |
+ Entities.createHarbourPoint(trip.getLandingHarbour(), trip.getEndDate(), TripMapPointType.llTripLandingHarbour).map(tripMapPoints::add);
|
|
| 77 | 76 |
return tripMapPoints;
|
| 78 | 77 |
}
|
| 79 | 78 |
|
| ... | ... | @@ -128,10 +127,10 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 128 | 127 |
return Collections.emptyList();
|
| 129 | 128 |
}
|
| 130 | 129 |
return this.
|
| 131 |
- <Trip>stream("From TripImpl Where vessel.id = :vesselId " +
|
|
| 132 |
- "And (( :startDate <= endDate And :endDate >= endDate ) " +
|
|
| 133 |
- " Or ( :endDate <= startDate And :endDate >= startDate )) " +
|
|
| 134 |
- "Order By startDate, endDate", ImmutableMap.of(
|
|
| 130 |
+ <Trip>stream("From fr.ird.observe.entities.data.ll.common.TripImpl Where vessel.id = :vesselId " +
|
|
| 131 |
+ "And (( :startDate <= endDate And :endDate >= endDate ) " +
|
|
| 132 |
+ " Or ( :endDate <= startDate And :endDate >= startDate )) " +
|
|
| 133 |
+ "Order By startDate, endDate", ImmutableMap.of(
|
|
| 135 | 134 |
"vesselId", vesselId,
|
| 136 | 135 |
"startDate", startDate,
|
| 137 | 136 |
"endDate", endDate))
|
| ... | ... | @@ -146,6 +145,7 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 146 | 145 |
" a.latitude," +
|
| 147 | 146 |
" a.longitude," +
|
| 148 | 147 |
" a.vesselActivity," +
|
| 148 |
+ " s.topiaId," +
|
|
| 149 | 149 |
" s.settingStartTimestamp," +
|
| 150 | 150 |
" s.settingStartLatitude," +
|
| 151 | 151 |
" s.settingStartLongitude," +
|
| ... | ... | @@ -184,26 +184,32 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 184 | 184 |
|
| 185 | 185 |
if (resultSet.getString(5) == null) {
|
| 186 | 186 |
// simple activity
|
| 187 |
- Optional<TripMapPoint> activity = createPoint(resultSet, 1, TripMapPointType.llActivityObs);
|
|
| 188 |
- activity.ifPresent(result::add);
|
|
| 187 |
+ TripMapPoint activity = Entities.createPoint(TripMapPointType.llActivityObs, resultSet, 1);
|
|
| 188 |
+ result.add(activity);
|
|
| 189 | 189 |
}
|
| 190 | 190 |
|
| 191 | 191 |
// settingStart
|
| 192 |
- Optional<TripMapPoint> settingStart = createPoint(resultSet, 5, TripMapPointType.llActivityObsWithSettingStart);
|
|
| 193 |
- settingStart.ifPresent(result::add);
|
|
| 192 |
+ TripMapPoint settingStart = Entities.createPoint(TripMapPointType.llActivityObsWithSettingStart, resultSet, 6);
|
|
| 193 |
+ result.add(settingStart);
|
|
| 194 | 194 |
|
| 195 | 195 |
// settingEnd
|
| 196 |
- Optional<TripMapPoint> settingEnd = createPoint(resultSet, 8, TripMapPointType.llActivityObsWithSettingEnd);
|
|
| 197 |
- settingEnd.ifPresent(result::add);
|
|
| 196 |
+ TripMapPoint settingEnd = Entities.createPoint(TripMapPointType.llActivityObsWithSettingEnd, resultSet, 9);
|
|
| 197 |
+ result.add(settingEnd);
|
|
| 198 | 198 |
|
| 199 | 199 |
// haulingStart
|
| 200 |
- Optional<TripMapPoint> haulingStart = createPoint(resultSet, 11, TripMapPointType.llActivityObsWithHaulingStart);
|
|
| 201 |
- haulingStart.ifPresent(result::add);
|
|
| 200 |
+ TripMapPoint haulingStart = Entities.createPoint(TripMapPointType.llActivityObsWithHaulingStart, resultSet, 12);
|
|
| 201 |
+ result.add(haulingStart);
|
|
| 202 | 202 |
|
| 203 | 203 |
// haulingEnd
|
| 204 |
- Optional<TripMapPoint> haulingEnd = createPoint(resultSet, 14, TripMapPointType.llActivityObsWithHaulingEnd);
|
|
| 205 |
- haulingEnd.ifPresent(result::add);
|
|
| 206 |
- |
|
| 204 |
+ TripMapPoint haulingEnd = Entities.createPoint(TripMapPointType.llActivityObsWithHaulingEnd, resultSet, 15);
|
|
| 205 |
+ result.add(haulingEnd);
|
|
| 206 |
+ |
|
| 207 |
+ if (!(settingStart.isValid() && settingEnd.isValid() && haulingStart.isValid() && haulingEnd.isValid())) {
|
|
| 208 |
+ settingStart.setValid(false);
|
|
| 209 |
+ settingEnd.setValid(false);
|
|
| 210 |
+ haulingStart.setValid(false);
|
|
| 211 |
+ haulingEnd.setValid(false);
|
|
| 212 |
+ }
|
|
| 207 | 213 |
return result;
|
| 208 | 214 |
}
|
| 209 | 215 |
}
|
| ... | ... | @@ -215,6 +221,7 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 215 | 221 |
" a.latitude," +
|
| 216 | 222 |
" a.longitude," +
|
| 217 | 223 |
" a.vesselActivity," +
|
| 224 |
+ " s.topiaId," +
|
|
| 218 | 225 |
" s.settingStartTimestamp," +
|
| 219 | 226 |
" s.settingStartLatitude," +
|
| 220 | 227 |
" s.settingStartLongitude," +
|
| ... | ... | @@ -253,25 +260,32 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 253 | 260 |
|
| 254 | 261 |
if (resultSet.getString(5) == null) {
|
| 255 | 262 |
// simple activity
|
| 256 |
- Optional<TripMapPoint> activity = createPoint(resultSet, 1, TripMapPointType.llActivityLogbook);
|
|
| 257 |
- activity.ifPresent(result::add);
|
|
| 263 |
+ TripMapPoint activity = Entities.createPoint(TripMapPointType.llActivityLogbook, resultSet, 1);
|
|
| 264 |
+ result.add(activity);
|
|
| 258 | 265 |
}
|
| 259 | 266 |
|
| 260 | 267 |
// settingStart
|
| 261 |
- Optional<TripMapPoint> settingStart = createPoint(resultSet, 5, TripMapPointType.llActivityLogbookWithSettingStart);
|
|
| 262 |
- settingStart.ifPresent(result::add);
|
|
| 268 |
+ TripMapPoint settingStart = Entities.createPoint(TripMapPointType.llActivityLogbookWithSettingStart, resultSet, 6);
|
|
| 269 |
+ result.add(settingStart);
|
|
| 263 | 270 |
|
| 264 | 271 |
// settingEnd
|
| 265 |
- Optional<TripMapPoint> settingEnd = createPoint(resultSet, 8, TripMapPointType.llActivityLogbookWithSettingEnd);
|
|
| 266 |
- settingEnd.ifPresent(result::add);
|
|
| 272 |
+ TripMapPoint settingEnd = Entities.createPoint(TripMapPointType.llActivityLogbookWithSettingEnd, resultSet, 9);
|
|
| 273 |
+ result.add(settingEnd);
|
|
| 267 | 274 |
|
| 268 | 275 |
// haulingStart
|
| 269 |
- Optional<TripMapPoint> haulingStart = createPoint(resultSet, 11, TripMapPointType.llActivityLogbookWithHaulingStart);
|
|
| 270 |
- haulingStart.ifPresent(result::add);
|
|
| 276 |
+ TripMapPoint haulingStart = Entities.createPoint(TripMapPointType.llActivityLogbookWithHaulingStart, resultSet, 12);
|
|
| 277 |
+ result.add(haulingStart);
|
|
| 271 | 278 |
|
| 272 | 279 |
// haulingEnd
|
| 273 |
- Optional<TripMapPoint> haulingEnd = createPoint(resultSet, 14, TripMapPointType.llActivityLogbookWithHaulingEnd);
|
|
| 274 |
- haulingEnd.ifPresent(result::add);
|
|
| 280 |
+ TripMapPoint haulingEnd = Entities.createPoint(TripMapPointType.llActivityLogbookWithHaulingEnd, resultSet, 15);
|
|
| 281 |
+ result.add(haulingEnd);
|
|
| 282 |
+ |
|
| 283 |
+ if (!(settingStart.isValid() && settingEnd.isValid() && haulingStart.isValid() && haulingEnd.isValid())) {
|
|
| 284 |
+ settingStart.setValid(false);
|
|
| 285 |
+ settingEnd.setValid(false);
|
|
| 286 |
+ haulingStart.setValid(false);
|
|
| 287 |
+ haulingEnd.setValid(false);
|
|
| 288 |
+ }
|
|
| 275 | 289 |
|
| 276 | 290 |
return result;
|
| 277 | 291 |
}
|
| ... | ... | @@ -315,29 +329,4 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 315 | 329 |
|
| 316 | 330 |
}
|
| 317 | 331 |
|
| 318 |
- private static Optional<TripMapPoint> createPoint(Harbour harbour, Date date, TripMapPointType tripMapPointType) {
|
|
| 319 |
- TripMapPoint result = null;
|
|
| 320 |
- if (harbour != null && harbour.getLatitude() != null && harbour.getLongitude() != null) {
|
|
| 321 |
- result = new TripMapPoint();
|
|
| 322 |
- result.setTime(date);
|
|
| 323 |
- result.setLatitude(harbour.getLatitude());
|
|
| 324 |
- result.setLongitude(harbour.getLongitude());
|
|
| 325 |
- result.setType(tripMapPointType);
|
|
| 326 |
- }
|
|
| 327 |
- return Optional.ofNullable(result);
|
|
| 328 |
- }
|
|
| 329 |
- |
|
| 330 |
- private static Optional<TripMapPoint> createPoint(ResultSet resultSet, int dateColumnIndex, TripMapPointType tripMapPointType) throws SQLException {
|
|
| 331 |
- |
|
| 332 |
- TripMapPoint result = null;
|
|
| 333 |
- if (resultSet.getString(dateColumnIndex) != null) {
|
|
| 334 |
- result = new TripMapPoint();
|
|
| 335 |
- result.setTime(resultSet.getDate(dateColumnIndex));
|
|
| 336 |
- result.setLatitude(resultSet.getFloat(dateColumnIndex + 1));
|
|
| 337 |
- result.setLongitude(resultSet.getFloat(dateColumnIndex + 2));
|
|
| 338 |
- result.setType(tripMapPointType);
|
|
| 339 |
- }
|
|
| 340 |
- return Optional.ofNullable(result);
|
|
| 341 |
- }
|
|
| 342 |
- |
|
| 343 | 332 |
}
|
| ... | ... | @@ -26,7 +26,7 @@ import fr.ird.observe.dto.ProtectedIds; |
| 26 | 26 |
import fr.ird.observe.dto.data.TripMapConfigDto;
|
| 27 | 27 |
import fr.ird.observe.dto.data.TripMapPoint;
|
| 28 | 28 |
import fr.ird.observe.dto.data.TripMapPointType;
|
| 29 |
-import fr.ird.observe.entities.referential.common.Harbour;
|
|
| 29 |
+import fr.ird.observe.entities.Entities;
|
|
| 30 | 30 |
import org.nuiton.topia.persistence.support.TopiaSqlQuery;
|
| 31 | 31 |
import org.nuiton.topia.persistence.support.TopiaSqlSupport;
|
| 32 | 32 |
import org.nuiton.util.DateUtil;
|
| ... | ... | @@ -40,7 +40,6 @@ import java.util.Date; |
| 40 | 40 |
import java.util.LinkedHashSet;
|
| 41 | 41 |
import java.util.List;
|
| 42 | 42 |
import java.util.Objects;
|
| 43 |
-import java.util.Optional;
|
|
| 44 | 43 |
import java.util.stream.Collectors;
|
| 45 | 44 |
|
| 46 | 45 |
/**
|
| ... | ... | @@ -58,14 +57,14 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 58 | 57 |
LinkedHashSet<TripMapPoint> tripMapPoints = new LinkedHashSet<>();
|
| 59 | 58 |
|
| 60 | 59 |
// add departure harbour
|
| 61 |
- createPoint(trip.getDepartureHarbour(), trip.getStartDate(), TripMapPointType.psTripDepartureHarbour).map(tripMapPoints::add);
|
|
| 60 |
+ Entities.createHarbourPoint(trip.getDepartureHarbour(), trip.getStartDate(), TripMapPointType.psTripDepartureHarbour).map(tripMapPoints::add);
|
|
| 62 | 61 |
|
| 63 | 62 |
// Add Activities
|
| 64 | 63 |
TripMapActivityPointQuery tripMapActivityPointQuery = new TripMapActivityPointQuery(tripId);
|
| 65 | 64 |
tripMapPoints.addAll(topiaSqlSupport.findMultipleResult(tripMapActivityPointQuery));
|
| 66 | 65 |
|
| 67 | 66 |
// add landing harbour
|
| 68 |
- createPoint(trip.getLandingHarbour(), trip.getEndDate(), TripMapPointType.psTripLandingHarbour).map(tripMapPoints::add);
|
|
| 67 |
+ Entities.createHarbourPoint(trip.getLandingHarbour(), trip.getEndDate(), TripMapPointType.psTripLandingHarbour).map(tripMapPoints::add);
|
|
| 69 | 68 |
|
| 70 | 69 |
return tripMapPoints;
|
| 71 | 70 |
}
|
| ... | ... | @@ -75,7 +74,7 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 75 | 74 |
return Collections.emptyList();
|
| 76 | 75 |
}
|
| 77 | 76 |
return this.
|
| 78 |
- <Trip>stream("From TripImpl Where vessel.id = :vesselId " +
|
|
| 77 |
+ <Trip>stream("From fr.ird.observe.entities.data.ps.common.TripImpl Where vessel.id = :vesselId " +
|
|
| 79 | 78 |
"And (( :startDate <= endDate And :endDate >= endDate ) " +
|
| 80 | 79 |
" Or ( :endDate <= startDate And :endDate >= startDate )) " +
|
| 81 | 80 |
"Order By startDate, endDate", ImmutableMap.of(
|
| ... | ... | @@ -119,32 +118,32 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 119 | 118 |
@Override
|
| 120 | 119 |
public TripMapPoint prepareResult(ResultSet resultSet) throws SQLException {
|
| 121 | 120 |
|
| 122 |
- TripMapPoint point = new TripMapPoint();
|
|
| 123 |
- Date time = DateUtil.getDateAndTime(resultSet.getDate(1), resultSet.getTime(2), true, false);
|
|
| 124 |
- point.setTime(time);
|
|
| 125 |
- point.setLatitude(resultSet.getFloat(3));
|
|
| 126 |
- point.setLongitude(resultSet.getFloat(4));
|
|
| 121 |
+ TripMapPointType type;
|
|
| 122 |
+ |
|
| 127 | 123 |
if (ProtectedIds.PS_COMMON_ACTIVITY_HARBOUR_ID.equals(resultSet.getString(5))) {
|
| 128 |
- point.setType(TripMapPointType.psActivityObsInHarbour);
|
|
| 124 |
+ type = TripMapPointType.psActivityObsInHarbour;
|
|
| 129 | 125 |
} else if (resultSet.getString(6) == null) {
|
| 130 |
- point.setType(TripMapPointType.psActivityObs);
|
|
| 126 |
+ type = TripMapPointType.psActivityObs;
|
|
| 131 | 127 |
} else {
|
| 132 | 128 |
String schoolType = resultSet.getString(6);
|
| 133 | 129 |
switch (schoolType) {
|
| 134 | 130 |
case ProtectedIds.PS_COMMON_SCHOOL_TYPE_FREE_ID:
|
| 135 |
- point.setType(TripMapPointType.psActivityObsWithFreeSchoolType);
|
|
| 131 |
+ type = TripMapPointType.psActivityObsWithFreeSchoolType;
|
|
| 136 | 132 |
break;
|
| 137 | 133 |
case ProtectedIds.PS_COMMON_SCHOOL_TYPE_OBJECT_ID:
|
| 138 |
- point.setType(TripMapPointType.psActivityObsWithObjectSchoolType);
|
|
| 134 |
+ type = TripMapPointType.psActivityObsWithObjectSchoolType;
|
|
| 139 | 135 |
break;
|
| 140 | 136 |
default:
|
| 141 |
- point.setType(TripMapPointType.psActivityObs);
|
|
| 137 |
+ type = TripMapPointType.psActivityObs;
|
|
| 142 | 138 |
}
|
| 143 | 139 |
}
|
| 144 |
- return point;
|
|
| 140 |
+ |
|
| 141 |
+ Date time = DateUtil.getDateAndTime(resultSet.getDate(1), resultSet.getTime(2), true, false);
|
|
| 142 |
+ return Entities.createPoint(type, time, resultSet, 3);
|
|
| 145 | 143 |
}
|
| 146 | 144 |
|
| 147 | 145 |
}
|
| 146 |
+ |
|
| 148 | 147 |
public boolean updateEndDate(Trip trip) {
|
| 149 | 148 |
|
| 150 | 149 |
boolean wasUpdated = false;
|
| ... | ... | @@ -230,16 +229,4 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { |
| 230 | 229 |
|
| 231 | 230 |
}
|
| 232 | 231 |
|
| 233 |
- private static Optional<TripMapPoint> createPoint(Harbour harbour, Date date, TripMapPointType tripMapPointType) {
|
|
| 234 |
- TripMapPoint result = null;
|
|
| 235 |
- if (harbour != null && harbour.getLatitude() != null && harbour.getLongitude() != null) {
|
|
| 236 |
- result = new TripMapPoint();
|
|
| 237 |
- result.setTime(date);
|
|
| 238 |
- result.setLatitude(harbour.getLatitude());
|
|
| 239 |
- result.setLongitude(harbour.getLongitude());
|
|
| 240 |
- result.setType(tripMapPointType);
|
|
| 241 |
- }
|
|
| 242 |
- return Optional.ofNullable(result);
|
|
| 243 |
- }
|
|
| 244 |
- |
|
| 245 | 232 |
}
|
| ... | ... | @@ -31,7 +31,6 @@ import fr.ird.observe.dto.referential.ReferentialDto; |
| 31 | 31 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 32 | 32 |
import fr.ird.observe.dto.referential.common.SpeciesDto;
|
| 33 | 33 |
import fr.ird.observe.dto.referential.ps.observation.ObservedSystemReference;
|
| 34 |
-import fr.ird.observe.entities.Entities;
|
|
| 35 | 34 |
import fr.ird.observe.entities.data.TripAware;
|
| 36 | 35 |
import fr.ird.observe.entities.referential.ReferentialEntity;
|
| 37 | 36 |
import fr.ird.observe.entities.referential.common.Species;
|
| ... | ... | @@ -47,6 +46,7 @@ import fr.ird.observe.services.service.actions.validate.ValidateService; |
| 47 | 46 |
import fr.ird.observe.services.service.actions.validate.ValidationRequest;
|
| 48 | 47 |
import fr.ird.observe.services.service.referential.ReferentialService;
|
| 49 | 48 |
import fr.ird.observe.spi.DbModelHelper;
|
| 49 |
+import fr.ird.observe.spi.DtoModelClasses;
|
|
| 50 | 50 |
import fr.ird.observe.spi.type.TypeTranslators;
|
| 51 | 51 |
import fr.ird.observe.validation.ServiceValidationContext;
|
| 52 | 52 |
import fr.ird.observe.validation.ValidatorsMap;
|
| ... | ... | @@ -156,7 +156,7 @@ public class ValidateServiceLocal extends ObserveServiceLocal implements Validat |
| 156 | 156 |
|
| 157 | 157 |
private void validateData(String dataId, ValidationMessageDetector detector, ServiceValidationContext validationContext, Set<SpeciesDto> species) {
|
| 158 | 158 |
TripAware<?, ?> trip;
|
| 159 |
- if (Entities.isSeineId(dataId)) {
|
|
| 159 |
+ if (DtoModelClasses.isSeineId(dataId)) {
|
|
| 160 | 160 |
trip = fr.ird.observe.entities.data.ps.common.Trip.loadEntity(getTopiaPersistenceContext(), dataId);
|
| 161 | 161 |
} else {
|
| 162 | 162 |
trip = fr.ird.observe.entities.data.ll.common.Trip.loadEntity(getTopiaPersistenceContext(), dataId);
|
| ... | ... | @@ -34,7 +34,6 @@ import fr.ird.observe.dto.referential.ReferenceStatus; |
| 34 | 34 |
import fr.ird.observe.dto.referential.ReferentialDto;
|
| 35 | 35 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 36 | 36 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 37 |
-import fr.ird.observe.entities.Entities;
|
|
| 38 | 37 |
import fr.ird.observe.entities.ObserveEntityEnum;
|
| 39 | 38 |
import fr.ird.observe.entities.ObserveTopiaPersistenceContext;
|
| 40 | 39 |
import fr.ird.observe.entities.data.ll.common.Trip;
|
| ... | ... | @@ -247,11 +246,11 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 247 | 246 |
ReferentialShellBuilder referentialShellBuilder = ReferentialShellBuilder.builder(request.getCentralSourceReferential());
|
| 248 | 247 |
|
| 249 | 248 |
for (String tripId : request.getTripIds()) {
|
| 250 |
- if (Entities.isLonglineId(tripId)) {
|
|
| 249 |
+ if (DtoModelClasses.isLonglineId(tripId)) {
|
|
| 251 | 250 |
Trip trip = fr.ird.observe.entities.data.ll.common.Trip.loadEntity(getTopiaPersistenceContext(), tripId);
|
| 252 | 251 |
log.info("Compute missing referential for trip: " + tripId);
|
| 253 | 252 |
referentialShellBuilder.scan(trip);
|
| 254 |
- } else if (Entities.isSeineId(tripId)) {
|
|
| 253 |
+ } else if (DtoModelClasses.isSeineId(tripId)) {
|
|
| 255 | 254 |
fr.ird.observe.entities.data.ps.common.Trip trip = fr.ird.observe.entities.data.ps.common.Trip.loadEntity(getTopiaPersistenceContext(), tripId);
|
| 256 | 255 |
log.info("Compute missing referential for trip: " + tripId);
|
| 257 | 256 |
referentialShellBuilder.scan(trip);
|
| ... | ... | @@ -25,7 +25,6 @@ package fr.ird.observe.services.local.service.sql; |
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 | 26 |
import com.google.common.collect.ListMultimap;
|
| 27 | 27 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 28 |
-import fr.ird.observe.entities.Entities;
|
|
| 29 | 28 |
import fr.ird.observe.entities.ObserveEntityEnum;
|
| 30 | 29 |
import fr.ird.observe.entities.ObserveTopiaApplicationContext;
|
| 31 | 30 |
import fr.ird.observe.services.local.service.ObserveServiceLocal;
|
| ... | ... | @@ -33,6 +32,7 @@ import fr.ird.observe.services.service.sql.AddSqlScriptProducerRequest; |
| 33 | 32 |
import fr.ird.observe.services.service.sql.DeleteSqlScriptProducerRequest;
|
| 34 | 33 |
import fr.ird.observe.services.service.sql.SqlScriptProducerService;
|
| 35 | 34 |
import fr.ird.observe.spi.DbModelHelper;
|
| 35 |
+import fr.ird.observe.spi.DtoModelClasses;
|
|
| 36 | 36 |
import org.apache.commons.collections4.CollectionUtils;
|
| 37 | 37 |
import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
|
| 38 | 38 |
import org.nuiton.topia.persistence.script.TopiaBlobsContainer;
|
| ... | ... | @@ -46,8 +46,8 @@ import java.util.List; |
| 46 | 46 |
import java.util.Set;
|
| 47 | 47 |
import java.util.stream.Collectors;
|
| 48 | 48 |
|
| 49 |
-import static fr.ird.observe.entities.Entities.IS_LONGLINE_ID;
|
|
| 50 |
-import static fr.ird.observe.entities.Entities.IS_SEINE_ID;
|
|
| 49 |
+import static fr.ird.observe.spi.DtoModelClasses.IS_LONGLINE_ID;
|
|
| 50 |
+import static fr.ird.observe.spi.DtoModelClasses.IS_SEINE_ID;
|
|
| 51 | 51 |
import static fr.ird.observe.entities.Entities.REFERENCE_ENTITIES_LIST;
|
| 52 | 52 |
|
| 53 | 53 |
/**
|
| ... | ... | @@ -174,14 +174,14 @@ public class SqlScriptProducerServiceLocal extends ObserveServiceLocal implement |
| 174 | 174 |
} else {
|
| 175 | 175 |
|
| 176 | 176 |
{
|
| 177 |
- Set<String> tripIds1 = tripIds.stream().filter(Entities.IS_SEINE_ID).collect(Collectors.toSet());
|
|
| 177 |
+ Set<String> tripIds1 = tripIds.stream().filter(DtoModelClasses.IS_SEINE_ID).collect(Collectors.toSet());
|
|
| 178 | 178 |
if (!tripIds1.isEmpty()) {
|
| 179 | 179 |
builder.addDeleteTablesRequest(topiaApplicationContext.getTripSeineTables(), TopiaSqlTableSelectArgument.of(tripIds1));
|
| 180 | 180 |
}
|
| 181 | 181 |
}
|
| 182 | 182 |
|
| 183 | 183 |
{
|
| 184 |
- Set<String> tripIds1 = tripIds.stream().filter(Entities.IS_LONGLINE_ID).collect(Collectors.toSet());
|
|
| 184 |
+ Set<String> tripIds1 = tripIds.stream().filter(DtoModelClasses.IS_LONGLINE_ID).collect(Collectors.toSet());
|
|
| 185 | 185 |
if (!tripIds1.isEmpty()) {
|
| 186 | 186 |
builder.addDeleteTablesRequest(topiaApplicationContext.getTripLonglineTables(), TopiaSqlTableSelectArgument.of(tripIds1));
|
| 187 | 187 |
}
|