Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113526 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-09 15:49:00 +00:00
parent 1ac6b4a849
commit 1e189b251c
18 changed files with 556 additions and 94 deletions

View File

@ -328,6 +328,12 @@ public class ConditionTypeMap {
break;
case UNIQUE:
break;
case SOUNDEX:
/*checkTypeArgument(column, firstArg);
exp = new C_Soundex(placeHolder, new TD_Value(dataType, firstArg));
readableExpression = "Equals(" + readablePlaceHolder + ","
+ firstArg + ")";*/
break;
default:
break;
}

View File

@ -1,5 +1,11 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum C_OperatorType {
// Arithmetic
ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, MODULUS, EXPONENTIATION,
@ -27,10 +33,15 @@ public enum C_OperatorType {
CONCAT, SUBSTRING_BY_INDEX, SUBSTRING_BY_REGEX, SUBSTRING_POSITION, TEXT_REPLACE_MATCHING_REGEX,
TRIM, LENGTH, UPPER, LOWER,
MD5, SOUNDEX, SIMILARITY, LEVENSHTEIN,
// FUNCTIONS
CAST,
// COMPLEX
SELECT_IN
SELECT_IN;
}

View File

@ -0,0 +1,51 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_AggregationExpression extends C_Expression {
private static final long serialVersionUID = 119851273439171169L;
private String id = "AggregationExpression";
protected C_Expression argument;
public C_AggregationExpression() {
}
public C_AggregationExpression(C_Expression argument) {
this.argument = argument;
}
@Override
public String getId() {
return id;
}
public String getReturnedDataType() {
return "DataType";
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "C_AggregationExpression [id=" + id + ", argument=" + argument
+ "]";
}
}

View File

@ -9,11 +9,10 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Avg extends C_Expression {
public class C_Avg extends C_AggregationExpression {
private static final long serialVersionUID = 7728851019516221450L;
protected String id = "Avg";
protected C_Expression argument;
public C_Avg() {
@ -32,23 +31,11 @@ public class C_Avg extends C_Expression {
return C_OperatorType.AVG;
}
public String getReturnedDataType() {
return "DataType";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Avg [id=" + id + ", argument=" + argument + "]";

View File

@ -9,11 +9,10 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Count extends C_Expression {
public class C_Count extends C_AggregationExpression {
private static final long serialVersionUID = 7728851019516221450L;
protected String id = "Count";
protected C_Expression argument;
public C_Count() {
@ -32,6 +31,7 @@ public class C_Count extends C_Expression {
return C_OperatorType.COUNT;
}
@Override
public String getReturnedDataType() {
return "Integer";
}
@ -41,13 +41,6 @@ public class C_Count extends C_Expression {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {

View File

@ -5,15 +5,14 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Max extends C_Expression {
public class C_Max extends C_AggregationExpression {
private static final long serialVersionUID = 7765751618067012879L;
protected String id = "Max";
protected C_Expression argument;
public C_Max() {
@ -32,29 +31,14 @@ public class C_Max extends C_Expression {
return C_OperatorType.MAX;
}
public String getReturnedDataType() {
return "DataType";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Max [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -9,11 +9,10 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Min extends C_Expression {
public class C_Min extends C_AggregationExpression {
private static final long serialVersionUID = -7717661319471699474L;
protected String id = "Min";
protected C_Expression argument;
public C_Min() {
@ -32,22 +31,12 @@ public class C_Min extends C_Expression {
return C_OperatorType.MIN;
}
public String getReturnedDataType() {
return "DataType";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {

View File

@ -5,18 +5,16 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_ST_Extent extends C_Expression {
public class C_ST_Extent extends C_AggregationExpression {
private static final long serialVersionUID = -3889328695012258308L;
protected String id = "ST_Extent";
protected C_Expression argument;
public C_ST_Extent() {
}
/**
@ -25,30 +23,17 @@ public class C_ST_Extent extends C_Expression {
*/
public C_ST_Extent(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.ST_EXTENT;
}
public String getReturnedDataType() {
return "DataType";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "ST_Extent [id=" + id + ", argument=" + argument + "]";

View File

@ -9,11 +9,10 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expressi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Sum extends C_Expression {
public class C_Sum extends C_AggregationExpression {
private static final long serialVersionUID = 1365651146183648884L;
protected String id = "Sum";
protected C_Expression argument;
public C_Sum() {
@ -32,23 +31,11 @@ public class C_Sum extends C_Expression {
return C_OperatorType.SUM;
}
public String getReturnedDataType() {
return "DataType";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Sum [id=" + id + ", argument=" + argument + "]";

View File

@ -0,0 +1,52 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Lenght extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "Length";
protected C_Expression argument;
public C_Lenght(){
}
public C_Lenght(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.LENGTH;
}
public String getReturnedDataType() {
return "Integer";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Length [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Levenshtein extends C_Expression {
private static final long serialVersionUID = 5871179766613405166L;
protected String id = "Levenshtein";
protected C_Expression leftArgument;
protected C_Expression rightArgument;
public C_Levenshtein(){
}
public C_Levenshtein(C_Expression leftArgument,
C_Expression rightArgument) {
this.leftArgument = leftArgument;
this.rightArgument = rightArgument;
}
public C_OperatorType getOperator() {
return C_OperatorType.LEVENSHTEIN;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getLeftArgument() {
return leftArgument;
}
public void setLeftArgument(C_Expression leftArgument) {
this.leftArgument = leftArgument;
}
public C_Expression getRightArgument() {
return rightArgument;
}
public void setRightArgument(C_Expression rightArgument) {
this.rightArgument = rightArgument;
}
@Override
public String toString() {
return "Levenshtein [id=" + id + ", leftArgument=" + leftArgument
+ ", rightArgument=" + rightArgument + "]";
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Lower extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "Lower";
protected C_Expression argument;
public C_Lower(){
}
public C_Lower(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.LOWER;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Lower [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_MD5 extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "MD5";
protected C_Expression argument;
public C_MD5(){
}
public C_MD5(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.MD5;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "MD5 [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Similarity extends C_Expression {
private static final long serialVersionUID = 5871179766613405166L;
protected String id = "Similarity";
protected C_Expression leftArgument;
protected C_Expression rightArgument;
public C_Similarity(){
}
public C_Similarity(C_Expression leftArgument,
C_Expression rightArgument) {
this.leftArgument = leftArgument;
this.rightArgument = rightArgument;
}
public C_OperatorType getOperator() {
return C_OperatorType.SIMILARITY;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getLeftArgument() {
return leftArgument;
}
public void setLeftArgument(C_Expression leftArgument) {
this.leftArgument = leftArgument;
}
public C_Expression getRightArgument() {
return rightArgument;
}
public void setRightArgument(C_Expression rightArgument) {
this.rightArgument = rightArgument;
}
@Override
public String toString() {
return "Similarity [id=" + id + ", leftArgument=" + leftArgument
+ ", rightArgument=" + rightArgument + "]";
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Soundex extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "Soundex";
protected C_Expression argument;
public C_Soundex(){
}
public C_Soundex(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.SOUNDEX;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Soundex [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Trim extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "Trim";
protected C_Expression argument;
public C_Trim(){
}
public C_Trim(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.TRIM;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Trim [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class C_Upper extends C_Expression {
private static final long serialVersionUID = -5149428840566398839L;
protected String id = "Upper";
protected C_Expression argument;
public C_Upper(){
}
public C_Upper(C_Expression argument) {
this.argument=argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.UPPER;
}
public String getReturnedDataType() {
return "Text";
}
@Override
public String getId() {
return id;
}
public C_Expression getArgument() {
return argument;
}
public void setArgument(C_Expression argument) {
this.argument = argument;
}
@Override
public String toString() {
return "Upper [id=" + id + ", argument=" + argument + "]";
}
}