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.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.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;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
@ -78,10 +79,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;
@ -89,7 +90,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);

View File

@ -1,16 +1,21 @@
package org.gcube.portlets.user.td.gwtservice.server.opexecution; package org.gcube.portlets.user.td.gwtservice.server.opexecution;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; 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.OperationDefinition;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution; 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.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap; 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.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId; 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.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -28,7 +33,6 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
private TabularDataService service; private TabularDataService service;
private MapCreationSession mapCreationSession; private MapCreationSession mapCreationSession;
public OpExecution4MapCreation(TabularDataService service, public OpExecution4MapCreation(TabularDataService service,
MapCreationSession mapCreationSession) { MapCreationSession mapCreationSession) {
this.service = service; this.service = service;
@ -44,12 +48,34 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
OperationsId.GenerateMap.toString(), service); OperationsId.GenerateMap.toString(), service);
Map<String, Object> map = new HashMap<String, Object>(); 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, map.put(Constants.PARAMETER_GENERATEMAP_MAPNAME,
mapCreationSession.getName()); mapCreationSession.getName());
map.put(Constants.PARAMETER_GENERATEMAP_FEATURE, map.put(Constants.PARAMETER_GENERATEMAP_FEATURE, futures);
mapCreationSession.getFeature()); map.put(Constants.PARAMETER_GENERATEMAP_GEOM, columnGeometryRef);
map.put(Constants.PARAMETER_GENERATEMAP_USEVIEW, map.put(Constants.PARAMETER_GENERATEMAP_USEVIEW, new Boolean(
mapCreationSession.isUseView()); mapCreationSession.isUseView()));
map.put(Constants.PARAMETER_GENERATEMAP_METAABSTRACT, map.put(Constants.PARAMETER_GENERATEMAP_METAABSTRACT,
mapCreationSession.getMetaAbstract()); mapCreationSession.getMetaAbstract());
map.put(Constants.PARAMETER_GENERATEMAP_METAPURPOSE, map.put(Constants.PARAMETER_GENERATEMAP_METAPURPOSE,
@ -61,7 +87,6 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
map.put(Constants.PARAMETER_GENERATEMAP_METAKEYWORDS, map.put(Constants.PARAMETER_GENERATEMAP_METAKEYWORDS,
mapCreationSession.getMetaKeywords()); mapCreationSession.getMetaKeywords());
OperationExecution invocation = new OperationExecution( OperationExecution invocation = new OperationExecution(
operationDefinition.getOperationId(), map); operationDefinition.getOperationId(), map);

View File

@ -101,6 +101,7 @@ public class Constants {
public static final String PARAMETER_GENERATEMAP_MAPNAME = "mapName"; public static final String PARAMETER_GENERATEMAP_MAPNAME = "mapName";
public static final String PARAMETER_GENERATEMAP_FEATURE = "feature"; 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_USEVIEW = "useView";
public static final String PARAMETER_GENERATEMAP_METAABSTRACT = "metaAbstract"; public static final String PARAMETER_GENERATEMAP_METAABSTRACT = "metaAbstract";
public static final String PARAMETER_GENERATEMAP_METAPURPOSE = "metaPurpose"; public static final String PARAMETER_GENERATEMAP_METAPURPOSE = "metaPurpose";