ref 9056:TabMan - Improve resource management in TabMan
https://support.d4science.org/issues/9056 Improve resources management git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@151397 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a4f31ec3e6
commit
d9e5320f64
|
@ -1469,4 +1469,14 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startGeometryCreatePoint(GeometryCreatePointSession geometryCreatePointSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieve the URL of default SDMX Registry
|
||||
*
|
||||
*
|
||||
* @return URL of the default SDMX Registry
|
||||
* @throws TDGWTServiceException
|
||||
* Exception
|
||||
*/
|
||||
public String getDefaultSDMXRegistryURL() throws TDGWTServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -97,8 +97,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
|
||||
public interface TDGWTServiceAsync {
|
||||
|
||||
public static TDGWTServiceAsync INSTANCE = (TDGWTServiceAsync) GWT
|
||||
.create(TDGWTService.class);
|
||||
public static TDGWTServiceAsync INSTANCE = (TDGWTServiceAsync) GWT.create(TDGWTService.class);
|
||||
|
||||
void hello(AsyncCallback<UserInfo> callback);
|
||||
|
||||
|
@ -108,21 +107,18 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void restoreUISession(TRId startTRId, AsyncCallback<TRId> callback);
|
||||
|
||||
void getUriFromResolver(UriResolverSession uriResolverSession,
|
||||
AsyncCallback<String> callback);
|
||||
void getUriFromResolver(UriResolverSession uriResolverSession, AsyncCallback<String> callback);
|
||||
|
||||
void getVREFolderIdByScope(AsyncCallback<String> callback);
|
||||
|
||||
// PeriodDataType
|
||||
void getPeriodDataTypes(AsyncCallback<ArrayList<PeriodDataType>> callback);
|
||||
|
||||
void getHierarchicalRelationshipForPeriodDataTypes(
|
||||
PeriodDataType periodDataType,
|
||||
void getHierarchicalRelationshipForPeriodDataTypes(PeriodDataType periodDataType,
|
||||
AsyncCallback<ArrayList<PeriodDataType>> callback);
|
||||
|
||||
// ValueDataFormat
|
||||
void getValueDataFormatsMap(
|
||||
AsyncCallback<HashMap<ColumnDataType, ArrayList<ValueDataFormat>>> callback);
|
||||
void getValueDataFormatsMap(AsyncCallback<HashMap<ColumnDataType, ArrayList<ValueDataFormat>>> callback);
|
||||
|
||||
void getValueDataFormatsOfColumnDataType(ColumnDataType columnDataType,
|
||||
AsyncCallback<ArrayList<ValueDataFormat>> callback);
|
||||
|
@ -130,8 +126,7 @@ public interface TDGWTServiceAsync {
|
|||
// TabularResource
|
||||
void getCurrentTRId(AsyncCallback<TRId> callback);
|
||||
|
||||
void createTabularResource(TabResource tabResource,
|
||||
AsyncCallback<TabResource> callback);
|
||||
void createTabularResource(TabResource tabResource, AsyncCallback<TabResource> callback);
|
||||
|
||||
void removeTabularResource(TRId trId, AsyncCallback<Void> callback);
|
||||
|
||||
|
@ -141,11 +136,9 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void getTabResourceInformation(AsyncCallback<TabResource> callback);
|
||||
|
||||
void getTabResourceInformation(TRId trId,
|
||||
AsyncCallback<TabResource> callback);
|
||||
void getTabResourceInformation(TRId trId, AsyncCallback<TabResource> callback);
|
||||
|
||||
void setTabResourceInformation(TabResource tabResource,
|
||||
AsyncCallback<Void> callback);
|
||||
void setTabResourceInformation(TabResource tabResource, AsyncCallback<Void> callback);
|
||||
|
||||
void setTabResourceToFinal(TRId trId, AsyncCallback<Void> callback);
|
||||
|
||||
|
@ -155,103 +148,83 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void getTabularResources(AsyncCallback<ArrayList<TabResource>> callback);
|
||||
|
||||
void getTabularResourcesAndLastTables(
|
||||
AsyncCallback<ArrayList<TabResource>> callback);
|
||||
void getTabularResourcesAndLastTables(AsyncCallback<ArrayList<TabResource>> callback);
|
||||
|
||||
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
||||
|
||||
void getTable(TRId trId, AsyncCallback<TableData> callback);
|
||||
|
||||
void getTableMetadata(TRId trId,
|
||||
AsyncCallback<ArrayList<TabMetadata>> callback);
|
||||
void getTableMetadata(TRId trId, AsyncCallback<ArrayList<TabMetadata>> callback);
|
||||
|
||||
void getTRMetadata(TRId trId, AsyncCallback<ArrayList<TRMetadata>> callback);
|
||||
|
||||
void getTimeTableId(PeriodDataType periodDataType,
|
||||
AsyncCallback<Long> callback);
|
||||
void getTimeTableId(PeriodDataType periodDataType, AsyncCallback<Long> callback);
|
||||
|
||||
void getColumns(AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnWithViewColumnIncluded(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumnWithViewColumnIncluded(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnWithOnlyViewColumnInRel(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumnWithOnlyViewColumnInRel(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnsForStatistical(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumnsForStatistical(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnsForDimension(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumnsForDimension(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumn(TRId trId, String columnName,
|
||||
AsyncCallback<ColumnData> callback);
|
||||
void getColumn(TRId trId, String columnName, AsyncCallback<ColumnData> callback);
|
||||
|
||||
void getColumn(String columnLocalId, TRId trId,
|
||||
AsyncCallback<ColumnData> callback);
|
||||
void getColumn(String columnLocalId, TRId trId, AsyncCallback<ColumnData> callback);
|
||||
|
||||
void getConnection(RefColumn refColumn, AsyncCallback<ColumnData> callback);
|
||||
|
||||
void closeAllTabularResources(AsyncCallback<Void> callback);
|
||||
|
||||
void closeTabularResourceAndOpen(TRId openTRId, TRId closeTRId,
|
||||
AsyncCallback<Void> callback);
|
||||
void closeTabularResourceAndOpen(TRId openTRId, TRId closeTRId, AsyncCallback<Void> callback);
|
||||
|
||||
void closeTabularResource(TRId closeTRId, AsyncCallback<Void> callback);
|
||||
|
||||
void setActiveTabularResource(TRId activeTRId, AsyncCallback<TRId> callback);
|
||||
|
||||
// Task
|
||||
void startTaskResubmit(TaskResubmitSession taskResubmitSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startTaskResubmit(TaskResubmitSession taskResubmitSession, AsyncCallback<String> callback);
|
||||
|
||||
void startTaskResume(TaskResumeSession taskResumeSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startTaskResume(TaskResumeSession taskResumeSession, AsyncCallback<String> callback);
|
||||
|
||||
// Validations
|
||||
void getValidationsTasksMetadata(TRId trId,
|
||||
AsyncCallback<ValidationsTasksMetadata> callback);
|
||||
void getValidationsTasksMetadata(TRId trId, AsyncCallback<ValidationsTasksMetadata> callback);
|
||||
|
||||
void getTableValidationsMetadata(TRId trId,
|
||||
AsyncCallback<TabValidationsMetadata> callback);
|
||||
void getTableValidationsMetadata(TRId trId, AsyncCallback<TabValidationsMetadata> callback);
|
||||
|
||||
void getValidationColumns(TRId trId, String columnName,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getValidationColumns(TRId trId, String columnName, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getValidationColumns(String columnLocalId, TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getValidationColumns(String columnLocalId, TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void startValidationsDelete(TRId trId, AsyncCallback<String> callback);
|
||||
|
||||
// RollBack
|
||||
void startRollBack(RollBackSession rollBackSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startRollBack(RollBackSession rollBackSession, AsyncCallback<String> callback);
|
||||
|
||||
void startDiscard(TRId trId, AsyncCallback<String> callback);
|
||||
|
||||
// Share
|
||||
void setShare(ShareTabResource shareInfo, AsyncCallback<Void> callback);
|
||||
|
||||
void setShareTemplate(ShareTemplate shareTemplate,
|
||||
AsyncCallback<Void> callback);
|
||||
void setShareTemplate(ShareTemplate shareTemplate, AsyncCallback<Void> callback);
|
||||
|
||||
void setShareRule(ShareRule shareRule, AsyncCallback<Void> callback);
|
||||
|
||||
// CodelistPagingLoaded
|
||||
void setCodelistsPagingLoader(AsyncCallback<Void> callback);
|
||||
|
||||
void getCodelistsPagingLoader(
|
||||
CodelistPagingLoadConfig codelistPagingLoadConfig,
|
||||
void getCodelistsPagingLoader(CodelistPagingLoadConfig codelistPagingLoadConfig,
|
||||
AsyncCallback<CodelistPagingLoadResult> callback);
|
||||
|
||||
// Open
|
||||
void tdOpen(TDOpenSession tdOpenSession, AsyncCallback<Void> callback);
|
||||
|
||||
// Clone
|
||||
void startCloneTabularResource(
|
||||
CloneTabularResourceSession cloneTabularResourceSession,
|
||||
void startCloneTabularResource(CloneTabularResourceSession cloneTabularResourceSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// SDMX
|
||||
|
@ -261,82 +234,61 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void getAgencies(AsyncCallback<ArrayList<Agencies>> callback);
|
||||
|
||||
void setSDMXRegistrySource(SDMXRegistrySource sdmxRegistrySource,
|
||||
AsyncCallback<Void> callback);
|
||||
void setSDMXRegistrySource(SDMXRegistrySource sdmxRegistrySource, AsyncCallback<Void> callback);
|
||||
|
||||
// Import SDMX
|
||||
void startSDMXImport(SDMXImportSession sdmxImportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startSDMXImport(SDMXImportSession sdmxImportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Import CSV
|
||||
void setCSVSession(CSVImportSession csvImportSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void setCSVSession(CSVImportSession csvImportSession, AsyncCallback<Void> callback);
|
||||
|
||||
void getFileFromWorkspace(CSVImportSession csvImportSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void getFileFromWorkspace(CSVImportSession csvImportSession, AsyncCallback<Void> callback);
|
||||
|
||||
void getAvailableCharset(AsyncCallback<AvailableCharsetList> callback);
|
||||
|
||||
void configureCSVParser(String encoding, HeaderPresence headerPresence,
|
||||
char delimiter, char comment,
|
||||
void configureCSVParser(String encoding, HeaderPresence headerPresence, char delimiter, char comment,
|
||||
AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
void checkCSV(long errorsLimit, AsyncCallback<CheckCSVSession> callback);
|
||||
|
||||
void startCSVImport(CSVImportSession csvImportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startCSVImport(CSVImportSession csvImportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Export CSV
|
||||
void getAvailableCharsetForExport(
|
||||
AsyncCallback<AvailableCharsetList> callback);
|
||||
void getAvailableCharsetForExport(AsyncCallback<AvailableCharsetList> callback);
|
||||
|
||||
void startCSVExport(CSVExportSession csvExportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startCSVExport(CSVExportSession csvExportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Export SDMX
|
||||
void startSDMXExport(SDMXExportSession exportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startSDMXExport(SDMXExportSession exportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Export Template SDMX
|
||||
void startSDMXTemplateExport(
|
||||
SDMXTemplateExportSession sdmxTemplateExportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startSDMXTemplateExport(SDMXTemplateExportSession sdmxTemplateExportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Export JSON
|
||||
void startJSONExport(JSONExportSession jsonExportSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startJSONExport(JSONExportSession jsonExportSession, AsyncCallback<String> callback);
|
||||
|
||||
// Table Operation
|
||||
void startChangeTableType(ChangeTableTypeSession changeTableTypeSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startChangeTableType(ChangeTableTypeSession changeTableTypeSession, AsyncCallback<String> callback);
|
||||
|
||||
void startUnion(UnionSession unionSession, AsyncCallback<String> callback);
|
||||
|
||||
// Rows Operation
|
||||
void startEditRow(EditRowSession editRowSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startEditRow(EditRowSession editRowSession, AsyncCallback<String> callback);
|
||||
|
||||
void startDeleteRows(DeleteRowsSession deleteRowsSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startDeleteRows(DeleteRowsSession deleteRowsSession, AsyncCallback<String> callback);
|
||||
|
||||
void startDuplicates(DuplicatesSession duplicatesSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startDuplicates(DuplicatesSession duplicatesSession, AsyncCallback<String> callback);
|
||||
|
||||
// Column Operation
|
||||
void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession, AsyncCallback<String> callback);
|
||||
|
||||
void startAddColumn(AddColumnSession addColumnSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startAddColumn(AddColumnSession addColumnSession, AsyncCallback<String> callback);
|
||||
|
||||
void startDeleteColumn(DeleteColumnSession deleteColumnSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startDeleteColumn(DeleteColumnSession deleteColumnSession, AsyncCallback<String> callback);
|
||||
|
||||
void startLabelColumn(LabelColumnSession labelColumnSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startLabelColumn(LabelColumnSession labelColumnSession, AsyncCallback<String> callback);
|
||||
|
||||
void startChangeColumnsPosition(
|
||||
ChangeColumnsPositionSession changeColumnsPositionSession,
|
||||
void startChangeColumnsPosition(ChangeColumnsPositionSession changeColumnsPositionSession,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
/*
|
||||
|
@ -353,36 +305,26 @@ public interface TDGWTServiceAsync {
|
|||
*/
|
||||
|
||||
// BatchReplace Operation
|
||||
void getOccurrencesForBatchReplace(
|
||||
OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession,
|
||||
void getOccurrencesForBatchReplace(OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession,
|
||||
AsyncCallback<ArrayList<Occurrences>> callback);
|
||||
|
||||
void startReplaceBatchColumn(
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startReplaceBatchColumn(ReplaceBatchColumnSession replaceBatchColumnSession, AsyncCallback<String> callback);
|
||||
|
||||
// Replace Operation
|
||||
void startReplaceColumn(ReplaceColumnSession replaceColumnSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startReplaceColumn(ReplaceColumnSession replaceColumnSession, AsyncCallback<String> callback);
|
||||
|
||||
void startReplaceByExternal(
|
||||
ReplaceByExternalSession replaceByExternalSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startReplaceByExternal(ReplaceByExternalSession replaceByExternalSession, AsyncCallback<String> callback);
|
||||
|
||||
// Templates
|
||||
void getTemplates(AsyncCallback<ArrayList<TemplateData>> callback);
|
||||
|
||||
void getTemplatesForDSDExport(
|
||||
AsyncCallback<ArrayList<TemplateData>> callback);
|
||||
void getTemplatesForDSDExport(AsyncCallback<ArrayList<TemplateData>> callback);
|
||||
|
||||
void getTemplateColumnsData(String templateId,
|
||||
AsyncCallback<ArrayList<TemplateColumnData>> callback);
|
||||
void getTemplateColumnsData(String templateId, AsyncCallback<ArrayList<TemplateColumnData>> callback);
|
||||
|
||||
void startTemplateApply(TemplateApplySession templateDeleteSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startTemplateApply(TemplateApplySession templateDeleteSession, AsyncCallback<String> callback);
|
||||
|
||||
void templateDelete(TemplateDeleteSession templateDeleteSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void templateDelete(TemplateDeleteSession templateDeleteSession, AsyncCallback<Void> callback);
|
||||
|
||||
// Locales
|
||||
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
||||
|
@ -400,82 +342,64 @@ public interface TDGWTServiceAsync {
|
|||
void getLastOperationInfo(TRId trId, AsyncCallback<OpHistory> callback);
|
||||
|
||||
// Helper Extract Codelist
|
||||
void startExtractCodelist(ExtractCodelistSession extractCodelistSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startExtractCodelist(ExtractCodelistSession extractCodelistSession, AsyncCallback<String> callback);
|
||||
|
||||
// Helper Codelist Mapping Import
|
||||
void setCodelistMappingSession(
|
||||
CodelistMappingSession codelistMappingSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void setCodelistMappingSession(CodelistMappingSession codelistMappingSession, AsyncCallback<Void> callback);
|
||||
|
||||
void getFileFromWorkspace(CodelistMappingSession codelistMappingSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void getFileFromWorkspace(CodelistMappingSession codelistMappingSession, AsyncCallback<Void> callback);
|
||||
|
||||
void startCodelistMappingImport(
|
||||
CodelistMappingSession codelistMappingSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startCodelistMappingImport(CodelistMappingSession codelistMappingSession, AsyncCallback<String> callback);
|
||||
|
||||
// Normalization
|
||||
void startNormalization(NormalizationSession normalizationSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startNormalization(NormalizationSession normalizationSession, AsyncCallback<String> callback);
|
||||
|
||||
// Denormalization
|
||||
void startDenormalization(DenormalizationSession denormalizationSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startDenormalization(DenormalizationSession denormalizationSession, AsyncCallback<String> callback);
|
||||
|
||||
// Operation Monitor
|
||||
void getOperationMonitor(OperationMonitorSession operationMonitorSession,
|
||||
AsyncCallback<OperationMonitor> callback);
|
||||
void getOperationMonitor(OperationMonitorSession operationMonitorSession, AsyncCallback<OperationMonitor> callback);
|
||||
|
||||
void getBackgroundOperationMonitor(
|
||||
BackgroundOperationMonitorSession backgroundOperationMonitorSession,
|
||||
void getBackgroundOperationMonitor(BackgroundOperationMonitorSession backgroundOperationMonitorSession,
|
||||
AsyncCallback<ArrayList<BackgroundOperationMonitor>> callback);
|
||||
|
||||
void getBackgroundOperationMonitorForSpecificTask(
|
||||
OperationMonitorSession operationMonitorSession,
|
||||
void getBackgroundOperationMonitorForSpecificTask(OperationMonitorSession operationMonitorSession,
|
||||
AsyncCallback<OperationMonitor> callback);
|
||||
|
||||
// File Upload Monitor
|
||||
void getFileUploadMonitor(AsyncCallback<FileUploadMonitor> callback);
|
||||
|
||||
// ResourceTD
|
||||
void getResourcesTD(TRId trId,
|
||||
AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
void getResourcesTD(TRId trId, AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
void getResourcesTDByType(TRId trId, ResourceTDType reourceTDType,
|
||||
AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
void removeResource(RemoveResourceSession removeResourceSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void removeResource(RemoveResourceSession removeResourceSession, AsyncCallback<Void> callback);
|
||||
|
||||
void saveResource(SaveResourceSession saveResourceSession,
|
||||
AsyncCallback<Void> callback);
|
||||
void saveResource(SaveResourceSession saveResourceSession, AsyncCallback<Void> callback);
|
||||
|
||||
// GIS MAP
|
||||
void startMapCreation(MapCreationSession mapCreationSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startMapCreation(MapCreationSession mapCreationSession, AsyncCallback<String> callback);
|
||||
|
||||
// DataMiner
|
||||
void startDataMinerOperation(
|
||||
DataMinerOperationSession dataMinerOperationSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startDataMinerOperation(DataMinerOperationSession dataMinerOperationSession, AsyncCallback<String> callback);
|
||||
|
||||
// Chart
|
||||
void startChartTopRating(ChartTopRatingSession chartTopRatingSession,
|
||||
AsyncCallback<String> callback);
|
||||
void startChartTopRating(ChartTopRatingSession chartTopRatingSession, AsyncCallback<String> callback);
|
||||
|
||||
// Geospatial
|
||||
void startGeospatialCreateCoordinates(
|
||||
GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession,
|
||||
void startGeospatialCreateCoordinates(GeospatialCreateCoordinatesSession geospatialCreateCoordinatesSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void startGeospatialDownscaleCSquare(
|
||||
GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession,
|
||||
void startGeospatialDownscaleCSquare(GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// Geometry
|
||||
void startGeometryCreatePoint(
|
||||
GeometryCreatePointSession geometryCreatePointSession,
|
||||
void startGeometryCreatePoint(GeometryCreatePointSession geometryCreatePointSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// Retrieve the URL of default SDMX Registry
|
||||
void getDefaultSDMXRegistryURL(AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SessionConstants {
|
|||
|
||||
public static final String TR_TASK_MANAGER = "TR_TASK_MANAGER";
|
||||
|
||||
public static final String SDMX_INTERNAL_REGISTRY_URL = "SDMX_INTERNAL_REGISTRY_URL";
|
||||
|
||||
public static final String SDMX_REGISTRY_SOURCE = "SDMX_REGISTRY_SOURCE";
|
||||
|
||||
public static final String SDMX_CLIENT_ATTRIBUTE = "SDMX_CLIENT";
|
||||
|
@ -133,4 +135,6 @@ public class SessionConstants {
|
|||
public static final String COLUMN_FILTER_SESSION_TASK = "COLUMN_FILTER_SESSION_TASK";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -536,6 +536,22 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
public static void setInternalSDMXRegistryURLSession(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
|
||||
String defaultSDMXRegistryUrl) {
|
||||
SessionOp<String> sessionOp = new SessionOp<>();
|
||||
sessionOp.set(httpRequest, serviceCredentials, SessionConstants.SDMX_INTERNAL_REGISTRY_URL, defaultSDMXRegistryUrl);
|
||||
}
|
||||
|
||||
public static String getInternalSDMXRegistryURLSession(HttpServletRequest httpRequest,
|
||||
ServiceCredentials serviceCredentials) {
|
||||
SessionOp<String> sessionOp = new SessionOp<>();
|
||||
String defaultSDMXRegistryURL = sessionOp.get(httpRequest, serviceCredentials,
|
||||
SessionConstants.SDMX_INTERNAL_REGISTRY_URL);
|
||||
return defaultSDMXRegistryURL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void setSDMXExportSession(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
|
||||
SDMXExportSession sdmxExportSession) {
|
||||
SessionOp<SDMXExportSession> sessionOp = new SessionOp<>();
|
||||
|
|
|
@ -111,6 +111,7 @@ import org.gcube.portlets.user.td.gwtservice.server.encoding.EncodingPGSupported
|
|||
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.FileUtil;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.is.ISUtils;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4AddColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4CSVExport;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4CSVImport;
|
||||
|
@ -4429,11 +4430,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
|
|||
// /
|
||||
switch (exportSession.getExportType()) {
|
||||
case CODELIST:
|
||||
OpExecution4SDMXCodelistExport opExC = new OpExecution4SDMXCodelistExport(service, exportSession);
|
||||
OpExecution4SDMXCodelistExport opExC = new OpExecution4SDMXCodelistExport(httpRequest,
|
||||
serviceCredentials, service, exportSession);
|
||||
director.setOperationExecutionBuilder(opExC);
|
||||
break;
|
||||
case DATASET:
|
||||
OpExecution4SDMXDatasetExport opExD = new OpExecution4SDMXDatasetExport(service, exportSession);
|
||||
OpExecution4SDMXDatasetExport opExD = new OpExecution4SDMXDatasetExport(httpRequest, serviceCredentials,
|
||||
service, exportSession);
|
||||
director.setOperationExecutionBuilder(opExD);
|
||||
break;
|
||||
case GENERIC:
|
||||
|
@ -4496,8 +4499,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
|
|||
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
// /
|
||||
OpExecution4SDMXTemplateExport opExD = new OpExecution4SDMXTemplateExport(service,
|
||||
sdmxTemplateExportSession);
|
||||
OpExecution4SDMXTemplateExport opExD = new OpExecution4SDMXTemplateExport(httpRequest, serviceCredentials,
|
||||
service, sdmxTemplateExportSession);
|
||||
director.setOperationExecutionBuilder(opExD);
|
||||
|
||||
director.constructOperationExecution();
|
||||
|
@ -8940,4 +8943,43 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTServi
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultSDMXRegistryURL() throws TDGWTServiceException {
|
||||
HttpServletRequest httpRequest = null;
|
||||
try {
|
||||
httpRequest = this.getThreadLocalRequest();
|
||||
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest);
|
||||
|
||||
String defaultSDMXRegistryURL = SessionUtil.getInternalSDMXRegistryURLSession(httpRequest,
|
||||
serviceCredentials);
|
||||
|
||||
if (defaultSDMXRegistryURL == null || defaultSDMXRegistryURL.isEmpty()) {
|
||||
defaultSDMXRegistryURL = ISUtils.retrieveInternalSDMXRegistryURL();
|
||||
if (defaultSDMXRegistryURL != null && !defaultSDMXRegistryURL.isEmpty()) {
|
||||
SessionUtil.setInternalSDMXRegistryURLSession(httpRequest, serviceCredentials,
|
||||
defaultSDMXRegistryURL);
|
||||
int pos = defaultSDMXRegistryURL.indexOf("FusionRegistry");
|
||||
defaultSDMXRegistryURL = defaultSDMXRegistryURL.substring(0, pos + 15);
|
||||
|
||||
}
|
||||
} else {
|
||||
int pos = defaultSDMXRegistryURL.indexOf("FusionRegistry");
|
||||
defaultSDMXRegistryURL = defaultSDMXRegistryURL.substring(0, pos + 15);
|
||||
}
|
||||
|
||||
logger.debug("Default SDMXRegistry URL: " + defaultSDMXRegistryURL);
|
||||
return defaultSDMXRegistryURL;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
ResourceBundle messages = getResourceBundle(httpRequest);
|
||||
throw new TDGWTServiceException(messages.getString(TDGWTServiceMessagesConstants.securityExceptionRights));
|
||||
} catch (Throwable e) {
|
||||
logger.error("getDefaultSDMXRegistryURL(): " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving default SDMX Regitry URL: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.is;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Profile;
|
||||
import org.gcube.common.resources.gcore.utils.Group;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ISUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ISUtils.class);
|
||||
|
||||
public static String retrieveInternalSDMXRegistryURL() {
|
||||
String sdmxRegistryURL = null;
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'")
|
||||
.addCondition("$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> listService = client.submit(query);
|
||||
if (listService.size() > 0) {
|
||||
ServiceEndpoint serviceEnd = listService.get(0);
|
||||
if (serviceEnd != null) {
|
||||
Profile prof = serviceEnd.profile();
|
||||
Group<AccessPoint> groupA = prof.accessPoints();
|
||||
for (AccessPoint acc : groupA) {
|
||||
if (acc.description().compareTo("REST Interface v2.1") == 0) {
|
||||
sdmxRegistryURL = acc.address();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
logger.debug("Retrieved URL of the default SDMX Registry: " + sdmxRegistryURL);
|
||||
return sdmxRegistryURL;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +1,21 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Profile;
|
||||
import org.gcube.common.resources.gcore.utils.Group;
|
||||
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.is.ISUtils;
|
||||
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.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -32,14 +27,17 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(OpExecution4SDMXCodelistExport.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(OpExecution4SDMXCodelistExport.class);
|
||||
|
||||
private HttpServletRequest httpRequest;
|
||||
private ServiceCredentials serviceCredentials;
|
||||
private TabularDataService service;
|
||||
private SDMXExportSession sdmxExportSession;
|
||||
|
||||
public OpExecution4SDMXCodelistExport(TabularDataService service,
|
||||
SDMXExportSession sdmxExportSession) {
|
||||
public OpExecution4SDMXCodelistExport(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
|
||||
TabularDataService service, SDMXExportSession sdmxExportSession) {
|
||||
this.httpRequest = httpRequest;
|
||||
this.serviceCredentials = serviceCredentials;
|
||||
this.service = service;
|
||||
this.sdmxExportSession = sdmxExportSession;
|
||||
}
|
||||
|
@ -52,8 +50,7 @@ public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
|||
// http://pc-fortunati.isti.cnr.it:8080/FusionRegistry/ws/rest/
|
||||
|
||||
if (sdmxExportSession != null) {
|
||||
if (sdmxExportSession.getRegistryBaseUrl() != null
|
||||
&& !sdmxExportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
if (sdmxExportSession.getRegistryBaseUrl() != null && !sdmxExportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
destination = sdmxExportSession.getRegistryBaseUrl();
|
||||
} else {
|
||||
internalRegistry = true;
|
||||
|
@ -63,37 +60,22 @@ public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
|||
}
|
||||
|
||||
if (internalRegistry) {
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'")
|
||||
.addCondition(
|
||||
"$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> listService = client.submit(query);
|
||||
if (listService.size() > 0) {
|
||||
ServiceEndpoint serviceEnd = listService.get(0);
|
||||
if (serviceEnd != null) {
|
||||
Profile prof = serviceEnd.profile();
|
||||
Group<AccessPoint> groupA = prof.accessPoints();
|
||||
for (AccessPoint acc : groupA) {
|
||||
if (acc.description().compareTo("REST Interface v2.1") == 0) {
|
||||
destination = acc.address();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
destination = SessionUtil.getInternalSDMXRegistryURLSession(httpRequest, serviceCredentials);
|
||||
if (destination == null || destination.isEmpty()) {
|
||||
destination = ISUtils.retrieveInternalSDMXRegistryURL();
|
||||
if(destination!=null&&!destination.isEmpty()){
|
||||
SessionUtil.setInternalSDMXRegistryURLSession(httpRequest, serviceCredentials, destination);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (destination == null) {
|
||||
logger.debug("Destination: " + destination);
|
||||
throw new TDGWTServiceException("SDMX Service not discovered");
|
||||
}
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.SDMXCodelistExport.toString(), service);
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(OperationsId.SDMXCodelistExport.toString(),
|
||||
service);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
|
@ -102,8 +84,7 @@ public class OpExecution4SDMXCodelistExport extends OpExecutionBuilder {
|
|||
map.put(Constants.PARAMETER_ID, sdmxExportSession.getId());
|
||||
map.put(Constants.PARAMETER_VERSION, sdmxExportSession.getVersion());
|
||||
|
||||
OperationExecution invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
OperationExecution invocation = new OperationExecution(operationDefinition.getOperationId(), map);
|
||||
|
||||
operationExecutionSpec.setOp(invocation);
|
||||
}
|
||||
|
|
|
@ -1,26 +1,21 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Profile;
|
||||
import org.gcube.common.resources.gcore.utils.Group;
|
||||
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.is.ISUtils;
|
||||
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.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -32,14 +27,15 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(OpExecution4SDMXDatasetExport.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(OpExecution4SDMXDatasetExport.class);
|
||||
|
||||
private HttpServletRequest httpRequest;
|
||||
private ServiceCredentials serviceCredentials;
|
||||
private TabularDataService service;
|
||||
private SDMXExportSession sdmxExportSession;
|
||||
|
||||
public OpExecution4SDMXDatasetExport(TabularDataService service,
|
||||
SDMXExportSession sdmxExportSession) {
|
||||
public OpExecution4SDMXDatasetExport(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
|
||||
TabularDataService service, SDMXExportSession sdmxExportSession) {
|
||||
this.service = service;
|
||||
this.sdmxExportSession = sdmxExportSession;
|
||||
}
|
||||
|
@ -52,8 +48,7 @@ public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
|||
// http://pc-fortunati.isti.cnr.it:8080/FusionRegistry/ws/rest/
|
||||
|
||||
if (sdmxExportSession != null) {
|
||||
if (sdmxExportSession.getRegistryBaseUrl() != null
|
||||
&& !sdmxExportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
if (sdmxExportSession.getRegistryBaseUrl() != null && !sdmxExportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
destination = sdmxExportSession.getRegistryBaseUrl();
|
||||
} else {
|
||||
internalRegistry = true;
|
||||
|
@ -63,28 +58,12 @@ public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
|||
}
|
||||
|
||||
if (internalRegistry) {
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'")
|
||||
.addCondition(
|
||||
"$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> listService = client.submit(query);
|
||||
if (listService.size() > 0) {
|
||||
ServiceEndpoint serviceEnd = listService.get(0);
|
||||
if (serviceEnd != null) {
|
||||
Profile prof = serviceEnd.profile();
|
||||
Group<AccessPoint> groupA = prof.accessPoints();
|
||||
for (AccessPoint acc : groupA) {
|
||||
if (acc.description().compareTo("REST Interface v2.1") == 0) {
|
||||
destination = acc.address();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
destination = SessionUtil.getInternalSDMXRegistryURLSession(httpRequest, serviceCredentials);
|
||||
if (destination == null || destination.isEmpty()) {
|
||||
destination = ISUtils.retrieveInternalSDMXRegistryURL();
|
||||
if(destination!=null&&!destination.isEmpty()){
|
||||
SessionUtil.setInternalSDMXRegistryURLSession(httpRequest, serviceCredentials, destination);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
if (destination == null) {
|
||||
|
@ -92,8 +71,8 @@ public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
|||
throw new TDGWTServiceException("SDMX Service not discovered");
|
||||
}
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.SDMXDatasetExport.toString(), service);
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(OperationsId.SDMXDatasetExport.toString(),
|
||||
service);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
|
@ -103,8 +82,7 @@ public class OpExecution4SDMXDatasetExport extends OpExecutionBuilder {
|
|||
map.put(Constants.PARAMETER_VERSION, sdmxExportSession.getVersion());
|
||||
map.put(Constants.PARAMETER_OBSVALUECOLUMN, sdmxExportSession.getObsValueColumn().getColumnId());
|
||||
map.put(Constants.PARAMETER_EXCEL, sdmxExportSession.isExcel());
|
||||
OperationExecution invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
OperationExecution invocation = new OperationExecution(operationDefinition.getOperationId(), map);
|
||||
|
||||
operationExecutionSpec.setOp(invocation);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Profile;
|
||||
import org.gcube.common.resources.gcore.utils.Group;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.gcube.data.analysis.tabulardata.commons.templates.model.Template;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTemplateException;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TemplateDescription;
|
||||
|
@ -18,13 +12,14 @@ import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.O
|
|||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
||||
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
|
||||
import org.gcube.data.analysis.tabulardata.service.template.TemplateId;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.is.ISUtils;
|
||||
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.sdmx.SDMXTemplateExportSession;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -36,14 +31,15 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class OpExecution4SDMXTemplateExport extends OpExecutionBuilder {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(OpExecution4SDMXTemplateExport.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(OpExecution4SDMXTemplateExport.class);
|
||||
|
||||
private HttpServletRequest httpRequest;
|
||||
private ServiceCredentials serviceCredentials;
|
||||
private TabularDataService service;
|
||||
private SDMXTemplateExportSession sdmxTemplateExportSession;
|
||||
|
||||
public OpExecution4SDMXTemplateExport(TabularDataService service,
|
||||
SDMXTemplateExportSession sdmxTemplateExportSession) {
|
||||
public OpExecution4SDMXTemplateExport(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
|
||||
TabularDataService service, SDMXTemplateExportSession sdmxTemplateExportSession) {
|
||||
this.service = service;
|
||||
this.sdmxTemplateExportSession = sdmxTemplateExportSession;
|
||||
}
|
||||
|
@ -57,8 +53,7 @@ public class OpExecution4SDMXTemplateExport extends OpExecutionBuilder {
|
|||
|
||||
if (sdmxTemplateExportSession != null) {
|
||||
if (sdmxTemplateExportSession.getRegistryBaseUrl() != null
|
||||
&& !sdmxTemplateExportSession.getRegistryBaseUrl()
|
||||
.isEmpty()) {
|
||||
&& !sdmxTemplateExportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
destination = sdmxTemplateExportSession.getRegistryBaseUrl();
|
||||
} else {
|
||||
internalRegistry = true;
|
||||
|
@ -68,30 +63,15 @@ public class OpExecution4SDMXTemplateExport extends OpExecutionBuilder {
|
|||
}
|
||||
|
||||
if (internalRegistry) {
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'SDMX'")
|
||||
.addCondition(
|
||||
"$resource/Profile/Name/text() eq 'SDMXRegistry'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> listService = client.submit(query);
|
||||
if (listService.size() > 0) {
|
||||
ServiceEndpoint serviceEnd = listService.get(0);
|
||||
if (serviceEnd != null) {
|
||||
Profile prof = serviceEnd.profile();
|
||||
Group<AccessPoint> groupA = prof.accessPoints();
|
||||
for (AccessPoint acc : groupA) {
|
||||
if (acc.description().compareTo("REST Interface v2.1") == 0) {
|
||||
destination = acc.address();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
destination = SessionUtil.getInternalSDMXRegistryURLSession(httpRequest, serviceCredentials);
|
||||
if (destination == null || destination.isEmpty()) {
|
||||
destination = ISUtils.retrieveInternalSDMXRegistryURL();
|
||||
if(destination!=null&&!destination.isEmpty()){
|
||||
SessionUtil.setInternalSDMXRegistryURLSession(httpRequest, serviceCredentials, destination);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (destination == null) {
|
||||
logger.debug("Destination: " + destination);
|
||||
throw new TDGWTServiceException("SDMX Service not discovered");
|
||||
|
@ -99,35 +79,29 @@ public class OpExecution4SDMXTemplateExport extends OpExecutionBuilder {
|
|||
|
||||
TemplateDescription templateDescriptor;
|
||||
try {
|
||||
templateDescriptor = service.getTemplate(new TemplateId(
|
||||
sdmxTemplateExportSession.getTemplateData().getId()));
|
||||
templateDescriptor = service
|
||||
.getTemplate(new TemplateId(sdmxTemplateExportSession.getTemplateData().getId()));
|
||||
} catch (NoSuchTemplateException e) {
|
||||
logger.debug(
|
||||
"Error retrieving template: " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving template: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.debug("Error retrieving template: " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving template: " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.SDMXTemplateExport.toString(), service);
|
||||
|
||||
HashMap<String,Template> templateMap=new HashMap<String,Template>();
|
||||
templateMap.put(Constants.PARAMETER_TEMPLATE,templateDescriptor.getTemplate());
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(OperationsId.SDMXTemplateExport.toString(),
|
||||
service);
|
||||
|
||||
HashMap<String, Template> templateMap = new HashMap<String, Template>();
|
||||
templateMap.put(Constants.PARAMETER_TEMPLATE, templateDescriptor.getTemplate());
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put(Constants.PARAMETER_REGISTRYBASEURL, destination);
|
||||
map.put(Constants.PARAMETER_AGENCY,
|
||||
sdmxTemplateExportSession.getAgencyId());
|
||||
map.put(Constants.PARAMETER_AGENCY, sdmxTemplateExportSession.getAgencyId());
|
||||
map.put(Constants.PARAMETER_ID, sdmxTemplateExportSession.getId());
|
||||
map.put(Constants.PARAMETER_VERSION,
|
||||
sdmxTemplateExportSession.getVersion());
|
||||
map.put(Constants.PARAMETER_OBSVALUECOLUMN, sdmxTemplateExportSession
|
||||
.getObsValueColumn().getColumnId());
|
||||
map.put(Constants.PARAMETER_VERSION, sdmxTemplateExportSession.getVersion());
|
||||
map.put(Constants.PARAMETER_OBSVALUECOLUMN, sdmxTemplateExportSession.getObsValueColumn().getColumnId());
|
||||
map.put(Constants.PARAMETER_EXCEL, sdmxTemplateExportSession.isExcel());
|
||||
map.put(Constants.PARAMETER_TEMPLATE, templateMap);
|
||||
OperationExecution invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
OperationExecution invocation = new OperationExecution(operationDefinition.getOperationId(), map);
|
||||
|
||||
operationExecutionSpec.setOp(invocation);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue