Updated Replace by Expression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@100026 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
33cefe2f32
commit
0d1d8c0e78
|
@ -1,6 +1,5 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.shared.model;
|
package org.gcube.portlets.user.td.expressionwidget.shared.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
|
||||||
|
@ -16,7 +15,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextEndsWith;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextEndsWith;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextMatchSQLRegexp;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextMatchSQLRegexp;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReferencePlaceholder;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReferencePlaceholder;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ConstantList;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_TypedColumnReference;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_TypedColumnReference;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
||||||
|
@ -33,13 +31,11 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeM
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OperatorTypeMap creates a C_Expression usable client-side
|
* OperatorTypeMap creates a C_Expression usable client-side
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OperatorTypeMap {
|
public class OperatorTypeMap {
|
||||||
|
@ -49,34 +45,36 @@ public class OperatorTypeMap {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Expression map(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){
|
public C_Expression map(ColumnData column, C_OperatorType operatorType,
|
||||||
|
String firstArg, String secondArg) {
|
||||||
Log.debug("OperatorTypeMap Map");
|
Log.debug("OperatorTypeMap Map");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
readableExpression = new String();
|
readableExpression = new String();
|
||||||
if (column.getTrId() == null) {
|
if (column.getTrId() == null) {
|
||||||
exp = mapPlaceHolder(column, operatorType, firstArg, secondArg);
|
exp = mapPlaceHolder(column, operatorType, firstArg, secondArg);
|
||||||
} else {
|
} else {
|
||||||
exp=mapTypedColumnReference(column,operatorType,firstArg,secondArg);
|
exp = mapTypedColumnReference(column, operatorType, firstArg,
|
||||||
|
secondArg);
|
||||||
}
|
}
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Expression mapPlaceHolder(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){
|
public C_Expression mapPlaceHolder(ColumnData column,
|
||||||
|
C_OperatorType operatorType, String firstArg, String secondArg) {
|
||||||
Log.debug("OperatorTypeMap Map Place Holder");
|
Log.debug("OperatorTypeMap Map Place Holder");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
Log.debug("Column Data Type Name:" + column.getDataTypeName());
|
Log.debug("Column Data Type Name:" + column.getDataTypeName());
|
||||||
ColumnDataType dataType=ColumnTypeMap.getColumnDataType(column.getDataTypeName());
|
ColumnDataType dataType = ColumnTypeMap.getColumnDataType(column
|
||||||
|
.getDataTypeName());
|
||||||
Log.debug("Data Type:" + dataType);
|
Log.debug("Data Type:" + dataType);
|
||||||
C_ColumnReferencePlaceholder placeHolder=new C_ColumnReferencePlaceholder(dataType
|
C_ColumnReferencePlaceholder placeHolder = new C_ColumnReferencePlaceholder(
|
||||||
, column.getColumnId());
|
dataType, column.getColumnId());
|
||||||
Log.debug("placeHolder:" + placeHolder);
|
Log.debug("placeHolder:" + placeHolder);
|
||||||
String readablePlaceHolder = column.getColumnId();
|
String readablePlaceHolder = column.getColumnId();
|
||||||
|
|
||||||
List<TD_Value> arguments=new ArrayList<TD_Value>();
|
|
||||||
TD_Value fArg;
|
TD_Value fArg;
|
||||||
TD_Value sArg;
|
TD_Value sArg;
|
||||||
C_Range range;
|
C_Range range;
|
||||||
int separator;
|
|
||||||
|
|
||||||
switch (operatorType) {
|
switch (operatorType) {
|
||||||
case ADDITION:
|
case ADDITION:
|
||||||
|
@ -88,66 +86,52 @@ public class OperatorTypeMap {
|
||||||
case ANY:
|
case ANY:
|
||||||
break;
|
break;
|
||||||
case BEGINS_WITH:
|
case BEGINS_WITH:
|
||||||
exp=new C_TextBeginsWith(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="Begins("+readablePlaceHolder+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "Begins(" + readablePlaceHolder + ", "
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case BETWEEN:
|
case BETWEEN:
|
||||||
fArg = new TD_Value(dataType, firstArg);
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
sArg = new TD_Value(dataType, secondArg);
|
sArg = new TD_Value(dataType, secondArg);
|
||||||
range = new C_Range(fArg, sArg);
|
range = new C_Range(fArg, sArg);
|
||||||
exp = new C_Between(placeHolder, range);
|
exp = new C_Between(placeHolder, range);
|
||||||
readableExpression="Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+"))";
|
readableExpression = "Between(" + readablePlaceHolder + ", Range("
|
||||||
|
+ firstArg + ", " + secondArg + "))";
|
||||||
break;
|
break;
|
||||||
case CONTAINS:
|
case CONTAINS:
|
||||||
separator=firstArg.indexOf(",");
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
if(separator==-1|| firstArg.length()==1){
|
exp = new C_TextContains(placeHolder, fArg);
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
readableExpression = "Contains(" + readablePlaceHolder + ", "
|
||||||
} else {
|
+ firstArg + ")";
|
||||||
String arg;
|
|
||||||
boolean end=false;
|
|
||||||
while(!end){
|
|
||||||
arg=firstArg.substring(0, separator);
|
|
||||||
arguments.add(new TD_Value(dataType,arg));
|
|
||||||
separator++;
|
|
||||||
if(separator<firstArg.length()){
|
|
||||||
firstArg=firstArg.substring(separator,firstArg.length());
|
|
||||||
separator=firstArg.indexOf(",");
|
|
||||||
if(separator==-1){
|
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
|
|
||||||
readableExpression="Contains("+readablePlaceHolder;
|
|
||||||
for(TD_Value v:arguments){
|
|
||||||
readableExpression+=", "+v.getValue();
|
|
||||||
}
|
|
||||||
readableExpression+=")";
|
|
||||||
break;
|
break;
|
||||||
case DIVISION:
|
case DIVISION:
|
||||||
break;
|
break;
|
||||||
case ENDS_WITH:
|
case ENDS_WITH:
|
||||||
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="TextEndsWith("+readablePlaceHolder+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "TextEndsWith(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case EQUALS:
|
case EQUALS:
|
||||||
exp = new C_Equals(placeHolder, new TD_Value(dataType, firstArg));
|
exp = new C_Equals(placeHolder, new TD_Value(dataType, firstArg));
|
||||||
readableExpression="Equals("+readablePlaceHolder+","+firstArg+")";
|
readableExpression = "Equals(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case EXISTS:
|
case EXISTS:
|
||||||
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
|
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
|
||||||
break;
|
break;
|
||||||
case GREATER:
|
case GREATER:
|
||||||
exp=new C_GreaterThan(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_GreaterThan(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="GreaterThan("+readablePlaceHolder+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "GreaterThan(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case GREATER_OR_EQUALS:
|
case GREATER_OR_EQUALS:
|
||||||
exp=new C_GreaterOrEquals(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_GreaterOrEquals(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="GreaterOrEquals("+readablePlaceHolder+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "GreaterOrEquals(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case IN:
|
case IN:
|
||||||
break;
|
break;
|
||||||
|
@ -161,17 +145,22 @@ public class OperatorTypeMap {
|
||||||
break;
|
break;
|
||||||
case LESSER:
|
case LESSER:
|
||||||
exp = new C_LessThan(placeHolder, new TD_Value(dataType, firstArg));
|
exp = new C_LessThan(placeHolder, new TD_Value(dataType, firstArg));
|
||||||
readableExpression="LessThan("+readablePlaceHolder+","+firstArg+")";
|
readableExpression = "LessThan(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case LESSER_OR_EQUALS:
|
case LESSER_OR_EQUALS:
|
||||||
exp=new C_LessOrEquals(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_LessOrEquals(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="LessOrEquals("+readablePlaceHolder+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "LessOrEquals(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case LIKE:
|
case LIKE:
|
||||||
break;
|
break;
|
||||||
case MATCH_REGEX:
|
case MATCH_REGEX:
|
||||||
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
|
||||||
readableExpression="TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "TextMatchSQLRegexp(" + readablePlaceHolder
|
||||||
|
+ "," + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case MODULUS:
|
case MODULUS:
|
||||||
break;
|
break;
|
||||||
|
@ -180,9 +169,11 @@ public class OperatorTypeMap {
|
||||||
case NOT:
|
case NOT:
|
||||||
break;
|
break;
|
||||||
case NOT_BEGINS_WITH:
|
case NOT_BEGINS_WITH:
|
||||||
exp=new C_TextBeginsWith(placeHolder, new TD_Value(dataType,firstArg));
|
exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
|
||||||
|
firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextBeginsWith("+readablePlaceHolder+","+firstArg+"))";
|
readableExpression = "Not(TextBeginsWith(" + readablePlaceHolder
|
||||||
|
+ "," + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case NOT_BETWEEN:
|
case NOT_BETWEEN:
|
||||||
fArg = new TD_Value(dataType, firstArg);
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
|
@ -190,64 +181,49 @@ public class OperatorTypeMap {
|
||||||
range = new C_Range(fArg, sArg);
|
range = new C_Range(fArg, sArg);
|
||||||
exp = new C_Between(placeHolder, range);
|
exp = new C_Between(placeHolder, range);
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+")))";
|
readableExpression = "Not(Between(" + readablePlaceHolder
|
||||||
|
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
||||||
break;
|
break;
|
||||||
case NOT_CONTAINS:
|
case NOT_CONTAINS:
|
||||||
separator=firstArg.indexOf(",");
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
if(separator==-1|| firstArg.length()==1){
|
exp = new C_TextContains(placeHolder, fArg);
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
} else {
|
|
||||||
String arg;
|
|
||||||
boolean end=false;
|
|
||||||
while(!end){
|
|
||||||
arg=firstArg.substring(0, separator);
|
|
||||||
arguments.add(new TD_Value(dataType,arg));
|
|
||||||
separator++;
|
|
||||||
if(separator<firstArg.length()){
|
|
||||||
firstArg=firstArg.substring(separator,firstArg.length());
|
|
||||||
separator=firstArg.indexOf(",");
|
|
||||||
if(separator==-1){
|
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
|
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(Contains("+readablePlaceHolder;
|
readableExpression = "Not(Contains(" + readablePlaceHolder + ", "
|
||||||
for(TD_Value v:arguments){
|
+ firstArg + "))";
|
||||||
readableExpression+=", "+v.getValue();
|
|
||||||
}
|
|
||||||
readableExpression+="))";
|
|
||||||
break;
|
break;
|
||||||
case NOT_ENDS_WITH:
|
case NOT_ENDS_WITH:
|
||||||
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
|
||||||
|
firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextEndsWith("+readablePlaceHolder+","+firstArg+"))";
|
readableExpression = "Not(TextEndsWith(" + readablePlaceHolder
|
||||||
|
+ "," + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case NOT_EQUALS:
|
case NOT_EQUALS:
|
||||||
exp = new C_NotEquals(placeHolder, new TD_Value(dataType, firstArg));
|
exp = new C_NotEquals(placeHolder, new TD_Value(dataType, firstArg));
|
||||||
readableExpression="NotEquals("+readablePlaceHolder+","+firstArg+")";
|
readableExpression = "NotEquals(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_GREATER:
|
case NOT_GREATER:
|
||||||
exp=new C_NotGreater(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_NotGreater(placeHolder,
|
||||||
readableExpression="NotGreater("+readablePlaceHolder+","+firstArg+")";
|
new TD_Value(dataType, firstArg));
|
||||||
|
readableExpression = "NotGreater(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_IN:
|
case NOT_IN:
|
||||||
break;
|
break;
|
||||||
case NOT_LESSER:
|
case NOT_LESSER:
|
||||||
exp = new C_NotLess(placeHolder, new TD_Value(dataType, firstArg));
|
exp = new C_NotLess(placeHolder, new TD_Value(dataType, firstArg));
|
||||||
readableExpression="NotLess("+readablePlaceHolder+","+firstArg+")";
|
readableExpression = "NotLess(" + readablePlaceHolder + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_LIKE:
|
case NOT_LIKE:
|
||||||
break;
|
break;
|
||||||
case NOT_MATCH_REGEX:
|
case NOT_MATCH_REGEX:
|
||||||
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg));
|
exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
|
||||||
|
firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+"))";
|
readableExpression = "Not(TextMatchSQLRegexp("
|
||||||
|
+ readablePlaceHolder + "," + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case OR:
|
case OR:
|
||||||
break;
|
break;
|
||||||
|
@ -264,26 +240,23 @@ public class OperatorTypeMap {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public C_Expression mapTypedColumnReference(ColumnData column,
|
||||||
|
C_OperatorType operatorType, String firstArg, String secondArg) {
|
||||||
|
|
||||||
public C_Expression mapTypedColumnReference(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){
|
|
||||||
Log.debug("OperatorTypeMap Map Typed Column Reference");
|
Log.debug("OperatorTypeMap Map Typed Column Reference");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
|
|
||||||
Log.debug("Column Data Type Name:" + column.getDataTypeName());
|
Log.debug("Column Data Type Name:" + column.getDataTypeName());
|
||||||
ColumnDataType dataType=ColumnTypeMap.getColumnDataType(column.getDataTypeName());
|
ColumnDataType dataType = ColumnTypeMap.getColumnDataType(column
|
||||||
|
.getDataTypeName());
|
||||||
Log.debug("Data Type:" + dataType);
|
Log.debug("Data Type:" + dataType);
|
||||||
C_TypedColumnReference columnReference=new C_TypedColumnReference(column.getTrId(), dataType
|
C_TypedColumnReference columnReference = new C_TypedColumnReference(
|
||||||
, column.getColumnId());
|
column.getTrId(), dataType, column.getColumnId());
|
||||||
Log.debug("Typed Column Reference:" + columnReference);
|
Log.debug("Typed Column Reference:" + columnReference);
|
||||||
String readableColumnReference = column.getLabel();
|
String readableColumnReference = column.getLabel();
|
||||||
|
|
||||||
List<TD_Value> arguments=new ArrayList<TD_Value>();
|
|
||||||
TD_Value fArg;
|
TD_Value fArg;
|
||||||
TD_Value sArg;
|
TD_Value sArg;
|
||||||
C_Range range;
|
C_Range range;
|
||||||
int separator;
|
|
||||||
|
|
||||||
switch (operatorType) {
|
switch (operatorType) {
|
||||||
case ADDITION:
|
case ADDITION:
|
||||||
|
@ -295,66 +268,53 @@ public class OperatorTypeMap {
|
||||||
case ANY:
|
case ANY:
|
||||||
break;
|
break;
|
||||||
case BEGINS_WITH:
|
case BEGINS_WITH:
|
||||||
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="TextBeginsWith("+readableColumnReference+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "TextBeginsWith(" + readableColumnReference
|
||||||
|
+ "," + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case BETWEEN:
|
case BETWEEN:
|
||||||
fArg = new TD_Value(dataType, firstArg);
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
sArg = new TD_Value(dataType, secondArg);
|
sArg = new TD_Value(dataType, secondArg);
|
||||||
range = new C_Range(fArg, sArg);
|
range = new C_Range(fArg, sArg);
|
||||||
exp = new C_Between(columnReference, range);
|
exp = new C_Between(columnReference, range);
|
||||||
readableExpression="Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+"))";
|
readableExpression = "Between(" + readableColumnReference
|
||||||
|
+ ", Range(" + firstArg + ", " + secondArg + "))";
|
||||||
break;
|
break;
|
||||||
case CONTAINS:
|
case CONTAINS:
|
||||||
separator=firstArg.indexOf(",");
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
if(separator==-1|| firstArg.length()==1){
|
exp = new C_TextContains(columnReference, fArg);
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
readableExpression = "Contains(" + columnReference + ", "
|
||||||
} else {
|
+ firstArg + ")";
|
||||||
String arg;
|
|
||||||
boolean end=false;
|
|
||||||
while(!end){
|
|
||||||
arg=firstArg.substring(0, separator);
|
|
||||||
arguments.add(new TD_Value(dataType,arg));
|
|
||||||
separator++;
|
|
||||||
if(separator<firstArg.length()){
|
|
||||||
firstArg=firstArg.substring(separator,firstArg.length());
|
|
||||||
separator=firstArg.indexOf(",");
|
|
||||||
if(separator==-1){
|
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
|
|
||||||
readableExpression="Contains("+readableColumnReference;
|
|
||||||
for(TD_Value v:arguments){
|
|
||||||
readableExpression+=", "+v.getValue();
|
|
||||||
}
|
|
||||||
readableExpression+=")";
|
|
||||||
break;
|
break;
|
||||||
case DIVISION:
|
case DIVISION:
|
||||||
break;
|
break;
|
||||||
case ENDS_WITH:
|
case ENDS_WITH:
|
||||||
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="TextEndsWith("+readableColumnReference+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "TextEndsWith(" + readableColumnReference
|
||||||
|
+ ", " + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case EQUALS:
|
case EQUALS:
|
||||||
exp=new C_Equals(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_Equals(columnReference,
|
||||||
readableExpression="Equals("+readableColumnReference+", "+firstArg+")";
|
new TD_Value(dataType, firstArg));
|
||||||
|
readableExpression = "Equals(" + readableColumnReference + ", "
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case EXISTS:
|
case EXISTS:
|
||||||
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
|
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
|
||||||
break;
|
break;
|
||||||
case GREATER:
|
case GREATER:
|
||||||
exp=new C_GreaterThan(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_GreaterThan(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="GreaterThan("+readableColumnReference+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "GreaterThan(" + readableColumnReference
|
||||||
|
+ ", " + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case GREATER_OR_EQUALS:
|
case GREATER_OR_EQUALS:
|
||||||
exp=new C_GreaterOrEquals(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_GreaterOrEquals(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="GreaterOrEquals("+readableColumnReference+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "GreaterOrEquals(" + readableColumnReference
|
||||||
|
+ ", " + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case IN:
|
case IN:
|
||||||
break;
|
break;
|
||||||
|
@ -367,18 +327,24 @@ public class OperatorTypeMap {
|
||||||
readableExpression = "IsNull(" + readableColumnReference + ")";
|
readableExpression = "IsNull(" + readableColumnReference + ")";
|
||||||
break;
|
break;
|
||||||
case LESSER:
|
case LESSER:
|
||||||
exp=new C_LessThan(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_LessThan(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="LessThan("+readableColumnReference+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "LessThan(" + readableColumnReference + ", "
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case LESSER_OR_EQUALS:
|
case LESSER_OR_EQUALS:
|
||||||
exp=new C_LessOrEquals(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_LessOrEquals(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="LessOrEquals("+readableColumnReference+", "+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "LessOrEquals(" + readableColumnReference
|
||||||
|
+ ", " + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case LIKE:
|
case LIKE:
|
||||||
break;
|
break;
|
||||||
case MATCH_REGEX:
|
case MATCH_REGEX:
|
||||||
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
|
||||||
readableExpression="TextMatchSQLRegexp("+readableColumnReference+", "+firstArg+")";
|
dataType, firstArg));
|
||||||
|
readableExpression = "TextMatchSQLRegexp("
|
||||||
|
+ readableColumnReference + ", " + firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case MODULUS:
|
case MODULUS:
|
||||||
break;
|
break;
|
||||||
|
@ -387,9 +353,11 @@ public class OperatorTypeMap {
|
||||||
case NOT:
|
case NOT:
|
||||||
break;
|
break;
|
||||||
case NOT_BEGINS_WITH:
|
case NOT_BEGINS_WITH:
|
||||||
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
|
||||||
|
firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextBeginsWith("+readableColumnReference+", "+firstArg+"))";
|
readableExpression = "Not(TextBeginsWith("
|
||||||
|
+ readableColumnReference + ", " + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case NOT_BETWEEN:
|
case NOT_BETWEEN:
|
||||||
fArg = new TD_Value(dataType, firstArg);
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
|
@ -397,64 +365,51 @@ public class OperatorTypeMap {
|
||||||
range = new C_Range(fArg, sArg);
|
range = new C_Range(fArg, sArg);
|
||||||
exp = new C_Between(columnReference, range);
|
exp = new C_Between(columnReference, range);
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+")))";
|
readableExpression = "Not(Between(" + readableColumnReference
|
||||||
|
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
||||||
break;
|
break;
|
||||||
case NOT_CONTAINS:
|
case NOT_CONTAINS:
|
||||||
separator=firstArg.indexOf(",");
|
fArg = new TD_Value(dataType, firstArg);
|
||||||
if(separator==-1|| firstArg.length()==1){
|
exp = new C_TextContains(columnReference, fArg);
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
} else {
|
|
||||||
String arg;
|
|
||||||
boolean end=false;
|
|
||||||
while(!end){
|
|
||||||
arg=firstArg.substring(0, separator);
|
|
||||||
arguments.add(new TD_Value(dataType,arg));
|
|
||||||
separator++;
|
|
||||||
if(separator<firstArg.length()){
|
|
||||||
firstArg=firstArg.substring(separator,firstArg.length());
|
|
||||||
separator=firstArg.indexOf(",");
|
|
||||||
if(separator==-1){
|
|
||||||
arguments.add(new TD_Value(dataType,firstArg));
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
end=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
|
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(Contains("+readableColumnReference;
|
readableExpression = "Not(Contains(" + columnReference + ", "
|
||||||
for(TD_Value v:arguments){
|
+ firstArg + "))";
|
||||||
readableExpression+=", "+v.getValue();
|
|
||||||
}
|
|
||||||
readableExpression+="))";
|
|
||||||
break;
|
break;
|
||||||
case NOT_ENDS_WITH:
|
case NOT_ENDS_WITH:
|
||||||
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
|
||||||
|
firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextEndsWith("+readableColumnReference+","+firstArg+"))";
|
readableExpression = "Not(TextEndsWith(" + readableColumnReference
|
||||||
|
+ "," + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case NOT_EQUALS:
|
case NOT_EQUALS:
|
||||||
exp=new C_NotEquals(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_NotEquals(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="NotEquals("+readableColumnReference+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "NotEquals(" + readableColumnReference + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_GREATER:
|
case NOT_GREATER:
|
||||||
exp=new C_NotGreater(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_NotGreater(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="NotGreater("+readableColumnReference+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "NotGreater(" + readableColumnReference + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_IN:
|
case NOT_IN:
|
||||||
break;
|
break;
|
||||||
case NOT_LESSER:
|
case NOT_LESSER:
|
||||||
exp=new C_NotLess(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_NotLess(columnReference, new TD_Value(dataType,
|
||||||
readableExpression="NotLess("+readableColumnReference+","+firstArg+")";
|
firstArg));
|
||||||
|
readableExpression = "NotLess(" + readableColumnReference + ","
|
||||||
|
+ firstArg + ")";
|
||||||
break;
|
break;
|
||||||
case NOT_LIKE:
|
case NOT_LIKE:
|
||||||
break;
|
break;
|
||||||
case NOT_MATCH_REGEX:
|
case NOT_MATCH_REGEX:
|
||||||
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg));
|
exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
|
||||||
|
dataType, firstArg));
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression="Not(TextMatchSQLRegexp("+readableColumnReference+","+firstArg+"))";
|
readableExpression = "Not(TextMatchSQLRegexp("
|
||||||
|
+ readableColumnReference + "," + firstArg + "))";
|
||||||
break;
|
break;
|
||||||
case OR:
|
case OR:
|
||||||
break;
|
break;
|
||||||
|
@ -485,5 +440,4 @@ public class OperatorTypeMap {
|
||||||
return readableExpression;
|
return readableExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue