81: Allow the creation and use of expressions on multi column in TDM portlet

Task-Url: https://support.d4science.org/issues/81

Update Rule on Table creation

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114807 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-05-19 16:53:48 +00:00
parent 413c7901ab
commit 1c18b4c38c
11 changed files with 189 additions and 40 deletions

View File

@ -197,7 +197,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCrea
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;

View File

@ -80,6 +80,7 @@ public class ColumnDataTypeMap {
public static Class<? extends DataType> mapToDataTypeClass(
ColumnDataType columnDataType) {
if (columnDataType == ColumnDataType.Integer) {
return IntegerType.class;
} else {
@ -106,5 +107,34 @@ public class ColumnDataTypeMap {
}
}
}
public static ColumnDataType mapFromDataTypeClass(
Class<? extends DataType> dataTypeClass) {
if (dataTypeClass == IntegerType.class) {
return ColumnDataType.Integer;
} else {
if (dataTypeClass == NumericType.class) {
return ColumnDataType.Numeric;
} else {
if (dataTypeClass == BooleanType.class) {
return ColumnDataType.Boolean;
} else {
if (dataTypeClass == GeometryType.class) {
return ColumnDataType.Geometry;
} else {
if (dataTypeClass == TextType.class) {
return ColumnDataType.Text;
} else {
if (dataTypeClass == DateType.class) {
return ColumnDataType.Date;
} else {
return null;
}
}
}
}
}
}
}
}

View File

