81: Allow the creation and use of expressions on multi column in TDM portlet

Task-Url: https://support.d4science.org/issues/81

Increased speed of creating expressions client side and added Label to ColumnReferencePlaceHolder

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114916 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-05-26 14:48:21 +00:00
parent b359825701
commit 04c91ad225
7 changed files with 57 additions and 304 deletions

View File

@ -777,7 +777,7 @@ public class ConditionWidget extends SimpleContainer {
secondArg == null ? null : secondArg.getCurrentValue(),
comboThreshold.getCurrentValue()==null?null:comboThreshold.getCurrentValue());
}
readableExpressionList.add(mapOp.getReadableExpression());
readableExpressionList.add(expression.getReadableExpression());
Log.debug(expression.toString());
arguments.add(expression);
}

View File

@ -1086,7 +1086,7 @@ public class ReplaceWidget extends SimpleContainer {
}
readableExpLeaf = mapReplace.getReadableExpression();
readableExpLeaf = expLeaf.getReadableExpression();
}
index++;
@ -1139,7 +1139,7 @@ public class ReplaceWidget extends SimpleContainer {
break;
}
readableExp = mapReplace.getReadableExpression();
readableExp = exp.getReadableExpression();
expressionContainer = new ExpressionContainer(exp,
readableExp);
}
@ -1206,7 +1206,7 @@ public class ReplaceWidget extends SimpleContainer {
}
readableExpLeaf = mapReplace.getReadableExpression();
readableExpLeaf = expLeaf.getReadableExpression();
}
index++;
@ -1261,7 +1261,7 @@ public class ReplaceWidget extends SimpleContainer {
break;
}
readableExp = mapReplace.getReadableExpression();
readableExp = exp.getReadableExpression();
expressionContainer = new ExpressionContainer(exp,
readableExp);
}
@ -1304,7 +1304,7 @@ public class ReplaceWidget extends SimpleContainer {
break;
}
readableExp = mapReplace.getReadableExpression();
readableExp = exp.getReadableExpression();
expressionContainer = new ExpressionContainer(exp,
readableExp);
}

View File

@ -683,7 +683,7 @@ public class C_ExpressionParser {
private C_Expression getColumnReferencePlaceholder(Expression exp) {
ColumnReferencePlaceholder c = (ColumnReferencePlaceholder) exp;
C_ColumnReferencePlaceholder col = new C_ColumnReferencePlaceholder(
mapColumnDataType(c.getDatatype()), c.getId());
mapColumnDataType(c.getDatatype()), c.getId(), c.getLabel());
return col;
}
@ -1375,7 +1375,7 @@ public class C_ExpressionParser {
private Expression getColumnReferencePlaceholder(C_Expression exp) {
C_ColumnReferencePlaceholder c = (C_ColumnReferencePlaceholder) exp;
ColumnReferencePlaceholder col = new ColumnReferencePlaceholder(
mapColumnDataType(c.getDataType()), c.getColumnId());
mapColumnDataType(c.getDataType()), c.getColumnId(), c.getLabel());
return col;
}

View File

