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:
parent
650de57de0
commit
071cc3922a
|
@ -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.geometry.GeometryCreatePointSession;
|
||||
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.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
|
@ -1191,6 +1192,19 @@ public interface TDGWTService extends RemoteService {
|
|||
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Start Downscale C-Square
|
||||
*
|
||||
*
|
||||
* @param geospatialDownscaleCSquareSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public String startGeospatialDownscaleCSquare(
|
||||
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
// Geometry
|
||||
/**
|
||||
* Point Creation
|
||||
|
|
|
@ -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.geometry.GeometryCreatePointSession;
|
||||
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.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
|
@ -438,6 +439,10 @@ public interface TDGWTServiceAsync {
|
|||
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void startGeospatialDownscaleCSquare(
|
||||
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// Geometry
|
||||
void startGeometryCreatePoint(
|
||||
GeometryCreatePointSession geometryCreatePointSession,
|
||||
|
|
|
@ -112,6 +112,8 @@ public class SessionConstants {
|
|||
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_DOWNSCALE_CSQUARE_SESSION = "GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION";
|
||||
|
||||
|
||||
public static final String GEOMETRY_CREATE_POINT_SESSION = "GEOMETRY_CREATE_POINT_SESSION";
|
||||
|
||||
|
|
|
@ -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.CodelistMappingFileUploadSession;
|
||||
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.codelisthelper.CodelistMappingSession;
|
||||
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.geometry.GeometryCreatePointSession;
|
||||
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.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
|
@ -86,10 +88,10 @@ public class SessionUtil {
|
|||
ASLSession session;
|
||||
if (username == null) {
|
||||
logger.warn("no user found in session, using test one");
|
||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
||||
/* throw new TDGWTSessionExpiredException("Session Expired!"); */
|
||||
|
||||
// Remove comment for Test
|
||||
/*
|
||||
|
||||
username = Constants.DEFAULT_USER;
|
||||
String scope = Constants.DEFAULT_SCOPE;
|
||||
|
||||
|
@ -97,7 +99,7 @@ public class SessionUtil {
|
|||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
session.setScope(scope);
|
||||
*/
|
||||
|
||||
} else {
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
|
@ -1711,16 +1713,17 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static ChangeColumnsPositionSession getChangeColumnsPositionSession(HttpSession httpSession) {
|
||||
public static ChangeColumnsPositionSession getChangeColumnsPositionSession(
|
||||
HttpSession httpSession) {
|
||||
ChangeColumnsPositionSession changeColumnsPositionSession = (ChangeColumnsPositionSession) httpSession
|
||||
.getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION);
|
||||
if (changeColumnsPositionSession != null) {
|
||||
return changeColumnsPositionSession;
|
||||
} else {
|
||||
changeColumnsPositionSession = new ChangeColumnsPositionSession();
|
||||
httpSession.setAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION,
|
||||
httpSession.setAttribute(
|
||||
SessionConstants.CHANGE_COLUMNS_POSITION_SESSION,
|
||||
changeColumnsPositionSession);
|
||||
return changeColumnsPositionSession;
|
||||
}
|
||||
|
@ -1731,9 +1734,12 @@ public class SessionUtil {
|
|||
ChangeColumnsPositionSession ccps = (ChangeColumnsPositionSession) httpSession
|
||||
.getAttribute(SessionConstants.CHANGE_COLUMNS_POSITION_SESSION);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1884,6 +1890,35 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
public static GeospatialDownscaleCSquareSession getGeospatialDownscaleCSquareSession(
|
||||
HttpSession httpSession) {
|
||||
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession = (GeospatialDownscaleCSquareSession) httpSession
|
||||
.getAttribute(SessionConstants.GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION);
|
||||
if (geospatialDownscaleCSquareSession != null) {
|
||||
return geospatialDownscaleCSquareSession;
|
||||
} else {
|
||||
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(
|
||||
|
@ -1901,8 +1936,7 @@ public class SessionUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setGeometryCreatePointSession(
|
||||
HttpSession httpSession,
|
||||
public static void setGeometryCreatePointSession(HttpSession httpSession,
|
||||
GeometryCreatePointSession geometryCreatePointSession) {
|
||||
GeometryCreatePointSession geom = (GeometryCreatePointSession) httpSession
|
||||
.getAttribute(SessionConstants.GEOMETRY_CREATE_POINT_SESSION);
|
||||
|
@ -2394,7 +2428,8 @@ public class SessionUtil {
|
|||
* @param taskWrapper
|
||||
* @throws TDGWTSessionExpiredException
|
||||
*/
|
||||
public static void removeAllTasksInBackground(HttpSession httpSession) throws TDGWTSessionExpiredException {
|
||||
public static void removeAllTasksInBackground(HttpSession httpSession)
|
||||
throws TDGWTSessionExpiredException {
|
||||
|
||||
ASLSession aslSession = getAslSession(httpSession);
|
||||
ScopeProvider.instance.set(aslSession.getScope());
|
||||
|
@ -2409,7 +2444,8 @@ public class SessionUtil {
|
|||
HashMap<String, TaskWrapper> tasksInBackground = scopeToTasksInBackgroundMap
|
||||
.get(aslSession.getScope());
|
||||
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 {
|
||||
scopeToTasksInBackgroundMap.remove(aslSession.getScope());
|
||||
httpSession
|
||||
|
@ -2424,9 +2460,6 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reomove Task on specific tabular resource from Tasks In Background
|
||||
*
|
||||
|
|
|
@ -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.OpExecution4GeometryCreatePoint;
|
||||
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.OpExecution4JSONExport;
|
||||
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.geometry.GeometryCreatePointSession;
|
||||
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.RollBackSession;
|
||||
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}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
|||
*/
|
||||
public class TaskStateMap {
|
||||
public static State map(TaskStatus status) {
|
||||
if(status==null){
|
||||
return State.FAILED;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case INITIALIZING:
|
||||
return State.INITIALIZING;
|
||||
|
|
|
@ -11,6 +11,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.WorkerState;
|
|||
*/
|
||||
public class WorkerStateMap {
|
||||
public static WorkerState map(WorkerStatus status) {
|
||||
if(status==null){
|
||||
return WorkerState.FAILED;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case FAILED:
|
||||
return WorkerState.FAILED;
|
||||
|
@ -24,6 +28,8 @@ public class WorkerStateMap {
|
|||
return WorkerState.SUCCEDED;
|
||||
case VALIDATING_DATA:
|
||||
return WorkerState.VALIDATING_DATA;
|
||||
case ABORTED:
|
||||
return WorkerState.ABORTED;
|
||||
default:
|
||||
return WorkerState.FAILED;
|
||||
|
||||
|
|
|
@ -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_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_DESCRIPTION = "description";
|
||||
public static final String PARAMETER_EXPRESSION_VALIDATION_TITLE = "title";
|
||||
|
|
|
@ -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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -13,7 +13,8 @@ public enum WorkerState {
|
|||
VALIDATING_DATA("Validating Data"),
|
||||
IN_PROGRESS("In Progress"),
|
||||
SUCCEDED("Succeded"),
|
||||
FAILED("Failed");
|
||||
FAILED("Failed"),
|
||||
ABORTED("Aborted");
|
||||
|
||||
/**
|
||||
* @param text
|
||||
|
@ -29,4 +30,16 @@ public enum WorkerState {
|
|||
return id;
|
||||
}
|
||||
|
||||
|
||||
public static WorkerState get(String state) {
|
||||
for(WorkerState ws:values()){
|
||||
if(ws.id.compareTo(state)==0){
|
||||
return ws;
|
||||
}
|
||||
}
|
||||
|
||||
return WorkerState.FAILED;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue