From 3f208a8026168fdd9f976e401829f1ddcd2624ef Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 23 Apr 2015 09:58:45 +0000 Subject: [PATCH] Updated Rules git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114358 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/server/TDGWTServiceImpl.java | 24 +++++++---- .../shared/rule/ApplyColumnRulesSession.java | 41 +++++++++++++------ 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index e02a5fa..b15079f 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -9484,16 +9484,24 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error in apply rules on column: No column selected."); } - ArrayList rules=applyColumnRulesSession.getRules(); - ArrayList ruleIds=new ArrayList(); - for(RuleDescriptionData r:rules){ - RuleId ruleId=new RuleId(r.getId()); - ruleIds.add(ruleId); - } - ColumnLocalId columnLocalId=new ColumnLocalId(column.getColumnId()); - Task trTask = service.applyColumnRule(tabularResourceId, columnLocalId,ruleIds ); + ArrayList rulesThatWillBeDetach=applyColumnRulesSession.getRulesThatWillBeDetached(); + ArrayList ruleIdsDetach=new ArrayList(); + for(RuleDescriptionData r:rulesThatWillBeDetach){ + RuleId ruleDetachId=new RuleId(r.getId()); + ruleIdsDetach.add(ruleDetachId); + } + service.detachColumnRules(tabularResourceId, columnLocalId,ruleIdsDetach ); + + + ArrayList rulesThatWillBeApplied=applyColumnRulesSession.getRulesThatWillBeApplied(); + ArrayList ruleIdsApplied=new ArrayList(); + for(RuleDescriptionData r:rulesThatWillBeApplied){ + RuleId ruleAppliedId=new RuleId(r.getId()); + ruleIdsApplied.add(ruleAppliedId); + } + Task trTask = service.applyColumnRule(tabularResourceId, columnLocalId,ruleIdsApplied ); logger.debug("Rules On Column Apply: TaskId " + trTask.getId()); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/rule/ApplyColumnRulesSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/rule/ApplyColumnRulesSession.java index 1c1abb3..31edf9b 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/rule/ApplyColumnRulesSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/rule/ApplyColumnRulesSession.java @@ -17,18 +17,28 @@ public class ApplyColumnRulesSession implements Serializable { private static final long serialVersionUID = -7746819321348425711L; private TRId trId; private ColumnData column; - private ArrayList rules; + private ArrayList rulesThatWillBeApplied; + private ArrayList rulesThatWillBeDetached; public ApplyColumnRulesSession() { super(); } + /** + * + * @param trId + * @param column + * @param rulesThatWillBeApplied + * @param rulesThatWillBeDetached + */ public ApplyColumnRulesSession(TRId trId, ColumnData column, - ArrayList rules) { + ArrayList rulesThatWillBeApplied, + ArrayList rulesThatWillBeDetached) { super(); this.trId = trId; this.column = column; - this.rules = rules; + this.rulesThatWillBeApplied = rulesThatWillBeApplied; + this.rulesThatWillBeDetached = rulesThatWillBeDetached; } public TRId getTrId() { @@ -47,22 +57,29 @@ public class ApplyColumnRulesSession implements Serializable { this.column = column; } - public ArrayList getRules() { - return rules; + public ArrayList getRulesThatWillBeApplied() { + return rulesThatWillBeApplied; } - public void setRules(ArrayList rules) { - this.rules = rules; + public void setRulesThatWillBeApplied( + ArrayList rulesThatWillBeApplied) { + this.rulesThatWillBeApplied = rulesThatWillBeApplied; + } + + public ArrayList getRulesThatWillBeDetached() { + return rulesThatWillBeDetached; + } + + public void setRulesThatWillBeDetached( + ArrayList rulesThatWillBeDetached) { + this.rulesThatWillBeDetached = rulesThatWillBeDetached; } @Override public String toString() { return "ApplyColumnRulesSession [trId=" + trId + ", column=" + column - + ", rules=" + rules + "]"; + + ", rulesThatWillBeApplied=" + rulesThatWillBeApplied + + ", rulesThatWillBeDetached=" + rulesThatWillBeDetached + "]"; } - - - - }