@ -88,7 +88,7 @@ public class ConditionOnMultiColumnTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeHolder = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), column.getLabel());
Log.debug("placeHolder:" + placeHolder);
// TD_Value fArg;
@ -307,7 +307,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_NotLess(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -334,7 +334,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_NotGreater(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -360,7 +360,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_NotEquals(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -387,7 +387,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_TextMatchSQLRegexp(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -414,7 +414,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_LessOrEquals(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -441,7 +441,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_LessThan(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -475,7 +475,7 @@ public class ConditionOnMultiColumnTypeMap {
* .getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
* C_ColumnReferencePlaceholder firstArgPlaceHolder = new
* C_ColumnReferencePlaceholder( firstArgDataType,
* firstArgColumn.getColumnId()); exp = new
* firstArgColumn.getColumnId(), firstArgColumn.getLabel()); exp = new
* C_ValueIsIn(placeHolder,firstArgPlaceHolder);
*/
@ -527,7 +527,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_GreaterOrEquals(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -554,7 +554,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_GreaterThan(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -581,7 +581,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_Equals(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -609,7 +609,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_TextEndsWith(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -637,7 +637,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
C_ColumnReferencePlaceholder firstArgPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
exp = new C_TextContains(placeHolder, firstArgPlaceHolder);
break;
case VALUE:
@ -670,7 +670,7 @@ public class ConditionOnMultiColumnTypeMap {
ColumnDataType firstArgDataType = ColumnDataType
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
fArg = new C_ColumnReferencePlaceholder(firstArgDataType,
firstArgColumn.getColumnId());
firstArgColumn.getColumnId(), firstArgColumn.getLabel());
break;
case VALUE:
if(firstArg==null|| firstArg.isEmpty()){
@ -692,7 +692,7 @@ public class ConditionOnMultiColumnTypeMap {
.getColumnDataTypeFromId(secondArgColumn.getDataTypeName());
Log.debug("Second Arg Data Type:" + secondArgDataType);
sArg = new C_ColumnReferencePlaceholder(secondArgDataType,
secondArgColumn.getColumnId());
secondArgColumn.getColumnId(), secondArgColumn.getLabel());
break;
case VALUE:
if(secondArg==null|| secondArg.isEmpty()){
@ -724,7 +724,7 @@ public class ConditionOnMultiColumnTypeMap {
.getColumnDataTypeFromId(firstArgColumn.getDataTypeName());
Log.debug("First Arg Data Type:" + firstArgDataType);
C_ColumnReferencePlaceholder firstArgColumnPlaceHolder = new C_ColumnReferencePlaceholder(
firstArgDataType, firstArgColumn.getColumnId());
firstArgDataType, firstArgColumn.getColumnId(), firstArgColumn.getLabel());
Log.debug("FirstArgColumnPlaceHolder:" + firstArgColumnPlaceHolder);
exp = new C_TextBeginsWith(placeHolder, firstArgColumnPlaceHolder);
break;

View File

@ -47,8 +47,6 @@ import com.allen_sauer.gwt.log.client.Log;
*
*/
public class ConditionTypeMap {
private String readableExpression;
public ConditionTypeMap() {
}
@ -57,7 +55,7 @@ public class ConditionTypeMap {
String firstArg, String secondArg, Threshold threshold) throws ConditionTypeMapException {
Log.debug("ConditionTypeMap Map");
C_Expression exp = null;
readableExpression = new String();
new String();
if (column.getTrId() == null) {
exp = mapPlaceHolder(column, operatorType, firstArg, secondArg, threshold);
} else {
@ -78,9 +76,8 @@ public class ConditionTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeHolder = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), column.getLabel());
Log.debug("placeHolder:" + placeHolder);
String readablePlaceHolder = column.getLabel();
TD_Value fArg;
TD_Value sArg;
@ -101,8 +98,6 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "Begins(" + readablePlaceHolder + ", "
+ firstArg + ")";
break;
case BETWEEN:
checkTypeArgument(column, firstArg);
@ -110,15 +105,11 @@ public class ConditionTypeMap {
fArg = new TD_Value(dataType, firstArg);
sArg = new TD_Value(dataType, secondArg);
exp = new C_Between(placeHolder, fArg, sArg);
readableExpression = "Between(" + readablePlaceHolder + ", Range("
+ firstArg + ", " + secondArg + "))";
break;
case CONTAINS:
checkTypeArgument(column, firstArg);
fArg = new TD_Value(dataType, firstArg);
exp = new C_TextContains(placeHolder, fArg);
readableExpression = "Contains(" + readablePlaceHolder + ", "
+ firstArg + ")";
break;
case DIVISION:
break;
@ -126,14 +117,10 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "TextEndsWith(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_Equals(placeHolder, new TD_Value(dataType, firstArg));
readableExpression = "Equals(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case EXISTS:
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
@ -142,15 +129,11 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_GreaterThan(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "GreaterThan(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case GREATER_OR_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_GreaterOrEquals(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "GreaterOrEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case IN:
separator = firstArg.indexOf(",");
@ -180,32 +163,21 @@ public class ConditionTypeMap {
}
}
exp = new C_ValueIsIn(placeHolder, new C_ConstantList(arguments));
readableExpression = "ValueIsIn(" + readablePlaceHolder;
for (TD_Value v : arguments) {
readableExpression += ", " + v.getValue();
}
readableExpression += ")";
break;
case IS_NOT_NULL:
exp = new C_IsNotNull(placeHolder);
readableExpression = "IsNotNull(" + readablePlaceHolder + ")";
break;
case IS_NULL:
exp = new C_IsNull(placeHolder);
readableExpression = "IsNull(" + readablePlaceHolder + ")";
break;
case LESSER:
checkTypeArgument(column, firstArg);
exp = new C_LessThan(placeHolder, new TD_Value(dataType, firstArg));
readableExpression = "LessThan(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case LESSER_OR_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_LessOrEquals(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "LessOrEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case LIKE:
break;
@ -213,8 +185,6 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
firstArg));
readableExpression = "TextMatchSQLRegexp(" + readablePlaceHolder
+ "," + firstArg + ")";
break;
case MODULUS:
break;
@ -227,8 +197,6 @@ public class ConditionTypeMap {
exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextBeginsWith(" + readablePlaceHolder
+ "," + firstArg + "))";
break;
case NOT_BETWEEN:
checkTypeArgument(column, firstArg);
@ -238,37 +206,27 @@ public class ConditionTypeMap {
sArg = new TD_Value(dataType, secondArg);
exp = new C_Between(placeHolder, fArg, sArg);
exp = new C_Not(exp);
readableExpression = "Not(Between(" + readablePlaceHolder
+ ", Range(" + firstArg + ", " + secondArg + ")))";
break;
case NOT_CONTAINS:
checkTypeArgument(column, firstArg);
fArg = new TD_Value(dataType, firstArg);
exp = new C_TextContains(placeHolder, fArg);
exp = new C_Not(exp);
readableExpression = "Not(Contains(" + readablePlaceHolder + ", "
+ firstArg + "))";
break;
case NOT_ENDS_WITH:
checkTypeArgument(column, firstArg);
exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextEndsWith(" + readablePlaceHolder
+ "," + firstArg + "))";
break;
case NOT_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_NotEquals(placeHolder, new TD_Value(dataType, firstArg));
readableExpression = "NotEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case NOT_GREATER:
checkTypeArgument(column, firstArg);
exp = new C_NotGreater(placeHolder,
new TD_Value(dataType, firstArg));
readableExpression = "NotGreater(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case NOT_IN:
separator = firstArg.indexOf(",");
@ -299,17 +257,10 @@ public class ConditionTypeMap {
}
exp = new C_ValueIsIn(placeHolder, new C_ConstantList(arguments));
exp = new C_Not(exp);
readableExpression = "Not(ValueIsIn(" + readablePlaceHolder;
for (TD_Value v : arguments) {
readableExpression += ", " + v.getValue();
}
readableExpression += "))";
break;
case NOT_LESSER:
checkTypeArgument(column, firstArg);
exp = new C_NotLess(placeHolder, new TD_Value(dataType, firstArg));
readableExpression = "NotLess(" + readablePlaceHolder + ","
+ firstArg + ")";
break;
case NOT_LIKE:
break;
@ -318,8 +269,6 @@ public class ConditionTypeMap {
exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextMatchSQLRegexp("
+ readablePlaceHolder + "," + firstArg + "))";
break;
case OR:
break;
@ -334,8 +283,6 @@ public class ConditionTypeMap {
C_Soundex soundexPlaceHolder=new C_Soundex(placeHolder);
C_Soundex soundexValue=new C_Soundex(new TD_Value(dataType, firstArg));
exp = new C_Equals(soundexPlaceHolder, soundexValue);
readableExpression = "Equals(Soundex(" + readablePlaceHolder + "),Soundex("
+ firstArg + "))";
break;
case LEVENSHTEIN:
checkTypeArgument(column, firstArg);
@ -349,8 +296,6 @@ public class ConditionTypeMap {
}
exp= new C_LessOrEquals(levenshstein,new TD_Value(ColumnDataType.Integer,
thresholdLev.getIntegerValue().toString()));
readableExpression = "LessOrEquals(Levenshtein(" + readablePlaceHolder + ","+firstArg+"),"
+ thresholdLev.getIntegerValue().toString() + ")";
break;
case SIMILARITY:
checkTypeArgument(column, firstArg);
@ -364,8 +309,6 @@ public class ConditionTypeMap {
}
exp= new C_GreaterOrEquals(similarity,new TD_Value(ColumnDataType.Numeric,
thresholdSim.getLabel()));
readableExpression = "GreaterOrEquals(Similarity(" + readablePlaceHolder + ","+firstArg+"),"
+ thresholdSim.getLabel() + ")";
break;
default:
@ -389,8 +332,7 @@ public class ConditionTypeMap {
C_ColumnReference columnReference = new C_ColumnReference(
column.getTrId(), dataType, column.getColumnId());
Log.debug("Typed Column Reference:" + columnReference);
String readableColumnReference = column.getLabel();
TD_Value fArg;
TD_Value sArg;
@ -410,8 +352,6 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "TextBeginsWith(" + readableColumnReference
+ "," + firstArg + ")";
break;
case BETWEEN:
checkTypeArgument(column, firstArg);
@ -419,15 +359,11 @@ public class ConditionTypeMap {
fArg = new TD_Value(dataType, firstArg);
sArg = new TD_Value(dataType, secondArg);
exp = new C_Between(columnReference, fArg, sArg);
readableExpression = "Between(" + readableColumnReference
+ ", Range(" + firstArg + ", " + secondArg + "))";
break;
case CONTAINS:
checkTypeArgument(column, firstArg);
fArg = new TD_Value(dataType, firstArg);
exp = new C_TextContains(columnReference, fArg);
readableExpression = "Contains(" + columnReference + ", "
+ firstArg + ")";
break;
case DIVISION:
break;
@ -435,15 +371,11 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "TextEndsWith(" + readableColumnReference
+ ", " + firstArg + ")";
break;
case EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_Equals(columnReference,
new TD_Value(dataType, firstArg));
readableExpression = "Equals(" + readableColumnReference + ", "
+ firstArg + ")";
break;
case EXISTS:
// exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
@ -452,15 +384,11 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_GreaterThan(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "GreaterThan(" + readableColumnReference
+ ", " + firstArg + ")";
break;
case GREATER_OR_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_GreaterOrEquals(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "GreaterOrEquals(" + readableColumnReference
+ ", " + firstArg + ")";
break;
case IN:
separator = firstArg.indexOf(",");
@ -491,33 +419,22 @@ public class ConditionTypeMap {
}
exp = new C_ValueIsIn(columnReference,
new C_ConstantList(arguments));
readableExpression = "ValueIsIn(" + readableColumnReference;
for (TD_Value v : arguments) {
readableExpression += ", " + v.getValue();
}
readableExpression += ")";
break;
case IS_NOT_NULL:
exp = new C_IsNotNull(columnReference);
readableExpression = "IsNotNull(" + readableColumnReference + ")";
break;
case IS_NULL:
exp = new C_IsNull(columnReference);
readableExpression = "IsNull(" + readableColumnReference + ")";
break;
case LESSER:
checkTypeArgument(column, firstArg);
exp = new C_LessThan(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "LessThan(" + readableColumnReference + ", "
+ firstArg + ")";
break;
case LESSER_OR_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_LessOrEquals(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "LessOrEquals(" + readableColumnReference
+ ", " + firstArg + ")";
break;
case LIKE:
break;
@ -525,8 +442,6 @@ public class ConditionTypeMap {
checkTypeArgument(column, firstArg);
exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
dataType, firstArg));
readableExpression = "TextMatchSQLRegexp("
+ readableColumnReference + ", " + firstArg + ")";
break;
case MODULUS:
break;
@ -539,8 +454,6 @@ public class ConditionTypeMap {
exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextBeginsWith("
+ readableColumnReference + ", " + firstArg + "))";
break;
case NOT_BETWEEN:
checkTypeArgument(column, firstArg);
@ -549,38 +462,28 @@ public class ConditionTypeMap {
sArg = new TD_Value(dataType, secondArg);
exp = new C_Between(columnReference, fArg, sArg);
exp = new C_Not(exp);
readableExpression = "Not(Between(" + readableColumnReference
+ ", Range(" + firstArg + ", " + secondArg + ")))";
break;
case NOT_CONTAINS:
checkTypeArgument(column, firstArg);
fArg = new TD_Value(dataType, firstArg);
exp = new C_TextContains(columnReference, fArg);
exp = new C_Not(exp);
readableExpression = "Not(Contains(" + columnReference + ", "
+ firstArg + "))";
break;
case NOT_ENDS_WITH:
checkTypeArgument(column, firstArg);
exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextEndsWith(" + readableColumnReference
+ "," + firstArg + "))";
break;
case NOT_EQUALS:
checkTypeArgument(column, firstArg);
exp = new C_NotEquals(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "NotEquals(" + readableColumnReference + ","
+ firstArg + ")";
break;
case NOT_GREATER:
checkTypeArgument(column, firstArg);
exp = new C_NotGreater(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "NotGreater(" + readableColumnReference + ","
+ firstArg + ")";
break;
case NOT_IN:
separator = firstArg.indexOf(",");
@ -612,18 +515,11 @@ public class ConditionTypeMap {
exp = new C_ValueIsIn(columnReference,
new C_ConstantList(arguments));
exp = new C_Not(exp);
readableExpression = "Not(ValueIsIn(" + readableColumnReference;
for (TD_Value v : arguments) {
readableExpression += ", " + v.getValue();
}
readableExpression += "))";
break;
case NOT_LESSER:
checkTypeArgument(column, firstArg);
exp = new C_NotLess(columnReference, new TD_Value(dataType,
firstArg));
readableExpression = "NotLess(" + readableColumnReference + ","
+ firstArg + ")";
break;
case NOT_LIKE:
break;
@ -632,8 +528,6 @@ public class ConditionTypeMap {
exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
dataType, firstArg));
exp = new C_Not(exp);
readableExpression = "Not(TextMatchSQLRegexp("
+ readableColumnReference + "," + firstArg + "))";
break;
case OR:
break;
@ -648,8 +542,6 @@ public class ConditionTypeMap {
C_Soundex soundexPlaceHolder=new C_Soundex(columnReference);
C_Soundex soundexValue=new C_Soundex(new TD_Value(dataType, firstArg));
exp = new C_Equals(soundexPlaceHolder, soundexValue);
readableExpression = "Equals(Soundex(" + columnReference + "),Soundex("
+ firstArg + "))";
break;
case LEVENSHTEIN:
checkTypeArgument(column, firstArg);
@ -663,8 +555,6 @@ public class ConditionTypeMap {
}
exp= new C_LessOrEquals(levenshstein,new TD_Value(ColumnDataType.Integer,
thresholdLev.getIntegerValue().toString()));
readableExpression = "LessOrEquals(Levenshtein(" + readableColumnReference + ","+firstArg+"),"
+ thresholdLev.getIntegerValue().toString() + ")";
break;
case SIMILARITY:
checkTypeArgument(column, firstArg);
@ -677,9 +567,7 @@ public class ConditionTypeMap {
thresholdSim=threshold;
}
exp= new C_GreaterOrEquals(similarity,new TD_Value(ColumnDataType.Numeric,
thresholdSim.getLabel()));
readableExpression = "GreaterOrEquals(Similarity(" + readableColumnReference + ","+firstArg+"),"
+ thresholdSim.getLabel() + ")";
thresholdSim.getLabel()));
break;
default:
break;
@ -698,9 +586,6 @@ public class ConditionTypeMap {
return or;
}
public String getReadableExpression() {
return readableExpression;
}
protected void checkTypeArgument(ColumnData column, String arg)
throws ConditionTypeMapException {

View File

@ -7,18 +7,20 @@ public class C_ColumnReferencePlaceholder extends C_Leaf {
private static final long serialVersionUID = 275747262118236529L;
protected String id = "ColumnReferencePlaceholder";
protected String columnId;
protected String label;
protected ColumnDataType dataType;
public C_ColumnReferencePlaceholder() {
}
public C_ColumnReferencePlaceholder(ColumnDataType dataType, String columnId) {
public C_ColumnReferencePlaceholder(ColumnDataType dataType,
String columnId, String label) {
this.dataType = dataType;
this.columnId = columnId;
if (dataType != null && columnId != null) {
this.readableExpression = "$"+columnId+"["
+ dataType.getLabel() + "]";
if (dataType != null && columnId != null && label != null) {
this.readableExpression = "$" + label + "[" + dataType.getLabel()
+ "]";
}
}
@ -36,6 +38,14 @@ public class C_ColumnReferencePlaceholder extends C_Leaf {
this.columnId = columnId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public ColumnDataType getDataType() {
return dataType;
}
@ -46,8 +56,9 @@ public class C_ColumnReferencePlaceholder extends C_Leaf {
@Override
public String toString() {
return "ColumnReferencePlaceholder [id=" + id + ", columnId="
+ columnId + ", dataType=" + dataType + "]";
return "C_ColumnReferencePlaceholder [id=" + id + ", columnId="
+ columnId + ", label=" + label + ", dataType=" + dataType
+ "]";
}
}

View File

@ -33,8 +33,6 @@ import com.allen_sauer.gwt.log.client.Log;
*
*/
public class ReplaceTypeMap {
private String readableExpression;
public ReplaceTypeMap() {
}
@ -49,7 +47,7 @@ public class ReplaceTypeMap {
C_Expression secondE, String readableFirstE, String readableSecondE) throws ReplaceTypeMapException {
Log.debug("ReplaceTypeMap Map");
C_Expression exp = null;
readableExpression = new String();
new String();
if (template) {
exp = mapPlaceHolder(column, targetType, replaceType, firstArg, secondArg,
firstE, secondE, readableFirstE,readableSecondE);
@ -71,44 +69,31 @@ public class ReplaceTypeMap {
case Value:
checkTypeArgument(targetType,firstArg);
exp = new TD_Value(targetType, firstArg);
readableExpression = "Value(" + firstArg + ")";
break;
case Concat:
C_Concat concat = new C_Concat(firstE, secondE);
exp= new C_Cast(concat,targetType);
readableExpression = "Cast(Concat(" + readableFirstE
+ ", " + readableSecondE + "),"+targetType+")";
break;
case Addition:
C_Addition add = new C_Addition(firstE, secondE);
exp= new C_Cast(add, targetType);
readableExpression = "Cast(Addition(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Subtraction:
C_Subtraction sub = new C_Subtraction(firstE, secondE);
exp= new C_Cast(sub,targetType);
readableExpression = "Cast(Subtraction(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Modulus:
C_Modulus modu = new C_Modulus(firstE, secondE);
exp=new C_Cast(modu,targetType);
readableExpression = "Cast(Modulus(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Multiplication:
C_Multiplication multi = new C_Multiplication(firstE, secondE);
exp=new C_Cast(multi,targetType);
readableExpression = "Cast(Multiplication(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Division:
C_Division divi = new C_Division(firstE, secondE);
exp=new C_Cast(divi,targetType);
readableExpression = "Cast(Division(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
default:
throw new ReplaceTypeMapException("No valid column selected");
@ -120,7 +105,6 @@ public class ReplaceTypeMap {
case Value:
checkTypeArgument(targetType,firstArg);
exp = new TD_Value(targetType, firstArg);
readableExpression = "Value(" + firstArg + ")";
break;
case ColumnValue:
exp = columnValuePlaceHolder(column, targetType);
@ -140,39 +124,27 @@ public class ReplaceTypeMap {
case Concat:
C_Concat concat = new C_Concat(firstE, secondE);
exp= new C_Cast(concat,targetType);
readableExpression = "Cast(Concat(" + readableFirstE
+ ", " + readableSecondE + "),"+targetType+")";
break;
case Addition:
C_Addition add = new C_Addition(firstE, secondE);
exp= new C_Cast(add, targetType);
readableExpression = "Cast(Addition(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Subtraction:
C_Subtraction sub = new C_Subtraction(firstE, secondE);
exp= new C_Cast(sub,targetType);
readableExpression = "Cast(Subtraction(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Modulus:
C_Modulus modu = new C_Modulus(firstE, secondE);
exp=new C_Cast(modu,targetType);
readableExpression = "Cast(Modulus(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Multiplication:
C_Multiplication multi = new C_Multiplication(firstE, secondE);
exp=new C_Cast(multi,targetType);
readableExpression = "Cast(Multiplication(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Division:
C_Division divi = new C_Division(firstE, secondE);
exp=new C_Cast(divi,targetType);
readableExpression = "Cast(Division(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case SubstringByRegex:
exp = substringByRegexPlaceHolder(column, targetType, firstArg);
@ -207,15 +179,12 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), column.getLabel());
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
@ -226,8 +195,6 @@ public class ReplaceTypeMap {
sArg = new TD_Value(ColumnDataType.Text, secondArg);
C_TextReplaceMatchingRegex substring = new C_TextReplaceMatchingRegex(placeHolder, fArg, sArg);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(TextReplaceMatchingRegex(" + readablePlaceHolder
+ ", " + firstArg + ", " + secondArg + "),"+targetType+")";
return exp;
}
@ -245,15 +212,12 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
@ -267,8 +231,6 @@ public class ReplaceTypeMap {
posTo = new C_SubstringPosition(placeHolder, fArg);
C_SubstringByIndex substring = new C_SubstringByIndex(placeHolder, posFrom, posTo);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(SubstringByCharSeq(" + readablePlaceHolder
+ ", " + firstArg + ", " + secondArg + "),"+targetType+")";
return exp;
}
@ -284,15 +246,12 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
@ -304,8 +263,6 @@ public class ReplaceTypeMap {
sArg = new TD_Value(ColumnDataType.Integer, secondArg);
C_SubstringByIndex substring = new C_SubstringByIndex(placeHolder, fArg, sArg);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(SubstringByIndex(" + readablePlaceHolder
+ ", " + firstArg + ", " + secondArg + "),"+targetType+")";
return exp;
}
@ -320,15 +277,12 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
@ -337,8 +291,6 @@ public class ReplaceTypeMap {
fArg = new TD_Value(ColumnDataType.Text, firstArg);
C_SubstringByRegex substring = new C_SubstringByRegex(placeHolder, fArg);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(SubStringByRegex(" + readablePlaceHolder
+ ", " + firstArg + "),"+targetType+")";
return exp;
}
@ -352,22 +304,18 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=targetType){
placeHolder=new C_Cast(placeH, targetType);
readablePlaceHolder= "Cast("+column.getLabel()+","+targetType+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
exp = placeHolder;
readableExpression = "ColumnValue(" + readablePlaceHolder + ")";
return exp;
}
@ -380,23 +328,18 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
C_Upper upper = new C_Upper(placeHolder);
exp=new C_Cast(upper, targetType);
readableExpression = "Cast(Upper(" + readablePlaceHolder
+"),"+targetType+")";
return exp;
}
@ -410,23 +353,18 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
C_Lower lower = new C_Lower(placeHolder);
exp=new C_Cast(lower, targetType);
readableExpression = "Cast(Lower(" + readablePlaceHolder
+"),"+targetType+")";
return exp;
}
@ -439,23 +377,18 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
C_Trim trim = new C_Trim(placeHolder);
exp=new C_Cast(trim, targetType);
readableExpression = "Cast(Trim(" + readablePlaceHolder
+"),"+targetType+")";
return exp;
}
@ -469,23 +402,18 @@ public class ReplaceTypeMap {
.getDataTypeName());
Log.debug("Data Type:" + dataType);
C_ColumnReferencePlaceholder placeH = new C_ColumnReferencePlaceholder(
dataType, column.getColumnId());
dataType, column.getColumnId(), null);
C_Expression placeHolder;
String readablePlaceHolder;
if(dataType!=ColumnDataType.Text){
placeHolder=new C_Cast(placeH, ColumnDataType.Text);
readablePlaceHolder= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
placeHolder=placeH;
readablePlaceHolder= column.getLabel();
}
Log.debug("placeHolder:" + placeHolder);
C_MD5 md5 = new C_MD5(placeHolder);
exp=new C_Cast(md5, targetType);
readableExpression = "Cast(MD5(" + readablePlaceHolder
+"),"+targetType+")";
return exp;
}
@ -503,44 +431,31 @@ public class ReplaceTypeMap {
case Value:
checkTypeArgument(targetType,firstArg);
exp = new TD_Value(targetType, firstArg);
readableExpression = "Value(" + firstArg + ")";
break;
case Concat:
C_Concat concat = new C_Concat(firstE, secondE);
exp= new C_Cast(concat,targetType);
readableExpression = "Cast(Concat(" + readableFirstE
+ ", " + readableSecondE + "),"+targetType+")";
break;
case Addition:
C_Addition add = new C_Addition(firstE, secondE);
exp= new C_Cast(add, targetType);
readableExpression = "Cast(Addition(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Subtraction:
C_Subtraction sub = new C_Subtraction(firstE, secondE);
exp= new C_Cast(sub,targetType);
readableExpression = "Cast(Subtraction(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Modulus:
C_Modulus modu = new C_Modulus(firstE, secondE);
exp=new C_Cast(modu,targetType);
readableExpression = "Cast(Modulus(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Multiplication:
C_Multiplication multi = new C_Multiplication(firstE, secondE);
exp=new C_Cast(multi,targetType);
readableExpression = "Cast(Multiplication(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Division:
C_Division divi = new C_Division(firstE, secondE);
exp=new C_Cast(divi,targetType);
readableExpression = "Cast(Division(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
default:
throw new ReplaceTypeMapException("No valid column selected");
@ -553,7 +468,6 @@ public class ReplaceTypeMap {
case Value:
checkTypeArgument(targetType, firstArg);
exp = new TD_Value(targetType, firstArg);
readableExpression = "Value(" + firstArg + ")";
break;
case ColumnValue:
exp = columnValueReference(column, targetType);
@ -573,39 +487,27 @@ public class ReplaceTypeMap {
case Concat:
C_Concat concat = new C_Concat(firstE, secondE);
exp= new C_Cast(concat,targetType);
readableExpression = "Cast(Concat(" + readableFirstE
+ ", " + readableSecondE + "),"+targetType+")";
break;
case Addition:
C_Addition add = new C_Addition(firstE, secondE);
exp= new C_Cast(add, targetType);
readableExpression = "Cast(Addition(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Subtraction:
C_Subtraction sub = new C_Subtraction(firstE, secondE);
exp= new C_Cast(sub,targetType);
readableExpression = "Cast(Subtraction(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Modulus:
C_Modulus modu = new C_Modulus(firstE, secondE);
exp=new C_Cast(modu,targetType);
readableExpression = "Cast(Modulus(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Multiplication:
C_Multiplication multi = new C_Multiplication(firstE, secondE);
exp=new C_Cast(multi,targetType);
readableExpression = "Cast(Multiplication(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case Division:
C_Division divi = new C_Division(firstE, secondE);
exp=new C_Cast(divi,targetType);
readableExpression = "Cast(Division(" + readableFirstE + ", "
+ readableSecondE + "),"+targetType+")";
break;
case SubstringByRegex:
exp = SubstringByRegexReference(column, targetType, firstArg);
@ -644,13 +546,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -661,8 +560,6 @@ public class ReplaceTypeMap {
sArg = new TD_Value(ColumnDataType.Text, secondArg);
C_TextReplaceMatchingRegex substring = new C_TextReplaceMatchingRegex(columnReference, fArg, sArg);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(TextReplaceMatchingRegex(" + readableColumnReference
+ ", " + firstArg + ", " + secondArg + "),"+targetType+")";
return exp;
}
@ -683,13 +580,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -702,9 +596,6 @@ public class ReplaceTypeMap {
posTo = new C_SubstringPosition(columnReference, fArg);
C_SubstringByIndex substring = new C_SubstringByIndex(columnReference, posFrom, posTo);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(SubstringByCharSeq("
+ readableColumnReference + ", " + firstArg + ", "
+ secondArg + "),"+targetType+")";
return exp;
}
@ -724,13 +615,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -741,8 +629,6 @@ public class ReplaceTypeMap {
sArg = new TD_Value(ColumnDataType.Integer, secondArg);
C_SubstringByIndex substring = new C_SubstringByIndex(columnReference, fArg, sArg);
exp=new C_Cast(substring,targetType);
readableExpression = "Cast(SubstringByIndex(" + readableColumnReference
+ ", " + firstArg + ", " + secondArg + "),"+targetType+")";
return exp;
}
@ -761,13 +647,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -777,8 +660,6 @@ public class ReplaceTypeMap {
fArg = new TD_Value(ColumnDataType.Text, firstArg);
C_SubstringByRegex substring= new C_SubstringByRegex(columnReference, fArg);
exp=new C_Cast(substring, targetType);
readableExpression = "Cast(SubStringByRegex(" + readableColumnReference
+ ", " + firstArg + "),"+targetType+")";
return exp;
}
@ -795,18 +676,14 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=targetType){
columnReference=new C_Cast(columnRef,targetType);
readableColumnReference= "Cast("+column.getLabel()+","+targetType+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
exp = columnReference;
readableExpression = "ColumnValue(" + readableColumnReference + ")";
return exp;
}
@ -824,13 +701,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -838,8 +712,6 @@ public class ReplaceTypeMap {
C_Upper upper= new C_Upper(columnReference);
exp=new C_Cast(upper, targetType);
readableExpression = "Cast(Upper(" + readableColumnReference
+ "),"+targetType+")";
return exp;
}
@ -856,13 +728,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -870,8 +739,6 @@ public class ReplaceTypeMap {
C_Lower lower= new C_Lower(columnReference);
exp=new C_Cast(lower, targetType);
readableExpression = "Cast(Lower(" + readableColumnReference
+ "),"+targetType+")";
return exp;
}
@ -889,13 +756,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -903,8 +767,6 @@ public class ReplaceTypeMap {
C_Trim trim= new C_Trim(columnReference);
exp=new C_Cast(trim, targetType);
readableExpression = "Cast(Trim(" + readableColumnReference
+ "),"+targetType+")";
return exp;
}
@ -921,13 +783,10 @@ public class ReplaceTypeMap {
column.getTrId(), dataType, column.getColumnId());
C_Expression columnReference;
String readableColumnReference;
if(dataType!=ColumnDataType.Text){
columnReference=new C_Cast(columnRef,ColumnDataType.Text);
readableColumnReference= "Cast("+column.getLabel()+","+ColumnDataType.Text+")";
} else {
columnReference=columnRef;
readableColumnReference= column.getLabel();
}
Log.debug("Typed Column Reference:" + columnReference);
@ -935,16 +794,14 @@ public class ReplaceTypeMap {
C_MD5 md5= new C_MD5(columnReference);
exp=new C_Cast(md5, targetType);
readableExpression = "Cast(MD5(" + readableColumnReference
+ "),"+targetType+")";
return exp;
}
public String getReadableExpression() {
/*public String getReadableExpression() {
return readableExpression;
}
}*/
protected void checkTypeArgument(ColumnDataType columnDataType, String arg)
throws ReplaceTypeMapException {