Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@91447 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
910dcd7799
commit
f8ed6f3a61
|
@ -87,6 +87,7 @@ public class ColumnExpressionDialog extends Window {
|
|||
}
|
||||
|
||||
public void setExpression(Expression exp) {
|
||||
Log.debug("New Expression set:"+exp.toString());
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,8 +373,19 @@ public class ConditionWidget extends SimpleContainer {
|
|||
ComboBox<Operation> comboOp = (ComboBox<Operation>) horiz
|
||||
.getItemByItemId(itemIdCombo);
|
||||
Log.debug("combo:" + comboOp.getCurrentValue().toString());
|
||||
mapOperation
|
||||
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
|
||||
|
||||
protected Expression mapOperation(Operation op, firstArg, secondArg){
|
||||
Expression single_exp=null;
|
||||
if()op.getOperatorType().
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -53,19 +53,79 @@ public class OperationsStore {
|
|||
add(new Operation(15,"NOT_IN","The value is not in",OperatorType.NOT_IN));
|
||||
}};
|
||||
|
||||
static ArrayList<Operation> operationsBoolean = new ArrayList<Operation>() {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -1095217157799110522L;
|
||||
|
||||
{
|
||||
add(new Operation(1,"EQUALS","The value is equal to",OperatorType.EQUALS));
|
||||
add(new Operation(2,"NOT_EQUALS","The value is not equal to",OperatorType.NOT_EQUALS));
|
||||
add(new Operation(3,"IS_NULL","The value is null",OperatorType.IS_NULL));
|
||||
add(new Operation(4,"IS_NOT_NULL","The value is not null",OperatorType.IS_NOT_NULL));
|
||||
|
||||
}};
|
||||
|
||||
static ArrayList<Operation> operationsDate = new ArrayList<Operation>() {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -1095217157799110522L;
|
||||
|
||||
{
|
||||
add(new Operation(1,"EQUALS","The value is equal to",OperatorType.EQUALS));
|
||||
add(new Operation(2,"GREATER","The value is greater than",OperatorType.GREATER));
|
||||
add(new Operation(3,"GREATER_OR_EQUALS","The value is greater than or equal to",OperatorType.GREATER_OR_EQUALS));
|
||||
add(new Operation(4,"LESSER","The value is less than",OperatorType.LESSER));
|
||||
add(new Operation(5,"LESSER_OR_EQUALS","The value is less than or equal to",OperatorType.LESSER_OR_EQUALS));
|
||||
add(new Operation(6,"NOT_EQUALS","The value is not equal to",OperatorType.NOT_EQUALS));
|
||||
add(new Operation(7,"NOT_GREATER","The value is not greater than",OperatorType.NOT_GREATER));
|
||||
add(new Operation(8,"NOT_LESSER","The value is not less than",OperatorType.NOT_LESSER));
|
||||
add(new Operation(9,"IS_NULL","The value is null",OperatorType.IS_NULL));
|
||||
add(new Operation(10,"IS_NOT_NULL","The value is not null",OperatorType.IS_NOT_NULL));
|
||||
add(new Operation(11,"BETWEEN","The value is between",OperatorType.BETWEEN));
|
||||
add(new Operation(12,"NOT_BETWEEN","The value is not between",OperatorType.NOT_BETWEEN));
|
||||
add(new Operation(13,"IN","The value is in",OperatorType.IN));
|
||||
add(new Operation(14,"NOT_IN","The value is not in",OperatorType.NOT_IN));
|
||||
|
||||
}};
|
||||
|
||||
static ArrayList<Operation> operationsGeometry = new ArrayList<Operation>() {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -1095217157799110522L;
|
||||
|
||||
{
|
||||
add(new Operation(1,"EQUALS","The value is equal to",OperatorType.EQUALS));
|
||||
add(new Operation(2,"GREATER","The value is greater than",OperatorType.GREATER));
|
||||
add(new Operation(3,"GREATER_OR_EQUALS","The value is greater than or equal to",OperatorType.GREATER_OR_EQUALS));
|
||||
add(new Operation(4,"LESSER","The value is less than",OperatorType.LESSER));
|
||||
add(new Operation(5,"LESSER_OR_EQUALS","The value is less than or equal to",OperatorType.LESSER_OR_EQUALS));
|
||||
add(new Operation(6,"NOT_EQUALS","The value is not equal to",OperatorType.NOT_EQUALS));
|
||||
add(new Operation(7,"NOT_GREATER","The value is not greater than",OperatorType.NOT_GREATER));
|
||||
add(new Operation(8,"NOT_LESSER","The value is not less than",OperatorType.NOT_LESSER));
|
||||
add(new Operation(9,"IS_NULL","The value is null",OperatorType.IS_NULL));
|
||||
add(new Operation(10,"IS_NOT_NULL","The value is not null",OperatorType.IS_NOT_NULL));
|
||||
add(new Operation(11,"BETWEEN","The value is between",OperatorType.BETWEEN));
|
||||
add(new Operation(12,"NOT_BETWEEN","The value is not between",OperatorType.NOT_BETWEEN));
|
||||
add(new Operation(13,"IN","The value is in",OperatorType.IN));
|
||||
add(new Operation(14,"NOT_IN","The value is not in",OperatorType.NOT_IN));
|
||||
|
||||
}};
|
||||
|
||||
|
||||
|
||||
public static ArrayList<Operation> getAll(String dataTypeName){
|
||||
if(dataTypeName.compareTo("Boolean")==0){
|
||||
operations=operationsNumeric;
|
||||
operations=operationsBoolean;
|
||||
} else {
|
||||
if(dataTypeName.compareTo("Date")==0){
|
||||
operations=operationsNumeric;
|
||||
operations=operationsDate;
|
||||
} else {
|
||||
if(dataTypeName.compareTo("Integer")==0){
|
||||
operations=operationsNumeric;
|
||||
} else {
|
||||
if(dataTypeName.compareTo("Geometry")==0){
|
||||
operations=operationsNumeric;
|
||||
operations=operationsGeometry;
|
||||
} else {
|
||||
if(dataTypeName.compareTo("Numeric")==0){
|
||||
operations=operationsNumeric;
|
||||
|
@ -73,7 +133,7 @@ public class OperationsStore {
|
|||
if(dataTypeName.compareTo("Text")==0){
|
||||
operations=operationsText;
|
||||
} else {
|
||||
operations=operationsText;
|
||||
operations=new ArrayList<Operation>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,20 @@ public class Expression implements Serializable{
|
|||
|
||||
private static final long serialVersionUID = 7818512507606450235L;
|
||||
|
||||
protected String id="Expression";
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Expression [id=" + id + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.saxon.functions.Contains;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.TextBeginsWith;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.TextContains;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.Between;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorTypeMap {
|
||||
protected Expression exp=null;
|
||||
|
||||
OperatorTypeMap(OperatorType operatorType, String firstArg, String secondArg){
|
||||
switch (operatorType) {
|
||||
case ADDITION:
|
||||
break;
|
||||
case ALL:
|
||||
break;
|
||||
case AND:
|
||||
break;
|
||||
case ANY:
|
||||
break;
|
||||
case BEGINS_WITH:
|
||||
exp=new TextBeginsWith(firstArg,secondArg);
|
||||
break;
|
||||
case BETWEEN:
|
||||
exp=new Between(arguments.get(0),arguments.get(1));
|
||||
break;
|
||||
case CONTAINS:
|
||||
exp=new TextContains(arguments.get(0),arguments.get(1));
|
||||
break;
|
||||
case DIVISION:
|
||||
break;
|
||||
case ENDS_WITH:
|
||||
break;
|
||||
case EQUALS:
|
||||
break;
|
||||
case EXISTS:
|
||||
break;
|
||||
case GREATER:
|
||||
break;
|
||||
case GREATER_OR_EQUALS:
|
||||
break;
|
||||
case IN:
|
||||
break;
|
||||
case IS_NOT_NULL:
|
||||
break;
|
||||
case IS_NULL:
|
||||
break;
|
||||
case LESSER:
|
||||
break;
|
||||
case LESSER_OR_EQUALS:
|
||||
break;
|
||||
case LIKE:
|
||||
break;
|
||||
case MATCH_REGEX:
|
||||
break;
|
||||
case MODULUS:
|
||||
break;
|
||||
case MULTIPLICATION:
|
||||
break;
|
||||
case NOT:
|
||||
break;
|
||||
case NOT_BEGINS_WITH:
|
||||
break;
|
||||
case NOT_BETWEEN:
|
||||
break;
|
||||
case NOT_CONTAINS:
|
||||
break;
|
||||
case NOT_ENDS_WITH:
|
||||
break;
|
||||
case NOT_EQUALS:
|
||||
break;
|
||||
case NOT_GREATER:
|
||||
break;
|
||||
case NOT_IN:
|
||||
break;
|
||||
case NOT_LESSER:
|
||||
break;
|
||||
case NOT_LIKE:
|
||||
break;
|
||||
case NOT_MATCH_REGEX:
|
||||
break;
|
||||
case OR:
|
||||
break;
|
||||
case SELECT_IN:
|
||||
break;
|
||||
case SUBTRACTION:
|
||||
break;
|
||||
case UNIQUE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,8 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*
|
||||
*/
|
||||
public class Equals extends Expression {
|
||||
protected String id="Equals";
|
||||
|
||||
private static final long serialVersionUID = 3154667914317692836L;
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
@ -27,4 +29,12 @@ public class Equals extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Equals [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -11,6 +11,8 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class GreaterOrEquals extends Expression {
|
||||
private static final long serialVersionUID = -5441076239992740424L;
|
||||
|
||||
protected String id="GreaterOrEquals";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -27,4 +29,12 @@ public class GreaterOrEquals extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GreaterOrEquals [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class GreaterThan extends Expression {
|
||||
private static final long serialVersionUID = -8878360512708863164L;
|
||||
protected String id="GreaterThan";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -27,4 +28,12 @@ public class GreaterThan extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GreaterThan [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class LessOrEquals extends Expression {
|
||||
private static final long serialVersionUID = 7693397481316523615L;
|
||||
protected String id="LessOrEquals";
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
||||
|
@ -26,4 +27,13 @@ public class LessOrEquals extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LessOrEquals [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class LessThan extends Expression {
|
||||
private static final long serialVersionUID = 6420164520127827750L;
|
||||
protected String id="LessThan";
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
||||
|
@ -27,4 +28,13 @@ public class LessThan extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LessThan [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class NotEquals extends Expression {
|
||||
private static final long serialVersionUID = 7587723477959909679L;
|
||||
protected String id="NotEquals";
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
||||
|
@ -26,4 +27,12 @@ public class NotEquals extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NotEquals [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class NotGreater extends Expression {
|
||||
private static final long serialVersionUID = 6783019184437499833L;
|
||||
protected String id="NotGreater";
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
||||
|
@ -26,4 +27,13 @@ public class NotGreater extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NotGreater [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class NotLess extends Expression {
|
||||
private static final long serialVersionUID = 4497500830326659077L;
|
||||
protected String id="NotLess";
|
||||
Expression leftArgument;
|
||||
Expression rightArgument;
|
||||
|
||||
|
@ -26,4 +27,13 @@ public class NotLess extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NotLess [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class TextBeginsWith extends Expression {
|
||||
private static final long serialVersionUID = 222662008523199480L;
|
||||
protected String id="TextBeginsWith";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -27,4 +28,12 @@ public class TextBeginsWith extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextBeginsWith [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class TextContains extends Expression {
|
||||
private static final long serialVersionUID = 7951499429397693592L;
|
||||
protected String id="TextContains";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -26,4 +27,13 @@ public class TextContains extends Expression {
|
|||
public String getReturnedDataType() {
|
||||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextContains [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class TextEndsWith extends Expression {
|
||||
private static final long serialVersionUID = -5149428840566398839L;
|
||||
protected String id="TextEndsWith";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -27,4 +28,12 @@ public class TextEndsWith extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextEndsWith [id=" + id + ", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType;
|
|||
*/
|
||||
public class TextMatchSQLRegexp extends Expression {
|
||||
private static final long serialVersionUID = -4097780009381262681L;
|
||||
protected String id="TextMatchSQLRegexp";
|
||||
protected Expression leftArgument;
|
||||
protected Expression rightArgument;
|
||||
|
||||
|
@ -27,5 +28,13 @@ public class TextMatchSQLRegexp extends Expression {
|
|||
return "Boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextMatchSQLRegexp [id=" + id + ", leftArgument="
|
||||
+ leftArgument + ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
|
||||
public class ColumnReferencePlaceholder extends Leaf {
|
||||
|
||||
private static final long serialVersionUID = 275747262118236529L;
|
||||
protected String id = "ConstantList";
|
||||
protected String columnId;
|
||||
protected ColumnDataType dataType;
|
||||
|
||||
ColumnReferencePlaceholder(ColumnDataType dataType, String columnId){
|
||||
this.dataType=dataType;
|
||||
this.columnId=columnId;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,22 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
||||
|
||||
public class ConstantList {
|
||||
import java.util.List;
|
||||
|
||||
public class ConstantList extends Leaf {
|
||||
private static final long serialVersionUID = 222662008523199480L;
|
||||
|
||||
protected String id = "ConstantList";
|
||||
List<TD_Value> arguments;
|
||||
|
||||
public ConstantList(List<TD_Value> arguments) {
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ConstantList [id=" + id + ", arguments=" + arguments + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression;
|
||||
|
||||
public class Leaf extends Expression {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2354159908167637688L;
|
||||
|
||||
protected String id="Leaf";
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Leaf [id=" + id + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
|
||||
public class TD_Value implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2802022467528178596L;
|
||||
protected String id="TD_Value";
|
||||
protected String value;
|
||||
protected ColumnDataType valueType;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ColumnDataType getValueType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
public void setValueType(ColumnDataType valueType) {
|
||||
this.valueType = valueType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TD_Value [value=" + value + ", valueType=" + valueType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue