Updated Geometry Type Support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@100067 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-19 15:50:10 +00:00
parent 0d1d8c0e78
commit b73de5a16e
14 changed files with 714 additions and 92 deletions

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.user.td.expressionwidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.expressionwidget.client.help.HelpReplaceColumnByExpressionDialog;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
@ -21,8 +21,8 @@ public class ExpressionWidgetEntry implements EntryPoint {
public void onModuleLoad() {
EventBus eventBus= new SimpleEventBus();
TRId trId=new TRId("154","1610");
String columnName="zwqvvx";
//TRId trId=new TRId("154","1610");
//String columnName="zwqvvx";
//Column Expression Dialog
//ColumnExpressionDialog expressionDialog=new ColumnExpressionDialog("1", ColumnTypeCode.ATTRIBUTE, ColumnDataType.Integer, eventBus);
@ -39,8 +39,11 @@ public class ExpressionWidgetEntry implements EntryPoint {
//multiColumnFilterDialog.show();
//Replace Column By Expression Dialog
ReplaceColumnByExpressionDialog replaceColumnByExpression= new ReplaceColumnByExpressionDialog(trId, columnName, eventBus);
replaceColumnByExpression.show();
//ReplaceColumnByExpressionDialog replaceColumnByExpression= new ReplaceColumnByExpressionDialog(trId, columnName, eventBus);
//replaceColumnByExpression.show();
HelpReplaceColumnByExpressionDialog help= new HelpReplaceColumnByExpressionDialog(eventBus);
help.show();
Log.info("Hello!");
}

View File

@ -14,6 +14,8 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.regexp.shared.MatchResult;
import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HorizontalPanel;
@ -45,11 +47,13 @@ import com.sencha.gxt.widget.core.client.form.TextField;
*
*/
public class ReplaceColumnByExpressionPanel extends FramedPanel {
private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
+ "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
protected static final String WIDTH = "698px";
protected static final String HEIGHT = "454px";
protected static final String HEIGHT_REDUCE = "368px";
protected static final String CONDITIONWIDTH = "662px";
protected static final String CONDITIONHEIGHT = "120px";
protected static final String CONDITION_LAYOUT_WIDTH = "662px";
@ -57,6 +61,9 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
protected static final String REPLACEHEIGHT = "120px";
protected static final String ALL_ROWS_FIELD_WIDTH = "662px";
protected static final String RADIO_LABEL_BY_CONDITION = "By Condition";
protected static final String RADIO_LABEL_ALL_ROWS = "All Rows";
protected EventBus eventBus;
protected ReplaceColumnByExpressionDialog parent;
@ -95,7 +102,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
setWidth(WIDTH);
if (column != null
&& column.getDataTypeName().compareTo(
ColumnDataType.Text.toString())==0) {
ColumnDataType.Text.toString()) == 0) {
setHeight(HEIGHT);
} else {
setHeight(HEIGHT_REDUCE);
@ -140,10 +147,10 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
conditionsVerticalLayout.setWidth(CONDITION_LAYOUT_WIDTH);
Radio radioAllRowsTrue = new Radio();
radioAllRowsTrue.setBoxLabel("true");
radioAllRowsTrue.setBoxLabel(RADIO_LABEL_ALL_ROWS);
Radio radioAllRowsFalse = new Radio();
radioAllRowsFalse.setBoxLabel("false");
radioAllRowsFalse.setBoxLabel(RADIO_LABEL_BY_CONDITION);
radioAllRowsTrue.setValue(true);
allRows = true;
@ -167,9 +174,9 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
hp.add(radioAllRowsTrue);
hp.add(radioAllRowsFalse);
hp.setWidth("100px");
hp.setWidth("140px");
allRowsField = new FieldLabel(hp, "All rows");
allRowsField = new FieldLabel(hp, "Select");
allRowsField.setWidth(ALL_ROWS_FIELD_WIDTH);
conditionWidget = new ConditionWidget(column, CONDITIONWIDTH,
@ -259,7 +266,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
protected void callAllRowChange(ValueChangeEvent<HasValue<Boolean>> event) {
ToggleGroup group = (ToggleGroup) event.getSource();
Radio radio = (Radio) group.getValue();
if (radio.getBoxLabel().compareTo("true") == 0) {
if (radio.getBoxLabel().compareTo(RADIO_LABEL_ALL_ROWS) == 0) {
conditionWidget.setEnabled(false);
allRows = true;
} else {
@ -302,12 +309,14 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
C_Expression cReplaceExpression = null;
try {
cReplaceExpression = replaceWidget.getExpression();
if(cReplaceExpression==null){
UtilsGXT3.alert("Attention", "Replace expression is not valid!");
if (cReplaceExpression == null) {
UtilsGXT3.alert("Attention",
"Replace expression is not valid!");
return;
}
} catch (Throwable e) {
UtilsGXT3.alert("Attention", "Replace expression is not valid!");
UtilsGXT3.alert("Attention",
"Replace expression is not valid!");
return;
}
parent.applyReplaceColumnByExpression(cConditionExpression,
@ -319,7 +328,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
value);
} else {
UtilsGXT3.alert("Error replace value",
"Insert a valid value!");
"Insert a valid replace value!");
return;
}
}
@ -341,7 +350,14 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
ok = true;
break;
case Geometry:
ok = true;
RegExp regExp = RegExp.compile(GEOMETRY_REGEXPR);
MatchResult matcher = regExp.exec(value);
boolean matchFound = matcher != null;
if (matchFound) {
ok = true;
} else {
ok = false;
}
break;
case Integer:
Integer.parseInt(value);

View File

@ -0,0 +1,72 @@
package org.gcube.portlets.user.td.expressionwidget.client.help;
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class HelpReplaceColumnByExpressionDialog extends Window {
protected static final String WIDTH = "800px";
protected static final String HEIGHT = "600px";
protected EventBus eventBus;
protected HelpReplaceColumnByExpressionPanel helpReplaceColumnByExpressionPanel;
public HelpReplaceColumnByExpressionDialog(EventBus eventBus) {
this.eventBus = eventBus;
initWindow();
create();
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Help Replace Column By Expression");
setClosable(true);
getHeader().setIcon(
ExpressionResources.INSTANCE.columnReplaceByExpression());
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void create() {
helpReplaceColumnByExpressionPanel = new HelpReplaceColumnByExpressionPanel(
this, eventBus);
add(helpReplaceColumnByExpressionPanel);
}
protected void close() {
hide();
}
}

View File

@ -0,0 +1,97 @@
package org.gcube.portlets.user.td.expressionwidget.client.help;
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class HelpReplaceColumnByExpressionPanel extends FramedPanel {
protected static final String WIDTH = "698px";
protected static final String HEIGHT = "454px";
protected EventBus eventBus;
protected HelpReplaceColumnByExpressionDialog parent;
private TextButton btnClose;
public HelpReplaceColumnByExpressionPanel(
HelpReplaceColumnByExpressionDialog parent, EventBus eventBus) {
super();
this.parent = parent;
this.eventBus = eventBus;
init();
create();
}
protected void init() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setHeaderVisible(false);
// Important: fixed rendering of widgets
forceLayoutOnResize = true;
}
protected void create() {
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
basicLayout.setAdjustForScroll(true);
basicLayout.setScrollMode(ScrollMode.AUTO);
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
//
btnClose = new TextButton("Close");
btnClose.setIcon(ExpressionResources.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Close");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
// Add to basic layout
//basicLayout.add(properties, new VerticalLayoutData(-1, -1, new Margins(
// 1)));
basicLayout.add(flowButton, new VerticalLayoutData(-1, 36, new Margins(
5, 2, 5, 2)));
add(basicLayout);
}
protected void close() {
parent.close();
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.td.expressionwidget.client.help;
public class HelpTemplate {
}

View File

@ -92,21 +92,10 @@ public class OperationsStore {
private static final long serialVersionUID = -1095217157799110522L;
{
add(new Operation(1,"EQUALS","The value is equal to",C_OperatorType.EQUALS));
add(new Operation(2,"GREATER","The value is greater than",C_OperatorType.GREATER));
add(new Operation(3,"GREATER_OR_EQUALS","The value is greater than or equal to",C_OperatorType.GREATER_OR_EQUALS));
add(new Operation(4,"LESSER","The value is less than",C_OperatorType.LESSER));
add(new Operation(5,"LESSER_OR_EQUALS","The value is less than or equal to",C_OperatorType.LESSER_OR_EQUALS));
add(new Operation(6,"NOT_EQUALS","The value is not equal to",C_OperatorType.NOT_EQUALS));
add(new Operation(7,"NOT_GREATER","The value is not greater than",C_OperatorType.NOT_GREATER));
add(new Operation(8,"NOT_LESSER","The value is not less than",C_OperatorType.NOT_LESSER));
add(new Operation(9,"IS_NULL","The value is null",C_OperatorType.IS_NULL));
add(new Operation(10,"IS_NOT_NULL","The value is not null",C_OperatorType.IS_NOT_NULL));
add(new Operation(11,"BETWEEN","The value is between",C_OperatorType.BETWEEN));
add(new Operation(12,"NOT_BETWEEN","The value is not between",C_OperatorType.NOT_BETWEEN));
add(new Operation(13,"IN","The value is in",C_OperatorType.IN));
add(new Operation(14,"NOT_IN","The value is not in",C_OperatorType.NOT_IN));
{
//[ADDITION, DIVISION, MODULUS, MULTIPLICATION, SUBTRACTION, IS_NOT_NULL, IS_NULL, NOT, COUNT, MAX, MIN, ST_EXTENT]
add(new Operation(1,"IS_NULL","The value is null",C_OperatorType.IS_NULL));
add(new Operation(2,"IS_NOT_NULL","The value is not null",C_OperatorType.IS_NOT_NULL));
}};

View File

@ -8,6 +8,12 @@ import java.util.List;
import org.gcube.data.analysis.tabulardata.expression.Expression;
import org.gcube.data.analysis.tabulardata.expression.MultivaluedExpression;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.Avg;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.Count;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.Max;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.Min;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.ST_Extent;
import org.gcube.data.analysis.tabulardata.expression.composite.aggregation.Sum;
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.Equals;
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.GreaterOrEquals;
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.GreaterThan;
@ -46,12 +52,19 @@ import org.gcube.data.analysis.tabulardata.model.datatype.NumericType;
import org.gcube.data.analysis.tabulardata.model.datatype.TextType;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDBoolean;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDDate;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDGeometry;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDInteger;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDNumeric;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDText;
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDTypeValue;
import org.gcube.data.analysis.tabulardata.model.table.TableId;
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_Avg;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_Count;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_Max;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_Min;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_ST_Extent;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation.C_Sum;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_GreaterOrEquals;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_GreaterThan;
@ -93,9 +106,9 @@ public class C_ExpressionParser {
protected SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public Expression parse(C_Expression exp) {
logger.debug("Parse: "+exp);
logger.debug("Parse: " + exp);
Expression ex = null;
switch (exp.getId()) {
case "ColumnReferencePlaceholder":
ex = getColumnReferencePlaceholder(exp);
@ -174,16 +187,35 @@ public class C_ExpressionParser {
ex = getConcat(exp);
break;
case "SubstringByIndex":
ex =getSubstringByIndex(exp);
ex = getSubstringByIndex(exp);
break;
case "SubstringByRegex":
ex =getSubstringByRegex(exp);
break;
ex = getSubstringByRegex(exp);
break;
case "SubstringPosition":
ex =getSubstringPosition(exp);
break;
ex = getSubstringPosition(exp);
break;
case "TextReplaceMatchingRegex":
ex =getTextReplaceMatchingRegex(exp);
ex = getTextReplaceMatchingRegex(exp);
break;
case "Avg":
ex = getAvg(exp);
break;
case "Count":
ex = getCount(exp);
break;
case "Max":
ex = getMax(exp);
break;
case "Min":
ex = getMin(exp);
break;
case "Sum":
ex = getSum(exp);
break;
case "ST_Extent":
ex = getSTExtent(exp);
break;
default:
break;
}
@ -210,9 +242,10 @@ public class C_ExpressionParser {
private Expression getValueIsIn(C_Expression exp) {
C_ValueIsIn v = (C_ValueIsIn) exp;
MultivaluedExpression multivalued=parseMultivalued(v.getRightArgument());
ValueIsIn valueIsIn = new ValueIsIn(parse(v.getLeftArgument()),multivalued
);
MultivaluedExpression multivalued = parseMultivalued(v
.getRightArgument());
ValueIsIn valueIsIn = new ValueIsIn(parse(v.getLeftArgument()),
multivalued);
return valueIsIn;
}
@ -356,37 +389,45 @@ public class C_ExpressionParser {
}
protected TDTypeValue getExpressionValue(TD_Value value) {
TDTypeValue ex = null;
switch (value.getValueType()) {
case Boolean:
ex = new TDBoolean(Boolean.valueOf(value.getValue()));
break;
case Date:
Date d = null;
try {
d = sdf.parse(value.getValue());
} catch (ParseException e) {
logger.error("Unparseable using " + sdf);
return null;
}
ex = new TDDate(d);
break;
case Geometry:
// ex = new TDGeometry(value.getValue());
break;
case Integer:
ex = new TDInteger(Integer.valueOf(value.getValue()));
break;
case Numeric:
ex = new TDNumeric(Float.valueOf(value.getValue()));
break;
case Text:
ex = new TDText(value.getValue());
break;
default:
break;
}
TDTypeValue ex = null;
try {
switch (value.getValueType()) {
case Boolean:
ex = new TDBoolean(Boolean.valueOf(value.getValue()));
break;
case Date:
Date d = null;
try {
d = sdf.parse(value.getValue());
} catch (ParseException e) {
logger.error("Unparseable using " + sdf);
return null;
}
ex = new TDDate(d);
break;
case Geometry:
if (TDGeometry.validateGeometry(value.getValue())) {
ex = new TDGeometry(value.getValue());
} else {
ex = null;
}
break;
case Integer:
ex = new TDInteger(Integer.valueOf(value.getValue()));
break;
case Numeric:
ex = new TDNumeric(Float.valueOf(value.getValue()));
break;
case Text:
ex = new TDText(value.getValue());
break;
default:
break;
}
} catch (Throwable e) {
logger.error("type error parsing value " + value+" "+ e.getLocalizedMessage());
}
return ex;
}
@ -457,7 +498,7 @@ public class C_ExpressionParser {
getExpressionValue(c.getMaximum()));
return range;
}
protected MultivaluedExpression getRange(C_MultivaluedExpression exp) {
C_Range c = (C_Range) exp;
Range range = new Range(getExpressionValue(c.getMinimum()),
@ -467,11 +508,11 @@ public class C_ExpressionParser {
protected Expression getTypedColumnReference(C_Expression exp) {
C_TypedColumnReference c = (C_TypedColumnReference) exp;
String tableIdS=null;
if(c.getTrId().isViewTable()){
tableIdS=c.getTrId().getReferenceTargetTableId();
String tableIdS = null;
if (c.getTrId().isViewTable()) {
tableIdS = c.getTrId().getReferenceTargetTableId();
} else {
tableIdS=c.getTrId().getTableId();
tableIdS = c.getTrId().getTableId();
}
TableId tableId = new TableId(Long.valueOf(tableIdS));
ColumnLocalId columnId = new ColumnLocalId(c.getColumnId());
@ -488,23 +529,23 @@ public class C_ExpressionParser {
Equals eq = new Equals(left, right);
return eq;
}
private Expression getConcat(C_Expression exp) {
C_Concat concat = (C_Concat) exp;
Concat conc = new Concat(
parse(concat.getLeftArgument()),
Concat conc = new Concat(parse(concat.getLeftArgument()),
parse(concat.getRightArgument()));
return conc;
}
private Expression getSubstringByIndex(C_Expression exp) {
C_SubstringByIndex subByIndex = (C_SubstringByIndex) exp;
SubstringByIndex sByIndex = new SubstringByIndex(
parse(subByIndex.getSourceString()),
parse(subByIndex.getFromIndex()), parse(subByIndex.getToIndex()));
parse(subByIndex.getFromIndex()),
parse(subByIndex.getToIndex()));
return sByIndex;
}
private Expression getSubstringByRegex(C_Expression exp) {
C_SubstringByRegex subByRegex = (C_SubstringByRegex) exp;
SubstringByRegex sByRegex = new SubstringByRegex(
@ -512,7 +553,7 @@ public class C_ExpressionParser {
parse(subByRegex.getRegex()));
return sByRegex;
}
private Expression getSubstringPosition(C_Expression exp) {
C_SubstringPosition subPosition = (C_SubstringPosition) exp;
SubstringPosition sPosition = new SubstringPosition(
@ -520,19 +561,65 @@ public class C_ExpressionParser {
parse(subPosition.getRightArgument()));
return sPosition;
}
private Expression getTextReplaceMatchingRegex(C_Expression exp) {
C_TextReplaceMatchingRegex textReplaceMatchingRegex = (C_TextReplaceMatchingRegex) exp;
TDText tdRegexp=new TDText(textReplaceMatchingRegex.getRegexp().getValue());
TDText tdReplacing=new TDText(textReplaceMatchingRegex.getReplacing().getValue());
TDText tdRegexp = new TDText(textReplaceMatchingRegex.getRegexp()
.getValue());
TDText tdReplacing = new TDText(textReplaceMatchingRegex.getReplacing()
.getValue());
TextReplaceMatchingRegex textRepRegex = new TextReplaceMatchingRegex(
parse(textReplaceMatchingRegex.getToCheckText()),
tdRegexp,
parse(textReplaceMatchingRegex.getToCheckText()), tdRegexp,
tdReplacing);
return textRepRegex;
}
private Expression getAvg(C_Expression exp) {
C_Avg avg = (C_Avg) exp;
Avg av = new Avg(
parse(avg.getArgument()));
return av;
}
private Expression getCount(C_Expression exp) {
C_Count count = (C_Count) exp;
Count cnt = new Count(
parse(count.getArgument()));
return cnt;
}
private Expression getMax(C_Expression exp) {
C_Max max = (C_Max) exp;
Max ma = new Max(
parse(max.getArgument()));
return ma;
}
private Expression getMin(C_Expression exp) {
C_Min min = (C_Min) exp;
Min mi = new Min(
parse(min.getArgument()));
return mi;
}
private Expression getSTExtent(C_Expression exp) {
C_ST_Extent stExtent = (C_ST_Extent) exp;
ST_Extent stEx = new ST_Extent(
parse(stExtent.getArgument()));
return stEx;
}
private Expression getSum(C_Expression exp) {
C_Sum sum = (C_Sum) exp;
Sum sm = new Sum(
parse(sum.getArgument()));
return sm;
}
}

View File

@ -17,6 +17,9 @@ public enum C_OperatorType {
ALL, AND, ANY, BETWEEN, NOT_BETWEEN, EXISTS, IN, NOT_IN,
LIKE, NOT_LIKE, NOT, OR, IS_NULL, UNIQUE, IS_NOT_NULL,
// AGGREGATION
AVG, COUNT, MAX, MIN, SUM, ST_EXTENT,
// STRING
BEGINS_WITH, ENDS_WITH, CONTAINS, MATCH_REGEX,

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_Avg extends C_Expression {
private static final long serialVersionUID = 7728851019516221450L;
protected String id = "Avg";
protected C_Expression argument;
public C_Avg() {
}
/**
*
* @param argument
*/
public C_Avg(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
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 "C_Avg [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,60 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_Count extends C_Expression {
private static final long serialVersionUID = 7728851019516221450L;
protected String id = "Count";
protected C_Expression argument;
public C_Count() {
}
/**
*
* @param argument
*/
public C_Count(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
return C_OperatorType.COUNT;
}
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 "C_Count [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,60 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_Max extends C_Expression {
private static final long serialVersionUID = 7765751618067012879L;
protected String id = "Max";
protected C_Expression argument;
public C_Max() {
}
/**
*
* @param argument
*/
public C_Max(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
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 "C_Max [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_Min extends C_Expression {
private static final long serialVersionUID = -7717661319471699474L;
protected String id = "Min";
protected C_Expression argument;
public C_Min() {
}
/**
*
* @param argument
*/
public C_Min(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
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() {
return "C_Min [id=" + id + ", argument=" + argument + "]";
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_ST_Extent extends C_Expression {
private static final long serialVersionUID = -3889328695012258308L;
protected String id = "ST_Extent";
protected C_Expression argument;
public C_ST_Extent() {
}
/**
*
* @param argument
*/
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

@ -0,0 +1,57 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.aggregation;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
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_Sum extends C_Expression {
private static final long serialVersionUID = 1365651146183648884L;
protected String id = "Sum";
protected C_Expression argument;
public C_Sum() {
}
/**
*
* @param argument
*/
public C_Sum(C_Expression argument) {
this.argument = argument;
}
public C_OperatorType getOperator() {
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 "C_Sum [id=" + id + ", argument=" + argument + "]";
}
}