Added Statistical Operation
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100887 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
deec3d408c
commit
67621940f4
|
@ -27,6 +27,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTemplate;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
|
||||
|
@ -454,7 +455,19 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<ColumnData> getColumns(TRId trId)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieves the list of columns in the table provided by trId
|
||||
* view columns included
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<ColumnData> getColumnWithViewColumnIncluded(TRId trId)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the list of columns in the table provided by trId only CODE and
|
||||
* CODENAME types
|
||||
|
@ -1002,5 +1015,18 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public String startMapCreation(MapCreationSession mapCreationSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
// Statistical
|
||||
/**
|
||||
*
|
||||
* @param statisticalOperationSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public String startStatisticalOperation(StatisticalOperationSession statisticalOperationSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTemplate;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
|
||||
|
@ -85,9 +86,10 @@ public interface TDGWTServiceAsync {
|
|||
void hello(AsyncCallback<UserInfo> callback);
|
||||
|
||||
void restoreUISession(AsyncCallback<TRId> callback);
|
||||
|
||||
void getUriFromResolver(UriResolverSession uriResolverSession, AsyncCallback<String> callback);
|
||||
|
||||
|
||||
void getUriFromResolver(UriResolverSession uriResolverSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// TabularResource
|
||||
void getCurrentTRId(AsyncCallback<TRId> callback);
|
||||
|
||||
|
@ -99,7 +101,7 @@ public interface TDGWTServiceAsync {
|
|||
void isTabularResourceValid(TRId trId, AsyncCallback<Boolean> callback);
|
||||
|
||||
void getInSessionTabResourceInfo(AsyncCallback<TabResource> callback);
|
||||
|
||||
|
||||
void getTabResourceInformation(AsyncCallback<TabResource> callback);
|
||||
|
||||
void getTabResourceInformation(TRId trId,
|
||||
|
@ -130,6 +132,9 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnWithViewColumnIncluded(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
void getColumnsForDimension(TRId trId,
|
||||
AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
|
@ -140,16 +145,16 @@ public interface TDGWTServiceAsync {
|
|||
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<Void> callback);
|
||||
|
||||
|
||||
void setActiveTabularResource(TRId activeTRId, AsyncCallback<Void> callback);
|
||||
|
||||
// Task
|
||||
void startTaskResubmit(TaskResubmitSession taskResubmitSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
@ -175,10 +180,10 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
// Share
|
||||
void setShare(ShareTabResource shareInfo, AsyncCallback<Void> callback);
|
||||
|
||||
void setShareTemplate(ShareTemplate shareTemplate,AsyncCallback<Void> callback);
|
||||
|
||||
|
||||
|
||||
void setShareTemplate(ShareTemplate shareTemplate,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
// CodelistPagingLoaded
|
||||
void setCodelistsPagingLoader(AsyncCallback<Void> callback);
|
||||
|
||||
|
@ -237,8 +242,8 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
// Export JSON
|
||||
void startJSONExport(JSONExportSession jsonExportSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// Table Operation
|
||||
void startChangeTableType(ChangeTableTypeSession changeTableTypeSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
@ -305,10 +310,10 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
// Locales
|
||||
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
|
||||
// Licences
|
||||
void getLicences(AsyncCallback<ArrayList<LicenceData>> callback);
|
||||
|
||||
|
||||
// History
|
||||
void getHistory(AsyncCallback<ArrayList<OpHistory>> callback);
|
||||
|
||||
|
@ -345,21 +350,28 @@ public interface TDGWTServiceAsync {
|
|||
// Operation Monitor
|
||||
void getOperationMonitor(OperationMonitorSession operationMonitorSession,
|
||||
AsyncCallback<OperationMonitor> callback);
|
||||
|
||||
void getBackgroundOperationMonitor(BackgroundOperationMonitorSession backgroundOperationMonitorSession,
|
||||
|
||||
void getBackgroundOperationMonitor(
|
||||
BackgroundOperationMonitorSession backgroundOperationMonitorSession,
|
||||
AsyncCallback<ArrayList<OperationMonitor>> callback);
|
||||
|
||||
// File Upload Monitor
|
||||
void getFileUploadMonitor(AsyncCallback<FileUploadMonitor> callback);
|
||||
|
||||
|
||||
//ResourceTD
|
||||
void getResourcesTD(TRId trId,AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
void getResourcesTDByType(TRId trId, ResourceTDType reourceTDType,AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
|
||||
//GIS MAP
|
||||
|
||||
// ResourceTD
|
||||
void getResourcesTD(TRId trId,
|
||||
AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
void getResourcesTDByType(TRId trId, ResourceTDType reourceTDType,
|
||||
AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
// GIS MAP
|
||||
void startMapCreation(MapCreationSession mapCreationSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
// Statistical
|
||||
void startStatisticalOperation(
|
||||
StatisticalOperationSession statisticalOperationSession,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ public class SessionConstants {
|
|||
|
||||
protected static final String UNION_SESSION = "UNION_SESSION";
|
||||
|
||||
protected static final String STATISTICAL_OPERATION_SESSION = "STATISTICAL_OPERATION_SESSION";
|
||||
|
||||
protected static final String NORMALIZATION_SESSION = "NORMALIZATION_SESSION";
|
||||
|
||||
protected static final String DENORMALIZATION_SESSION = "DENORMALIZATION_SESSION";
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper;
|
||||
|
@ -1424,6 +1425,32 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static StatisticalOperationSession getStatisticalOperationSession(HttpSession httpSession) {
|
||||
StatisticalOperationSession statisticalOperationSession = (StatisticalOperationSession) httpSession
|
||||
.getAttribute(SessionConstants.STATISTICAL_OPERATION_SESSION);
|
||||
if (statisticalOperationSession != null) {
|
||||
return statisticalOperationSession;
|
||||
} else {
|
||||
statisticalOperationSession = new StatisticalOperationSession();
|
||||
httpSession.setAttribute(SessionConstants.STATISTICAL_OPERATION_SESSION,
|
||||
statisticalOperationSession);
|
||||
return statisticalOperationSession;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setStatisticalOperationSession(HttpSession httpSession,
|
||||
StatisticalOperationSession statisticalOperationSession) {
|
||||
StatisticalOperationSession so = (StatisticalOperationSession) httpSession
|
||||
.getAttribute(SessionConstants.STATISTICAL_OPERATION_SESSION);
|
||||
if (so != null) {
|
||||
httpSession.removeAttribute(SessionConstants.STATISTICAL_OPERATION_SESSION);
|
||||
}
|
||||
httpSession.setAttribute(SessionConstants.STATISTICAL_OPERATION_SESSION, statisticalOperationSession);
|
||||
|
||||
}
|
||||
|
||||
// /
|
||||
|
||||
public static MapCreationSession getMapCreationSession(
|
||||
|
|
|
@ -130,6 +130,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Repl
|
|||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceColumnByExpression;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4SplitColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4StatisticalOperation;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Union;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecutionDirector;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTDCreator;
|
||||
|
@ -175,6 +176,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTabResource;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareTemplate;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SourceType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||
|
@ -877,6 +879,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<ColumnData> getColumns(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
|
@ -988,6 +991,121 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ArrayList<ColumnData> other than IdColumnType,
|
||||
* ValidationColumnType
|
||||
*
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ArrayList<ColumnData> getColumnWithViewColumnIncluded(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
logger.debug("getColumns():" + trId.toString());
|
||||
|
||||
Table table = service.getTable(new TableId(Long.valueOf(trId
|
||||
.getTableId())));
|
||||
|
||||
ArrayList<ColumnData> columns = new ArrayList<ColumnData>();
|
||||
|
||||
List<Column> cols = table.getColumns();
|
||||
int i = 0;
|
||||
for (Column c : cols) {
|
||||
if (c.getColumnType() instanceof IdColumnType
|
||||
|| c.getColumnType() instanceof ValidationColumnType) {
|
||||
|
||||
} else {
|
||||
ColumnData cData = new ColumnData();
|
||||
cData.setId(Integer.toString(i));
|
||||
cData.setColumnId(c.getLocalId().getValue());
|
||||
cData.setName(c.getName());
|
||||
cData.setTypeCode(c.getColumnType().getCode());
|
||||
cData.setTypeName(c.getColumnType().getName());
|
||||
cData.setDataTypeName(c.getDataType().getName());
|
||||
ColumnRelationship rel = c.getRelationship();
|
||||
if (rel != null) {
|
||||
RelationshipData relData = new RelationshipData(rel
|
||||
.getTargetTableId().getValue(), rel
|
||||
.getTargetColumnId().getValue());
|
||||
cData.setRelationship(relData);
|
||||
|
||||
}
|
||||
NamesMetadata labelsMetadata = null;
|
||||
try {
|
||||
labelsMetadata = c.getMetadata(NamesMetadata.class);
|
||||
} catch (NoSuchMetadataException e) {
|
||||
logger.debug("labelMetadata: NoSuchMetadataException "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
if (labelsMetadata == null) {
|
||||
cData.setLabel("nolabel");
|
||||
logger.debug("LabelsMetadata no labels");
|
||||
} else {
|
||||
LocalizedText cl = null;
|
||||
cl = labelsMetadata.getTextWithLocale("en");
|
||||
if (cl == null) {
|
||||
cData.setLabel("nolabel");
|
||||
logger.debug("ColumnLabel no label in en");
|
||||
} else {
|
||||
if (cl.getValue() == null
|
||||
|| cl.getValue().isEmpty()) {
|
||||
cData.setLabel("nolabel");
|
||||
logger.debug("ColumnLabel no label in en");
|
||||
} else {
|
||||
cData.setLabel(cl.getValue());
|
||||
logger.debug("Column Set Label: "
|
||||
+ cl.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataLocaleMetadata dataLocaleMetadata = null;
|
||||
try {
|
||||
dataLocaleMetadata = c
|
||||
.getMetadata(DataLocaleMetadata.class);
|
||||
} catch (NoSuchMetadataException e) {
|
||||
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
if (dataLocaleMetadata == null) {
|
||||
logger.debug("No DataLocaleMetadata");
|
||||
} else {
|
||||
cData.setLocale(dataLocaleMetadata.getLocale());
|
||||
}
|
||||
|
||||
cData.setTrId(trId);
|
||||
columns.add(cData);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return columns;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
logger.error(
|
||||
"Error retrieving Columns: " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving Columns: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -3991,7 +4109,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error in CSVExport: Operation not supported for now!");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -4065,7 +4182,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error in JSONExport: Operation not supported for now!");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -4132,7 +4248,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error in ChangeColumnType: Operation not supported for now!");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -4407,7 +4522,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
|
||||
logger.debug("Start Replace on Service:"
|
||||
|
@ -4477,7 +4592,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
if (invocations == null) {
|
||||
throw new TDGWTServiceException("Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocations);
|
||||
Task trTask = service.executeBatch(invocations, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -4720,7 +4835,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error Delete Rows invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -4785,10 +4899,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TabularResource cloneTR = service.createTabularResource();
|
||||
cloneTR.setAllMetadata(tabularResource.getAllMetadata());
|
||||
NameMetadata nameMetadata = cloneTR.getMetadata(NameMetadata.class);
|
||||
|
@ -4874,7 +4985,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error Delete Rows invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -5498,7 +5608,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error Replace Column Value invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -5565,7 +5674,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
if (invocations == null) {
|
||||
throw new TDGWTServiceException("Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocations.toString());
|
||||
Task trTask = service.executeBatch(invocations, tabularResourceId);
|
||||
if (trTask == null) {
|
||||
|
@ -6163,7 +6272,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
@ -6483,7 +6592,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
}
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Extract Codelist on service: TaskId "
|
||||
|
@ -7119,6 +7228,67 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String startStatisticalOperation(StatisticalOperationSession statisticalOperationSession)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.setStatisticalOperationSession(session, statisticalOperationSession);
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
checkTRId(statisticalOperationSession.getTrId());
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(statisticalOperationSession.getTrId().getId()));
|
||||
TabularResource tabularResource = service
|
||||
.getTabularResource(tabularResourceId);
|
||||
|
||||
checkTabularResourceLocked(tabularResource);
|
||||
|
||||
OpExecution4StatisticalOperation opEx = new OpExecution4StatisticalOperation(service, aslSession,
|
||||
statisticalOperationSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error Statistical Operation invocation: Operation not supported");
|
||||
}
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, tabularResourceId);
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||
UIOperationsId.StatisticalOperation, statisticalOperationSession.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 in statistical operation: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.opexecution;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
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.trservice.OperationDefinitionMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Operation Execution for union
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OpExecution4StatisticalOperation extends OpExecutionBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(OpExecution4StatisticalOperation.class);
|
||||
|
||||
private TabularDataService service;
|
||||
private ASLSession aslSession;
|
||||
private StatisticalOperationSession statisticalOperationSession;
|
||||
|
||||
|
||||
public OpExecution4StatisticalOperation(
|
||||
TabularDataService service,ASLSession aslSession,
|
||||
StatisticalOperationSession statisticalOperationSession) {
|
||||
this.service = service;
|
||||
this.aslSession = aslSession;
|
||||
this.statisticalOperationSession = statisticalOperationSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildOpEx() throws TDGWTServiceException {
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(statisticalOperationSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.StatisticalOperation.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_STATISTICAL_OPERATION_USER, aslSession.getUsername());
|
||||
map.put(Constants.PARAMETER_STATISTICAL_OPERATION_ALGORITHM, statisticalOperationSession.getOperatorId());
|
||||
|
||||
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, String> parameters=statisticalOperationSession.getParameters();
|
||||
for (String key : parameters.keySet()) {
|
||||
params.put(key.toString(), parameters.get(key));
|
||||
}
|
||||
map.put(Constants.PARAMETER_STATISTICAL_OPERATION_PARAMETERS, params);
|
||||
|
||||
map.put(Constants.PARAMETER_STATISTICAL_OPERATION_DESCRIPTION, statisticalOperationSession.getDescription());
|
||||
map.put(Constants.PARAMETER_STATISTICAL_OPERATION_TITLE, statisticalOperationSession.getTitle());
|
||||
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
|
||||
operationExecutionSpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,12 @@ public class Constants {
|
|||
public static final String PARAMETER_UNION_COMPOSITE_SOURCE = "source";
|
||||
public static final String PARAMETER_UNION_COMPOSITE_TARGET = "target";
|
||||
public static final String PARAMETER_UNION_COMPOSITE = "mappings";
|
||||
|
||||
|
||||
public static final String PARAMETER_STATISTICAL_OPERATION_USER = "user";
|
||||
public static final String PARAMETER_STATISTICAL_OPERATION_ALGORITHM = "algorithm";
|
||||
public static final String PARAMETER_STATISTICAL_OPERATION_PARAMETERS = "smEntries";
|
||||
public static final String PARAMETER_STATISTICAL_OPERATION_DESCRIPTION = "description";
|
||||
public static final String PARAMETER_STATISTICAL_OPERATION_TITLE = "title";
|
||||
|
||||
public static final String PARAMETER_ADD_ROW_COMPOSITE_FIELD = "field";
|
||||
public static final String PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE = "toSetValue";
|
||||
|
|
|
@ -96,7 +96,8 @@ public enum UIOperationsId {
|
|||
ResubmitTask("ResubmitTask"),
|
||||
RollBack("Roll Back"),
|
||||
ApplyTemplate("Apply Template"),
|
||||
GenerateMap("Generate Map");
|
||||
GenerateMap("Generate Map"),
|
||||
StatisticalOperation("Statistical Operation");
|
||||
|
||||
/**
|
||||
* @param text
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.gwtservice.shared.statistical;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class StatisticalOperationSession implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8968614490778086448L;
|
||||
private TRId trId;
|
||||
private Map<String, String> parameters;
|
||||
private String description;
|
||||
private String title;
|
||||
private String operatorId;
|
||||
private String operatorName;
|
||||
private String operatorBriefDescription;
|
||||
|
||||
public StatisticalOperationSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StatisticalOperationSession(TRId trId,
|
||||
Map<String, String> parameters, String description, String title,
|
||||
String operatorId, String operatorName,
|
||||
String operatorBriefDescription) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
this.parameters = parameters;
|
||||
this.description = description;
|
||||
this.title = title;
|
||||
this.operatorId = operatorId;
|
||||
this.operatorName = operatorName;
|
||||
this.operatorBriefDescription = operatorBriefDescription;
|
||||
}
|
||||
|
||||
public TRId getTrId() {
|
||||
return trId;
|
||||
}
|
||||
|
||||
public void setTrId(TRId trId) {
|
||||
this.trId = trId;
|
||||
}
|
||||
|
||||
public Map<String, String> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, String> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorId(String operatorId) {
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public String getOperatorName() {
|
||||
return operatorName;
|
||||
}
|
||||
|
||||
public void setOperatorName(String operatorName) {
|
||||
this.operatorName = operatorName;
|
||||
}
|
||||
|
||||
public String getOperatorBriefDescription() {
|
||||
return operatorBriefDescription;
|
||||
}
|
||||
|
||||
public void setOperatorBriefDescription(String operatorBriefDescription) {
|
||||
this.operatorBriefDescription = operatorBriefDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StatisticalOperationSession [trId=" + trId + ", parameters="
|
||||
+ parameters + ", description=" + description + ", title="
|
||||
+ title + ", operatorId=" + operatorId + ", operatorName="
|
||||
+ operatorName + ", operatorBriefDescription="
|
||||
+ operatorBriefDescription + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue