r395 - in trunk: sammoa-application/src/main/java/fr/ulr/sammoa/application/map sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence
Author: tchemit Date: 2012-08-10 14:56:49 +0200 (Fri, 10 Aug 2012) New Revision: 395 Url: http://forge.codelutin.com/repositories/revision/sammoa/395 Log: refs #1203: Export SHP (fix Observations export) Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/map/ExportMapService.java trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/map/ExportMapService.java =================================================================== --- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/map/ExportMapService.java 2012-08-10 12:28:10 UTC (rev 394) +++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/map/ExportMapService.java 2012-08-10 12:56:49 UTC (rev 395) @@ -202,6 +202,7 @@ // to keep current effort group identifier String effortGroup = null; + Route previousRoute = null; for (Route route : routes) { if (logger.isTraceEnabled()) { @@ -229,7 +230,7 @@ // add route data fillRouteRecord(flight, - route, + previousRoute, effortGroup, LegStatus.END, record); @@ -277,7 +278,11 @@ } // add route data - fillRouteRecord(flight, route, effortGroup, legStatus, record); + fillRouteRecord(flight, + route, + effortGroup, + legStatus, + record); // add geoPoint data and flush @@ -286,6 +291,9 @@ builder, graphicList); } + + // keep current route as previousroute + previousRoute = route; } } @@ -445,8 +453,10 @@ // use flight end date routeEndTime = flight.getEndDate(); } - Preconditions.checkState(routeEndTime.after(beginTime), - String.format("Route debut de route %s - fin de route %s", beginTime, routeEndTime)); + if (routeEndTime != null) { + Preconditions.checkState(routeEndTime.after(beginTime), + String.format("Route debut de route %s - fin de route %s", beginTime, routeEndTime)); + } PeriodDates routePeriod = new PeriodDates(beginTime, routeEndTime); @@ -518,8 +528,8 @@ record.put("CALVES", observation.getCalves()); record.put("PHOTO", observation.isPhoto()); record.put("OBSERVER", observation.getObserverPosition().getObserver().getInitials()); - record.put("SIDE", observation.getObserverPosition().getPosition().getName()); - record.put("STATUS", observation.getObservationStatus().getName()); + record.put("SIDE", observation.getObserverPosition().getPosition()); + record.put("STATUS", observation.getObservationStatus()); record.put("COMMENT", observation.getComment()); GeoPoint geoPoint = geoPointIterator.next(); @@ -693,15 +703,19 @@ fillRouteTypeRecord(flight, route, effortGroup, record); if (legStatus != null) { - record.put("STATUS", LegStatus.END); + record.put("STATUS", legStatus); } record.put("COMMENT", route.getComment()); record.put("SEA_STATE", route.getSeaState()); record.put("SWELL", route.getSwell()); record.put("TURBIDITY", route.getTurbidity()); record.put("SKY_GLINT", route.getSkyGlint()); - record.put("GLARE_FROM", route.getGlareFrom()); - record.put("GLARE_TO", route.getGlareTo()); + if (route.getGlareFrom() != null) { + record.put("GLARE_FROM", String.valueOf(route.getGlareFrom())); + } + if (route.getGlareTo() != null) { + record.put("GLARE_TO", String.valueOf(route.getGlareTo())); + } record.put("GLARE_SEVERITY", route.getGlareSeverity()); record.put("GLARE_UNDER", route.isGlareUnder()); record.put("CLOUD_COVER", route.getCloudCover()); @@ -731,7 +745,7 @@ String effortGroup, Map<String, Object> record) { - record.put("ROUTE_TYPE", route.getRouteType().getName()); + record.put("ROUTE_TYPE", route.getRouteType()); if (Routes.isRouteLeg(route)) { fillLegRouteRecord(route, effortGroup, record); } Modified: trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java =================================================================== --- trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java 2012-08-10 12:28:10 UTC (rev 394) +++ trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java 2012-08-10 12:56:49 UTC (rev 395) @@ -97,13 +97,26 @@ List<Observation> result = Lists.newArrayList(); Iterator<Observation> itr = observations.iterator(); - while (itr.hasNext()) { - Observation observation = itr.next(); - Date observationTime = observation.getObservationTime(); - if (periodDate.between(observationTime)) { - itr.remove(); - result.add(observation); + if (periodDate.getThruDate() == null) { + Date fromDate = periodDate.getFromDate(); + // no up bound + while (itr.hasNext()) { + Observation observation = itr.next(); + Date observationTime = observation.getObservationTime(); + if (fromDate.before(observationTime)) { + itr.remove(); + result.add(observation); + } } + } else { + while (itr.hasNext()) { + Observation observation = itr.next(); + Date observationTime = observation.getObservationTime(); + if (periodDate.between(observationTime)) { + itr.remove(); + result.add(observation); + } + } } return result; }
participants (1)
-
tchemit@users.forge.codelutin.com