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
This commit is contained in:
parent
f681088abf
commit
b23cce03ba
|
@ -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.client.store.ColumnDataTypeStore;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
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.model.logical.C_Not;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDBaseColumnRuleType;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDBaseColumnRuleType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.type.TDRuleColumnType;
|
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.monitorwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer;
|
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.client.expression.ExpressionWrapper;
|
||||||
|
|
|
@ -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.resources.ExpressionResources;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
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.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.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.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,14 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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.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.AddColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
|
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.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.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
@ -55,9 +57,14 @@ public interface ExpressionService extends RemoteService {
|
||||||
public ArrayList<RuleDescriptionData> getRules(RuleScopeType scope)
|
public ArrayList<RuleDescriptionData> getRules(RuleScopeType scope)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
public ArrayList<RuleDescriptionData> getApplicableBaseColumnRules(
|
||||||
|
ColumnData columnData) throws TDGWTServiceException;
|
||||||
|
|
||||||
public String saveColumnRule(RuleDescriptionData ruleDescriptionData)
|
public String saveColumnRule(RuleDescriptionData ruleDescriptionData)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
public void removeRulesById(ArrayList<RuleDescriptionData> rules) throws TDGWTServiceException;
|
public void removeRulesById(ArrayList<RuleDescriptionData> rules) throws TDGWTServiceException;
|
||||||
|
|
||||||
|
public String startRulesOnColumnApply(RulesOnColumnApplySession ruleOnColumnApplySession)
|
||||||
|
throws TDGWTServiceException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ package org.gcube.portlets.user.td.expressionwidget.client.rpc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionData;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleScopeType;
|
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.AddColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
|
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.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.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -41,8 +43,17 @@ public interface ExpressionServiceAsync {
|
||||||
void getRules(RuleScopeType scope,
|
void getRules(RuleScopeType scope,
|
||||||
AsyncCallback<ArrayList<RuleDescriptionData>> callback);
|
AsyncCallback<ArrayList<RuleDescriptionData>> callback);
|
||||||
|
|
||||||
|
void getApplicableBaseColumnRules(ColumnData columnData,
|
||||||
|
AsyncCallback<ArrayList<RuleDescriptionData>> callback);
|
||||||
|
|
||||||
void saveColumnRule(RuleDescriptionData ruleDescriptionData,
|
void saveColumnRule(RuleDescriptionData ruleDescriptionData,
|
||||||
AsyncCallback<String> callback);
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
void removeRulesById(ArrayList<RuleDescriptionData> rules, AsyncCallback<Void> callback);
|
void removeRulesById(ArrayList<RuleDescriptionData> rules,
|
||||||
|
AsyncCallback<Void> callback);
|
||||||
|
|
||||||
|
void startRulesOnColumnApply(
|
||||||
|
RulesOnColumnApplySession ruleOnColumnApplySession,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.utils.AuthorizationToken;
|
||||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.RuleDescription;
|
import org.gcube.data.analysis.tabulardata.commons.webservice.types.RuleDescription;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
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.TabularDataService;
|
||||||
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
|
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
|
||||||
import org.gcube.data.analysis.tabulardata.service.rules.RuleId;
|
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.server.service.rule.RuleScopeMap;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ExpressionParserException;
|
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.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.SessionUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl;
|
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.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.AddColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
|
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.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
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.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnMockUp;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -209,6 +215,62 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ArrayList<RuleDescriptionData> 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<RuleDescription> rules = service.getRules();
|
||||||
|
|
||||||
|
ArrayList<RuleDescriptionData> rulesDes = new ArrayList<RuleDescriptionData>();
|
||||||
|
|
||||||
|
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}
|
* {@inheritDoc}
|
||||||
|
@ -220,7 +282,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("GetRule()");
|
logger.debug("GetRules()");
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
@ -235,11 +297,14 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
for (RuleDescription ruleDescription : rules) {
|
for (RuleDescription ruleDescription : rules) {
|
||||||
Expression serviceExpression = ruleDescription.getRule();
|
Expression serviceExpression = ruleDescription.getRule();
|
||||||
C_Expression cexp = parser.parse(serviceExpression);
|
C_Expression cexp = parser.parse(serviceExpression);
|
||||||
|
TDRuleColumnType tdRuleColumnType = RuleColumnTypeMap
|
||||||
|
.map(ruleDescription.getRuleColumnType());
|
||||||
RuleDescriptionData ruleData = new RuleDescriptionData(
|
RuleDescriptionData ruleData = new RuleDescriptionData(
|
||||||
ruleDescription.getId(), ruleDescription.getName(),
|
ruleDescription.getId(), ruleDescription.getName(),
|
||||||
ruleDescription.getDescription(),
|
ruleDescription.getDescription(),
|
||||||
ruleDescription.getOwner(),
|
ruleDescription.getOwner(),
|
||||||
RuleScopeMap.map(ruleDescription.getScope()), cexp);
|
RuleScopeMap.map(ruleDescription.getScope()),
|
||||||
|
tdRuleColumnType, cexp);
|
||||||
rulesDes.add(ruleData);
|
rulesDes.add(ruleData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -254,7 +319,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error in getRule(): " + e.getLocalizedMessage());
|
logger.error("Error in getRules(): " + e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error retrieving the rules: "
|
throw new TDGWTServiceException("Error retrieving the rules: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
|
@ -267,18 +332,31 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<RuleDescriptionData> getRules()
|
public ArrayList<RuleDescriptionData> getApplicableBaseColumnRules(
|
||||||
throws TDGWTServiceException {
|
ColumnData columnData) throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("GetRule()");
|
logger.debug("GetApplicableBaseColumnRules(): " + columnData);
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
List<RuleDescription> 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<? extends DataType> dataType = ColumnDataTypeMap
|
||||||
|
.mapToDataTypeClass(columnDataType);
|
||||||
|
|
||||||
|
List<RuleDescription> rules = service
|
||||||
|
.getApplicableBaseColumnRules(dataType);
|
||||||
|
|
||||||
ArrayList<RuleDescriptionData> rulesDes = new ArrayList<RuleDescriptionData>();
|
ArrayList<RuleDescriptionData> rulesDes = new ArrayList<RuleDescriptionData>();
|
||||||
|
|
||||||
|
@ -287,11 +365,14 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
for (RuleDescription ruleDescription : rules) {
|
for (RuleDescription ruleDescription : rules) {
|
||||||
Expression serviceExpression = ruleDescription.getRule();
|
Expression serviceExpression = ruleDescription.getRule();
|
||||||
C_Expression cexp = parser.parse(serviceExpression);
|
C_Expression cexp = parser.parse(serviceExpression);
|
||||||
|
TDRuleColumnType tdRuleColumnType = RuleColumnTypeMap
|
||||||
|
.map(ruleDescription.getRuleColumnType());
|
||||||
RuleDescriptionData ruleData = new RuleDescriptionData(
|
RuleDescriptionData ruleData = new RuleDescriptionData(
|
||||||
ruleDescription.getId(), ruleDescription.getName(),
|
ruleDescription.getId(), ruleDescription.getName(),
|
||||||
ruleDescription.getDescription(),
|
ruleDescription.getDescription(),
|
||||||
ruleDescription.getOwner(),
|
ruleDescription.getOwner(),
|
||||||
RuleScopeMap.map(ruleDescription.getScope()), cexp);
|
RuleScopeMap.map(ruleDescription.getScope()),
|
||||||
|
tdRuleColumnType, cexp);
|
||||||
rulesDes.add(ruleData);
|
rulesDes.add(ruleData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -314,6 +395,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -411,7 +494,8 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error in removeRuleById(): " + e.getLocalizedMessage());
|
logger.error("Error in removeRuleById(): "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error removing the rules: "
|
throw new TDGWTServiceException("Error removing the rules: "
|
||||||
+ e.getLocalizedMessage());
|
+ 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
|
* Retrieve and set Tabular Resource Type
|
||||||
*
|
*
|
||||||
|
|
|
@ -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.commons.utils.DimensionReference;
|
||||||
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
|
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
|
||||||
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
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.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;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.DimensionReferenceData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.server.service.rule;
|
package org.gcube.portlets.user.td.expressionwidget.server.service.rule;
|
||||||
|
|
||||||
import org.gcube.data.analysis.tabulardata.commons.rules.RuleScope;
|
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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
|
||||||
*/
|
*/
|
||||||
public class C_ValueIsIn extends C_Expression {
|
public class C_ValueIsIn extends C_Expression {
|
||||||
private static final long serialVersionUID = 739569588958197726L;
|
private static final long serialVersionUID = 739569588958197726L;
|
||||||
protected String id = "IsNull";
|
protected String id = "ValueIsIn";
|
||||||
protected C_Expression leftArgument;
|
protected C_Expression leftArgument;
|
||||||
protected C_MultivaluedExpression rightArgument;
|
protected C_MultivaluedExpression rightArgument;
|
||||||
|
|
||||||
|
|
|
@ -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" <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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 + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.google.gwt.editor.client.Editor.Path;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
|
|
@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface RuleDescriptionDataPropertiesCombo extends PropertyAccess<RuleDescriptionData> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<RuleDescriptionData> id();
|
||||||
|
|
||||||
|
LabelProvider<RuleDescriptionData> name();
|
||||||
|
|
||||||
|
@Path("name")
|
||||||
|
ValueProvider<RuleDescriptionData, String> nameProv();
|
||||||
|
}
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.shared.rule;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author giancarlo email: <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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 + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -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: <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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 + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.shared.rule.type;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author giancarlo
|
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TDRuleColumnType implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 8230123565752504602L;
|
|
||||||
|
|
||||||
public TDRuleColumnType(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue