Added Delete Validations

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@115466 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-22 15:23:29 +00:00
parent b454b07d2d
commit c794410030
3 changed files with 70 additions and 8 deletions

View File

@ -420,6 +420,16 @@ public interface TDGWTService extends RemoteService {
public ArrayList<ColumnData> getValidationColumns(String columnLocalId, public ArrayList<ColumnData> getValidationColumns(String columnLocalId,
TRId trId) throws TDGWTServiceException; TRId trId) throws TDGWTServiceException;
/**
* Remove Validations from tabular resource
*
* @param trId
* @return
* @throws TDGWTServiceException
*/
public String startValidationsDelete(TRId trId)
throws TDGWTServiceException;
// RollBack // RollBack
/** /**
* Call rollback on tabular resource * Call rollback on tabular resource
@ -460,7 +470,6 @@ public interface TDGWTService extends RemoteService {
public void setShareTemplate(ShareTemplate shareTemplate) public void setShareTemplate(ShareTemplate shareTemplate)
throws TDGWTServiceException; throws TDGWTServiceException;
/** /**
* Share Rule * Share Rule
* *
@ -468,8 +477,7 @@ public interface TDGWTService extends RemoteService {
* @return * @return
* @throws TDGWTServiceException * @throws TDGWTServiceException
*/ */
public void setShareRule(ShareRule shareRule) public void setShareRule(ShareRule shareRule) throws TDGWTServiceException;
throws TDGWTServiceException;
// Open // Open
@ -570,9 +578,9 @@ public interface TDGWTService extends RemoteService {
throws TDGWTServiceException; throws TDGWTServiceException;
/** /**
* Retrieves the list of columns in the table provided by trId * Retrieves the list of columns in the table provided by trId only view
* only view columns in relationship are included. * columns in relationship are included. TimeDimensionColumn and
* TimeDimensionColumn and DimensionColumn are not included. * DimensionColumn are not included.
* *
* *
* @param trId * @param trId

View File

@ -216,6 +216,8 @@ public interface TDGWTServiceAsync {
void getValidationColumns(String columnLocalId, TRId trId, void getValidationColumns(String columnLocalId, TRId trId,
AsyncCallback<ArrayList<ColumnData>> callback); AsyncCallback<ArrayList<ColumnData>> callback);
void startValidationsDelete(TRId trId, AsyncCallback<String> callback);
// RollBack // RollBack
void startRollBack(RollBackSession rollBackSession, void startRollBack(RollBackSession rollBackSession,
AsyncCallback<String> callback); AsyncCallback<String> callback);

View File

@ -5847,6 +5847,58 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
//TODO
/**
*
* {@inheritDoc}
*/
@Override
public String startValidationsDelete(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();
checkTRId(trId);
TabularResourceId tabularResourceId = new TabularResourceId(
Long.valueOf(trId.getId()));
TabularResource tabularResource = service
.getTabularResource(tabularResourceId);
checkTabularResourceIsFlow(tabularResource);
checkTabularResourceLocked(tabularResource);
checkTabularResourceIsFinal(tabularResource);
Task trTask = service.removeValidations(tabularResourceId);
logger.debug("Start Task on service: TaskId " + trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.ValidationsDelete, trId);
SessionUtil.setStartedTask(session, taskWrapper);
return trTask.getId().getValue();
} catch (TDGWTServiceException e) {
throw e;
} catch (SecurityException e) {
e.printStackTrace();
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error deleting validations: "
+ e.getLocalizedMessage());
}
}
private ArrayList<Contacts> retrieveShareInfo(TabularResource tr) private ArrayList<Contacts> retrieveShareInfo(TabularResource tr)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {