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,
TRId trId) throws TDGWTServiceException;
/**
* Remove Validations from tabular resource
*
* @param trId
* @return
* @throws TDGWTServiceException
*/
public String startValidationsDelete(TRId trId)
throws TDGWTServiceException;
// RollBack
/**
* Call rollback on tabular resource
@ -460,7 +470,6 @@ public interface TDGWTService extends RemoteService {
public void setShareTemplate(ShareTemplate shareTemplate)
throws TDGWTServiceException;
/**
* Share Rule
*
@ -468,8 +477,7 @@ public interface TDGWTService extends RemoteService {
* @return
* @throws TDGWTServiceException
*/
public void setShareRule(ShareRule shareRule)
throws TDGWTServiceException;
public void setShareRule(ShareRule shareRule) throws TDGWTServiceException;
// Open
@ -568,11 +576,11 @@ public interface TDGWTService extends RemoteService {
*/
public ArrayList<ColumnData> getColumnWithViewColumnIncluded(TRId trId)
throws TDGWTServiceException;
/**
* Retrieves the list of columns in the table provided by trId
* only view columns in relationship are included.
* TimeDimensionColumn and DimensionColumn are not included.
* Retrieves the list of columns in the table provided by trId only view
* columns in relationship are included. TimeDimensionColumn and
* DimensionColumn are not included.
*
*
* @param trId
@ -581,7 +589,7 @@ public interface TDGWTService extends RemoteService {
*/
public ArrayList<ColumnData> getColumnWithOnlyViewColumnInRel(TRId trId)
throws TDGWTServiceException;
/**
* Retrieves the list of columns in the table provided by trId for
* statistical

View File

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

View File

@ -5846,7 +5846,59 @@ 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)
throws TDGWTServiceException {
try {