@ -4,6 +4,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
/**
*
* @author "Giancarlo Panichi" <a

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.rule;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.rule;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;

View File

@ -0,0 +1,55 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule;
import java.io.Serializable;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class RuleColumnPlaceHolderDescriptor implements Serializable {
private static final long serialVersionUID = -7746819321348425711L;
private String id;
private ColumnDataType columnDataType;
public RuleColumnPlaceHolderDescriptor() {
super();
}
public RuleColumnPlaceHolderDescriptor(String id, ColumnDataType columnDataType) {
super();
this.id = id;
this.columnDataType = columnDataType;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel(){
return id;
}
public ColumnDataType getColumnDataType() {
return columnDataType;
}
public void setColumnDataType(ColumnDataType columnDataType) {
this.columnDataType = columnDataType;
}
@Override
public String toString() {
return "RuleColumnDescriptor [id=" + id + ", columnDataType="
+ columnDataType + "]";
}
}

View File

@ -1,9 +1,10 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule;
package org.gcube.portlets.user.td.gwtservice.shared.rule.description;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleType;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
@ -19,42 +20,30 @@ public class RuleDescriptionData implements Serializable {
private long id;
private String name;
private String description;
private String creationDate;
private Contacts owner;
private ArrayList<Contacts> contacts;
private RuleScopeType scope;
private TDRuleColumnType tdRuleColumnType;
private C_Expression expression;
private TDRuleType tdRuleType;
public RuleDescriptionData() {
super();
}
public RuleDescriptionData(long id, String name, String description,
Contacts owner, ArrayList<Contacts> contacts, RuleScopeType scope,
C_Expression expression) {
String creationDate, Contacts owner, ArrayList<Contacts> contacts,
RuleScopeType scope, C_Expression expression, TDRuleType tdRuleType) {
super();
this.id = id;
this.name = name;
this.description = description;
this.creationDate = creationDate;
this.owner = owner;
this.contacts = contacts;
this.scope = scope;
this.tdRuleColumnType = null;
this.expression = expression;
}
public RuleDescriptionData(long id, String name, String description,
Contacts owner, ArrayList<Contacts> contacts, RuleScopeType scope,
TDRuleColumnType tdRuleColumnType, C_Expression expression) {
super();
this.id = id;
this.name = name;
this.description = description;
this.owner = owner;
this.contacts = contacts;
this.scope = scope;
this.tdRuleColumnType = tdRuleColumnType;
this.expression = expression;
this.tdRuleType = tdRuleType;
}
public long getId() {
@ -81,6 +70,14 @@ public class RuleDescriptionData implements Serializable {
this.description = description;
}
public String getCreationDate() {
return creationDate;
}
public void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
public Contacts getOwner() {
return owner;
}
@ -104,15 +101,14 @@ public class RuleDescriptionData implements Serializable {
public void setContacts(ArrayList<Contacts> contacts) {
this.contacts = contacts;
}
public ArrayList<String> getContactsAsStringList(){
ArrayList<String> contactsList=new ArrayList<String>();
for(Contacts contact:contacts){
public ArrayList<String> getContactsAsStringList() {
ArrayList<String> contactsList = new ArrayList<String>();
for (Contacts contact : contacts) {
contactsList.add(contact.getLogin());
}
return contactsList;
}
public RuleScopeType getScope() {
return scope;
@ -130,14 +126,6 @@ public class RuleDescriptionData implements Serializable {
}
}
public TDRuleColumnType getTdRuleColumnType() {
return tdRuleColumnType;
}
public void setTdRuleColumnType(TDRuleColumnType tdRuleColumnType) {
this.tdRuleColumnType = tdRuleColumnType;
}
public C_Expression getExpression() {
return expression;
}
@ -154,6 +142,14 @@ public class RuleDescriptionData implements Serializable {
}
}
public TDRuleType getTdRuleType() {
return tdRuleType;
}
public void setTdRuleType(TDRuleType tdRuleType) {
this.tdRuleType = tdRuleType;
}
public boolean equals(RuleDescriptionData ruleDescriptionData) {
if (ruleDescriptionData == null) {
return false;
@ -170,9 +166,10 @@ public class RuleDescriptionData implements Serializable {
@Override
public String toString() {
return "RuleDescriptionData [id=" + id + ", name=" + name
+ ", description=" + description + ", owner=" + owner
+ ", scope=" + scope + ", tdRuleColumnType=" + tdRuleColumnType
+ ", expression=" + expression + "]";
+ ", description=" + description + ", creationDate="
+ creationDate + ", owner=" + owner + ", contacts=" + contacts
+ ", scope=" + scope + ", expression=" + expression
+ ", tdRuleType=" + tdRuleType + "]";
}
}

View File

@ -1,6 +1,5 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import java.io.Serializable;
/**
@ -9,7 +8,7 @@ import java.io.Serializable;
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TDRuleColumnType implements Serializable {
public class TDRuleColumnType extends TDRuleType {
/**
*

View File

@ -0,0 +1,43 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleColumnPlaceHolderDescriptor;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TDRuleTableType extends TDRuleType {
private static final long serialVersionUID = -5017575127171820493L;
private ArrayList<RuleColumnPlaceHolderDescriptor> ruleColumnPlaceHolderDescriptors;
public TDRuleTableType() {
super();
}
public TDRuleTableType(ArrayList<RuleColumnPlaceHolderDescriptor> ruleColumnPlaceHolderDescriptors) {
super();
this.ruleColumnPlaceHolderDescriptors = ruleColumnPlaceHolderDescriptors;
}
public ArrayList<RuleColumnPlaceHolderDescriptor> getRuleColumnPlaceHolderDescriptors() {
return ruleColumnPlaceHolderDescriptors;
}
public void setRuleColumnPlaceHolderDescriptors(
ArrayList<RuleColumnPlaceHolderDescriptor> ruleColumnPlaceHolderDescriptors) {
this.ruleColumnPlaceHolderDescriptors = ruleColumnPlaceHolderDescriptors;
}
@Override
public String toString() {
return "TDRuleTableType [ruleColumnPlaceHolderDescriptors="
+ ruleColumnPlaceHolderDescriptors + "]";
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import java.io.Serializable;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public abstract class TDRuleType implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8134785512446081458L;
}

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.share;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
/**
*