Updated expression for Template
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114204 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
023c72d122
commit
f681088abf
|
@ -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<ColumnTypeCodeElement> comboColumnTypeCode;
|
||||
// private ComboBox<ColumnDataTypeElement> 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();
|
||||
|
|
|
@ -97,8 +97,6 @@ public class ReplaceExpressionDialog extends Window implements
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* ColumnMockUp and ColumnMockUpList must have set columnId, label, columnTypeCode and
|
||||
|
|
|
@ -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);
|
||||
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:
|
||||
|
|
|
@ -174,7 +174,6 @@ public class RuleDialog extends Window implements
|
|||
if (listeners != null) {
|
||||
for (RuleDialogNotificationListener listener : listeners) {
|
||||
listener.failed(caught);
|
||||
;
|
||||
}
|
||||
}
|
||||
hide();
|
||||
|
|
|
@ -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,15 +30,16 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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<ExpressionWrapperNotificationListener> listeners;
|
||||
private ColumnExpressionPanel columnExpressionPanel;
|
||||
private C_Expression exp = null;
|
||||
private ColumnData column = null;
|
||||
private TRId trId;
|
||||
private String columnId = null;
|
||||
|
@ -48,16 +50,15 @@ public class ColumnExpressionDialog extends Window {
|
|||
* @param columnMockUp
|
||||
* @param eventBus
|
||||
*/
|
||||
public ColumnExpressionDialog(
|
||||
ColumnMockUp columnMockUp,
|
||||
EventBus eventBus) {
|
||||
initWindow();
|
||||
public TemplateColumnExpressionDialog(ColumnMockUp columnMockUp, EventBus eventBus) {
|
||||
listeners = new ArrayList<ExpressionWrapperNotificationListener>();
|
||||
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<ExpressionWrapperNotificationListener>();
|
||||
this.eventBus = eventBus;
|
||||
this.trId = trId;
|
||||
this.columnId = columnId;
|
||||
initWindow();
|
||||
load();
|
||||
|
||||
}
|
||||
|
@ -100,7 +101,6 @@ public class ColumnExpressionDialog extends Window {
|
|||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
|
@ -109,14 +109,9 @@ public class ColumnExpressionDialog extends Window {
|
|||
}
|
||||
|
||||
protected void close() {
|
||||
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
fireAborted();
|
||||
}
|
||||
|
||||
|
||||
protected void create() {
|
||||
if (column.getTypeCode()
|
||||
.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0
|
||||
|
@ -148,14 +143,8 @@ 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() {
|
||||
|
@ -174,10 +163,13 @@ public class ColumnExpressionDialog extends Window {
|
|||
} else {
|
||||
Log.error("Error retrieving column: "
|
||||
+ caught.getMessage());
|
||||
UtilsGXT3.alert("Error","Error retrieving column: "
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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<RuleDescriptionData> rules) throws TDGWTServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -44,5 +44,5 @@ public interface ExpressionServiceAsync {
|
|||
void saveColumnRule(RuleDescriptionData ruleDescriptionData,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void removeRuleById(String ruleId, AsyncCallback<Void> callback);
|
||||
void removeRulesById(ArrayList<RuleDescriptionData> rules, AsyncCallback<Void> callback);
|
||||
}
|
||||
|
|
|
@ -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,7 +346,8 @@ 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);
|
||||
|
||||
|
@ -374,41 +376,31 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void removeRuleById(
|
||||
String ruleId)
|
||||
public void removeRulesById(ArrayList<RuleDescriptionData> 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);
|
||||
|
||||
for (RuleDescriptionData ruleDescriptionData : rules) {
|
||||
RuleId id = new RuleId(ruleDescriptionData.getId());
|
||||
service.removeRuleById(id);
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
|
@ -419,7 +411,7 @@ 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());
|
||||
|
@ -427,8 +419,6 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve and set Tabular Resource Type
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue