From b23cce03bab967a1db4b8aa579198cc4f7d89b00 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 17 Apr 2015 16:52:37 +0000 Subject: [PATCH] Updated Rules git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114236 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ColumnExpressionPanel.java | 8 +- .../expressionwidget/client/RuleDialog.java | 2 +- .../client/rpc/ExpressionService.java | 17 ++- .../client/rpc/ExpressionServiceAsync.java | 19 ++- .../server/ExpressionServiceImpl.java | 131 ++++++++++++++++-- .../service/rule/RuleColumnTypeMap.java | 6 +- .../server/service/rule/RuleScopeMap.java | 2 +- .../shared/model/logical/C_ValueIsIn.java | 2 +- .../shared/rule/RuleDescriptionData.java | 131 ------------------ .../rule/RuleDescriptionDataProperties.java | 2 + .../RuleDescriptionDataPropertiesCombo.java | 27 ++++ .../shared/rule/RuleScopeType.java | 37 ----- .../rule/type/TDBaseColumnRuleType.java | 41 ------ .../rule/type/TDDimensionColumnRuleType.java | 41 ------ .../shared/rule/type/TDRuleColumnType.java | 25 ---- 15 files changed, 185 insertions(+), 306 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionData.java create mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataPropertiesCombo.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleScopeType.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDBaseColumnRuleType.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDDimensionColumnRuleType.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDRuleColumnType.java 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 e9339af..34f3bb7 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 @@ -11,10 +11,10 @@ import org.gcube.portlets.user.td.expressionwidget.client.store.ColumnDataTypeEl import org.gcube.portlets.user.td.expressionwidget.client.store.ColumnDataTypeStore; import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException; import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Not; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData; -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.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDBaseColumnRuleType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType; import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer; import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper; 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 dc92e30..9820860 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 @@ -8,8 +8,8 @@ import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialo import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; 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 abafb63..65676b1 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 @@ -5,12 +5,14 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc; import java.util.ArrayList; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @@ -54,10 +56,15 @@ public interface ExpressionService extends RemoteService { public ArrayList getRules(RuleScopeType scope) throws TDGWTServiceException; - + + public ArrayList getApplicableBaseColumnRules( + ColumnData columnData) throws TDGWTServiceException; + public String saveColumnRule(RuleDescriptionData ruleDescriptionData) throws TDGWTServiceException; - + public void removeRulesById(ArrayList rules) throws TDGWTServiceException; - + + public String startRulesOnColumnApply(RulesOnColumnApplySession ruleOnColumnApplySession) + 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 7602330..ee5e0d8 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 @@ -5,11 +5,13 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc; import java.util.ArrayList; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -41,8 +43,17 @@ public interface ExpressionServiceAsync { void getRules(RuleScopeType scope, AsyncCallback> callback); + void getApplicableBaseColumnRules(ColumnData columnData, + AsyncCallback> callback); + void saveColumnRule(RuleDescriptionData ruleDescriptionData, AsyncCallback callback); - - void removeRulesById(ArrayList rules, AsyncCallback callback); + + void removeRulesById(ArrayList rules, + AsyncCallback callback); + + void startRulesOnColumnApply( + RulesOnColumnApplySession ruleOnColumnApplySession, + 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 271c5a6..dd7a668 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 @@ -12,6 +12,7 @@ import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider; import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken; import org.gcube.data.analysis.tabulardata.commons.webservice.types.RuleDescription; import org.gcube.data.analysis.tabulardata.expression.Expression; +import org.gcube.data.analysis.tabulardata.model.datatype.DataType; import org.gcube.data.analysis.tabulardata.service.TabularDataService; import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory; import org.gcube.data.analysis.tabulardata.service.rules.RuleId; @@ -20,15 +21,20 @@ import org.gcube.portlets.user.td.expressionwidget.server.service.rule.RuleColum import org.gcube.portlets.user.td.expressionwidget.server.service.rule.RuleScopeMap; import org.gcube.portlets.user.td.expressionwidget.shared.exception.ExpressionParserException; import org.gcube.portlets.user.td.expressionwidget.shared.exception.ExpressionServiceException; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.gwtservice.server.SessionUtil; import org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl; +import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession; 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.ColumnDataType; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnMockUp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -209,6 +215,62 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements } } + /** + * + * {@inheritDoc} + */ + @Override + public ArrayList getRules() + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + ASLSession aslSession = SessionUtil.getAslSession(session); + + logger.debug("GetRules()"); + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername(), aslSession.getScope())); + TabularDataService service = TabularDataServiceFactory.getService(); + + List rules = service.getRules(); + + ArrayList rulesDes = new ArrayList(); + + C_ExpressionParser parser = new C_ExpressionParser(); + + for (RuleDescription ruleDescription : rules) { + Expression serviceExpression = ruleDescription.getRule(); + C_Expression cexp = parser.parse(serviceExpression); + TDRuleColumnType tdRuleColumnType = RuleColumnTypeMap + .map(ruleDescription.getRuleColumnType()); + RuleDescriptionData ruleData = new RuleDescriptionData( + ruleDescription.getId(), ruleDescription.getName(), + ruleDescription.getDescription(), + ruleDescription.getOwner(), + RuleScopeMap.map(ruleDescription.getScope()), + tdRuleColumnType, cexp); + rulesDes.add(ruleData); + + } + + return rulesDes; + + } 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 getRules(): " + e.getLocalizedMessage()); + e.printStackTrace(); + throw new TDGWTServiceException("Error retrieving the rules: " + + e.getLocalizedMessage()); + } + + } + + /** * * {@inheritDoc} @@ -220,7 +282,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - logger.debug("GetRule()"); + logger.debug("GetRules()"); AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); @@ -235,11 +297,14 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements for (RuleDescription ruleDescription : rules) { Expression serviceExpression = ruleDescription.getRule(); C_Expression cexp = parser.parse(serviceExpression); + TDRuleColumnType tdRuleColumnType = RuleColumnTypeMap + .map(ruleDescription.getRuleColumnType()); RuleDescriptionData ruleData = new RuleDescriptionData( ruleDescription.getId(), ruleDescription.getName(), ruleDescription.getDescription(), ruleDescription.getOwner(), - RuleScopeMap.map(ruleDescription.getScope()), cexp); + RuleScopeMap.map(ruleDescription.getScope()), + tdRuleColumnType, cexp); rulesDes.add(ruleData); } @@ -254,7 +319,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 getRules(): " + e.getLocalizedMessage()); e.printStackTrace(); throw new TDGWTServiceException("Error retrieving the rules: " + e.getLocalizedMessage()); @@ -266,19 +331,32 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements * * {@inheritDoc} */ - @Override - public ArrayList getRules() - throws TDGWTServiceException { + @Override + public ArrayList getApplicableBaseColumnRules( + ColumnData columnData) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - logger.debug("GetRule()"); + logger.debug("GetApplicableBaseColumnRules(): " + columnData); AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - List rules = service.getRules(); + if (columnData == null) { + logger.error("Error in getApplicableBaseColumnRules(): No valid column, " + + columnData); + throw new TDGWTServiceException( + "Error in getRules: no valid column set"); + } + + ColumnDataType columnDataType = ColumnDataType + .getColumnDataTypeFromId(columnData.getDataTypeName()); + Class dataType = ColumnDataTypeMap + .mapToDataTypeClass(columnDataType); + + List rules = service + .getApplicableBaseColumnRules(dataType); ArrayList rulesDes = new ArrayList(); @@ -287,11 +365,14 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements for (RuleDescription ruleDescription : rules) { Expression serviceExpression = ruleDescription.getRule(); C_Expression cexp = parser.parse(serviceExpression); + TDRuleColumnType tdRuleColumnType = RuleColumnTypeMap + .map(ruleDescription.getRuleColumnType()); RuleDescriptionData ruleData = new RuleDescriptionData( ruleDescription.getId(), ruleDescription.getName(), ruleDescription.getDescription(), ruleDescription.getOwner(), - RuleScopeMap.map(ruleDescription.getScope()), cexp); + RuleScopeMap.map(ruleDescription.getScope()), + tdRuleColumnType, cexp); rulesDes.add(ruleData); } @@ -314,6 +395,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements } + + /** * * {@inheritDoc} @@ -411,7 +494,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements e.printStackTrace(); throw e; } catch (Throwable e) { - logger.error("Error in removeRuleById(): " + e.getLocalizedMessage()); + logger.error("Error in removeRuleById(): " + + e.getLocalizedMessage()); e.printStackTrace(); throw new TDGWTServiceException("Error removing the rules: " + e.getLocalizedMessage()); @@ -419,6 +503,29 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements } + /** + * + * {@inheritDoc} + */ + @Override + public String startRulesOnColumnApply( + RulesOnColumnApplySession ruleOnColumnApplySession) + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + String taskId = startRulesOnColumnApply(ruleOnColumnApplySession, + session); + return taskId; + + } catch (TDGWTServiceException e) { + throw e; + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException(e.getLocalizedMessage()); + } + + } + /** * Retrieve and set Tabular Resource Type * diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleColumnTypeMap.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleColumnTypeMap.java index 0ce0f19..6f529bd 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleColumnTypeMap.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleColumnTypeMap.java @@ -6,10 +6,10 @@ import org.gcube.data.analysis.tabulardata.commons.rules.types.RuleColumnType; import org.gcube.data.analysis.tabulardata.commons.utils.DimensionReference; import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId; import org.gcube.data.analysis.tabulardata.model.table.TableId; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDBaseColumnRuleType; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDDimensionColumnRuleType; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDRuleColumnType; import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDBaseColumnRuleType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDDimensionColumnRuleType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.DimensionReferenceData; /** diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleScopeMap.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleScopeMap.java index b01cd73..e497bf1 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleScopeMap.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/server/service/rule/RuleScopeMap.java @@ -1,7 +1,7 @@ package org.gcube.portlets.user.td.expressionwidget.server.service.rule; import org.gcube.data.analysis.tabulardata.commons.rules.RuleScope; -import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; /** diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/C_ValueIsIn.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/C_ValueIsIn.java index ea02b0c..3affad5 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/C_ValueIsIn.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/C_ValueIsIn.java @@ -12,7 +12,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi */ public class C_ValueIsIn extends C_Expression { private static final long serialVersionUID = 739569588958197726L; - protected String id = "IsNull"; + protected String id = "ValueIsIn"; protected C_Expression leftArgument; protected C_MultivaluedExpression rightArgument; diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionData.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionData.java deleted file mode 100644 index 71a7d12..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionData.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.shared.rule; - -import java.io.Serializable; - -import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDRuleColumnType; -import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; - -/** - * - * @author "Giancarlo Panichi" g.panichi@isti.cnr.it - * - */ -public class RuleDescriptionData implements Serializable { - - private static final long serialVersionUID = 2238695825091799598L; - private long id; - private String name; - private String description; - private String owner; - private RuleScopeType scope; - private TDRuleColumnType tdRuleColumnType; - private C_Expression expression; - - public RuleDescriptionData() { - super(); - } - - public RuleDescriptionData(long id, String name, String description, String owner, - RuleScopeType scope, - C_Expression expression) { - super(); - this.id = id; - this.name = name; - this.description = description; - this.owner=owner; - this.scope = scope; - this.tdRuleColumnType = null; - this.expression = expression; - } - - - public RuleDescriptionData(long id, String name, String description,String owner, - RuleScopeType scope, TDRuleColumnType tdRuleColumnType, - C_Expression expression) { - super(); - this.id = id; - this.name = name; - this.description = description; - this.owner=owner; - this.scope = scope; - this.tdRuleColumnType = tdRuleColumnType; - this.expression = expression; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public RuleScopeType getScope() { - return scope; - } - - public void setScope(RuleScopeType scope) { - this.scope = scope; - } - - public TDRuleColumnType getTdRuleColumnType() { - return tdRuleColumnType; - } - - public void setTdRuleColumnType(TDRuleColumnType tdRuleColumnType) { - this.tdRuleColumnType = tdRuleColumnType; - } - - public C_Expression getExpression() { - return expression; - } - - public void setExpression(C_Expression expression) { - this.expression = expression; - } - - - public String getReadableExpression() { - if (expression != null) { - return expression.getReadableExpression(); - } else { - return ""; - } - } - - @Override - public String toString() { - return "RuleDescriptionData [id=" + id + ", name=" + name - + ", description=" + description + ", owner=" + owner - + ", scope=" + scope + ", tdRuleColumnType=" + tdRuleColumnType - + ", expression=" + expression + "]"; - } - - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataProperties.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataProperties.java index 3f72e14..18ec399 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataProperties.java @@ -4,6 +4,8 @@ package org.gcube.portlets.user.td.expressionwidget.shared.rule; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; + import com.google.gwt.editor.client.Editor.Path; import com.sencha.gxt.core.client.ValueProvider; import com.sencha.gxt.data.shared.ModelKeyProvider; diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataPropertiesCombo.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataPropertiesCombo.java new file mode 100644 index 0000000..09885d1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleDescriptionDataPropertiesCombo.java @@ -0,0 +1,27 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.rule; + +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; + +import com.google.gwt.editor.client.Editor.Path; +import com.sencha.gxt.core.client.ValueProvider; +import com.sencha.gxt.data.shared.LabelProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public interface RuleDescriptionDataPropertiesCombo extends PropertyAccess { + + @Path("id") + ModelKeyProvider id(); + + LabelProvider name(); + + @Path("name") + ValueProvider nameProv(); +} + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleScopeType.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleScopeType.java deleted file mode 100644 index 92ec473..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/RuleScopeType.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.shared.rule; - - -/** - * - * @author giancarlo email: g.panichi@isti.cnr.it - * - */ -public enum RuleScopeType { - TABLE("Table"), COLUMN("Column"); - /** - * @param text - */ - private RuleScopeType(final String id) { - this.id = id; - } - - private final String id; - - @Override - public String toString() { - return id; - } - - - public static RuleScopeType get(String ruleScopeType) { - for(RuleScopeType ws:values()){ - if(ws.id.compareTo(ruleScopeType)==0){ - return ws; - } - } - - return null; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDBaseColumnRuleType.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDBaseColumnRuleType.java deleted file mode 100644 index a62002f..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDBaseColumnRuleType.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.shared.rule.type; - -import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; - -/** - * - * @author giancarlo - * email: g.panichi@isti.cnr.it - * - */ -public class TDBaseColumnRuleType extends TDRuleColumnType { - - private static final long serialVersionUID = -2967788094664606371L; - private ColumnDataType columnDataType; - - public TDBaseColumnRuleType(){ - super(); - } - - public TDBaseColumnRuleType(ColumnDataType columnDataType) { - super(); - this.columnDataType = columnDataType; - } - - public ColumnDataType getColumnDataType() { - return columnDataType; - } - - public void setColumnDataType(ColumnDataType columnDataType) { - this.columnDataType = columnDataType; - } - - @Override - public String toString() { - return "TDBaseColumnRuleType [columnDataType=" + columnDataType + "]"; - } - - - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDDimensionColumnRuleType.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDDimensionColumnRuleType.java deleted file mode 100644 index 712a533..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDDimensionColumnRuleType.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.shared.rule.type; - -import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.DimensionReferenceData; - -/** - * - * @author giancarlo email: g.panichi@isti.cnr.it - * - */ -public class TDDimensionColumnRuleType extends TDRuleColumnType { - - private static final long serialVersionUID = -2967788094664606371L; - private DimensionReferenceData dimensionReferenceData; - - public TDDimensionColumnRuleType() { - super(); - } - - public TDDimensionColumnRuleType( - DimensionReferenceData dimensionReferenceData) { - super(); - this.dimensionReferenceData = dimensionReferenceData; - } - - public DimensionReferenceData getDimensionReferenceData() { - return dimensionReferenceData; - } - - public void setDimensionReferenceData( - DimensionReferenceData dimensionReferenceData) { - this.dimensionReferenceData = dimensionReferenceData; - } - - @Override - public String toString() { - return "TDDimensionColumnRuleType [dimensionReferenceData=" - + dimensionReferenceData + "]"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDRuleColumnType.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDRuleColumnType.java deleted file mode 100644 index d1c107c..0000000 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/rule/type/TDRuleColumnType.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.gcube.portlets.user.td.expressionwidget.shared.rule.type; - -import java.io.Serializable; - - -/** - * - * @author giancarlo - * email: g.panichi@isti.cnr.it - * - */ -public class TDRuleColumnType implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 8230123565752504602L; - - public TDRuleColumnType(){ - - } - - - -}