Updated Rules

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114286 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-21 11:37:15 +00:00
parent 027993085e
commit 9256c69e17
5 changed files with 34 additions and 22 deletions

View File

@ -31,7 +31,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownsca
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession;
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;
@ -1093,14 +1093,14 @@ public class SessionUtil {
//
public static RulesOnColumnApplySession getRulesOnColumnApplySession(
public static ApplyColumnRulesSession getRulesOnColumnApplySession(
HttpSession httpSession) {
RulesOnColumnApplySession rulesOnColumnApplySession = (RulesOnColumnApplySession) httpSession
ApplyColumnRulesSession rulesOnColumnApplySession = (ApplyColumnRulesSession) httpSession
.getAttribute(SessionConstants.RULES_ON_COLUMN_APPLY_SESSION);
if (rulesOnColumnApplySession != null) {
return rulesOnColumnApplySession;
} else {
rulesOnColumnApplySession = new RulesOnColumnApplySession();
rulesOnColumnApplySession = new ApplyColumnRulesSession();
httpSession.setAttribute(
SessionConstants.RULES_ON_COLUMN_APPLY_SESSION,
rulesOnColumnApplySession);
@ -1110,8 +1110,8 @@ public class SessionUtil {
public static void setRulesOnColumnApplySession(
HttpSession httpSession,
RulesOnColumnApplySession rulesOnColumnApplySession) {
RulesOnColumnApplySession rules = (RulesOnColumnApplySession) httpSession
ApplyColumnRulesSession rulesOnColumnApplySession) {
ApplyColumnRulesSession rules = (ApplyColumnRulesSession) httpSession
.getAttribute(SessionConstants.RULES_ON_COLUMN_APPLY_SESSION);
if (rules != null) {
httpSession

View File

@ -194,7 +194,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession;
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.share.Contacts;
@ -9388,34 +9388,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
/**
*
* @param rulesOnColumnApplySession
* @param applyColumnRulesSession
* @param session
* @return
* @throws TDGWTServiceException
*/
public String startRulesOnColumnApply(
RulesOnColumnApplySession rulesOnColumnApplySession,
public String startApplyColumnnRules(
ApplyColumnRulesSession applyColumnRulesSession,
HttpSession session) throws TDGWTServiceException {
try {
// HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
SessionUtil.setRulesOnColumnApplySession(session, rulesOnColumnApplySession);
SessionUtil.setRulesOnColumnApplySession(session, applyColumnRulesSession);
if (rulesOnColumnApplySession == null) {
logger.error("RulesOnColumnApplySession is null");
if (applyColumnRulesSession == null) {
logger.error("ApplyColumnRulesSession is null");
throw new TDGWTServiceException(
"Error in apply rules on column: RulesOnColumnApplySession is null");
"Error in apply rules on column: ApplyColumnRulesSession is null");
}
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService();
checkTRId(rulesOnColumnApplySession.getTrId());
checkTRId(applyColumnRulesSession.getTrId());
TabularResourceId tabularResourceId = new TabularResourceId(
Long.valueOf(rulesOnColumnApplySession
Long.valueOf(applyColumnRulesSession
.getTrId().getId()));
TabularResource tabularResource = service
.getTabularResource(tabularResourceId);
@ -9424,14 +9424,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
checkTabularResourceLocked(tabularResource);
checkTabularResourceIsFinal(tabularResource);
ColumnData column=rulesOnColumnApplySession.getColumn();
ColumnData column=applyColumnRulesSession.getColumn();
if(column==null){
logger.error("Error in apply rules on column: No column selected.");
throw new TDGWTServiceException(
"Error in apply rules on column: No column selected.");
}
ArrayList<RuleDescriptionData> rules=rulesOnColumnApplySession.getRules();
ArrayList<RuleDescriptionData> rules=applyColumnRulesSession.getRules();
ArrayList<RuleId> ruleIds=new ArrayList<RuleId>();
for(RuleDescriptionData r:rules){
RuleId ruleId=new RuleId(r.getId());
@ -9444,7 +9444,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.RuleOnColumnApply,
rulesOnColumnApplySession.getTrId());
applyColumnRulesSession.getTrId());
SessionUtil.setStartedTask(session, taskWrapper);
return trTask.getId().getValue();

View File

@ -12,18 +12,18 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class RulesOnColumnApplySession implements Serializable {
public class ApplyColumnRulesSession implements Serializable {
private static final long serialVersionUID = -7746819321348425711L;
private TRId trId;
private ColumnData column;
private ArrayList<RuleDescriptionData> rules;
public RulesOnColumnApplySession() {
public ApplyColumnRulesSession() {
super();
}
public RulesOnColumnApplySession(TRId trId, ColumnData column,
public ApplyColumnRulesSession(TRId trId, ColumnData column,
ArrayList<RuleDescriptionData> rules) {
super();
this.trId = trId;

View File

@ -92,6 +92,14 @@ public class RuleDescriptionData implements Serializable {
public void setScope(RuleScopeType scope) {
this.scope = scope;
}
public String getScopeLabel(){
if(scope==null){
return "";
} else {
return scope.getLabel();
}
}
public TDRuleColumnType getTdRuleColumnType() {
return tdRuleColumnType;

View File

@ -23,6 +23,10 @@ public enum RuleScopeType {
return id;
}
public String getLabel() {
return id;
}
public static RuleScopeType get(String ruleScopeType) {
for(RuleScopeType ws:values()){