Added Delete Rule
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114199 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b2ed6e163a
commit
023c72d122
|
@ -58,4 +58,6 @@ public interface ExpressionService extends RemoteService {
|
|||
public String saveColumnRule(RuleDescriptionData ruleDescriptionData)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
public void removeRuleById(String ruleId) throws TDGWTServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -43,5 +43,6 @@ public interface ExpressionServiceAsync {
|
|||
|
||||
void saveColumnRule(RuleDescriptionData ruleDescriptionData,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
|
||||
void removeRuleById(String ruleId, AsyncCallback<Void> callback);
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
|||
|
||||
String ruleIdent=null;
|
||||
if(ruleId!=null){
|
||||
ruleIdent=String.valueOf(ruleId.getId());
|
||||
ruleIdent=String.valueOf(ruleId.getValue());
|
||||
}
|
||||
|
||||
return ruleIdent;
|
||||
|
@ -373,6 +373,61 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void removeRuleById(
|
||||
String ruleId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("RemoveRuleById() :" + ruleId);
|
||||
if(ruleId==null|| ruleId.isEmpty()){
|
||||
throw new TDGWTServiceException("Error removing the rule, ruleId="+ruleId);
|
||||
}
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
long rId=0;
|
||||
|
||||
try{
|
||||
rId=Long.parseLong(ruleId);
|
||||
} catch(NumberFormatException e){
|
||||
throw new TDGWTServiceException("Error removing the rule, ruleId="+ruleId);
|
||||
}
|
||||
|
||||
|
||||
RuleId id=new RuleId(rId);
|
||||
|
||||
service.removeRuleById(id);
|
||||
|
||||
return;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in getRule(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error removing the rules: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve and set Tabular Resource Type
|
||||
|
|
Loading…
Reference in New Issue