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 7ee1a32..ca714a5 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 @@ -34,13 +34,14 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder private TabularDataService service; private GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession; private ASLSession aslSession; - + public OpExecution4GeospatialCreateCoordinates( - ASLSession aslSession, TabularDataService service, + ASLSession aslSession, + TabularDataService service, GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession) { this.service = service; this.geospatialCreateCoordinatesSession = geospatialCreateCoordinatesSession; - this.aslSession=aslSession; + this.aslSession = aslSession; } @Override @@ -51,52 +52,60 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder OperationDefinition operationDefinition; Map map = new HashMap(); - TRId trId = geospatialCreateCoordinatesSession.getTrId(); logger.debug("trID: " + trId); - if(trId==null){ + if (trId == null) { logger.error("Error Creating Geospatial Coordinates: trId is null"); throw new TDGWTServiceException("No tabular resource set"); } - + long tabId; - if(trId.isViewTable()){ + if (trId.isViewTable()) { tabId = new Long(trId.getReferenceTargetTableId()); } else { tabId = new Long(trId.getTableId()); - + } TableId tId = new TableId(tabId); - - ColumnData latitudeColumn=geospatialCreateCoordinatesSession.getLatitude(); - logger.debug("Latitude Column: "+latitudeColumn); - if(latitudeColumn==null){ + + ColumnData latitudeColumn = geospatialCreateCoordinatesSession + .getLatitude(); + logger.debug("Latitude Column: " + latitudeColumn); + if (latitudeColumn == null) { logger.error("Error Creating Geospatial Coordinates: Latitude Column is null"); throw new TDGWTServiceException("No latitude column set"); } - ColumnLocalId latitudeId = new ColumnLocalId(latitudeColumn.getColumnId()); - ColumnReference latitudeColumnReference = new ColumnReference(tId, latitudeId); - - ColumnData longitudeColumn=geospatialCreateCoordinatesSession.getLatitude(); - logger.debug("Longitude Column: "+longitudeColumn); - if(longitudeColumn==null){ + ColumnLocalId latitudeId = new ColumnLocalId( + latitudeColumn.getColumnId()); + ColumnReference latitudeColumnReference = new ColumnReference(tId, + latitudeId); + + ColumnData longitudeColumn = geospatialCreateCoordinatesSession + .getLatitude(); + logger.debug("Longitude Column: " + longitudeColumn); + if (longitudeColumn == null) { logger.error("Error Creating Geospatial Coordinates: Longitude Column is null"); throw new TDGWTServiceException("No longitude column set"); } - ColumnLocalId longitudeId = new ColumnLocalId(longitudeColumn.getColumnId()); - ColumnReference longitudeColumnReference = new ColumnReference(tId, longitudeId); - + ColumnLocalId longitudeId = new ColumnLocalId( + longitudeColumn.getColumnId()); + ColumnReference longitudeColumnReference = new ColumnReference(tId, + longitudeId); + operationDefinition = OperationDefinitionMap.map( - OperationsId.CoordinatesEnhancement.toString(), service); - map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LATITUDE, latitudeColumnReference); - map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LONGITUDE, longitudeColumnReference); - map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_FEATURE, geospatialCreateCoordinatesSession.getType().getId()); - map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER, aslSession.getUsername()); - + OperationsId.EnhanceLatLong.toString(), service); + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LATITUDE, + latitudeColumnReference); + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_LONGITUDE, + longitudeColumnReference); + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_FEATURE, + geospatialCreateCoordinatesSession.getType().getId()); + map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER, + aslSession.getUsername()); + invocation = new OperationExecution( operationDefinition.getOperationId(), map); - operationExecutionSpec.setOp(invocation); }