Minor update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100622 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
26bb4951b1
commit
af19d456e2
|
@ -18,6 +18,7 @@ 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;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
|
@ -929,4 +930,15 @@ public interface TDGWTService extends RemoteService {
|
|||
public ArrayList<ResourceTDDescriptor> getResourcesTDByType(TRId trId,
|
||||
ResourceTDType resourceTDType) throws TDGWTServiceException;
|
||||
|
||||
// GIS MAP
|
||||
/**
|
||||
* Start Map Creation and invokes the client library
|
||||
*
|
||||
* @param mapCreationSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public String startMapCreation(MapCreationSession mapCreationSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ 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;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
|
@ -341,6 +342,7 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
|
||||
//GIS MAP
|
||||
|
||||
void startMapCreation(MapCreationSession mapCreationSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ public class SessionConstants {
|
|||
|
||||
protected static final String DUPLICATES_ROWS_SESSION = "DUPLICATES_ROWS_SESSION";
|
||||
|
||||
protected static final String MAP_CREATION_SESSION = "MAP_CREATION_SESSION";
|
||||
|
||||
protected static final String TEMPLATE_APPLY_SESSION = "TEMPLATE_APPLY_SESSION";
|
||||
|
||||
protected static final String CODELISTS_PAGING_LOADED = "CODELISTS_PAGING_LOADED";
|
||||
|
|
|
@ -25,6 +25,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.history.RollBackSession;
|
||||
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.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
|
@ -81,14 +82,13 @@ public class SessionUtil {
|
|||
|
||||
// Remove comment for Test
|
||||
/*
|
||||
username = Constants.DEFAULT_USER;
|
||||
String scope = Constants.DEFAULT_SCOPE;
|
||||
|
||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
session.setScope(scope);
|
||||
*/
|
||||
* username = Constants.DEFAULT_USER; String scope =
|
||||
* Constants.DEFAULT_SCOPE;
|
||||
*
|
||||
* httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE,
|
||||
* username); session = SessionManager.getInstance().getASLSession(
|
||||
* httpSession.getId(), username); session.setScope(scope);
|
||||
*/
|
||||
} else {
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
|
@ -1305,6 +1305,36 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
// /
|
||||
|
||||
public static MapCreationSession getMapCreationSession(
|
||||
HttpSession httpSession) {
|
||||
MapCreationSession mapCreationSession = (MapCreationSession) httpSession
|
||||
.getAttribute(SessionConstants.MAP_CREATION_SESSION);
|
||||
if (mapCreationSession != null) {
|
||||
return mapCreationSession;
|
||||
} else {
|
||||
mapCreationSession = new MapCreationSession();
|
||||
httpSession.setAttribute(SessionConstants.MAP_CREATION_SESSION,
|
||||
mapCreationSession);
|
||||
return mapCreationSession;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setMapCreationSession(HttpSession httpSession,
|
||||
MapCreationSession mapCreationSession) {
|
||||
MapCreationSession mapC = (MapCreationSession) httpSession
|
||||
.getAttribute(SessionConstants.MAP_CREATION_SESSION);
|
||||
if (mapC != null) {
|
||||
httpSession.removeAttribute(SessionConstants.MAP_CREATION_SESSION);
|
||||
}
|
||||
httpSession.setAttribute(SessionConstants.MAP_CREATION_SESSION,
|
||||
mapCreationSession);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static TaskWrapper getStartedTask(HttpSession httpSession,
|
||||
String taskId) {
|
||||
TaskWrapper taskWrapper = null;
|
||||
|
|
|
@ -123,6 +123,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Filt
|
|||
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;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4MapCreation;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4MergeColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Normalization;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceBatch;
|
||||
|
@ -161,6 +162,7 @@ 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;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorCreator;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
|
@ -6764,6 +6766,57 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startMapCreation(MapCreationSession mapCreationSession)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.setMapCreationSession(session, mapCreationSession);
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, mapCreationSession.getTrId());
|
||||
|
||||
|
||||
OpExecution4MapCreation opEx = new OpExecution4MapCreation(service,
|
||||
mapCreationSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error Delete Rows invocation: Operation not supported");
|
||||
}
|
||||
|
||||
TabularResourceId serviceTR = new TabularResourceId(
|
||||
Long.valueOf(mapCreationSession.getTrId().getId()));
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, serviceTR);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||
UIOperationsId.GenerateMap, mapCreationSession.getTrId());
|
||||
SessionUtil.setStartedTask(session, taskWrapper);
|
||||
|
||||
return trTask.getId().getValue();
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error creating the map: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class OpExecution4MapCreation extends OpExecutionBuilder {
|
|||
map.put(Constants.PARAMETER_GENERATEMAP_METACREDITS,
|
||||
mapCreationSession.getMetaCredits());
|
||||
map.put(Constants.PARAMETER_GENERATEMAP_METAKEYWORDS,
|
||||
mapCreationSession.getMetaKewords());
|
||||
mapCreationSession.getMetaKeywords());
|
||||
|
||||
|
||||
OperationExecution invocation = new OperationExecution(
|
||||
|
|
|
@ -95,7 +95,8 @@ public enum UIOperationsId {
|
|||
ResumeTask("Resume Task"),
|
||||
ResubmitTask("ResubmitTask"),
|
||||
RollBack("Roll Back"),
|
||||
ApplyTemplate("Apply Template");
|
||||
ApplyTemplate("Apply Template"),
|
||||
GenerateMap("Generate Map");
|
||||
|
||||
/**
|
||||
* @param text
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -18,6 +19,7 @@ public class MapCreationSession implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 2648327461965415567L;
|
||||
|
||||
private TRId trId;
|
||||
private String name;
|
||||
private ArrayList<ColumnData> feature;
|
||||
private boolean useView;
|
||||
|
@ -26,14 +28,15 @@ public class MapCreationSession implements Serializable {
|
|||
private String metaAbstract;
|
||||
private String metaPurpose;
|
||||
private String metaCredits;
|
||||
private ArrayList<String> metaKewords;
|
||||
private ArrayList<String> metaKeywords;
|
||||
|
||||
public MapCreationSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
* @param name
|
||||
* @param feature
|
||||
* @param useView
|
||||
|
@ -42,13 +45,15 @@ public class MapCreationSession implements Serializable {
|
|||
* @param metaAbstract
|
||||
* @param metaPurpose
|
||||
* @param metaCredits
|
||||
* @param metaKewords
|
||||
* @param metaKeywords
|
||||
*/
|
||||
public MapCreationSession(String name, ArrayList<ColumnData> feature,
|
||||
boolean useView, ColumnData geometry, String username,
|
||||
String metaAbstract, String metaPurpose, String metaCredits,
|
||||
ArrayList<String> metaKewords) {
|
||||
public MapCreationSession(TRId trId, String name,
|
||||
ArrayList<ColumnData> feature, boolean useView,
|
||||
ColumnData geometry, String username, String metaAbstract,
|
||||
String metaPurpose, String metaCredits,
|
||||
ArrayList<String> metaKeywords) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
this.name = name;
|
||||
this.feature = feature;
|
||||
this.useView = useView;
|
||||
|
@ -57,7 +62,15 @@ public class MapCreationSession implements Serializable {
|
|||
this.metaAbstract = metaAbstract;
|
||||
this.metaPurpose = metaPurpose;
|
||||
this.metaCredits = metaCredits;
|
||||
this.metaKewords = metaKewords;
|
||||
this.metaKeywords = metaKeywords;
|
||||
}
|
||||
|
||||
public TRId getTrId() {
|
||||
return trId;
|
||||
}
|
||||
|
||||
public void setTrId(TRId trId) {
|
||||
this.trId = trId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -124,21 +137,22 @@ public class MapCreationSession implements Serializable {
|
|||
this.metaCredits = metaCredits;
|
||||
}
|
||||
|
||||
public ArrayList<String> getMetaKewords() {
|
||||
return metaKewords;
|
||||
public ArrayList<String> getMetaKeywords() {
|
||||
return metaKeywords;
|
||||
}
|
||||
|
||||
public void setMetaKewords(ArrayList<String> metaKewords) {
|
||||
this.metaKewords = metaKewords;
|
||||
public void setMetaKeywords(ArrayList<String> metaKeywords) {
|
||||
this.metaKeywords = metaKeywords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MapCreationSession [name=" + name + ", feature=" + feature
|
||||
+ ", useView=" + useView + ", geometry=" + geometry
|
||||
+ ", username=" + username + ", metaAbstract=" + metaAbstract
|
||||
+ ", metaPurpose=" + metaPurpose + ", metaCredits="
|
||||
+ metaCredits + ", metaKewords=" + metaKewords + "]";
|
||||
return "MapCreationSession [trId=" + trId + ", name=" + name
|
||||
+ ", feature=" + feature + ", useView=" + useView
|
||||
+ ", geometry=" + geometry + ", username=" + username
|
||||
+ ", metaAbstract=" + metaAbstract + ", metaPurpose="
|
||||
+ metaPurpose + ", metaCredits=" + metaCredits
|
||||
+ ", metaKeywords=" + metaKeywords + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue