From 13304049b0d9435c103611626048bacd33c864f2 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 11 Feb 2015 17:56:41 +0000 Subject: [PATCH] Updated Geospatial Coordinates git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111920 82a268e6-3cf1-43bd-a215-b396298e98cf --- ...Execution4GeospatialCreateCoordinates.java | 22 ++++++++++++- .../user/td/gwtservice/shared/Constants.java | 1 + .../GeospatialCreateCoordinatesSession.java | 32 ++++++++++++------- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4GeospatialCreateCoordinates.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4GeospatialCreateCoordinates.java index 4971d25..da03052 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4GeospatialCreateCoordinates.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4GeospatialCreateCoordinates.java @@ -8,6 +8,7 @@ import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.O import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution; import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId; import org.gcube.data.analysis.tabulardata.model.column.ColumnReference; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDNumeric; import org.gcube.data.analysis.tabulardata.model.table.TableId; import org.gcube.data.analysis.tabulardata.service.TabularDataService; import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap; @@ -101,6 +102,11 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER, aslSession.getUsername()); + + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_RESOLUTION, + new TDNumeric(geospatialCreateCoordinatesSession.getResolution())); + + switch(geospatialCreateCoordinatesSession.getType()){ case C_SQUARE: map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_FEATURE, @@ -110,8 +116,22 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_FEATURE, geospatialCreateCoordinatesSession.getType().getId()); if(geospatialCreateCoordinatesSession.isHasQuadrant()){ + ColumnData quadrantColumn = geospatialCreateCoordinatesSession + .getQuadrant(); + logger.debug("Quadrant Column: " + quadrantColumn); + if (quadrantColumn == null) { + logger.error("Error Creating Geospatial Coordinates: Quadrant Column is null"); + throw new TDGWTServiceException("No quadrant column set"); + } + ColumnLocalId quadrantId = new ColumnLocalId( + quadrantColumn.getColumnId()); + ColumnReference quadrantColumnReference = new ColumnReference(tId, + quadrantId); + + + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_QUADRANT, - geospatialCreateCoordinatesSession.getQuadrant()); + quadrantColumnReference); } break; default: diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java index 57fa1b2..3b6c7d5 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java @@ -114,6 +114,7 @@ public class Constants { public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LATITUDE = "latitude"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LONGITUDE = "longitude"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_FEATURE = "feature"; + public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_RESOLUTION = "resolution"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER = "user"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_QUADRANT = "quadrant"; diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/geospatial/GeospatialCreateCoordinatesSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/geospatial/GeospatialCreateCoordinatesSession.java index 4e3017b..e789f37 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/geospatial/GeospatialCreateCoordinatesSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/geospatial/GeospatialCreateCoordinatesSession.java @@ -21,6 +21,7 @@ public class GeospatialCreateCoordinatesSession implements Serializable { private GeospatialCoordinatesType type; private boolean hasQuadrant; private ColumnData quadrant; + private Double resolution; public GeospatialCreateCoordinatesSession() { } @@ -31,18 +32,24 @@ public class GeospatialCreateCoordinatesSession implements Serializable { * @param latitude * @param longitude * @param type - * @param hasQuadrant TODO - * @param quadrant TODO + * @param hasQuadrant + * TODO + * @param quadrant + * TODO + * @param resolution + * TODO */ public GeospatialCreateCoordinatesSession(TRId trId, ColumnData latitude, - ColumnData longitude, GeospatialCoordinatesType type, boolean hasQuadrant, ColumnData quadrant) { + ColumnData longitude, GeospatialCoordinatesType type, + boolean hasQuadrant, ColumnData quadrant, Double resolution) { super(); this.trId = trId; this.latitude = latitude; this.longitude = longitude; this.type = type; - this.hasQuadrant=hasQuadrant; - this.quadrant=quadrant; + this.hasQuadrant = hasQuadrant; + this.quadrant = quadrant; + this.resolution = resolution; } public TRId getTrId() { @@ -93,17 +100,20 @@ public class GeospatialCreateCoordinatesSession implements Serializable { this.quadrant = quadrant; } + public Double getResolution() { + return resolution; + } + + public void setResolution(Double resolution) { + this.resolution = resolution; + } + @Override public String toString() { return "GeospatialCreateCoordinatesSession [trId=" + trId + ", latitude=" + latitude + ", longitude=" + longitude + ", type=" + type + ", hasQuadrant=" + hasQuadrant - + ", quadrant=" + quadrant + "]"; + + ", quadrant=" + quadrant + ", resolution=" + resolution + "]"; } - - - - - }