Updated Map Creation

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100660 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-10-14 09:17:30 +00:00
parent 85c84f41db
commit 58c8ec54bf
3 changed files with 42 additions and 15 deletions

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.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.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
@ -78,10 +79,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;
@ -89,7 +90,7 @@ public class SessionUtil {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
session.setScope(scope);
*/
} else {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);

View File

@ -1,16 +1,21 @@
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
import java.util.ArrayList;
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.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.OperationsId;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -28,28 +33,49 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
private TabularDataService service;
private MapCreationSession mapCreationSession;
public OpExecution4MapCreation(TabularDataService service,
MapCreationSession mapCreationSession) {
this.service = service;
this.mapCreationSession = mapCreationSession;
this.mapCreationSession = mapCreationSession;
}
@Override
public void buildOpEx() throws TDGWTServiceException {
logger.debug(mapCreationSession.toString());
logger.debug(mapCreationSession.toString());
OperationDefinition operationDefinition;
operationDefinition = OperationDefinitionMap.map(
OperationsId.GenerateMap.toString(), service);
Map<String, Object> map = new HashMap<String, Object>();
ArrayList<ColumnData> fut = mapCreationSession.getFeature();
ArrayList<ColumnReference> futures = new ArrayList<ColumnReference>();
String tableIdS = null;
if (mapCreationSession.getTrId().isViewTable()) {
tableIdS = mapCreationSession.getTrId().getReferenceTargetTableId();
} else {
tableIdS = mapCreationSession.getTrId().getTableId();
}
TableId tableId = new TableId(Long.valueOf(tableIdS));
for (ColumnData c : fut) {
ColumnLocalId columnId = new ColumnLocalId(c.getColumnId());
ColumnReference columnRef = new ColumnReference(tableId, columnId);
futures.add(columnRef);
}
ColumnLocalId columnGeometryId = new ColumnLocalId(mapCreationSession
.getGeometry().getColumnId());
ColumnReference columnGeometryRef = new ColumnReference(tableId,
columnGeometryId);
map.put(Constants.PARAMETER_GENERATEMAP_MAPNAME,
mapCreationSession.getName());
map.put(Constants.PARAMETER_GENERATEMAP_FEATURE,
mapCreationSession.getFeature());
map.put(Constants.PARAMETER_GENERATEMAP_USEVIEW,
mapCreationSession.isUseView());
map.put(Constants.PARAMETER_GENERATEMAP_FEATURE, futures);
map.put(Constants.PARAMETER_GENERATEMAP_GEOM, columnGeometryRef);
map.put(Constants.PARAMETER_GENERATEMAP_USEVIEW, new Boolean(
mapCreationSession.isUseView()));
map.put(Constants.PARAMETER_GENERATEMAP_METAABSTRACT,
mapCreationSession.getMetaAbstract());
map.put(Constants.PARAMETER_GENERATEMAP_METAPURPOSE,
@ -60,11 +86,10 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
mapCreationSession.getMetaCredits());
map.put(Constants.PARAMETER_GENERATEMAP_METAKEYWORDS,
mapCreationSession.getMetaKeywords());
OperationExecution invocation = new OperationExecution(
operationDefinition.getOperationId(), map);
operationExecutionSpec.setOp(invocation);
}

View File

@ -101,6 +101,7 @@ public class Constants {
public static final String PARAMETER_GENERATEMAP_MAPNAME = "mapName";
public static final String PARAMETER_GENERATEMAP_FEATURE = "feature";
public static final String PARAMETER_GENERATEMAP_GEOM = "geom";
public static final String PARAMETER_GENERATEMAP_USEVIEW = "useView";
public static final String PARAMETER_GENERATEMAP_METAABSTRACT = "metaAbstract";
public static final String PARAMETER_GENERATEMAP_METAPURPOSE = "metaPurpose";