diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java index e3619eb..e9339af 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java @@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.expressionwidget.client; import java.util.ArrayList; import org.gcube.portlets.user.td.expressionwidget.client.expression.ConditionWidget; +import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification; import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataPropertiesCombo; import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataTypeProperties; import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources; @@ -15,7 +16,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDBaseColumnRuleType; import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDRuleColumnType; import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3; -import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper; import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; @@ -48,6 +48,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FieldSet; +import com.sencha.gxt.widget.core.client.form.TextArea; import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.info.Info; @@ -58,6 +59,7 @@ import com.sencha.gxt.widget.core.client.info.Info; * */ public class ColumnExpressionPanel extends FramedPanel { + private static final String RULE_DESCRIPTION_HEIGHT = "44px"; private static final String RULE_PLACE_HOLDER_ID = "RulePlaceHolderId"; private enum ColumnExpressionPanelType { @@ -71,9 +73,9 @@ public class ColumnExpressionPanel extends FramedPanel { private static final String RULE_HEIGHT = "388px"; private ColumnExpressionPanelType type; - private EventBus eventBus; + - private ColumnExpressionDialog parentTemplateDialog; + private TemplateColumnExpressionDialog parentTemplateDialog; private ColumnFilterDialog parentFilterDialog; private RowsDeleteByExpressionDialog parentRowsDeleteByExpressionDialog; private MultiColumnFilterTabPanel parentMultiColumnFilterTabPanel; @@ -92,7 +94,7 @@ public class ColumnExpressionPanel extends FramedPanel { private RuleDescriptionData initialRuleDescriptionData; private TextField ruleName; - private TextField ruleDescription; + private TextArea ruleDescription; // private ComboBox comboColumnTypeCode; // private ComboBox comboMeasureType; @@ -119,7 +121,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.parentMultiColumnFilterTabPanel = parentMultiColumnFilterTabPanel; this.column = column; this.columns = null; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnMultiColumnFilter(); @@ -141,7 +142,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.parentFilterDialog = parentFilterDialog; this.column = column; this.columns = columns; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnFilter(); } @@ -163,7 +163,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.parentRowsDeleteByExpressionDialog = parentRowsDeleteByExpressionDialog; this.column = column; this.columns = columns; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnRowsDeleteByExpression(); } @@ -175,7 +174,7 @@ public class ColumnExpressionPanel extends FramedPanel { * @param eventBus */ public ColumnExpressionPanel( - ColumnExpressionDialog parentColumnExpressionDialog, + TemplateColumnExpressionDialog parentColumnExpressionDialog, ColumnData column, EventBus eventBus) { super(); setWidth(WIDTH); @@ -184,7 +183,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.parentTemplateDialog = parentColumnExpressionDialog; this.column = column; this.columns = null; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnTemplate(); @@ -203,7 +201,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.parentRuleDialog = parentRuleDialog; this.column = null; this.columns = null; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnRule(); @@ -219,7 +216,6 @@ public class ColumnExpressionPanel extends FramedPanel { this.initialRuleDescriptionData = ruleDescriptionData; this.column = null; this.columns = null; - this.eventBus = eventBus; Log.debug("Column:" + column); createOnRule(); @@ -308,7 +304,8 @@ public class ColumnExpressionPanel extends FramedPanel { } FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Rule Name"); - ruleDescription = new TextField(); + ruleDescription = new TextArea(); + ruleDescription.setHeight(RULE_DESCRIPTION_HEIGHT); ruleDescription.setToolTip("Rule Description"); if (initialRuleDescriptionData != null) { ruleDescription.setValue(initialRuleDescriptionData @@ -662,8 +659,8 @@ public class ColumnExpressionPanel extends FramedPanel { columnMockUp.getColumnDataType()); RuleDescriptionData ruleDescriptionData = new RuleDescriptionData( - 0, ruleNameS, ruleDescriptionS, null, RuleScopeType.COLUMN, - tdBaseColumnRule, exp); + 0, ruleNameS, ruleDescriptionS, null, + RuleScopeType.COLUMN, tdBaseColumnRule, exp); return ruleDescriptionData; } else { UtilsGXT3.alert("Attention", "Enter a valid condition!"); @@ -1108,7 +1105,6 @@ public class ColumnExpressionPanel extends FramedPanel { C_Expression exp; C_ExpressionContainer condContainer = null; ExpressionWrapper exWrapper = null; - ExpressionWrapperEvent expressionEvent = null; switch (type) { case Template: @@ -1119,7 +1115,6 @@ public class ColumnExpressionPanel extends FramedPanel { UtilsGXT3.alert("Attention", e.getLocalizedMessage()); return; } - parentTemplateDialog.setExpression(exp); condContainer = new C_ExpressionContainer(); condContainer.setId(C_ExpressionContainer.Contains.C_Expression); condContainer.setExp(exp); @@ -1127,10 +1122,11 @@ public class ColumnExpressionPanel extends FramedPanel { .getReadableExpression()); exWrapper = new ExpressionWrapper(column.getTrId(), column, condContainer); - expressionEvent = new ExpressionWrapperEvent(exWrapper); - Log.debug(expressionEvent.toString()); - parentTemplateDialog.hide(); - eventBus.fireEvent(expressionEvent); + + ExpressionWrapperNotification expressionWrapperNotification = new ExpressionWrapperNotification( + exWrapper); + Log.debug("Notification: "+expressionWrapperNotification); + parentTemplateDialog.onExpression(expressionWrapperNotification); break; case Rule: if (!conditionWidget.isEnabled()) { @@ -1191,12 +1187,7 @@ public class ColumnExpressionPanel extends FramedPanel { protected void close() { switch (type) { case Template: - ExpressionWrapper exWrapper = new ExpressionWrapper(); - ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent( - exWrapper); - Log.debug(expressionEvent.toString()); - parentTemplateDialog.hide(); - eventBus.fireEvent(expressionEvent); + parentTemplateDialog.close(); break; case Rule: parentRuleDialog.close(); diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionDialog.java index a30bb49..49183a5 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionDialog.java @@ -97,8 +97,6 @@ public class ReplaceExpressionDialog extends Window implements } - - /** * * ColumnMockUp and ColumnMockUpList must have set columnId, label, columnTypeCode and diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionPanel.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionPanel.java index 3c67fd6..3bb54fb 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ReplaceExpressionPanel.java @@ -9,7 +9,6 @@ import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionRe import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceExpressionType; import org.gcube.portlets.user.td.expressionwidget.shared.exception.ReplaceTypeMapException; import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3; -import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper; import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; @@ -392,17 +391,14 @@ public class ReplaceExpressionPanel extends FramedPanel { } ExpressionWrapper exWrapper; - ExpressionWrapperEvent expressionEvent; ExpressionWrapperNotification expressionWrapperNotification; switch (type) { case Template: exWrapper = new ExpressionWrapper( - replaceValue, column.getTrId(),column); - expressionEvent = new ExpressionWrapperEvent( - exWrapper); - Log.debug(expressionEvent.toString()); - eventBus.fireEvent(expressionEvent); + replaceValue, column.getTrId(), column); + expressionWrapperNotification=new ExpressionWrapperNotification(exWrapper); + parent.applyReplaceColumnByExpression(expressionWrapperNotification); close(); break; case Replace: @@ -430,23 +426,17 @@ public class ReplaceExpressionPanel extends FramedPanel { } ExpressionWrapper exWrapper; - ExpressionWrapperEvent expressionEvent; ExpressionWrapperNotification expressionWrapperNotification; C_ExpressionContainer replaceExpressionContainer; switch (type) { case Template: - replaceExpressionContainer = new C_ExpressionContainer( C_ExpressionContainer.Contains.C_Expression, cReplaceExpression, replaceWidget.getReadableExpression()); exWrapper = new ExpressionWrapper( replaceExpressionContainer, column.getTrId(), column); - expressionEvent = new ExpressionWrapperEvent( - exWrapper); - - Log.debug(expressionEvent.toString()); - eventBus.fireEvent(expressionEvent); - close(); + expressionWrapperNotification=new ExpressionWrapperNotification(exWrapper); + parent.applyReplaceColumnByExpression(expressionWrapperNotification); break; case Replace: case AddColumn: diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/RuleDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/RuleDialog.java index ac91d2c..dc92e30 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/RuleDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/RuleDialog.java @@ -174,7 +174,6 @@ public class RuleDialog extends Window implements if (listeners != null) { for (RuleDialogNotificationListener listener : listeners) { listener.failed(caught); - ; } } hide(); diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/TemplateColumnExpressionDialog.java similarity index 66% rename from src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java rename to src/main/java/org/gcube/portlets/user/td/expressionwidget/client/TemplateColumnExpressionDialog.java index 6fb6591..2364604 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/TemplateColumnExpressionDialog.java @@ -1,17 +1,18 @@ package org.gcube.portlets.user.td.expressionwidget.client; +import java.util.ArrayList; +import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification; +import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification.ExpressionWrapperNotificationListener; +import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification.HasExpressionWrapperNotificationListener; import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; -import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; -import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnMockUp; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; @@ -29,35 +30,35 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it * */ -public class ColumnExpressionDialog extends Window { +public class TemplateColumnExpressionDialog extends Window implements + HasExpressionWrapperNotificationListener { private static final String WIDTH = "660px"; private static final String HEIGHT = "426px"; + private ArrayList listeners; private ColumnExpressionPanel columnExpressionPanel; - private C_Expression exp = null; private ColumnData column = null; private TRId trId; private String columnId = null; private EventBus eventBus; - + /** * * @param columnMockUp * @param eventBus */ - public ColumnExpressionDialog( - ColumnMockUp columnMockUp, - EventBus eventBus) { - initWindow(); + public TemplateColumnExpressionDialog(ColumnMockUp columnMockUp, EventBus eventBus) { + listeners = new ArrayList(); this.eventBus = eventBus; column = new ColumnData(); column.setColumnId(columnMockUp.getColumnId()); column.setLabel(columnMockUp.getLabel()); column.setDataTypeName(columnMockUp.getColumnDataType().toString()); column.setTypeCode(columnMockUp.getColumnType().toString()); + initWindow(); create(); } @@ -68,12 +69,12 @@ public class ColumnExpressionDialog extends Window { * @param columnId * @param eventBus */ - public ColumnExpressionDialog(TRId trId, String columnId, - EventBus eventBus) { - initWindow(); + public TemplateColumnExpressionDialog(TRId trId, String columnId, EventBus eventBus) { + listeners = new ArrayList(); this.eventBus = eventBus; this.trId = trId; this.columnId = columnId; + initWindow(); load(); } @@ -90,7 +91,7 @@ public class ColumnExpressionDialog extends Window { getHeader().setIcon(ExpressionResources.INSTANCE.rule()); } - + /** * {@inheritDoc} */ @@ -100,22 +101,16 @@ public class ColumnExpressionDialog extends Window { closeBtn.addSelectHandler(new SelectHandler() { - public void onSelect(SelectEvent event) { close(); } }); } - - protected void close (){ - ExpressionWrapper exWrapper=new ExpressionWrapper(); - ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper); - Log.debug(expressionEvent.toString()); - hide(); - eventBus.fireEvent(expressionEvent); + + protected void close() { + fireAborted(); } - protected void create() { if (column.getTypeCode() @@ -148,18 +143,12 @@ public class ColumnExpressionDialog extends Window { } } - public C_Expression getExpression() { - return exp; - } - - protected void setExpression(C_Expression exp) { - Log.debug("New Expression set:" + exp.toString()); - this.exp = exp; - + protected void onExpression(ExpressionWrapperNotification expressionWrapperNotification){ + fireNotification(expressionWrapperNotification); } protected void load() { - TDGWTServiceAsync.INSTANCE.getColumn(columnId,trId, + TDGWTServiceAsync.INSTANCE.getColumn(columnId, trId, new AsyncCallback() { public void onFailure(Throwable caught) { @@ -174,10 +163,13 @@ public class ColumnExpressionDialog extends Window { } else { Log.error("Error retrieving column: " + caught.getMessage()); - UtilsGXT3.alert("Error","Error retrieving column: " - + caught.getMessage()); - } + UtilsGXT3.alert( + "Error", + "Error retrieving column: " + + caught.getMessage()); } + } + fireFailed(caught); } @@ -191,4 +183,47 @@ public class ColumnExpressionDialog extends Window { } + @Override + public void addExpressionWrapperNotificationListener( + ExpressionWrapperNotificationListener handler) { + listeners.add(handler); + + } + + @Override + public void removeExpressionWrapperNotificationListener( + ExpressionWrapperNotificationListener handler) { + listeners.remove(handler); + + } + + private void fireNotification(ExpressionWrapperNotification expressionWrapperNotification) { + if (listeners != null) { + for (ExpressionWrapperNotificationListener listener : listeners) { + listener.onExpression(expressionWrapperNotification); + } + } + hide(); + } + + private void fireAborted() { + if (listeners != null) { + for (ExpressionWrapperNotificationListener listener : listeners) { + listener.aborted(); + } + } + hide(); + } + + private void fireFailed(Throwable caught) { + if (listeners != null) { + for (ExpressionWrapperNotificationListener listener : listeners) { + listener.failed(caught); + } + } + hide(); + + } + + } diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java index fd36f59..abafb63 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java @@ -58,6 +58,6 @@ public interface ExpressionService extends RemoteService { public String saveColumnRule(RuleDescriptionData ruleDescriptionData) throws TDGWTServiceException; - public void removeRuleById(String ruleId) throws TDGWTServiceException; + public void removeRulesById(ArrayList rules) throws TDGWTServiceException; } diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java index 4ebcecb..7602330 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java @@ -44,5 +44,5 @@ public interface ExpressionServiceAsync { void saveColumnRule(RuleDescriptionData ruleDescriptionData, AsyncCallback callback); - void removeRuleById(String ruleId, AsyncCallback callback); + void removeRulesById(ArrayList rules, AsyncCallback callback); } diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java index 9f226c5..271c5a6 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/ExpressionServiceImpl.java @@ -237,7 +237,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements C_Expression cexp = parser.parse(serviceExpression); RuleDescriptionData ruleData = new RuleDescriptionData( ruleDescription.getId(), ruleDescription.getName(), - ruleDescription.getDescription(),ruleDescription.getOwner(), + ruleDescription.getDescription(), + ruleDescription.getOwner(), RuleScopeMap.map(ruleDescription.getScope()), cexp); rulesDes.add(ruleData); @@ -288,7 +289,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements C_Expression cexp = parser.parse(serviceExpression); RuleDescriptionData ruleData = new RuleDescriptionData( ruleDescription.getId(), ruleDescription.getName(), - ruleDescription.getDescription(),ruleDescription.getOwner(), + ruleDescription.getDescription(), + ruleDescription.getOwner(), RuleScopeMap.map(ruleDescription.getScope()), cexp); rulesDes.add(ruleData); @@ -317,8 +319,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements * {@inheritDoc} */ @Override - public String saveColumnRule( - RuleDescriptionData ruleDescriptionData) + public String saveColumnRule(RuleDescriptionData ruleDescriptionData) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -345,15 +346,16 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements RuleColumnType ruleColumnType = RuleColumnTypeMap .map(ruleDescriptionData.getTdRuleColumnType()); - RuleId ruleId=service.saveColumnRule(ruleDescriptionData.getName(), + RuleId ruleId = service.saveColumnRule( + ruleDescriptionData.getName(), ruleDescriptionData.getDescription(), conditionExpression, ruleColumnType); - logger.debug("RuleId: "+ruleId); - - String ruleIdent=null; - if(ruleId!=null){ - ruleIdent=String.valueOf(ruleId.getValue()); + logger.debug("RuleId: " + ruleId); + + String ruleIdent = null; + if (ruleId != null) { + ruleIdent = String.valueOf(ruleId.getValue()); } return ruleIdent; @@ -373,42 +375,32 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements } } - - + /** * * {@inheritDoc} */ @Override - public void removeRuleById( - String ruleId) + public void removeRulesById(ArrayList rules) 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); + + logger.debug("RemoveRuleById() :" + rules); + if (rules == null || !(rules.size() > 0)) { + throw new TDGWTServiceException( + "Error removing the rule, no rules selected"); } - + 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); - + for (RuleDescriptionData ruleDescriptionData : rules) { + RuleId id = new RuleId(ruleDescriptionData.getId()); + service.removeRuleById(id); + } return; } catch (TDGWTServiceException e) { @@ -419,15 +411,13 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements e.printStackTrace(); throw e; } catch (Throwable e) { - logger.error("Error in getRule(): " + e.getLocalizedMessage()); + logger.error("Error in removeRuleById(): " + e.getLocalizedMessage()); e.printStackTrace(); throw new TDGWTServiceException("Error removing the rules: " + e.getLocalizedMessage()); } } - - /** * Retrieve and set Tabular Resource Type