Minor Updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@91815 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-18 10:35:56 +00:00
parent a38018ff3a
commit 8a0f365d8d
5 changed files with 170 additions and 19 deletions

View File

@ -94,3 +94,67 @@ Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 11.43 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 8 seconds)
30% complete (ETR: 8 seconds)
30% complete (ETR: 8 seconds)
30% complete (ETR: 8 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 17.45 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -197,6 +197,7 @@ public class ColumnExpressionPanel extends FramedPanel {
C_ExpressionContainer container = new C_ExpressionContainer();
container.setId(C_ExpressionContainer.Contains.C_Expression);
container.setExp(exp);
container.setReadableExpression(conditionWidget.getReadableExpression());
expressionEvent.setC_ExpressionContainer(container);
expressionEvent.setTrId(column.getTrId());
expressionEvent.setColumnId(column.getColumnId());

View File

@ -58,6 +58,10 @@ public class ConditionWidget extends SimpleContainer {
protected VerticalLayoutContainer vert;
protected ColumnData column;
protected String readableExpression;
ConditionWidget(ColumnData column) {
this.column = column;
setBorders(true);
@ -90,7 +94,6 @@ public class ConditionWidget extends SimpleContainer {
groupMatch.add(radioAll);
groupMatch.add(radioAny);
groupMatch.setValue(radioAll);
vert = new VerticalLayoutContainer();
vert.setScrollMode(ScrollMode.AUTO);
@ -363,7 +366,9 @@ public class ConditionWidget extends SimpleContainer {
public C_Expression getExpression() {
C_Expression exp = null;
readableExpression = new String();
List<C_Expression> arguments = new ArrayList<C_Expression>();
List<String> readableExpressionList = new ArrayList<String>();
TextField firstArg;
TextField secondArg;
C_Expression expression;
@ -372,8 +377,7 @@ public class ConditionWidget extends SimpleContainer {
Iterator<Widget> iteratorVert = vert.iterator();
HBoxLayoutContainer horiz;
while (iteratorVert.hasNext()) {
horiz = (HBoxLayoutContainer) iteratorVert
.next();
horiz = (HBoxLayoutContainer) iteratorVert.next();
@SuppressWarnings("unchecked")
ComboBox<Operation> comboOp = (ComboBox<Operation>) horiz
.getItemByItemId(itemIdCombo);
@ -387,21 +391,44 @@ public class ConditionWidget extends SimpleContainer {
.getOperatorType(),
firstArg == null ? null : firstArg.getCurrentValue(),
secondArg == null ? null : secondArg.getCurrentValue());
readableExpressionList.add(mapOp.getReadableExpression());
Log.debug(expression.toString());
arguments.add(expression);
}
Log.debug("Expression Arguments Calculated: " +arguments.size());
Log.debug("Expression Arguments Calculated: " + arguments.size());
if (arguments.size() > 0) {
if (arguments.size() == 1) {
exp = arguments.get(0);
readableExpression = readableExpressionList.get(0);
} else {
Radio radio = (Radio) groupMatch.getValue();
Log.debug("Match:"+radio);
Log.debug("Match:" + radio);
if (radio.getName().compareTo("All") == 0) {
exp = mapOp.createC_And(arguments);
readableExpression = "And(";
boolean first = true;
for (String read : readableExpressionList) {
if (first) {
readableExpression += read;
} else {
readableExpression += ", " + read;
}
}
readableExpression += ")";
} else {
if (radio.getName().compareTo("Any") == 0) {
exp = mapOp.createC_Or(arguments);
readableExpression = "Or(";
boolean first = true;
for (String read : readableExpressionList) {
if (first) {
readableExpression += read;
} else {
readableExpression += ", " + read;
}
}
readableExpression += ")";
} else {
Log.error("No All or Any set!");
}
@ -412,5 +439,9 @@ public class ConditionWidget extends SimpleContainer {
Log.debug("C_Expression:" + exp.toString());
return exp;
}
public String getReadableExpression() {
return readableExpression;
}
}

View File

@ -55,18 +55,14 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
List<OperationDefinition> capabilities = service.getCapabilities();
OperationDefinition importSDMXCodelistOperation = OperationDefinitionMap.map(
OperationDefinition operation = OperationDefinitionMap.map(
OperationsId.FilterByExpression.toString(), capabilities);
Map<String, Object> parameterInstance=null;// = retrieveOperationParameters(sdmxImportSession);
Map<String, Object> parameterInstance = null;//retrieveOperationParameters(sdmxImportSession);
OperationExecution invocation = new OperationExecution(
importSDMXCodelistOperation.getOperationId(),
operation.getOperationId(),
parameterInstance);

View File

@ -43,7 +43,7 @@ import com.allen_sauer.gwt.log.client.Log;
*
*/
public class OperatorTypeMap {
private String readableExpression;
public OperatorTypeMap(){
@ -52,6 +52,7 @@ public class OperatorTypeMap {
public C_Expression map(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){
Log.debug("OperatorTypeMap Map");
C_Expression exp=null;
readableExpression=new String();
if(column.getTrId()==null){
exp=mapPlaceHolder(column,operatorType,firstArg,secondArg);
} else {
@ -65,11 +66,11 @@ public class OperatorTypeMap {
C_Expression exp = null;
Log.debug("Column Data Type Name:"+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
, column.getColumnId());
Log.debug("placeHolder:"+placeHolder);
String readablePlaceHolder=column.getColumnId();
List<TD_Value> arguments=new ArrayList<TD_Value>();
TD_Value fArg;
@ -88,12 +89,14 @@ public class OperatorTypeMap {
break;
case BEGINS_WITH:
exp=new C_TextBeginsWith(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="Begins("+readablePlaceHolder+", "+firstArg+")";
break;
case BETWEEN:
fArg=new TD_Value(dataType,firstArg);
sArg=new TD_Value(dataType,secondArg);
range=new C_Range(fArg,sArg);
exp=new C_Between(placeHolder,range);
readableExpression="Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+"))";
break;
case CONTAINS:
separator=firstArg.indexOf(",");
@ -119,42 +122,56 @@ public class OperatorTypeMap {
}
}
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
readableExpression="Contains("+readablePlaceHolder;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+=")";
break;
case DIVISION:
break;
case ENDS_WITH:
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="TextEndsWith("+readablePlaceHolder+","+firstArg+")";
break;
case EQUALS:
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));
break;
case GREATER:
exp=new C_GreaterThan(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="GreaterThan("+readablePlaceHolder+","+firstArg+")";
break;
case GREATER_OR_EQUALS:
exp=new C_GreaterOrEquals(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="GreaterOrEquals("+readablePlaceHolder+","+firstArg+")";
break;
case IN:
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:
exp=new C_LessThan(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="LessThan("+readablePlaceHolder+","+firstArg+")";
break;
case LESSER_OR_EQUALS:
exp=new C_LessOrEquals(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="LessOrEquals("+readablePlaceHolder+","+firstArg+")";
break;
case LIKE:
break;
case MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+")";
break;
case MODULUS:
break;
@ -165,6 +182,7 @@ public class OperatorTypeMap {
case NOT_BEGINS_WITH:
exp=new C_TextBeginsWith(placeHolder, new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextBeginsWith("+readablePlaceHolder+","+firstArg+"))";
break;
case NOT_BETWEEN:
fArg=new TD_Value(dataType,firstArg);
@ -172,6 +190,7 @@ public class OperatorTypeMap {
range=new C_Range(fArg,sArg);
exp=new C_Between(placeHolder,range);
exp=new C_Not(exp);
readableExpression="Not(Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+")))";
break;
case NOT_CONTAINS:
separator=firstArg.indexOf(",");
@ -198,27 +217,37 @@ public class OperatorTypeMap {
}
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
exp=new C_Not(exp);
readableExpression="Not(Contains("+readablePlaceHolder;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+="))";
break;
case NOT_ENDS_WITH:
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextEndsWith("+readablePlaceHolder+","+firstArg+"))";
break;
case NOT_EQUALS:
exp=new C_NotEquals(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="NotEquals("+readablePlaceHolder+","+firstArg+")";
break;
case NOT_GREATER:
exp=new C_NotGreater(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="NotGreater("+readablePlaceHolder+","+firstArg+")";
break;
case NOT_IN:
break;
case NOT_LESSER:
exp=new C_NotLess(placeHolder,new TD_Value(dataType,firstArg));
readableExpression="NotLess("+readablePlaceHolder+","+firstArg+")";
break;
case NOT_LIKE:
break;
case NOT_MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+"))";
break;
case OR:
break;
@ -245,11 +274,10 @@ public class OperatorTypeMap {
Log.debug("Column Data Type Name:"+column.getDataTypeName());
ColumnDataType dataType=ColumnTypeMap.getColumnDataType(column.getDataTypeName());
Log.debug("Data Type:"+dataType);
C_TypedColumnReference columnReference=new C_TypedColumnReference(column.getTrId(), dataType
, column.getColumnId());
Log.debug("Typed Column Reference:"+columnReference);
String readableColumnReference=column.getLabel();
List<TD_Value> arguments=new ArrayList<TD_Value>();
TD_Value fArg;
@ -268,12 +296,14 @@ public class OperatorTypeMap {
break;
case BEGINS_WITH:
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg));
readableExpression="TextBeginsWith("+readableColumnReference+","+firstArg+")";
break;
case BETWEEN:
fArg=new TD_Value(dataType,firstArg);
sArg=new TD_Value(dataType,secondArg);
range=new C_Range(fArg,sArg);
exp=new C_Between(columnReference,range);
readableExpression="Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+"))";
break;
case CONTAINS:
separator=firstArg.indexOf(",");
@ -299,42 +329,56 @@ public class OperatorTypeMap {
}
}
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
readableExpression="Contains("+readableColumnReference;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+=")";
break;
case DIVISION:
break;
case ENDS_WITH:
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg));
readableExpression="TextEndsWith("+readableColumnReference+", "+firstArg+")";
break;
case EQUALS:
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));
break;
case GREATER:
exp=new C_GreaterThan(columnReference,new TD_Value(dataType,firstArg));
readableExpression="GreaterThan("+readableColumnReference+", "+firstArg+")";
break;
case GREATER_OR_EQUALS:
exp=new C_GreaterOrEquals(columnReference,new TD_Value(dataType,firstArg));
readableExpression="GreaterOrEquals("+readableColumnReference+", "+firstArg+")";
break;
case IN:
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:
exp=new C_LessThan(columnReference,new TD_Value(dataType,firstArg));
readableExpression="LessThan("+readableColumnReference+", "+firstArg+")";
break;
case LESSER_OR_EQUALS:
exp=new C_LessOrEquals(columnReference,new TD_Value(dataType,firstArg));
readableExpression="LessOrEquals("+readableColumnReference+", "+firstArg+")";
break;
case LIKE:
break;
case MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg));
readableExpression="TextMatchSQLRegexp("+readableColumnReference+", "+firstArg+")";
break;
case MODULUS:
break;
@ -345,6 +389,7 @@ public class OperatorTypeMap {
case NOT_BEGINS_WITH:
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextBeginsWith("+readableColumnReference+", "+firstArg+"))";
break;
case NOT_BETWEEN:
fArg=new TD_Value(dataType,firstArg);
@ -352,6 +397,7 @@ public class OperatorTypeMap {
range=new C_Range(fArg,sArg);
exp=new C_Between(columnReference,range);
exp=new C_Not(exp);
readableExpression="Not(Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+")))";
break;
case NOT_CONTAINS:
separator=firstArg.indexOf(",");
@ -378,27 +424,37 @@ public class OperatorTypeMap {
}
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
exp=new C_Not(exp);
readableExpression="Not(Contains("+readableColumnReference;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+="))";
break;
case NOT_ENDS_WITH:
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextEndsWith("+readableColumnReference+","+firstArg+"))";
break;
case NOT_EQUALS:
exp=new C_NotEquals(columnReference,new TD_Value(dataType,firstArg));
readableExpression="NotEquals("+readableColumnReference+","+firstArg+")";
break;
case NOT_GREATER:
exp=new C_NotGreater(columnReference,new TD_Value(dataType,firstArg));
readableExpression="NotGreater("+readableColumnReference+","+firstArg+")";
break;
case NOT_IN:
break;
case NOT_LESSER:
exp=new C_NotLess(columnReference,new TD_Value(dataType,firstArg));
readableExpression="NotLess("+readableColumnReference+","+firstArg+")";
break;
case NOT_LIKE:
break;
case NOT_MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg));
exp=new C_Not(exp);
readableExpression="Not(TextMatchSQLRegexp("+readableColumnReference+","+firstArg+"))";
break;
case OR:
break;
@ -425,6 +481,9 @@ public class OperatorTypeMap {
return or;
}
public String getReadableExpression() {
return readableExpression;
}
}