Updated to new PortalContext

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@141688 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-01-20 18:16:33 +00:00
parent ef992b212e
commit 27b7851227
2 changed files with 26 additions and 21 deletions

View File

@ -3,7 +3,6 @@ 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;
@ -12,6 +11,7 @@ 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;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
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;
@ -34,15 +34,15 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder
private TabularDataService service;
private GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession;
private ASLSession aslSession;
private ServiceCredentials serviceCredentials;
public OpExecution4GeospatialCreateCoordinates(
ASLSession aslSession,
ServiceCredentials serviceCredentials,
TabularDataService service,
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession) {
this.service = service;
this.geospatialCreateCoordinatesSession = geospatialCreateCoordinatesSession;
this.aslSession = aslSession;
this.serviceCredentials = serviceCredentials;
}
@Override
@ -101,7 +101,7 @@ public class OpExecution4GeospatialCreateCoordinates extends OpExecutionBuilder
longitudeColumnReference);
map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_USER,
aslSession.getUsername());
serviceCredentials.getUserName());
map.put(Constants.PARAMETER_GEOSPATIAL_CREATE_COORDINATES_RESOLUTION,
new TDNumeric(geospatialCreateCoordinatesSession.getResolution()));

View File

@ -3,13 +3,14 @@ package org.gcube.portlets.user.td.gwtservice.server.opexecution;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
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.SessionUtil;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
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.json.JSONExportSession;
@ -28,41 +29,45 @@ public class OpExecution4JSONExport extends OpExecutionBuilder {
protected static Logger logger = LoggerFactory
.getLogger(OpExecution4JSONExport.class);
private HttpSession session;
private HttpServletRequest httpRequest;
private ServiceCredentials serviceCredentials;
private TabularDataService service;
private JSONExportSession jsonExportSession;
public OpExecution4JSONExport(HttpSession session, TabularDataService service,
public OpExecution4JSONExport(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials, TabularDataService service,
JSONExportSession jsonExportSession) {
this.service = service;
this.jsonExportSession = jsonExportSession;
this.session=session;
this.httpRequest = httpRequest;
this.serviceCredentials = serviceCredentials;
}
@Override
public void buildOpEx() throws TDGWTServiceException {
logger.debug(jsonExportSession.toString());
SessionUtil.setJSONExportEnd(session, false);
logger.debug(jsonExportSession.toString());
SessionUtil.setJSONExportEnd(httpRequest, serviceCredentials, false);
OperationDefinition operationDefinition;
operationDefinition = OperationDefinitionMap.map(
OperationsId.JSONExport.toString(), service);
Map<String, Object> map = new HashMap<String, Object>();
map.put(Constants.PARAMETER_RESOURCE_NAME, jsonExportSession.getFileName());
map.put(Constants.PARAMETER_RESOURCE_DESCRIPTION, jsonExportSession.getFileDescription());
map.put(Constants.PARAMETER_RESOURCE_NAME,
jsonExportSession.getFileName());
map.put(Constants.PARAMETER_RESOURCE_DESCRIPTION,
jsonExportSession.getFileDescription());
map.put(Constants.PARAMETER_VIEW_COLUMNS,
jsonExportSession.isExportViewColumns());
map.put(Constants.PARAMETER_COLUMNS,
jsonExportSession.getColumnsAsString());
OperationExecution invocation = new OperationExecution(
operationDefinition.getOperationId(), map);
operationExecutionSpec.setOp(invocation);
}