Added Geospatial Create Coordinates Panel
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111806 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
aa742e89e1
commit
eb1227b26b
|
@ -16,6 +16,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
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.file.HeaderPresence;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
|
||||||
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;
|
||||||
|
@ -133,8 +134,7 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String getUriFromResolver(UriResolverSession uriResolverSession)
|
public String getUriFromResolver(UriResolverSession uriResolverSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// PeriodDataType
|
||||||
//PeriodDataType
|
|
||||||
/**
|
/**
|
||||||
* Get list of PeriodDataType
|
* Get list of PeriodDataType
|
||||||
*
|
*
|
||||||
|
@ -142,20 +142,19 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public ArrayList<PeriodDataType> getPeriodDataTypes()
|
public ArrayList<PeriodDataType> getPeriodDataTypes()
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the hierarchical relationship for the specific period data type
|
* Retrieves the hierarchical relationship for the specific period data type
|
||||||
*
|
*
|
||||||
* @param periodDataType
|
* @param periodDataType
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public ArrayList<PeriodDataType> getHierarchicalRelationshipForPeriodDataTypes(PeriodDataType periodDataType)
|
public ArrayList<PeriodDataType> getHierarchicalRelationshipForPeriodDataTypes(
|
||||||
throws TDGWTServiceException;
|
PeriodDataType periodDataType) throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// ValueDataFormats
|
||||||
//ValueDataFormats
|
|
||||||
/**
|
/**
|
||||||
* Retrieve ValueDataFormat for all ColumnDataType
|
* Retrieve ValueDataFormat for all ColumnDataType
|
||||||
*
|
*
|
||||||
|
@ -164,8 +163,7 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public HashMap<ColumnDataType, ArrayList<ValueDataFormat>> getValueDataFormatsMap()
|
public HashMap<ColumnDataType, ArrayList<ValueDataFormat>> getValueDataFormatsMap()
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve ValueDataFormat for specific ColumnDataType
|
* Retrieve ValueDataFormat for specific ColumnDataType
|
||||||
*
|
*
|
||||||
|
@ -175,7 +173,7 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public ArrayList<ValueDataFormat> getValueDataFormatsOfColumnDataType(
|
public ArrayList<ValueDataFormat> getValueDataFormatsOfColumnDataType(
|
||||||
ColumnDataType columnDataType) throws TDGWTServiceException;
|
ColumnDataType columnDataType) throws TDGWTServiceException;
|
||||||
|
|
||||||
// TabularResource
|
// TabularResource
|
||||||
/**
|
/**
|
||||||
* Get current TRId
|
* Get current TRId
|
||||||
|
@ -1155,4 +1153,16 @@ public interface TDGWTService extends RemoteService {
|
||||||
ChartTopRatingSession chartTopRatingSession)
|
ChartTopRatingSession chartTopRatingSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// Geospatial
|
||||||
|
/**
|
||||||
|
* Start Geospatial Coordinates Creation
|
||||||
|
*
|
||||||
|
* @param geospatialCreateCoordinatesSession
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public String startGeospatialCreateCoordinates(
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession)
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
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.file.HeaderPresence;
|
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
|
||||||
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;
|
||||||
|
@ -419,4 +420,10 @@ public interface TDGWTServiceAsync {
|
||||||
// Chart
|
// Chart
|
||||||
void startChartTopRating(ChartTopRatingSession chartTopRatingSession,
|
void startChartTopRating(ChartTopRatingSession chartTopRatingSession,
|
||||||
AsyncCallback<String> callback);
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
// Geospatial
|
||||||
|
void startGeospatialCreateCoordinates(
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ 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";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
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.geospatial.GeospatialCreateCoordinatesSession;
|
||||||
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;
|
||||||
|
@ -1823,6 +1824,35 @@ public class SessionUtil {
|
||||||
chartTopRatingSession);
|
chartTopRatingSession);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Geospatial
|
||||||
|
public static GeospatialCreateCoordinatesSession getGeospatialCreateCoordinatesSession(
|
||||||
|
HttpSession httpSession) {
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession = (GeospatialCreateCoordinatesSession) httpSession
|
||||||
|
.getAttribute(SessionConstants.GEOSPATIAL_CREATE_COORDINATES_SESSION);
|
||||||
|
if (geospatialCreateCoordinatesSession != null) {
|
||||||
|
return geospatialCreateCoordinatesSession;
|
||||||
|
} else {
|
||||||
|
geospatialCreateCoordinatesSession = new GeospatialCreateCoordinatesSession();
|
||||||
|
httpSession.setAttribute(SessionConstants.GEOSPATIAL_CREATE_COORDINATES_SESSION,
|
||||||
|
geospatialCreateCoordinatesSession);
|
||||||
|
return geospatialCreateCoordinatesSession;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGeospatialCreateCoordinatesSession(HttpSession httpSession,
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinateSession) {
|
||||||
|
GeospatialCreateCoordinatesSession sc = (GeospatialCreateCoordinatesSession) httpSession
|
||||||
|
.getAttribute(SessionConstants.GEOSPATIAL_CREATE_COORDINATES_SESSION);
|
||||||
|
if (sc != null) {
|
||||||
|
httpSession.removeAttribute(SessionConstants.GEOSPATIAL_CREATE_COORDINATES_SESSION);
|
||||||
|
}
|
||||||
|
httpSession.setAttribute(SessionConstants.GEOSPATIAL_CREATE_COORDINATES_SESSION,
|
||||||
|
geospatialCreateCoordinateSession);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve task started
|
* Retrieve task started
|
||||||
|
|
|
@ -126,6 +126,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Dupl
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4EditRow;
|
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4EditRow;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ExtractCodelist;
|
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ExtractCodelist;
|
||||||
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.OpExecution4GeospatialCreateCoordinates;
|
||||||
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;
|
||||||
|
@ -171,6 +172,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.file.FileUploadState;
|
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.geospatial.GeospatialCreateCoordinatesSession;
|
||||||
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;
|
||||||
|
@ -441,9 +443,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
valueF.getRegExpr());
|
valueF.getRegExpr());
|
||||||
valueDataFormats.add(valueDataFormat);
|
valueDataFormats.add(valueDataFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
columnDataTypeFormats.put(columnDataType, valueDataFormats);
|
columnDataTypeFormats.put(columnDataType, valueDataFormats);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("getValueDataFormats(): " + columnDataTypeFormats);
|
logger.debug("getValueDataFormats(): " + columnDataTypeFormats);
|
||||||
|
@ -488,7 +490,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
valueDataFormats.add(valueDataFormat);
|
valueDataFormats.add(valueDataFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("getValueDataFormatsOfColumnDataType(): ["+columnDataType+", "+ valueDataFormats+"]");
|
logger.debug("getValueDataFormatsOfColumnDataType(): ["
|
||||||
|
+ columnDataType + ", " + valueDataFormats + "]");
|
||||||
return valueDataFormats;
|
return valueDataFormats;
|
||||||
|
|
||||||
} catch (TDGWTServiceException e) {
|
} catch (TDGWTServiceException e) {
|
||||||
|
@ -497,7 +500,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("getValueDataFormatsOfColumnDataType(): " + e.getLocalizedMessage(), e);
|
logger.error(
|
||||||
|
"getValueDataFormatsOfColumnDataType(): "
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"Error retrieving value data formats: "
|
"Error retrieving value data formats: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
|
@ -8590,4 +8595,78 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String startGeospatialCreateCoordinates(
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.setGeospatialCreateCoordinatesSession(session,
|
||||||
|
geospatialCreateCoordinatesSession);
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
if (geospatialCreateCoordinatesSession == null) {
|
||||||
|
logger.error("GeospatialCreateCoordinatesSession is null");
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error creating geospatial coordinates: GeospatialCreateCoordinatesSession is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("StartGeospatialCreateCoordinates: "
|
||||||
|
+ geospatialCreateCoordinatesSession);
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
checkTRId(geospatialCreateCoordinatesSession.getTrId());
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(geospatialCreateCoordinatesSession.getTrId()
|
||||||
|
.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
|
||||||
|
checkTabularResourceIsFlow(tabularResource);
|
||||||
|
checkTabularResourceLocked(tabularResource);
|
||||||
|
checkTabularResourceIsFinal(tabularResource);
|
||||||
|
|
||||||
|
OpExecution4GeospatialCreateCoordinates opEx = new OpExecution4GeospatialCreateCoordinates(
|
||||||
|
aslSession, service, geospatialCreateCoordinatesSession);
|
||||||
|
OpExecutionDirector director = new OpExecutionDirector();
|
||||||
|
director.setOperationExecutionBuilder(opEx);
|
||||||
|
director.constructOperationExecution();
|
||||||
|
ArrayList<OperationExecution> invocations = director
|
||||||
|
.getListOperationExecution();
|
||||||
|
|
||||||
|
if (invocations == null) {
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in invocation: Operation not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("OperationInvocation: \n" + invocations.toString());
|
||||||
|
Task trTask = service.executeBatch(invocations, tabularResourceId);
|
||||||
|
logger.debug("Split Column on service: TaskId " + trTask.getId());
|
||||||
|
|
||||||
|
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||||
|
UIOperationsId.GeospatialCreateCoordinates,
|
||||||
|
geospatialCreateCoordinatesSession.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 creating geospatial coordinates: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
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.model.column.ColumnLocalId;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.column.ColumnReference;
|
||||||
|
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;
|
||||||
|
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.GeospatialCreateCoordinatesSession;
|
||||||
|
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.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 OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(OpExecution4GeospatialCreateCoordinates.class);
|
||||||
|
|
||||||
|
private TabularDataService service;
|
||||||
|
private GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession;
|
||||||
|
private ASLSession aslSession;
|
||||||
|
|
||||||
|
public OpExecution4GeospatialCreateCoordinates(
|
||||||
|
ASLSession aslSession, TabularDataService service,
|
||||||
|
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession) {
|
||||||
|
this.service = service;
|
||||||
|
this.geospatialCreateCoordinatesSession = geospatialCreateCoordinatesSession;
|
||||||
|
this.aslSession=aslSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildOpEx() throws TDGWTServiceException {
|
||||||
|
OperationExecution invocation = null;
|
||||||
|
|
||||||
|
logger.debug(geospatialCreateCoordinatesSession.toString());
|
||||||
|
OperationDefinition operationDefinition;
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
TRId trId = geospatialCreateCoordinatesSession.getTrId();
|
||||||
|
logger.debug("trID: " + trId);
|
||||||
|
if(trId==null){
|
||||||
|
logger.error("Error Creating Geospatial Coordinates: trId is null");
|
||||||
|
throw new TDGWTServiceException("No tabular resource set");
|
||||||
|
}
|
||||||
|
|
||||||
|
long tabId;
|
||||||
|
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){
|
||||||
|
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){
|
||||||
|
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);
|
||||||
|
|
||||||
|
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().toString());
|
||||||
|
map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER, aslSession.getUsername());
|
||||||
|
|
||||||
|
invocation = new OperationExecution(
|
||||||
|
operationDefinition.getOperationId(), map);
|
||||||
|
|
||||||
|
|
||||||
|
operationExecutionSpec.setOp(invocation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -83,14 +83,6 @@ public class Constants {
|
||||||
public static final String PARAMETER_TABLE_TYPE = "tableType";
|
public static final String PARAMETER_TABLE_TYPE = "tableType";
|
||||||
|
|
||||||
public static final String PARAMETER_ROW_ID = "rowId";
|
public static final String PARAMETER_ROW_ID = "rowId";
|
||||||
|
|
||||||
public static final String REQUEST_PROPERTIES_INVOCATIONS = "InvocationS";
|
|
||||||
public static final String REQUEST_PROPERTIES_REFCOLUMN = "RefColumn";
|
|
||||||
public static final String REQUEST_PROPERTIES_COLUMNID = "ColumnId";
|
|
||||||
public static final String REQUEST_PROPERTIES_TASKID = "TaskId";
|
|
||||||
public static final String REQUEST_PROPERTIES_CONDITIONCODE = "ConditionCode";
|
|
||||||
public static final String REQUEST_PROPERTIES_VALIDATIONCOLUMNCOLUMNID = "ValidationColumnColumnId";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String PARAMETER_ADD_COLUMN_COLUMN_TYPE = "columnType";
|
public static final String PARAMETER_ADD_COLUMN_COLUMN_TYPE = "columnType";
|
||||||
public static final String PARAMETER_ADD_COLUMN_LABEL = "label";
|
public static final String PARAMETER_ADD_COLUMN_LABEL = "label";
|
||||||
|
@ -119,6 +111,8 @@ public class Constants {
|
||||||
public static final String PARAMETER_CHART_TOPRATING_SAMPLESIZE = "sampleSize";
|
public static final String PARAMETER_CHART_TOPRATING_SAMPLESIZE = "sampleSize";
|
||||||
public static final String PARAMETER_CHART_TOPRATING_VALUEOPERATION = "valueOperation";
|
public static final String PARAMETER_CHART_TOPRATING_VALUEOPERATION = "valueOperation";
|
||||||
|
|
||||||
|
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_USER = "user";
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
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.GeospatialCoordinatesType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GeospatialCreateCoordinatesSession implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7962959445625100578L;
|
||||||
|
private TRId trId;
|
||||||
|
private ColumnData latitude;
|
||||||
|
private ColumnData longitude;
|
||||||
|
private GeospatialCoordinatesType type;
|
||||||
|
|
||||||
|
public GeospatialCreateCoordinatesSession() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @param latitude
|
||||||
|
* @param longitude
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
public GeospatialCreateCoordinatesSession(TRId trId, ColumnData latitude,
|
||||||
|
ColumnData longitude, GeospatialCoordinatesType type) {
|
||||||
|
super();
|
||||||
|
this.trId = trId;
|
||||||
|
this.latitude = latitude;
|
||||||
|
this.longitude = longitude;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TRId getTrId() {
|
||||||
|
return trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrId(TRId trId) {
|
||||||
|
this.trId = trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnData getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(ColumnData latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnData getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(ColumnData longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeospatialCoordinatesType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(GeospatialCoordinatesType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CreateGeospatialCoordinatesSession [trId=" + trId
|
||||||
|
+ ", latitude=" + latitude + ", longitude=" + longitude
|
||||||
|
+ ", type=" + type + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue