Updated for curation on validations
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@95873 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8df18051ef
commit
6fbe320733
|
@ -29,6 +29,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySessio
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
||||||
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.RefColumn;
|
||||||
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.batch.Occurrences;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences;
|
||||||
|
@ -96,14 +97,13 @@ public interface TDGWTService extends RemoteService {
|
||||||
|
|
||||||
// TabularResource
|
// TabularResource
|
||||||
/**
|
/**
|
||||||
* Get current TRId
|
* Get current TRId
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public TRId getCurrentTRId() throws TDGWTServiceException;
|
public TRId getCurrentTRId() throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get informations on the current tabular resource
|
* Get informations on the current tabular resource
|
||||||
*
|
*
|
||||||
|
@ -204,11 +204,18 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public ArrayList<TRMetadata> getTRMetadata(TRId trId)
|
public ArrayList<TRMetadata> getTRMetadata(TRId trId)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retreive a ColumnData that is a connection to external table
|
||||||
|
*
|
||||||
//Validations
|
* @param refColumn
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public ColumnData getConnection(RefColumn refColumn)
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// Validations
|
||||||
/**
|
/**
|
||||||
* Returns validations contained in the tasks
|
* Returns validations contained in the tasks
|
||||||
*
|
*
|
||||||
|
@ -216,9 +223,9 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public ValidationsTasksMetadata getValidationsTasksMetadata(TRId trId)
|
public ValidationsTasksMetadata getValidationsTasksMetadata(TRId trId)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return Validations Metadata of Table
|
* Return Validations Metadata of Table
|
||||||
*
|
*
|
||||||
|
@ -226,10 +233,9 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns ArrayList<ColumnData> that contains all the validation columns of
|
* Returns ArrayList<ColumnData> that contains all the validation columns of
|
||||||
* columnName
|
* columnName
|
||||||
|
@ -241,37 +247,34 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public ArrayList<ColumnData> getValidationColumns(TRId trId,
|
public ArrayList<ColumnData> getValidationColumns(TRId trId,
|
||||||
String columnName) throws TDGWTServiceException;
|
String columnName) throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// RollBack
|
||||||
//RollBack
|
|
||||||
/**
|
/**
|
||||||
* Call rollback on tabular resource
|
* Call rollback on tabular resource
|
||||||
*
|
*
|
||||||
* @param rollBackSession
|
* @param rollBackSession
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public void rollBack(RollBackSession rollBackSession)
|
public void rollBack(RollBackSession rollBackSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Operation Monitor during the rollback
|
* Get Operation Monitor during the rollback
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public RollBackSessionMonitor getRollBackMonitor()
|
public RollBackSessionMonitor getRollBackMonitor()
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call discard operation on tabular resource
|
* Call discard operation on tabular resource
|
||||||
*
|
*
|
||||||
* @param trId
|
* @param trId
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public RollBackSession discard(TRId trId)
|
public RollBackSession discard(TRId trId) throws TDGWTServiceException;
|
||||||
throws TDGWTServiceException;
|
|
||||||
|
|
||||||
|
|
||||||
// Share
|
// Share
|
||||||
/**
|
/**
|
||||||
* Retrieves information sharing on the tabular resource
|
* Retrieves information sharing on the tabular resource
|
||||||
|
@ -596,11 +599,10 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public EditRowMonitor getEditRowMonitor()
|
public EditRowMonitor getEditRowMonitor() throws TDGWTServiceException;
|
||||||
throws TDGWTServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start edit row or add row
|
* Start edit row or add row
|
||||||
*
|
*
|
||||||
* @param labelColumnSession
|
* @param labelColumnSession
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
|
@ -608,7 +610,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public void startEditRow(EditRowSession editRowSession)
|
public void startEditRow(EditRowSession editRowSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Operation Monitor during the Delete Rows operation
|
* Get Operation Monitor during the Delete Rows operation
|
||||||
*
|
*
|
||||||
|
@ -805,8 +806,8 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
ArrayList<String> getLocales() throws TDGWTServiceException;
|
ArrayList<String> getLocales() throws TDGWTServiceException;
|
||||||
|
|
||||||
//History
|
// History
|
||||||
/**
|
/**
|
||||||
* Retrieve History
|
* Retrieve History
|
||||||
*
|
*
|
||||||
|
@ -814,7 +815,7 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
ArrayList<OpHistory> getHistory() throws TDGWTServiceException;
|
ArrayList<OpHistory> getHistory() throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve History for specific tabular resource
|
* Retrieve History for specific tabular resource
|
||||||
*
|
*
|
||||||
|
@ -823,14 +824,14 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
ArrayList<OpHistory> getHistory(TRId trId) throws TDGWTServiceException;
|
ArrayList<OpHistory> getHistory(TRId trId) throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
OpHistory getLastOperationInfo() throws TDGWTServiceException;
|
OpHistory getLastOperationInfo() throws TDGWTServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param trId
|
* @param trId
|
||||||
|
@ -838,6 +839,5 @@ public interface TDGWTService extends RemoteService {
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
OpHistory getLastOperationInfo(TRId trId) throws TDGWTServiceException;
|
OpHistory getLastOperationInfo(TRId trId) throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySessio
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
||||||
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.RefColumn;
|
||||||
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.batch.Occurrences;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences;
|
||||||
|
@ -100,6 +101,7 @@ public interface TDGWTServiceAsync {
|
||||||
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);
|
||||||
|
|
||||||
//Validations
|
//Validations
|
||||||
void getValidationsTasksMetadata(TRId trId,AsyncCallback<ValidationsTasksMetadata> callback);
|
void getValidationsTasksMetadata(TRId trId,AsyncCallback<ValidationsTasksMetadata> callback);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
|
import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
|
@ -73,15 +74,15 @@ public class SessionUtil {
|
||||||
ASLSession session;
|
ASLSession session;
|
||||||
if (username == null) {
|
if (username == null) {
|
||||||
logger.warn("no user found in session, using test one");
|
logger.warn("no user found in session, using test one");
|
||||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
|
||||||
|
|
||||||
/*username = Constants.DEFAULT_USER;
|
username = Constants.DEFAULT_USER;
|
||||||
String scope = Constants.DEFAULT_SCOPE;
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
|
||||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
session.setScope(scope);*/
|
session.setScope(scope);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.gcube.data.analysis.tabulardata.model.metadata.common.DescriptionsMet
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.Validation;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.Validation;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.ValidationsMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.ValidationsMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
|
||||||
|
@ -100,12 +101,13 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExpressionGenerator;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExpressionGenerator;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
|
@ -140,6 +142,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
||||||
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.ColumnViewData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.RelationshipData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.RelationshipData;
|
||||||
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;
|
||||||
|
@ -3871,7 +3874,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
* @param replaceColumnSession
|
* @param replaceColumnSession
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// TODO Check this operation
|
|
||||||
protected OperationExecution retrieveOperationExecution(
|
protected OperationExecution retrieveOperationExecution(
|
||||||
TabularDataService service, EditRowSession editRowSession)
|
TabularDataService service, EditRowSession editRowSession)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
|
@ -6487,6 +6490,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
validations.add(validation);
|
validations.add(validation);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
//TODO Fix refColumn
|
||||||
|
|
||||||
InvocationS invocationS=null;
|
InvocationS invocationS=null;
|
||||||
if (job.getInvocation() != null) {
|
if (job.getInvocation() != null) {
|
||||||
Map<String,Object> mapSent=new HashMap<String,Object>();
|
Map<String,Object> mapSent=new HashMap<String,Object>();
|
||||||
|
@ -6499,10 +6504,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
mapSent.put(key, o.toString());
|
mapSent.put(key, o.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefColumn refColumn=ExtractReferences.extract(job.getInvocation());
|
||||||
|
|
||||||
invocationS = new InvocationS(job.getInvocation()
|
invocationS = new InvocationS(job.getInvocation()
|
||||||
.getColumnId(), job.getInvocation()
|
.getColumnId(), job.getInvocation()
|
||||||
.getIdentifier(), job.getInvocation()
|
.getIdentifier(), job.getInvocation()
|
||||||
.getOperationId(), mapSent);
|
.getOperationId(), mapSent, refColumn);
|
||||||
}
|
}
|
||||||
JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
|
JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
|
||||||
job.getHumaReadableStatus(), job.getDescription(),
|
job.getHumaReadableStatus(), job.getDescription(),
|
||||||
|
@ -6678,5 +6685,44 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TODO Connect
|
||||||
|
@Override
|
||||||
|
public ColumnData getConnection(RefColumn refColumn)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
logger.debug("GetConnection on " + refColumn.toString());
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
TableId tableId = new TableId(
|
||||||
|
new Long(refColumn.getTableId()));
|
||||||
|
|
||||||
|
Table table=service.getTable(tableId);
|
||||||
|
TableDescriptorMetadata tableDesc=table.getMetadata(TableDescriptorMetadata.class);
|
||||||
|
if(tableDesc==null){
|
||||||
|
logger.error("Error in getConnection(): No TableDescriptorMetadata found for table "+table);
|
||||||
|
throw new TDGWTServiceException("Error in getConnection(): No TableDescriptorMetadata found for table "+table);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("Table connect to tabular resource: "+tableDesc.getRefId());
|
||||||
|
TRId tId=new TRId(String.valueOf(tableDesc.getRefId()));
|
||||||
|
TRId trId=retrieveTabularResourceBasicData(tId);
|
||||||
|
ColumnData columnData=getColumn(refColumn.getColumnId(), trId);
|
||||||
|
|
||||||
|
return columnData;
|
||||||
|
} catch (TDGWTSessionExpiredException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.debug("Error in getConnection(): " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException("Error: " + e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.server.trservice;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.column.ColumnReference;
|
||||||
|
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.tr.RefColumn;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExtractReferences {
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(ExtractReferences.class);
|
||||||
|
|
||||||
|
public static RefColumn extract(OperationExecution op) {
|
||||||
|
logger.debug("ExtractReferences OperationExecution: "+op);
|
||||||
|
RefColumn refColumn = null;
|
||||||
|
Long opId = op.getOperationId();
|
||||||
|
|
||||||
|
if (opId.compareTo(OperationsId.ChangeToDimensionColumn.toLong())==0) {
|
||||||
|
refColumn = retrieveRefColumn(op);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("ExtractReferences: " + refColumn);
|
||||||
|
return refColumn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static RefColumn retrieveRefColumn(OperationExecution op) {
|
||||||
|
RefColumn refColumn = null;
|
||||||
|
Map<String, Object> parameters = op.getParameters();
|
||||||
|
ColumnReference columnReference = (ColumnReference) parameters
|
||||||
|
.get(Constants.PARAMETER_REFERENCE_COLUMN);
|
||||||
|
logger.debug("Parameter " + Constants.PARAMETER_REFERENCE_COLUMN + ": "
|
||||||
|
+ columnReference);
|
||||||
|
if (columnReference != null && columnReference.getColumnId() != null
|
||||||
|
&& columnReference.getTableId() != null) {
|
||||||
|
refColumn = new RefColumn(String.valueOf(columnReference
|
||||||
|
.getTableId().getValue()), columnReference.getColumnId()
|
||||||
|
.getValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
return refColumn;
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,7 @@ public class Constants {
|
||||||
public static final String NAME_PARAMETER_ID="NAME_PARAMETER_ID";
|
public static final String NAME_PARAMETER_ID="NAME_PARAMETER_ID";
|
||||||
public static final String PARAMETER_KEY="key";
|
public static final String PARAMETER_KEY="key";
|
||||||
public static final String PARAMETER_REFERENCE_COLUMN="refColumn";
|
public static final String PARAMETER_REFERENCE_COLUMN="refColumn";
|
||||||
|
|
||||||
public static final String PARAMETER_PERIOD_FORMAT="periodFormat";
|
public static final String PARAMETER_PERIOD_FORMAT="periodFormat";
|
||||||
public static final String PARAMETER_EXPRESSION="expression";
|
public static final String PARAMETER_EXPRESSION="expression";
|
||||||
|
|
||||||
|
@ -55,4 +56,8 @@ public class Constants {
|
||||||
|
|
||||||
public static final String PARAMETER_ROW_ID="rowId";
|
public static final String PARAMETER_ROW_ID="rowId";
|
||||||
|
|
||||||
|
public static final String REQUEST_PROPERTIES_REFCOLUMN="RefColumn";
|
||||||
|
public static final String REQUEST_PROPERTIES_COLUMNID="ColumnId";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.td.gwtservice.server.trservice;
|
package org.gcube.portlets.user.td.gwtservice.shared;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,6 +129,11 @@ public enum OperationsId {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long toLong(){
|
||||||
|
return Long.valueOf(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.gwtservice.shared.task;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
|
@ -16,19 +18,21 @@ public class InvocationS implements Serializable {
|
||||||
protected long operationId;
|
protected long operationId;
|
||||||
protected Long identifier;
|
protected Long identifier;
|
||||||
protected Map<String, Object> parameters;
|
protected Map<String, Object> parameters;
|
||||||
|
protected RefColumn refColumn;
|
||||||
public InvocationS(){
|
|
||||||
|
public InvocationS() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InvocationS(String columnId,long operationId,Long identifier,Map<String, Object> parameters){
|
public InvocationS(String columnId, long operationId, Long identifier,
|
||||||
this.columnId=columnId;
|
Map<String, Object> parameters, RefColumn refColumn) {
|
||||||
this.operationId=operationId;
|
this.columnId = columnId;
|
||||||
this.identifier=identifier;
|
this.operationId = operationId;
|
||||||
this.parameters=parameters;
|
this.identifier = identifier;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.refColumn=refColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getColumnId() {
|
public String getColumnId() {
|
||||||
return columnId;
|
return columnId;
|
||||||
}
|
}
|
||||||
|
@ -60,12 +64,22 @@ public class InvocationS implements Serializable {
|
||||||
public void setParameters(Map<String, Object> parameters) {
|
public void setParameters(Map<String, Object> parameters) {
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RefColumn getRefColumn() {
|
||||||
|
return refColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefColumn(RefColumn refColumn) {
|
||||||
|
this.refColumn = refColumn;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InvocationS [columnId=" + columnId + ", operationId="
|
return "InvocationS [columnId=" + columnId + ", operationId="
|
||||||
+ operationId + ", identifier=" + identifier + ", parameters="
|
+ operationId + ", identifier=" + identifier + ", parameters="
|
||||||
+ parameters + "]";
|
+ parameters + ", refColumn=" + refColumn + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.tr;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RefColumn implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5400296839423693397L;
|
||||||
|
|
||||||
|
protected String tableId;
|
||||||
|
protected String columnId;
|
||||||
|
|
||||||
|
public RefColumn(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RefColumn(String tableId, String columnId){
|
||||||
|
this.tableId=tableId;
|
||||||
|
this.columnId=columnId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTableId() {
|
||||||
|
return tableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTableId(String tableId) {
|
||||||
|
this.tableId = tableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColumnId() {
|
||||||
|
return columnId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnId(String columnId) {
|
||||||
|
this.columnId = columnId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RefColumn [tableId=" + tableId + ", columnId=" + columnId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue