diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..3a5b2af --- /dev/null +++ b/.classpath @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..1908e4c --- /dev/null +++ b/.project @@ -0,0 +1,53 @@ + + + tabular-data-expression-widget + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + com.google.gwt.eclipse.core.gwtNature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..3b2886e --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/com.google.appengine.eclipse.core.prefs b/.settings/com.google.appengine.eclipse.core.prefs new file mode 100644 index 0000000..5260f5f --- /dev/null +++ b/.settings/com.google.appengine.eclipse.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +filesCopiedToWebInfLib= +googleCloudSqlEnabled=false +localDevMySqlEnabled=true diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 0000000..3e27203 --- /dev/null +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +lastWarOutDir=/home/giancarlo/workspace/tabular-data-expression-widget/target/tabular-data-expression-widget-1.0.0-SNAPSHOT +warSrcDir=src/main/webapp +warSrcDirIsOutput=false diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 0000000..fb32c70 --- /dev/null +++ b/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +entryPointModules= +filesCopiedToWebInfLib= diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8ad6fb0 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..fac2dd0 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,13 @@ + + + + + + + + uses + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d74c55e --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/ExpressionWidget.launch b/ExpressionWidget.launch new file mode 100644 index 0000000..0fa3c42 --- /dev/null +++ b/ExpressionWidget.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4a5a964 --- /dev/null +++ b/pom.xml @@ -0,0 +1,297 @@ + + + + + maven-parent + org.gcube.tools + 1.0.0 + + + + + 4.0.0 + org.gcube.portlets.user + tabular-data-expression-widget + 1.0.0-SNAPSHOT + + + tabular-data-expression-widget + tabular-data-expression-widget allows to create expression on column of table + + + https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget + + + + + Giancarlo Panichi + g.panichi@isti.cnr.it + CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + architect + developer + + + + + + ${project.basedir}/distro + ${project.build.directory}/${project.build.finalName} + 2013-10-18 + templates + distro + config + + + 2.5.1 + + ${env.GLOBUS_LOCATION} + + UTF-8 + UTF-8 + + + + + + + localRun + + + org.slf4j + slf4j-api + compile + + + ch.qos.logback + logback-classic + 1.0.1 + runtime + + + + + + + + + com.google.gwt + gwt-servlet + + + com.google.gwt + gwt-user + + + + + javax.validation + validation-api + 1.0.0.GA + test + + + javax.validation + validation-api + 1.0.0.GA + sources + test + + + + com.sencha.gxt + gxt + 3.0.1 + + + + + + + + org.gcube.portlets.user + tabular-data-gwt-service + [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT) + + + + + + com.allen-sauer.gwt.log + gwt-log + + + + org.slf4j + slf4j-api + + + + + + junit + junit + 4.8.1 + test + + + + + + + + + + ${webappDirectory}/WEB-INF/classes + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + true + + + + + org.apache.maven.surefire + surefire-junit47 + 2.16 + + + + + + + org.codehaus.mojo + gwt-maven-plugin + ${gwtVersion} + + + + resources + + + + + ExpressionWidget.html + ${webappDirectory} + org.gcube.portlets.user.td.expressionwidget.ExpressionWidget + + + + + + maven-resources-plugin + 2.6 + + + copy-profile + process-resources + + copy-resources + + + ${configDirectory} + + + ${templatesDirectory} + + profile.xml + + true + + + + + + copy-distro-resources + process-resources + + copy-resources + + + ${distroDirectory} + + + ${templatesDirectory} + + profile.xml + descriptor.xml + + true + + + + + + + + maven-clean-plugin + 2.5 + + + + ${distroDirectory} + + ** + + false + + + ${configDirectory} + + ** + + false + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${templatesDirectory}/descriptor.xml + + + + + servicearchive + package + + single + + + + + + + + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + + war + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml b/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml new file mode 100644 index 0000000..71ab088 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java new file mode 100644 index 0000000..fc2ec75 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionPanel.java @@ -0,0 +1,190 @@ +package org.gcube.portlets.user.td.expressionwidget.client; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; +import com.sencha.gxt.widget.core.client.FramedPanel; +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.form.FieldLabel; +import com.sencha.gxt.widget.core.client.form.TextArea; +import com.sencha.gxt.widget.core.client.form.TextField; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ColumnExpressionPanel extends FramedPanel { + protected TRId trId; + protected String columnName=null; + protected ColumnData column; + //protected ComboBox combo=null; + + /** + * + * @param columnTypeCode + * @param dataTypeName + */ + public ColumnExpressionPanel(String columnId, String columnTypeCode, String dataTypeName) { + column=new ColumnData(); + column.setColumnId(columnId); + column.setDataTypeName(dataTypeName); + column.setTypeCode(columnTypeCode); + create(); + } + + /** + * + * @param trId + * @param columnName + */ + public ColumnExpressionPanel(TRId trId, String columnName) { + this.trId=trId; + this.columnName=columnName; + load(trId, columnName); + } + + protected void create() { + setBodyBorder(false); + // getHeader().setIcon(Resources.IMAGES.side_list()); + setWidth(400); + setHeight(400); + setResize(true); + + VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); + basicLayout.setScrollMode(ScrollMode.AUTO); + basicLayout.setAdjustForScroll(true); + + + TextField nome= new TextField(); + basicLayout.add(new FieldLabel(nome, "Nome"), new VerticalLayoutData(1, -1)); + + TextArea descrizione= new TextArea(); + basicLayout.add(new FieldLabel(descrizione, "Descrizione"), new VerticalLayoutData(1, -1)); + + + ConditionWidget conditionWidget =new ConditionWidget(column.getColumnId(), column.getTypeCode(), column.getDataTypeName()); + basicLayout.add(conditionWidget); + + add(basicLayout); + show(); + + /* + ContentPanel panel = new ContentPanel(); + panel.setHeaderVisible(false); + + //panel.setBodyStyle("margin: 0px;"); + + ColumnDataProperties props = GWT.create(ColumnDataProperties.class); + ListStore store = new ListStore(props.id()); + + Log.trace("Store created"); + RpcProxy> proxy = new RpcProxy>() { + + public void load(ListLoadConfig loadConfig, final AsyncCallback> callback) { + loadData(loadConfig, callback); + } + }; + final ListLoader> loader = new ListLoader>(proxy); + loader.setRemoteSort(false); + loader.addLoadHandler(new LoadResultListStoreBinding>(store)); + Log.trace("Loader created"); + + + combo = new ComboBox(store, + props.label()){ + @Override + protected void onAfterFirstAttach() { + super.onAfterFirstAttach(); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + public void execute() { + loader.load(); + } + }); + } + }; + Log.trace("Combo created"); + + addHandlersForEventObservation(combo, props.label()); + + combo.setEmptyText("Select a column..."); + combo.setWidth(150); + combo.setTypeAhead(true); + combo.setTriggerAction(TriggerAction.ALL); + combo.setLoader(loader); + + FramedPanel form = new FramedPanel(); + form.setHeaderVisible(false); + //form.setWidth(350); + form.setBodyStyle("background: none;"); + + VerticalLayoutContainer v = new VerticalLayoutContainer(); + v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1)); + form.add(v); + form.addButton(new TextButton("Remove")); + + + panel.add(form); + + basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins())); + */ + + } + + /* + private void addHandlersForEventObservation(ComboBox combo, + final LabelProvider labelProvider) { + combo.addValueChangeHandler(new ValueChangeHandler() { + + public void onValueChange(ValueChangeEvent event) { + Info.display( + "Value Changed", + "New value: " + + (event.getValue() == null ? "nothing" + : labelProvider.getLabel(event + .getValue()) + "!")); + + } + }); + combo.addSelectionHandler(new SelectionHandler() { + public void onSelection(SelectionEvent event) { + Info.display( + "State Selected", + "You selected " + + (event.getSelectedItem() == null ? "nothing" + : labelProvider.getLabel(event + .getSelectedItem()) + "!")); + } + }); + } + + */ + + + + protected void load(TRId trId, String columnName) { + TDGWTServiceAsync.INSTANCE.getColumn(trId,columnName, new AsyncCallback(){ + + public void onFailure(Throwable caught) { + Log.error("Error retrieving column: "+caught.getMessage()); + + } + + public void onSuccess(ColumnData result) { + Log.debug("Retrived column: "+result); + column=result; + create(); + } + + }); + + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ConditionWidget.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ConditionWidget.java new file mode 100644 index 0000000..09dacbc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ConditionWidget.java @@ -0,0 +1,99 @@ +package org.gcube.portlets.user.td.expressionwidget.client; + +import org.gcube.data.analysis.tabulardata.expression.Operator; +import org.gcube.portlets.user.td.expressionwidget.client.operation.Operation; +import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationProperties; +import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationsStore; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.logical.shared.SelectionEvent; +import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.event.logical.shared.ValueChangeEvent; +import com.google.gwt.event.logical.shared.ValueChangeHandler; +import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; +import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.data.shared.LabelProvider; +import com.sencha.gxt.data.shared.ListStore; +import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer; +import com.sencha.gxt.widget.core.client.container.SimpleContainer; +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.container.HorizontalLayoutContainer.HorizontalLayoutData; + +import com.sencha.gxt.widget.core.client.form.ComboBox; +import com.sencha.gxt.widget.core.client.info.Info; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ConditionWidget extends SimpleContainer { + protected Operator op; + protected ComboBox comboOp=null; + + ConditionWidget(String columnPlaceHolderId,String columnTypeCode, String dataTypeName){ + VerticalLayoutContainer vert=new VerticalLayoutContainer(); + vert.setScrollMode(ScrollMode.AUTO); + vert.setAdjustForScroll(true); + + HorizontalLayoutContainer horiz=new HorizontalLayoutContainer(); + + OperationProperties props = GWT.create(OperationProperties.class); + ListStore storeOp = new ListStore(props.id()); + storeOp.addAll(OperationsStore.getAll(dataTypeName)); + + Log.trace("Store created"); + + + comboOp = new ComboBox(storeOp, + props.label()); + + Log.trace("ComboOperation created"); + + addHandlersForEventObservation(comboOp, props.label()); + + comboOp.setEmptyText("Select a operation..."); + comboOp.setWidth(150); + comboOp.setTypeAhead(true); + comboOp.setTriggerAction(TriggerAction.ALL); + + horiz.add(comboOp,new HorizontalLayoutData(-1, -1, new Margins(0))); + + vert.add(horiz,new VerticalLayoutData(-1, -1, new Margins(0))); + add(vert); + } + + private void addHandlersForEventObservation(ComboBox combo, + final LabelProvider labelProvider) { + combo.addValueChangeHandler(new ValueChangeHandler() { + + public void onValueChange(ValueChangeEvent event) { + Info.display( + "Value Changed", + "New value: " + + (event.getValue() == null ? "nothing" + : labelProvider.getLabel(event + .getValue()) + "!")); + + } + }); + combo.addSelectionHandler(new SelectionHandler() { + public void onSelection(SelectionEvent event) { + Info.display( + "State Selected", + "You selected " + + (event.getSelectedItem() == null ? "nothing" + : labelProvider.getLabel(event + .getSelectedItem()) + "!")); + } + }); + } + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ExpressionWidgetEntry.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ExpressionWidgetEntry.java new file mode 100644 index 0000000..f8e914f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ExpressionWidgetEntry.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.client; + + + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.user.client.ui.RootPanel; +import com.sencha.gxt.widget.core.client.Window; + +public class ExpressionWidgetEntry implements EntryPoint { + + + public void onModuleLoad() { + TRId trId=new TRId(); + //For example Tabular Resource 1 and table 1 + trId.setId("1"); + trId.setTableId("1"); + + ColumnExpressionPanel expressionPanel=new ColumnExpressionPanel("0", "Attribute", "Integer"); + RootPanel.get().add(expressionPanel); + + /*ChangeLabelColumnDialog changeLabel=new ChangeLabelColumnDialog(trId); + changeLabel.show(); + ChangeToAnnotationColumnDialog changeToAnnotation=new ChangeToAnnotationColumnDialog(trId); + changeToAnnotation.show();*/ + Log.info("Hello!"); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/Operation.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/Operation.java new file mode 100644 index 0000000..e94ec82 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/Operation.java @@ -0,0 +1,73 @@ +package org.gcube.portlets.user.td.expressionwidget.client.operation; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class Operation implements Serializable{ + + private static final long serialVersionUID = 3713817747863556150L; + + Integer id; + String name; + OperatorType operatorType; + String label; + + public Operation(Integer id,String name, String label, OperatorType operatorType){ + this.id=id; + this.name=name; + this.label=label; + this.operatorType=operatorType; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public OperatorType getOperatorType() { + return operatorType; + } + + public void setOperatorType(OperatorType operatorType) { + this.operatorType = operatorType; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + @Override + public String toString() { + return "Operation [id=" + id + ", name=" + name + ", operatorType=" + + operatorType + ", label=" + label + "]"; + } + + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationProperties.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationProperties.java new file mode 100644 index 0000000..76c377f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationProperties.java @@ -0,0 +1,21 @@ +package org.gcube.portlets.user.td.expressionwidget.client.operation; + +import com.google.gwt.editor.client.Editor.Path; +import com.sencha.gxt.data.shared.LabelProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface OperationProperties extends PropertyAccess { + + @Path("id") + ModelKeyProvider id(); + + LabelProvider label(); + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationsStore.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationsStore.java new file mode 100644 index 0000000..fd726ea --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/operation/OperationsStore.java @@ -0,0 +1,86 @@ +package org.gcube.portlets.user.td.expressionwidget.client.operation; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class OperationsStore { + static ArrayList operations; + + static ArrayList operationsNumeric = new ArrayList() { + private static final long serialVersionUID = -6559885743626876431L; + { + add(new Operation(1,"EQUALS","Equals",OperatorType.EQUALS)); + add(new Operation(2,"GREATER","Greater",OperatorType.GREATER)); + add(new Operation(3,"GREATER_OR_EQUALS","Greater or equals",OperatorType.GREATER_OR_EQUALS)); + add(new Operation(4,"LESSER","Lesser",OperatorType.LESSER)); + add(new Operation(5,"LESSER_OR_EQUALS","Lesser or equals",OperatorType.LESSER_OR_EQUALS)); + add(new Operation(6,"NOT_EQUALS","Not equals",OperatorType.NOT_EQUALS)); + add(new Operation(7,"NOT_GREATER","Not greater",OperatorType.NOT_GREATER)); + add(new Operation(8,"NOT_LESSER","Not lesser",OperatorType.NOT_LESSER)); + add(new Operation(9,"IS_NULL","Is null",OperatorType.IS_NULL)); + add(new Operation(10,"IS_NOT_NULL","Is not null",OperatorType.IS_NOT_NULL)); + add(new Operation(11,"BETWEEN","Between",OperatorType.BETWEEN)); + add(new Operation(12,"IN","In",OperatorType.IN)); + }}; + + static ArrayList operationsText = new ArrayList() { + private static final long serialVersionUID = -6559885743626876431L; + { + add(new Operation(1,"BEGIN_WITH","Begin with",OperatorType.BEGINS_WITH)); + add(new Operation(2,"CONTAINS","Contains",OperatorType.CONTAINS)); + add(new Operation(3,"ENDS_WITH","End with",OperatorType.ENDS_WITH)); + add(new Operation(4,"MATCH","Match",OperatorType.MATCH_REGEX)); + add(new Operation(5,"NOT_BEGIN_WITH","Not begin with",OperatorType.BEGINS_WITH)); + add(new Operation(6,"NOT_CONTAINS","Not contains",OperatorType.CONTAINS)); + add(new Operation(7,"NOT_ENDS_WITH","Not end with",OperatorType.ENDS_WITH)); + add(new Operation(8,"NOT_MATCH","Not match",OperatorType.MATCH_REGEX)); + add(new Operation(10,"IS_NULL","Is null",OperatorType.IS_NULL)); + add(new Operation(11,"IS_NOT_NULL","Is not null",OperatorType.IS_NOT_NULL)); + add(new Operation(12,"BETWEEN","Between",OperatorType.BETWEEN)); + add(new Operation(13,"IN","In",OperatorType.IN)); + + }}; + + + public static ArrayList getAll(String dataTypeName){ + if(dataTypeName.compareTo("Boolean")==0){ + operations=operationsNumeric; + } else { + if(dataTypeName.compareTo("Date")==0){ + operations=operationsNumeric; + } else { + if(dataTypeName.compareTo("Integer")==0){ + operations=operationsNumeric; + } else { + if(dataTypeName.compareTo("Geometry")==0){ + operations=operationsNumeric; + } else { + if(dataTypeName.compareTo("Numeric")==0){ + operations=operationsNumeric; + } else { + if(dataTypeName.compareTo("Text")==0){ + operations=operationsText; + } else { + operations=operationsText; + } + } + } + + } + } + } + return operations; + } + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/ExpressionResources.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/ExpressionResources.java new file mode 100644 index 0000000..8d8aaa2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/ExpressionResources.java @@ -0,0 +1,26 @@ +package org.gcube.portlets.user.td.expressionwidget.client.resource; + + + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.ImageResource; +//import com.google.gwt.resources.client.ClientBundle.Source; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface ExpressionResources extends ClientBundle { + + public static final ExpressionResources INSTANCE = GWT.create(ExpressionResources.class); + + @Source("add.png") + ImageResource add(); + + @Source("delete.png") + ImageResource delete(); + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add.png b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add.png new file mode 100644 index 0000000..6b1ab47 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add_32.png b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add_32.png new file mode 100644 index 0000000..6981821 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/add_32.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete.png b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete.png new file mode 100644 index 0000000..b639afd Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete_32.png b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete_32.png new file mode 100644 index 0000000..020b555 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/resource/delete_32.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java new file mode 100644 index 0000000..68433a1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionService.java @@ -0,0 +1,36 @@ +/** + * + */ +package org.gcube.portlets.user.td.expressionwidget.client.rpc; + + + +import org.gcube.portlets.user.td.expressionwidget.shared.expression.ExpressionServiceException; +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +/** + * + * Implements the basic interfaces generate and submit Expression on service. + * + *

+ * Allows:   + *

    + *
  • Generate Expression
  • + *
      + *

      + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +@RemoteServiceRelativePath("ExpressionService") +public interface ExpressionService extends RemoteService { + + public Void submitExpression(Expression expression) throws ExpressionServiceException; + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java new file mode 100644 index 0000000..dce2be2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/rpc/ExpressionServiceAsync.java @@ -0,0 +1,25 @@ +/** + * + */ +package org.gcube.portlets.user.td.expressionwidget.client.rpc; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ + +public interface ExpressionServiceAsync { + + public static ExpressionServiceAsync INSTANCE = (ExpressionServiceAsync) GWT + .create(ExpressionService.class); + + void submitExpression(Expression expression,AsyncCallback callback); + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/Constants.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/Constants.java new file mode 100644 index 0000000..22df2c4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/Constants.java @@ -0,0 +1,26 @@ +package org.gcube.portlets.user.td.expressionwidget.shared; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class Constants { + + public final static String VERSION = "1.0.0"; + public final static String DEFAULT_USER = "giancarlo.panichi"; + public final static String DEFAULT_SCOPE = "/gcube/devsec"; + + public static final String PARAMETER_ENCODING = "encoding"; + public static final String PARAMETER_HASHEADER = "hasHeader"; + public static final String PARAMETER_SEPARATOR = "separator"; + public static final String PARAMETER_COLUMNS = "columns"; + public static final String PARAMETER_URL = "url"; + + public static final String PARAMETER_REGISTRYBASEURL ="registryBaseUrl"; + public static final String PARAMETER_AGENCY ="agency"; + public static final String PARAMETER_ID ="id"; + public static final String PARAMETER_VERSION ="version"; + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/expression/ExpressionServiceException.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/expression/ExpressionServiceException.java new file mode 100644 index 0000000..776a2ae --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/expression/ExpressionServiceException.java @@ -0,0 +1,28 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.expression; + +public class ExpressionServiceException extends Exception { + + private static final long serialVersionUID = -9066034060104406559L; + + /** + * + */ + public ExpressionServiceException() { + super(); + } + + /** + * @param message + */ + public ExpressionServiceException(String message) { + super(message); + } + + + public ExpressionServiceException(String message,Throwable t) { + super(message,t); + } + + +} + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/Expression.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/Expression.java new file mode 100644 index 0000000..33bdca9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/Expression.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model; + +import java.io.Serializable; + +public class Expression implements Serializable{ + + + private static final long serialVersionUID = 7818512507606450235L; + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/OperatorType.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/OperatorType.java new file mode 100644 index 0000000..1547efa --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/OperatorType.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model; + +public enum OperatorType { + // Arithmetic + ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, MODULUS, + + // COMPARISON + + EQUALS, GREATER, LESSER, + + GREATER_OR_EQUALS, LESSER_OR_EQUALS, + + NOT_EQUALS, NOT_GREATER, NOT_LESSER, + + // LOGICAL + + ALL, AND, ANY, BETWEEN, EXISTS, IN, LIKE, NOT, OR, IS_NULL, UNIQUE, IS_NOT_NULL, + + // STRING + + BEGINS_WITH, ENDS_WITH, CONTAINS, MATCH_REGEX, + + NO_BEGINS_WITH, NO_ENDS_WITH, NO_CONTAINS, NO_MATCH_REGEX, + + + // COMPLEX + + SELECT_IN +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/Equals.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/Equals.java new file mode 100644 index 0000000..475178f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/Equals.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class Equals extends Expression { + private static final long serialVersionUID = 3154667914317692836L; + Expression leftArgument; + Expression rightArgument; + + public Equals(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.EQUALS; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterOrEquals.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterOrEquals.java new file mode 100644 index 0000000..b9425fe --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterOrEquals.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class GreaterOrEquals extends Expression { + private static final long serialVersionUID = -5441076239992740424L; + protected Expression leftArgument; + protected Expression rightArgument; + + public GreaterOrEquals(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.GREATER_OR_EQUALS; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterThan.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterThan.java new file mode 100644 index 0000000..3b049e4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/GreaterThan.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class GreaterThan extends Expression { + private static final long serialVersionUID = -8878360512708863164L; + protected Expression leftArgument; + protected Expression rightArgument; + + public GreaterThan(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.GREATER; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessOrEquals.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessOrEquals.java new file mode 100644 index 0000000..bc7da96 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessOrEquals.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class LessOrEquals extends Expression { + private static final long serialVersionUID = 7693397481316523615L; + Expression leftArgument; + Expression rightArgument; + + public LessOrEquals(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.LESSER_OR_EQUALS; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessThan.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessThan.java new file mode 100644 index 0000000..19754c7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/LessThan.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class LessThan extends Expression { + private static final long serialVersionUID = 6420164520127827750L; + Expression leftArgument; + Expression rightArgument; + + public LessThan(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.LESSER; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotEquals.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotEquals.java new file mode 100644 index 0000000..69884ea --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotEquals.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class NotEquals extends Expression { + private static final long serialVersionUID = 7587723477959909679L; + Expression leftArgument; + Expression rightArgument; + + public NotEquals(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.NOT_EQUALS; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotGreater.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotGreater.java new file mode 100644 index 0000000..6ea8fa4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotGreater.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class NotGreater extends Expression { + private static final long serialVersionUID = 6783019184437499833L; + Expression leftArgument; + Expression rightArgument; + + public NotGreater(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.NOT_GREATER; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotLess.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotLess.java new file mode 100644 index 0000000..d674088 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/comparable/NotLess.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class NotLess extends Expression { + private static final long serialVersionUID = 4497500830326659077L; + Expression leftArgument; + Expression rightArgument; + + public NotLess(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.NOT_LESSER; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextBeginsWith.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextBeginsWith.java new file mode 100644 index 0000000..a2acff3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextBeginsWith.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class TextBeginsWith extends Expression { + private static final long serialVersionUID = 222662008523199480L; + protected Expression leftArgument; + protected Expression rightArgument; + + public TextBeginsWith(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.BEGINS_WITH; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextContains.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextContains.java new file mode 100644 index 0000000..69f16e3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextContains.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class TextContains extends Expression { + private static final long serialVersionUID = 7951499429397693592L; + protected Expression leftArgument; + protected Expression rightArgument; + + public TextContains(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.CONTAINS; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextEndsWith.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextEndsWith.java new file mode 100644 index 0000000..2768c20 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextEndsWith.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class TextEndsWith extends Expression { + private static final long serialVersionUID = -5149428840566398839L; + protected Expression leftArgument; + protected Expression rightArgument; + + public TextEndsWith(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.ENDS_WITH; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextMatchSQLRegexp.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextMatchSQLRegexp.java new file mode 100644 index 0000000..0cc9f98 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/composite/text/TextMatchSQLRegexp.java @@ -0,0 +1,31 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class TextMatchSQLRegexp extends Expression { + private static final long serialVersionUID = -4097780009381262681L; + protected Expression leftArgument; + protected Expression rightArgument; + + public TextMatchSQLRegexp(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.MATCH_REGEX; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} + diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/And.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/And.java new file mode 100644 index 0000000..941c35f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/And.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import java.util.Arrays; +import java.util.List; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class And extends Expression { + private static final long serialVersionUID = -4462616033767138280L; + protected List arguments; + + public And(Expression... arguments) { + this.arguments = Arrays.asList(arguments); + } + + public And(List arguments) { + this.arguments = arguments; + } + + public OperatorType getOperator() { + return OperatorType.AND; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Between.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Between.java new file mode 100644 index 0000000..d6c42cc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Between.java @@ -0,0 +1,31 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class Between extends Expression { + + private static final long serialVersionUID = 5367101215792568854L; + + protected Expression leftArgument; + protected Expression rightArgument; + + public Between(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.BETWEEN; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNotNull.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNotNull.java new file mode 100644 index 0000000..1859304 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNotNull.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class IsNotNull extends Expression { + + private static final long serialVersionUID = 8930488371061116376L; + protected Expression argument; + + public IsNotNull(Expression argument) { + this.argument=argument; + } + + public OperatorType getOperator() { + return OperatorType.IS_NOT_NULL; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNull.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNull.java new file mode 100644 index 0000000..0cb3f90 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/IsNull.java @@ -0,0 +1,28 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class IsNull extends Expression { + private static final long serialVersionUID = -7845762664802353175L; + protected Expression argument; + + public IsNull(Expression argument) { + this.argument=argument; + } + + public OperatorType getOperator() { + return OperatorType.IS_NULL; + } + + public String getReturnedDataType() { + return "Boolean"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Not.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Not.java new file mode 100644 index 0000000..cd2ae73 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Not.java @@ -0,0 +1,27 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class Not extends Expression { + private static final long serialVersionUID = 9206533042761278382L; + protected Expression argument; + + public Not(Expression argument) { + this.argument = argument; + } + + public OperatorType getOperator() { + return OperatorType.NOT; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Or.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Or.java new file mode 100644 index 0000000..e860c31 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/Or.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import java.util.Arrays; +import java.util.List; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class Or extends Expression { + private static final long serialVersionUID = 1855717717443945397L; + + protected List arguments; + + public Or(Expression... arguments) { + this.arguments = Arrays.asList(arguments); + } + + public Or(List arguments) { + this.arguments = arguments; + } + + public OperatorType getOperator() { + return OperatorType.OR; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/ValueIsIn.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/ValueIsIn.java new file mode 100644 index 0000000..91677a5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/shared/model/logical/ValueIsIn.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.expressionwidget.shared.model.logical; + +import org.gcube.portlets.user.td.expressionwidget.shared.model.Expression; +import org.gcube.portlets.user.td.expressionwidget.shared.model.OperatorType; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class ValueIsIn extends Expression { + private static final long serialVersionUID = 739569588958197726L; + protected Expression leftArgument; + protected Expression rightArgument; + + public ValueIsIn(Expression leftArgument, Expression rightArgument) { + this.leftArgument = leftArgument; + this.rightArgument = rightArgument; + } + + public OperatorType getOperator() { + return OperatorType.IN; + } + + public String getReturnedDataType() { + return "Boolean"; + } +} diff --git a/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml new file mode 100644 index 0000000..8349886 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidget.gwt.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages.properties new file mode 100644 index 0000000..c222555 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages.properties @@ -0,0 +1,2 @@ +sendButton = Send +nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages_fr.properties new file mode 100644 index 0000000..b4a7627 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/expressionwidget/client/Messages_fr.properties @@ -0,0 +1,2 @@ +sendButton = Envoyer +nameField = Entrez votre nom \ No newline at end of file diff --git a/src/main/webapp/ExpressionWidget.css b/src/main/webapp/ExpressionWidget.css new file mode 100644 index 0000000..7aca7ac --- /dev/null +++ b/src/main/webapp/ExpressionWidget.css @@ -0,0 +1,34 @@ +/** Add css rules here for your application. */ + + +/** Example rules used by the template application (remove for your app) */ +h1 { + font-size: 2em; + font-weight: bold; + color: #777777; + margin: 40px 0px 70px; + text-align: center; +} + +.sendButton { + display: block; + font-size: 16pt; +} + +/** Most GWT widgets already have a style name defined */ +.gwt-DialogBox { + width: 400px; +} + +.dialogVPanel { + margin: 5px; +} + +.serverResponseLabelError { + color: red; +} + +/** Set ids using widget.getElement().setId("idOfElement") */ +#closeButton { + margin: 15px 6px 6px; +} diff --git a/src/main/webapp/ExpressionWidget.html b/src/main/webapp/ExpressionWidget.html new file mode 100644 index 0000000..095c8ae --- /dev/null +++ b/src/main/webapp/ExpressionWidget.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + Web Application Starter Project + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..ff96f4b --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + + + + TDGWTService + org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl + + + + jUnitHostImpl + com.google.gwt.junit.server.JUnitHostImpl + + + + + TDGWTService + ExpressionWidget/TDGWTService + + + jUnitHostImpl + ExpressionWidget/junithost/* + + + + + + ExpressionWidget.html + + + diff --git a/src/test/java/org/gcube/portlets/user/td/expressionwidget/client/GwtTestExpressionWidget.java b/src/test/java/org/gcube/portlets/user/td/expressionwidget/client/GwtTestExpressionWidget.java new file mode 100644 index 0000000..162b5a1 --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/td/expressionwidget/client/GwtTestExpressionWidget.java @@ -0,0 +1,64 @@ +package org.gcube.portlets.user.td.expressionwidget.client; + + + +import com.google.gwt.junit.client.GWTTestCase; + +/** + * GWT JUnit integration tests must extend GWTTestCase. + * Using "GwtTest*" naming pattern exclude them from running with + * surefire during the test phase. + * + * If you run the tests using the Maven command line, you will have to + * navigate with your browser to a specific url given by Maven. + * See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html + * for details. + */ +public class GwtTestExpressionWidget extends GWTTestCase { + + /** + * Must refer to a valid module that sources this class. + */ + public String getModuleName() { + return "org.gcube.portlets.user.td.expressionwidget.ExpressionWidgetJUnit"; + } + + + /** + * This test will send a request to the server using the greetServer method in + * GreetingService and verify the response. + */ + public void testGreetingService() { + // Create the service that we will test. + //GreetingServiceAsync greetingService = GWT.create(GreetingService.class); + //ServiceDefTarget target = (ServiceDefTarget) greetingService; + //target.setServiceEntryPoint(GWT.getModuleBaseURL() + "SDMXImportWizardTD/greet"); + + // Since RPC calls are asynchronous, we will need to wait for a response + // after this test method returns. This line tells the test runner to wait + // up to 10 seconds before timing out. + //delayTestFinish(10000); + + // Send a request to the server. + /* greetingService.greetServer("GWT User", new AsyncCallback() { + public void onFailure(Throwable caught) { + // The request resulted in an unexpected error. + fail("Request failure: " + caught.getMessage()); + } + + + public void onSuccess(String result) { + // Verify that the response is correct. + assertTrue(result.startsWith("Hello, GWT User!")); + + // Now that we have received a response, we need to tell the test runner + // that the test is complete. You must call finishTest() after an + // asynchronous test finishes successfully, or the test will time out. + finishTest(); + } + });*/ + + } + + +} diff --git a/src/test/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidgetJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidgetJUnit.gwt.xml new file mode 100644 index 0000000..0e67944 --- /dev/null +++ b/src/test/resources/org/gcube/portlets/user/td/expressionwidget/ExpressionWidgetJUnit.gwt.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/INSTALL b/templates/INSTALL new file mode 100644 index 0000000..e69de29 diff --git a/templates/LICENSE b/templates/LICENSE new file mode 100644 index 0000000..cc51139 --- /dev/null +++ b/templates/LICENSE @@ -0,0 +1,6 @@ +gCube System - License +------------------------------------------------------------ + +The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl). +The software and documentation is provided by its authors/distributors "as is" and no expressed or +implied warranty is given for its use, quality or fitness for a particular case. \ No newline at end of file diff --git a/templates/MAINTAINERS b/templates/MAINTAINERS new file mode 100644 index 0000000..0bc9be3 --- /dev/null +++ b/templates/MAINTAINERS @@ -0,0 +1 @@ +Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" diff --git a/templates/README b/templates/README new file mode 100644 index 0000000..e81341a --- /dev/null +++ b/templates/README @@ -0,0 +1,40 @@ +The gCube System - ${name} +------------------------------------------------------------ + +This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2) + +Authors +------- + +Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, +Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + +Version and Release Date +------------------------ + +v. ${version} (${release.date}) + +Description +----------- + +${project.description} + +Download information +-------------------- +Source code URL: ${scm.url} + + +Documentation +------------- + +${project.description} + + +Licensing +--------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. + + + diff --git a/templates/changelog.xml b/templates/changelog.xml new file mode 100644 index 0000000..3741410 --- /dev/null +++ b/templates/changelog.xml @@ -0,0 +1,6 @@ + + + First Release + + \ No newline at end of file diff --git a/templates/descriptor.xml b/templates/descriptor.xml new file mode 100644 index 0000000..b978636 --- /dev/null +++ b/templates/descriptor.xml @@ -0,0 +1,39 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + INSTALL + MAINTAINERS + changelog.xml + + 755 + + + + + ${distroDirectory}/svnpath.txt + /${artifactId} + + + ${configDirectory}/profile.xml + / + + + target/${build.finalName}.${packaging} + /${artifactId} + + + \ No newline at end of file diff --git a/templates/profile.xml b/templates/profile.xml new file mode 100644 index 0000000..ffa3274 --- /dev/null +++ b/templates/profile.xml @@ -0,0 +1,29 @@ + + + + Service + + ${project.description} + PortletsUser + ${project.name} + 1.0.0 + + + ${project.description} + ${project.name} + ${version} + + ${project.groupId} + ${project.artifactId} + ${project.version} + + library + + ${project.build.finalName}.${project.packaging} + + + + + + + diff --git a/templates/svnpath.txt b/templates/svnpath.txt new file mode 100644 index 0000000..dcd0d22 --- /dev/null +++ b/templates/svnpath.txt @@ -0,0 +1 @@ +${scm.url} \ No newline at end of file