Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@113498 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-06 16:23:25 +00:00
parent 650de57de0
commit 071cc3922a
12 changed files with 341 additions and 82 deletions

View File

@ -18,6 +18,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession; import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession; import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
@ -1191,6 +1192,19 @@ public interface TDGWTService extends RemoteService {
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession) GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession)
throws TDGWTServiceException; throws TDGWTServiceException;
/**
* Start Downscale C-Square
*
*
* @param geospatialDownscaleCSquareSession
* @return
* @throws TDGWTServiceException
*/
public String startGeospatialDownscaleCSquare(
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession)
throws TDGWTServiceException;
// Geometry // Geometry
/** /**
* Point Creation * Point Creation

View File

@ -17,6 +17,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession; import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession; import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
@ -438,6 +439,10 @@ public interface TDGWTServiceAsync {
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession, GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession,
AsyncCallback<String> callback); AsyncCallback<String> callback);
void startGeospatialDownscaleCSquare(
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession,
AsyncCallback<String> callback);
// Geometry // Geometry
void startGeometryCreatePoint( void startGeometryCreatePoint(
GeometryCreatePointSession geometryCreatePointSession, GeometryCreatePointSession geometryCreatePointSession,

View File

@ -112,6 +112,8 @@ public class SessionConstants {
public static final String RESOURCE_SAVE_SESSION = "RESOURCE_SAVE_SESSION"; public static final String RESOURCE_SAVE_SESSION = "RESOURCE_SAVE_SESSION";
public static final String GEOSPATIAL_CREATE_COORDINATES_SESSION = "GEOSPATIAL_CREATE_COORDINATES_SESSION"; public static final String GEOSPATIAL_CREATE_COORDINATES_SESSION = "GEOSPATIAL_CREATE_COORDINATES_SESSION";
public static final String GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION = "GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION";
public static final String GEOMETRY_CREATE_POINT_SESSION = "GEOMETRY_CREATE_POINT_SESSION"; public static final String GEOMETRY_CREATE_POINT_SESSION = "GEOMETRY_CREATE_POINT_SESSION";

View File

@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager; import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession; import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession;
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
@ -26,6 +27,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSessi
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession; import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession; import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession; import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
@ -86,10 +88,10 @@ public class SessionUtil {
ASLSession session; ASLSession session;
if (username == null) { if (username == null) {
logger.warn("no user found in session, using test one"); logger.warn("no user found in session, using test one");
throw new TDGWTSessionExpiredException("Session Expired!"); /* throw new TDGWTSessionExpiredException("Session Expired!"); */
// Remove comment for Test // Remove comment for Test
/*
username = Constants.DEFAULT_USER; username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE; String scope = Constants.DEFAULT_SCOPE;
@ -97,7 +99,7 @@ public class SessionUtil {
session = SessionManager.getInstance().getASLSession( session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username); httpSession.getId(), username);
session.setScope(scope); session.setScope(scope);
*/
} else { } else {
session = SessionManager.getInstance().getASLSession( session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username); httpSession.getId(), username);
@ -1710,17 +1712,18 @@ public class SessionUtil {
httpSession.setAttribute(SessionConstants.UNION_SESSION, unionSession); httpSession.setAttribute(SessionConstants.UNION_SESSION, unionSession);
} }
// //
public static ChangeColumnsPositionSession getChangeColumnsPositionSession(HttpSession httpSession) { public static ChangeColumnsPositionSession getChangeColumnsPositionSession(
HttpSession httpSession) {
ChangeColumnsPositionSession changeColumnsPositionSession = (ChangeColumnsPositionSession) httpSession ChangeColumnsPositionSession changeColumnsPositionSession = (ChangeColumnsPositionSession) httpSession
.getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION); .getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION);
if (changeColumnsPositionSession != null) { if (changeColumnsPositionSession != null) {
return changeColumnsPositionSession; return changeColumnsPositionSession;
} else { } else {
changeColumnsPositionSession = new ChangeColumnsPositionSession(); changeColumnsPositionSession = new ChangeColumnsPositionSession();
httpSession.setAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION, httpSession.setAttribute(
SessionConstants.CHANGE_COLUMNS_POSITION_SESSION,
changeColumnsPositionSession); changeColumnsPositionSession);
return changeColumnsPositionSession; return changeColumnsPositionSession;
} }
@ -1731,9 +1734,12 @@ public class SessionUtil {
ChangeColumnsPositionSession ccps = (ChangeColumnsPositionSession) httpSession ChangeColumnsPositionSession ccps = (ChangeColumnsPositionSession) httpSession
.getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION); .getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION);
if (ccps != null) { if (ccps != null) {
httpSession.removeAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION); httpSession
.removeAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION);
} }
httpSession.setAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION, changeColumnsPositionSession); httpSession.setAttribute(
SessionConstants.CHANGE_COLUMNS_POSITION_SESSION,
changeColumnsPositionSession);
} }
@ -1883,38 +1889,66 @@ public class SessionUtil {
geospatialCreateCoordinateSession); geospatialCreateCoordinateSession);
} }
// Geometry
public static GeometryCreatePointSession getGeometryCreatePointSession(
HttpSession httpSession) {
GeometryCreatePointSession geometryCreatePointSession = (GeometryCreatePointSession) httpSession
.getAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION);
if (geometryCreatePointSession != null) {
return geometryCreatePointSession;
} else {
geometryCreatePointSession = new GeometryCreatePointSession();
httpSession.setAttribute(
SessionConstants.GEOMETRY_CREATE_POINT_SESSION,
geometryCreatePointSession);
return geometryCreatePointSession;
}
}
public static void setGeometryCreatePointSession( public static GeospatialDownscaleCSquareSession getGeospatialDownscaleCSquareSession(
HttpSession httpSession, HttpSession httpSession) {
GeometryCreatePointSession geometryCreatePointSession) { GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession = (GeospatialDownscaleCSquareSession) httpSession
GeometryCreatePointSession geom = (GeometryCreatePointSession) httpSession .getAttribute(SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION);
.getAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION); if (geospatialDownscaleCSquareSession != null) {
if (geom != null) { return geospatialDownscaleCSquareSession;
httpSession } else {
.removeAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION); geospatialDownscaleCSquareSession = new GeospatialDownscaleCSquareSession();
} httpSession.setAttribute(
SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION,
geospatialDownscaleCSquareSession);
return geospatialDownscaleCSquareSession;
}
}
public static void setGeospatialDownscaleCSquareSession(
HttpSession httpSession,
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession) {
GeospatialDownscaleCSquareSession sc = (GeospatialDownscaleCSquareSession) httpSession
.getAttribute(SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION);
if (sc != null) {
httpSession
.removeAttribute(SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION);
}
httpSession.setAttribute(
SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION,
geospatialDownscaleCSquareSession);
}
// Geometry
public static GeometryCreatePointSession getGeometryCreatePointSession(
HttpSession httpSession) {
GeometryCreatePointSession geometryCreatePointSession = (GeometryCreatePointSession) httpSession
.getAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION);
if (geometryCreatePointSession != null) {
return geometryCreatePointSession;
} else {
geometryCreatePointSession = new GeometryCreatePointSession();
httpSession.setAttribute( httpSession.setAttribute(
SessionConstants.GEOMETRY_CREATE_POINT_SESSION, SessionConstants.GEOMETRY_CREATE_POINT_SESSION,
geometryCreatePointSession); geometryCreatePointSession);
return geometryCreatePointSession;
} }
}
public static void setGeometryCreatePointSession(HttpSession httpSession,
GeometryCreatePointSession geometryCreatePointSession) {
GeometryCreatePointSession geom = (GeometryCreatePointSession) httpSession
.getAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION);
if (geom != null) {
httpSession
.removeAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION);
}
httpSession.setAttribute(
SessionConstants.GEOMETRY_CREATE_POINT_SESSION,
geometryCreatePointSession);
}
/** /**
* Retrieve task started * Retrieve task started
@ -2386,7 +2420,7 @@ public class SessionUtil {
return; return;
} }
/** /**
* Reomove All Background Tasks in the scope * Reomove All Background Tasks in the scope
* *
@ -2394,7 +2428,8 @@ public class SessionUtil {
* @param taskWrapper * @param taskWrapper
* @throws TDGWTSessionExpiredException * @throws TDGWTSessionExpiredException
*/ */
public static void removeAllTasksInBackground(HttpSession httpSession) throws TDGWTSessionExpiredException { public static void removeAllTasksInBackground(HttpSession httpSession)
throws TDGWTSessionExpiredException {
ASLSession aslSession = getAslSession(httpSession); ASLSession aslSession = getAslSession(httpSession);
ScopeProvider.instance.set(aslSession.getScope()); ScopeProvider.instance.set(aslSession.getScope());
@ -2409,7 +2444,8 @@ public class SessionUtil {
HashMap<String, TaskWrapper> tasksInBackground = scopeToTasksInBackgroundMap HashMap<String, TaskWrapper> tasksInBackground = scopeToTasksInBackgroundMap
.get(aslSession.getScope()); .get(aslSession.getScope());
if (tasksInBackground == null) { if (tasksInBackground == null) {
logger.debug("No tasks in background in session for scope: " + aslSession.getScope()); logger.debug("No tasks in background in session for scope: "
+ aslSession.getScope());
} else { } else {
scopeToTasksInBackgroundMap.remove(aslSession.getScope()); scopeToTasksInBackgroundMap.remove(aslSession.getScope());
httpSession httpSession
@ -2423,9 +2459,6 @@ public class SessionUtil {
return; return;
} }
/** /**
* Reomove Task on specific tabular resource from Tasks In Background * Reomove Task on specific tabular resource from Tasks In Background

View File

@ -129,6 +129,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Extr
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4FilterColumn; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4FilterColumn;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GeometryCreatePoint; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GeometryCreatePoint;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GeospatialCreateCoordinates; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GeospatialCreateCoordinates;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GeospatialDownscaleCSquare;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GroupBy; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4GroupBy;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4JSONExport; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4JSONExport;
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4LabelColumn; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4LabelColumn;
@ -176,6 +177,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession; import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession; import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
@ -8879,6 +8881,83 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
/**
*
* {@inheritDoc}
*/
@Override
public String startGeospatialDownscaleCSquare(
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession)
throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
SessionUtil.setGeospatialDownscaleCSquareSession(session,
geospatialDownscaleCSquareSession);
ASLSession aslSession = SessionUtil.getAslSession(session);
if (geospatialDownscaleCSquareSession == null) {
logger.error("GeospatialDownscaleCSquareSession is null");
throw new TDGWTServiceException(
"Error in downscale C-Square: GeospatialDownscaleCSquareSession is null");
}
logger.debug("StartGeospatialDownscaleCSquare: "
+ geospatialDownscaleCSquareSession);
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService();
checkTRId(geospatialDownscaleCSquareSession.getTrId());
TabularResourceId tabularResourceId = new TabularResourceId(
Long.valueOf(geospatialDownscaleCSquareSession.getTrId()
.getId()));
TabularResource tabularResource = service
.getTabularResource(tabularResourceId);
checkTabularResourceIsFlow(tabularResource);
checkTabularResourceLocked(tabularResource);
checkTabularResourceIsFinal(tabularResource);
OpExecution4GeospatialDownscaleCSquare opEx = new OpExecution4GeospatialDownscaleCSquare (
service, geospatialDownscaleCSquareSession);
OpExecutionDirector director = new OpExecutionDirector();
director.setOperationExecutionBuilder(opEx);
director.constructOperationExecution();
OperationExecution invocation = director.getOperationExecution();
if (invocation == null) {
throw new TDGWTServiceException(
"Error in invocation: Operation not supported");
}
logger.debug("OperationInvocation: \n" + invocation.toString());
Task trTask = service.execute(invocation, tabularResourceId);
logger.debug("GeospatialCreateCoordinates on service: TaskId "
+ trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.DownscaleCSquare,
geospatialDownscaleCSquareSession.getTrId());
SessionUtil.setStartedTask(session, taskWrapper);
return trTask.getId().getValue();
} catch (TDGWTServiceException e) {
throw e;
} catch (SecurityException e) {
e.printStackTrace();
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error in downscale C-Square: "
+ e.getLocalizedMessage());
}
}
/** /**
* *
* {@inheritDoc} * {@inheritDoc}

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
import java.util.HashMap;
import java.util.Map;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Operation Execution for change table type
*
* @author "Giancarlo Panichi" email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OpExecution4GeospatialDownscaleCSquare extends OpExecutionBuilder {
protected static Logger logger = LoggerFactory
.getLogger(OpExecution4GeospatialDownscaleCSquare.class);
private TabularDataService service;
private GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession;
public OpExecution4GeospatialDownscaleCSquare(
TabularDataService service,
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession) {
this.service = service;
this.geospatialDownscaleCSquareSession = geospatialDownscaleCSquareSession;
}
@Override
public void buildOpEx() throws TDGWTServiceException {
OperationExecution invocation = null;
logger.debug("Downscale CSquare: "+ geospatialDownscaleCSquareSession);
OperationDefinition operationDefinition;
Map<String, Object> map = new HashMap<String, Object>();
ColumnData col=geospatialDownscaleCSquareSession.getCsquareColumn();
if(col==null|| col.getColumnId()==null|| col.getColumnId().isEmpty()){
logger.error("Error in downscale c-square: no valid column set");
throw new TDGWTServiceException("No valid column set");
}
operationDefinition = OperationDefinitionMap.map(
OperationsId.DownscaleCSquare.toString(), service);
map.put(Constants.PARAMETER_DOWNSCALE_CSQUARE_RESOLUTION,
geospatialDownscaleCSquareSession.getType().getId());
invocation = new OperationExecution(col.getColumnId(),
operationDefinition.getOperationId(), map);
operationExecutionSpec.setOp(invocation);
}
}

View File

@ -11,6 +11,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.State;
*/ */
public class TaskStateMap { public class TaskStateMap {
public static State map(TaskStatus status) { public static State map(TaskStatus status) {
if(status==null){
return State.FAILED;
}
switch (status) { switch (status) {
case INITIALIZING: case INITIALIZING:
return State.INITIALIZING; return State.INITIALIZING;

View File

@ -11,6 +11,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.WorkerState;
*/ */
public class WorkerStateMap { public class WorkerStateMap {
public static WorkerState map(WorkerStatus status) { public static WorkerState map(WorkerStatus status) {
if(status==null){
return WorkerState.FAILED;
}
switch (status) { switch (status) {
case FAILED: case FAILED:
return WorkerState.FAILED; return WorkerState.FAILED;
@ -24,6 +28,8 @@ public class WorkerStateMap {
return WorkerState.SUCCEDED; return WorkerState.SUCCEDED;
case VALIDATING_DATA: case VALIDATING_DATA:
return WorkerState.VALIDATING_DATA; return WorkerState.VALIDATING_DATA;
case ABORTED:
return WorkerState.ABORTED;
default: default:
return WorkerState.FAILED; return WorkerState.FAILED;

View File

@ -118,6 +118,8 @@ public class Constants {
public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER = "user"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER = "user";
public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_QUADRANT = "quadrant"; public static final String PARAMETER_GEOSPATIAL_CREATE_COORDINATES_QUADRANT = "quadrant";
public static final String PARAMETER_DOWNSCALE_CSQUARE_RESOLUTION = "resolution";
public static final String PARAMETER_EXPRESSION_VALIDATION_EXPRESSION = "expression"; public static final String PARAMETER_EXPRESSION_VALIDATION_EXPRESSION = "expression";
public static final String PARAMETER_EXPRESSION_VALIDATION_DESCRIPTION = "description"; public static final String PARAMETER_EXPRESSION_VALIDATION_DESCRIPTION = "description";
public static final String PARAMETER_EXPRESSION_VALIDATION_TITLE = "title"; public static final String PARAMETER_EXPRESSION_VALIDATION_TITLE = "title";

View File

@ -0,0 +1,74 @@
package org.gcube.portlets.user.td.gwtservice.shared.geospatial;
import java.io.Serializable;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial.CSquareDownscaleResolution;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class GeospatialDownscaleCSquareSession implements Serializable {
private static final long serialVersionUID = -7790774506217649775L;
private TRId trId;
private ColumnData csquareColumn;
private CSquareDownscaleResolution type;
public GeospatialDownscaleCSquareSession() {
}
/**
*
* @param trId
* @param csquareColumn
* @param type
*/
public GeospatialDownscaleCSquareSession(TRId trId,
ColumnData csquareColumn, CSquareDownscaleResolution type) {
super();
this.trId = trId;
this.csquareColumn = csquareColumn;
this.type = type;
}
public TRId getTrId() {
return trId;
}
public void setTrId(TRId trId) {
this.trId = trId;
}
public ColumnData getCsquareColumn() {
return csquareColumn;
}
public void setCsquareColumn(ColumnData csquareColumn) {
this.csquareColumn = csquareColumn;
}
public CSquareDownscaleResolution getType() {
return type;
}
public void setType(CSquareDownscaleResolution type) {
this.type = type;
}
@Override
public String toString() {
return "GeospatialDownscaleCSquareSession [trId=" + trId
+ ", csquareColumn=" + csquareColumn + ", type=" + type + "]";
}
}

View File

@ -13,7 +13,8 @@ public enum WorkerState {
VALIDATING_DATA("Validating Data"), VALIDATING_DATA("Validating Data"),
IN_PROGRESS("In Progress"), IN_PROGRESS("In Progress"),
SUCCEDED("Succeded"), SUCCEDED("Succeded"),
FAILED("Failed"); FAILED("Failed"),
ABORTED("Aborted");
/** /**
* @param text * @param text
@ -28,5 +29,17 @@ public enum WorkerState {
public String toString() { public String toString() {
return id; return id;
} }
public static WorkerState get(String state) {
for(WorkerState ws:values()){
if(ws.id.compareTo(state)==0){
return ws;
}
}
return WorkerState.FAILED;
}
} }

View File

@ -1,39 +0,0 @@
package org.gcube.portlets.user.td.gwtservice.shared.task;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class WorkerStateParser {
public static WorkerState parse(String state) {
if (WorkerState.PENDING.toString().compareTo(state) == 0) {
return WorkerState.PENDING;
} else {
if (WorkerState.INITIALIZING.toString().compareTo(state) == 0) {
return WorkerState.INITIALIZING;
} else {
if (WorkerState.VALIDATING_DATA.toString().compareTo(state) == 0) {
return WorkerState.VALIDATING_DATA;
} else {
if (WorkerState.IN_PROGRESS.toString().compareTo(state) == 0) {
return WorkerState.IN_PROGRESS;
} else {
if (WorkerState.SUCCEDED.toString().compareTo(state) == 0) {
return WorkerState.SUCCEDED;
} else {
if (WorkerState.FAILED.toString().compareTo(state) == 0) {
return WorkerState.FAILED;
} else {
return null;
}
}
}
}
}
}
}
}