Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@91293 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e018f0f86c
commit
ed61005813
|
@ -22,6 +22,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnMonitor;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
||||||
|
@ -367,7 +369,7 @@ public interface TDGWTService extends RemoteService {
|
||||||
public void startSDMXExport(SDMXExportSession exportSession)
|
public void startSDMXExport(SDMXExportSession exportSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
// Change Column Type
|
//Column Operation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Operation Monitor during the Change Column Type operation
|
* Get Operation Monitor during the Change Column Type operation
|
||||||
|
@ -388,4 +390,27 @@ public interface TDGWTService extends RemoteService {
|
||||||
ChangeColumnTypeSession changeColumnTypeSession)
|
ChangeColumnTypeSession changeColumnTypeSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Operation Monitor during the Delete Column operation
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public DeleteColumnMonitor getDeleteColumnMonitor()
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start delete column
|
||||||
|
*
|
||||||
|
* @param changeColumnTypeSession
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public void startDeleteColumn(
|
||||||
|
DeleteColumnSession deleteColumnSession)
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
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.sdmx.SDMXExportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
|
||||||
|
@ -21,6 +22,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnMonitor;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
||||||
|
@ -127,8 +130,10 @@ public interface TDGWTServiceAsync {
|
||||||
void startSDMXExport(SDMXExportSession exportSession, AsyncCallback<Void> callback);
|
void startSDMXExport(SDMXExportSession exportSession, AsyncCallback<Void> callback);
|
||||||
|
|
||||||
|
|
||||||
//Change Column Type
|
//Column Operation
|
||||||
void getChangeColumnTypeMonitor(AsyncCallback<ChangeColumnTypeMonitor> callback);
|
void getChangeColumnTypeMonitor(AsyncCallback<ChangeColumnTypeMonitor> callback);
|
||||||
void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession,AsyncCallback<Void> callback);
|
void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession,AsyncCallback<Void> callback);
|
||||||
|
void getDeleteColumnMonitor(AsyncCallback<DeleteColumnMonitor> callback);
|
||||||
|
void startDeleteColumn(DeleteColumnSession deleteColumnSession,AsyncCallback<Void> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ 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.sdmx.SDMXImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnMonitor;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||||
|
@ -72,10 +74,19 @@ public class SessionUtil {
|
||||||
protected static final String CHANGE_COLUMN_TYPE_MONITOR = "CHANGE_COLUMN_TYPE_MONITOR";
|
protected static final String CHANGE_COLUMN_TYPE_MONITOR = "CHANGE_COLUMN_TYPE_MONITOR";
|
||||||
protected static final String CHANGE_COLUMN_TYPE_TASK = "CHANGE_COLUMN_TYPE_TASK";
|
protected static final String CHANGE_COLUMN_TYPE_TASK = "CHANGE_COLUMN_TYPE_TASK";
|
||||||
|
|
||||||
|
protected static final String DELETE_COLUMN_SESSION = "DELETE_COLUMN_SESSION";
|
||||||
|
protected static final String DELETE_COLUMN_MONITOR = "DELETE_COLUMN_MONITOR";
|
||||||
|
protected static final String DELETE_COLUMN_TASK = "DELETE_COLUMN_TASK";
|
||||||
|
|
||||||
|
|
||||||
protected static final String CODELISTS_PAGING_LOADED = "CODELISTS_PAGING_LOADED";
|
protected static final String CODELISTS_PAGING_LOADED = "CODELISTS_PAGING_LOADED";
|
||||||
protected static final String CODELISTS_PAGING_LOADED_DIRECTION = "CODELISTS_PAGING_LOADED_DIRECTION";
|
protected static final String CODELISTS_PAGING_LOADED_DIRECTION = "CODELISTS_PAGING_LOADED_DIRECTION";
|
||||||
protected static final String CODELISTS_PAGING_LOADED_FILTER = "CODELISTS_PAGING_LOADED_FILTER";
|
protected static final String CODELISTS_PAGING_LOADED_FILTER = "CODELISTS_PAGING_LOADED_FILTER";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
protected static ASLSession getAslSession(HttpSession httpSession) {
|
protected static ASLSession getAslSession(HttpSession httpSession) {
|
||||||
|
@ -508,7 +519,8 @@ public class SessionUtil {
|
||||||
httpSession.setAttribute(TR_TASK_MANAGER, trTasksManager);
|
httpSession.setAttribute(TR_TASK_MANAGER, trTasksManager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
public static ChangeColumnTypeSession getChangeColumnTypeSession(
|
public static ChangeColumnTypeSession getChangeColumnTypeSession(
|
||||||
HttpSession httpSession) {
|
HttpSession httpSession) {
|
||||||
ChangeColumnTypeSession changeColumnTypeSession = (ChangeColumnTypeSession) httpSession
|
ChangeColumnTypeSession changeColumnTypeSession = (ChangeColumnTypeSession) httpSession
|
||||||
|
@ -576,7 +588,78 @@ public class SessionUtil {
|
||||||
httpSession.removeAttribute(CHANGE_COLUMN_TYPE_TASK);
|
httpSession.removeAttribute(CHANGE_COLUMN_TYPE_TASK);
|
||||||
httpSession.setAttribute(CHANGE_COLUMN_TYPE_TASK, task);
|
httpSession.setAttribute(CHANGE_COLUMN_TYPE_TASK, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
public static DeleteColumnSession getDeleteColumnSession(
|
||||||
|
HttpSession httpSession) {
|
||||||
|
DeleteColumnSession deleteColumnSession = (DeleteColumnSession) httpSession
|
||||||
|
.getAttribute(DELETE_COLUMN_SESSION);
|
||||||
|
if (deleteColumnSession != null) {
|
||||||
|
return deleteColumnSession;
|
||||||
|
} else {
|
||||||
|
deleteColumnSession = new DeleteColumnSession();
|
||||||
|
httpSession.setAttribute(DELETE_COLUMN_SESSION,
|
||||||
|
deleteColumnSession);
|
||||||
|
return deleteColumnSession;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDeleteColumnSession(HttpSession httpSession,
|
||||||
|
DeleteColumnSession deleteColumnSession) {
|
||||||
|
DeleteColumnSession dc = (DeleteColumnSession) httpSession
|
||||||
|
.getAttribute(DELETE_COLUMN_SESSION);
|
||||||
|
if (dc != null) {
|
||||||
|
httpSession.removeAttribute(DELETE_COLUMN_SESSION);
|
||||||
|
}
|
||||||
|
httpSession.setAttribute(DELETE_COLUMN_SESSION,
|
||||||
|
deleteColumnSession);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeleteColumnMonitor getDeleteColumnMonitor(
|
||||||
|
HttpSession httpSession) {
|
||||||
|
DeleteColumnMonitor deleteColumnMonitor = (DeleteColumnMonitor) httpSession
|
||||||
|
.getAttribute(DELETE_COLUMN_MONITOR);
|
||||||
|
if (deleteColumnMonitor != null) {
|
||||||
|
return deleteColumnMonitor;
|
||||||
|
} else {
|
||||||
|
deleteColumnMonitor = new DeleteColumnMonitor();
|
||||||
|
httpSession.setAttribute(DELETE_COLUMN_MONITOR,
|
||||||
|
deleteColumnMonitor);
|
||||||
|
return deleteColumnMonitor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDeleteColumnMonitor(HttpSession httpSession,
|
||||||
|
DeleteColumnMonitor deleteColumnMonitor) {
|
||||||
|
DeleteColumnMonitor cm = (DeleteColumnMonitor) httpSession
|
||||||
|
.getAttribute(DELETE_COLUMN_MONITOR);
|
||||||
|
if (cm != null) {
|
||||||
|
httpSession.removeAttribute(DELETE_COLUMN_MONITOR);
|
||||||
|
}
|
||||||
|
httpSession.setAttribute(DELETE_COLUMN_MONITOR,
|
||||||
|
deleteColumnMonitor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task getDeleteColumnTask(HttpSession httpSession) {
|
||||||
|
Task monitor = (Task) httpSession.getAttribute(DELETE_COLUMN_TASK);
|
||||||
|
if (monitor == null) {
|
||||||
|
logger.error("DELETE_COLUMN_TASK was not acquired");
|
||||||
|
}
|
||||||
|
return monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDeleteColumnTask(HttpSession httpSession,
|
||||||
|
Task task) {
|
||||||
|
Task monitor = (Task) httpSession.getAttribute(DELETE_COLUMN_TASK);
|
||||||
|
if (monitor != null)
|
||||||
|
httpSession.removeAttribute(DELETE_COLUMN_TASK);
|
||||||
|
httpSession.setAttribute(DELETE_COLUMN_TASK, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
public static ArrayList<TabResource> getCodelistsPagingLoaded(
|
public static ArrayList<TabResource> getCodelistsPagingLoaded(
|
||||||
HttpSession httpSession) {
|
HttpSession httpSession) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -92,6 +92,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnMonitor;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRAgencyMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRAgencyMetadata;
|
||||||
|
@ -127,6 +129,7 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
import org.gcube.common.resources.gcore.utils.Group;
|
import org.gcube.common.resources.gcore.utils.Group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi" <a
|
* @author "Giancarlo Panichi" <a
|
||||||
|
@ -975,9 +978,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
OperationInterface oService = service;
|
|
||||||
TabularResourceInterface trService = service;
|
|
||||||
|
|
||||||
List<OperationDefinition> capabilities = service.getCapabilities();
|
List<OperationDefinition> capabilities = service.getCapabilities();
|
||||||
|
|
||||||
// Import SDMX Codelist takes id 200
|
// Import SDMX Codelist takes id 200
|
||||||
|
@ -987,7 +987,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabResource sdmxImportTabResource = sdmxImportSession
|
TabResource sdmxImportTabResource = sdmxImportSession
|
||||||
.getTabResource();
|
.getTabResource();
|
||||||
|
|
||||||
TabularResource serviceTR = trService.createTabularResource();
|
TabularResource serviceTR = service.createTabularResource();
|
||||||
|
|
||||||
syncTRMetaData(serviceTR, sdmxImportTabResource);
|
syncTRMetaData(serviceTR, sdmxImportTabResource);
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
parameterInstance);
|
parameterInstance);
|
||||||
|
|
||||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||||
Task trTask = oService.execute(invocation, serviceTR.getId());
|
Task trTask = service.execute(invocation, serviceTR.getId());
|
||||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||||
SessionUtil.setSDMXImportTask(session, trTask);
|
SessionUtil.setSDMXImportTask(session, trTask);
|
||||||
return;
|
return;
|
||||||
|
@ -1881,50 +1881,53 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
protected Map<String, Object> sdmxExportParameter(
|
protected Map<String, Object> sdmxExportParameter(
|
||||||
SDMXExportSession exportSession) throws TDGWTServiceException {
|
SDMXExportSession exportSession) throws TDGWTServiceException {
|
||||||
boolean internalRegistry = false;
|
boolean internalRegistry = false;
|
||||||
String destination=null;//Es: http://pc-fortunati.isti.cnr.it:8080/FusionRegistry/ws/rest/
|
String destination = null;// Es:
|
||||||
|
// http://pc-fortunati.isti.cnr.it:8080/FusionRegistry/ws/rest/
|
||||||
|
|
||||||
if (exportSession != null) {
|
if (exportSession != null) {
|
||||||
if (exportSession.getRegistryBaseUrl() != null
|
if (exportSession.getRegistryBaseUrl() != null
|
||||||
&& !exportSession.getRegistryBaseUrl().isEmpty()) {
|
&& !exportSession.getRegistryBaseUrl().isEmpty()) {
|
||||||
destination= exportSession.getRegistryBaseUrl();
|
destination = exportSession.getRegistryBaseUrl();
|
||||||
} else {
|
} else {
|
||||||
internalRegistry = true;
|
internalRegistry = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
internalRegistry = true;
|
internalRegistry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(internalRegistry){
|
if (internalRegistry) {
|
||||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'").addCondition("$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'")
|
||||||
|
.addCondition(
|
||||||
|
"$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
||||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
List<ServiceEndpoint> listService=client.submit(query);
|
List<ServiceEndpoint> listService = client.submit(query);
|
||||||
if(listService.size()>0){
|
if (listService.size() > 0) {
|
||||||
ServiceEndpoint serviceEnd=listService.get(0);
|
ServiceEndpoint serviceEnd = listService.get(0);
|
||||||
if(serviceEnd!=null){
|
if (serviceEnd != null) {
|
||||||
Profile prof=serviceEnd.profile();
|
Profile prof = serviceEnd.profile();
|
||||||
Group<AccessPoint> groupA=prof.accessPoints();
|
Group<AccessPoint> groupA = prof.accessPoints();
|
||||||
for(AccessPoint acc: groupA){
|
for (AccessPoint acc : groupA) {
|
||||||
if(acc.description().compareTo("REST Interface v2.1")==0){
|
if (acc.description().compareTo("REST Interface v2.1") == 0) {
|
||||||
destination=acc.address();
|
destination = acc.address();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(destination==null){
|
if (destination == null) {
|
||||||
logger.debug("Destination: "+destination);
|
logger.debug("Destination: " + destination);
|
||||||
throw new TDGWTServiceException("SDMX Service not discovered");
|
throw new TDGWTServiceException("SDMX Service not discovered");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> parameterInstances = new HashMap<String, Object>();
|
Map<String, Object> parameterInstances = new HashMap<String, Object>();
|
||||||
parameterInstances.put(Constants.PARAMETER_REGISTRYBASEURL,
|
parameterInstances
|
||||||
destination);
|
.put(Constants.PARAMETER_REGISTRYBASEURL, destination);
|
||||||
parameterInstances.put(Constants.PARAMETER_AGENCY, "SDMX");
|
parameterInstances.put(Constants.PARAMETER_AGENCY, "SDMX");
|
||||||
parameterInstances.put(Constants.PARAMETER_ID, "NEW_CL_DIVISION");
|
parameterInstances.put(Constants.PARAMETER_ID, "NEW_CL_DIVISION");
|
||||||
parameterInstances.put(Constants.PARAMETER_VERSION, "2.0");
|
parameterInstances.put(Constants.PARAMETER_VERSION, "2.0");
|
||||||
|
@ -2392,6 +2395,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
return invocation;
|
return invocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected OperationExecution retriveOperationExecution(
|
||||||
|
TabularDataService service, DeleteColumnSession deleteColumnSession)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
|
||||||
|
OperationExecution invocation = null;
|
||||||
|
List<OperationDefinition> capabilities = service.getCapabilities();
|
||||||
|
|
||||||
|
logger.debug(deleteColumnSession.toString());
|
||||||
|
OperationDefinition operationDefinition;
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
operationDefinition = getOperationDescriptorWithId(
|
||||||
|
OperationsId.RemoveColumn.toString(), capabilities);
|
||||||
|
|
||||||
|
invocation = new OperationExecution(deleteColumnSession
|
||||||
|
.getColumnData().getColumnId(),
|
||||||
|
operationDefinition.getOperationId(), map);
|
||||||
|
|
||||||
|
return invocation;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -2439,7 +2464,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
// ASLSession aslSession = SessionUtil.getAslSession(session);
|
|
||||||
ChangeColumnTypeSession changeColumnTypeSession = SessionUtil
|
ChangeColumnTypeSession changeColumnTypeSession = SessionUtil
|
||||||
.getChangeColumnTypeSession(session);
|
.getChangeColumnTypeSession(session);
|
||||||
|
|
||||||
|
@ -2526,4 +2550,135 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public void startDeleteColumn(DeleteColumnSession deleteColumnSession)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.setDeleteColumnSession(session, deleteColumnSession);
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
OperationExecution invocation = retriveOperationExecution(service,
|
||||||
|
deleteColumnSession);
|
||||||
|
if (invocation == null) {
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in ChangeColumnType: Operation not supported for now!");
|
||||||
|
}
|
||||||
|
|
||||||
|
TabularResourceId serviceTR = new TabularResourceId(
|
||||||
|
Long.valueOf(deleteColumnSession.getColumnData().getTrId()
|
||||||
|
.getId()));
|
||||||
|
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||||
|
Task trTask = service.execute(invocation, serviceTR);
|
||||||
|
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||||
|
SessionUtil.setChangeColumnTypeTask(session, trTask);
|
||||||
|
return;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException("Error in ChangeColumnType: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public DeleteColumnMonitor getDeleteColumnMonitor()
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
DeleteColumnSession deleteColumnSession = SessionUtil
|
||||||
|
.getDeleteColumnSession(session);
|
||||||
|
|
||||||
|
Task task = SessionUtil.getDeleteColumnTask(session);
|
||||||
|
DeleteColumnMonitor deleteColumnMonitor = new DeleteColumnMonitor();
|
||||||
|
|
||||||
|
if (task == null) {
|
||||||
|
logger.debug("Task null");
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in ChangeColumnType task null");
|
||||||
|
} else {
|
||||||
|
TaskStatus status = task.getStatus();
|
||||||
|
if (status == null) {
|
||||||
|
logger.debug("Services TaskStatus : null");
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in ChangeColumnType Status null");
|
||||||
|
} else {
|
||||||
|
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||||
|
|
||||||
|
deleteColumnMonitor.setStatus(matchTaskState(task
|
||||||
|
.getStatus()));
|
||||||
|
switch (deleteColumnMonitor.getStatus()) {
|
||||||
|
case FAILED:
|
||||||
|
if (task.getResult() != null) {
|
||||||
|
logger.debug("Task exception:"
|
||||||
|
+ task.getErrorCause());
|
||||||
|
deleteColumnMonitor.setError(new Throwable(task
|
||||||
|
.getErrorCause()));
|
||||||
|
} else {
|
||||||
|
logger.debug("Task exception: Error In ChangeColumnType");
|
||||||
|
deleteColumnMonitor.setError(new Throwable(
|
||||||
|
"Error In ChangeColumnType"));
|
||||||
|
}
|
||||||
|
deleteColumnMonitor.setProgress(task.getProgress());
|
||||||
|
break;
|
||||||
|
case SUCCEDED:
|
||||||
|
logger.debug("Task Result:" + task.getResult());
|
||||||
|
deleteColumnMonitor.setProgress(task.getProgress());
|
||||||
|
Table table = task.getResult().getPrimaryTable();
|
||||||
|
logger.debug("Table retrived: " + table.toString());
|
||||||
|
TRId trId = new TRId();
|
||||||
|
trId.setId(deleteColumnSession.getColumnData()
|
||||||
|
.getTrId().getId());
|
||||||
|
trId.setTableId(String
|
||||||
|
.valueOf(table.getId().getValue()));
|
||||||
|
trId.setTableType(table.getTableType().getName());
|
||||||
|
deleteColumnMonitor.setTrId(trId);
|
||||||
|
TabResource tabResource = SessionUtil
|
||||||
|
.getTabResource(session);
|
||||||
|
tabResource.setTrId(trId);
|
||||||
|
SessionUtil.setTabResource(session, tabResource);
|
||||||
|
SessionUtil.setTRId(session, trId);
|
||||||
|
break;
|
||||||
|
case IN_PROGRESS:
|
||||||
|
deleteColumnMonitor.setProgress(task.getProgress());
|
||||||
|
break;
|
||||||
|
case VALIDATING_RULES:
|
||||||
|
deleteColumnMonitor.setProgress(task.getProgress());
|
||||||
|
break;
|
||||||
|
case ABORTED:
|
||||||
|
break;
|
||||||
|
case STOPPED:
|
||||||
|
deleteColumnMonitor.setError(new Throwable(
|
||||||
|
"Export Stopped on service"));
|
||||||
|
break;
|
||||||
|
case INITIALIZING:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SessionUtil.setChangeColumnTypeTask(session, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("DeleteColumnMonitor(): " + deleteColumnMonitor);
|
||||||
|
return deleteColumnMonitor;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in delete column monitor DeleteColumnMonitor: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OperationMonitor implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5378053063599667767L;
|
||||||
|
|
||||||
|
protected float progress;
|
||||||
|
protected State status;
|
||||||
|
protected String statusDescription;
|
||||||
|
protected Throwable error;
|
||||||
|
protected TRId trId;
|
||||||
|
protected String columnName;
|
||||||
|
|
||||||
|
public float getProgress(){
|
||||||
|
return progress;
|
||||||
|
};
|
||||||
|
|
||||||
|
public State getStatus(){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusDescription(){
|
||||||
|
return statusDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(float progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(State status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = State.values()[status];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setStatusDescription(String statusDescription) {
|
||||||
|
this.statusDescription = statusDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Throwable getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(Throwable error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TRId getTrId() {
|
||||||
|
return trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrId(TRId trId) {
|
||||||
|
this.trId = trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColumnName() {
|
||||||
|
return columnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnName(String columnName) {
|
||||||
|
this.columnName = columnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ChangeColumnTypeMonitor [progress=" + progress + ", status="
|
||||||
|
+ status + ", statusDescription=" + statusDescription
|
||||||
|
+ ", error=" + error + ", trId=" + trId + ", columnName="
|
||||||
|
+ columnName + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.tr.column;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.OperationMonitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DeleteColumnMonitor extends OperationMonitor implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7694151843138161474L;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.tr.column;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DeleteColumnSession implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1896235499708614266L;
|
||||||
|
|
||||||
|
protected ColumnData columnData;
|
||||||
|
|
||||||
|
|
||||||
|
public ColumnData getColumnData() {
|
||||||
|
return columnData;
|
||||||
|
}
|
||||||
|
public void setColumnData(ColumnData columnData) {
|
||||||
|
this.columnData = columnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue