Fixed Split and Merge ColumnType

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@97224 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-10 14:26:48 +00:00
parent 43ce585753
commit f990c83706
3 changed files with 145 additions and 18 deletions

View File

@ -215,7 +215,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeMap;
import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery; import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -4434,9 +4433,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Map<String, Object> map1 = new HashMap<String, Object>(); Map<String, Object> map1 = new HashMap<String, Object>();
Map<String, Object> map2 = new HashMap<String, Object>(); Map<String, Object> map2 = new HashMap<String, Object>();
ColumnData columnData=splitColumnSession.getColumnData(); //ColumnData columnData=splitColumnSession.getColumnData();
ColumnTypeCode type = ColumnTypeMap.getColumnTypeCode(columnData.getTypeCode()); //ColumnTypeCode type = ColumnTypeMap.getColumnTypeCode(columnData.getTypeCode());
//ColumnDataType dataType =ColumnTypeMap.getColumnDataType(columnData.getDataTypeName()); //ColumnDataType dataType =ColumnTypeMap.getColumnDataType(columnData.getDataTypeName());
ArrayList<Expression> expressions=splitColumnSession.getExpressions(); ArrayList<Expression> expressions=splitColumnSession.getExpressions();
@ -4444,6 +4443,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
throw new TDGWTServiceException("No valid expressions in splitColumnSession"); throw new TDGWTServiceException("No valid expressions in splitColumnSession");
} }
map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
ColumnTypeCodeMap.getColumnType(splitColumnSession.getFirstSplitColumnType()));
map1.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
ColumnDataTypeMap.map(splitColumnSession.getFirstSplitColumnDataType()));
map1.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
new ImmutableLocalizedText(splitColumnSession.getLabel1()));
map1.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
expressions.get(0));
invocations.add(new OperationExecution(
operationDefinition.getOperationId(), map1));
map2.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
ColumnTypeCodeMap.getColumnType(splitColumnSession.getSecondSplitColumnType()));
map2.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
ColumnDataTypeMap.map(splitColumnSession.getSecondSplitColumnDataType()));
map2.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
new ImmutableLocalizedText(splitColumnSession.getLabel2()));
map2.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
expressions.get(1));
invocations.add(new OperationExecution(
operationDefinition.getOperationId(), map2));
/*
switch (type) { switch (type) {
case ANNOTATION: case ANNOTATION:
map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
@ -4586,6 +4607,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
break; break;
} }
*/
return invocations; return invocations;
} }
@ -4610,9 +4633,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
ColumnData columnData=mergeColumnSession.getColumnData(); //ColumnData columnData=mergeColumnSession.getColumnData();
ColumnTypeCode type = ColumnTypeMap.getColumnTypeCode(columnData.getTypeCode()); //ColumnTypeCode type = ColumnTypeMap.getColumnTypeCode(columnData.getTypeCode());
//ColumnDataType dataType =ColumnTypeMap.getColumnDataType(columnData.getDataTypeName()); //ColumnDataType dataType =ColumnTypeMap.getColumnDataType(columnData.getDataTypeName());
Expression expression =mergeColumnSession.getExpression(); Expression expression =mergeColumnSession.getExpression();
@ -4620,6 +4643,18 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
throw new TDGWTServiceException("No valid expression in splitColumnSession"); throw new TDGWTServiceException("No valid expression in splitColumnSession");
} }
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
ColumnTypeCodeMap.getColumnType(mergeColumnSession.getMergeColumnType()));
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
ColumnDataTypeMap.map(mergeColumnSession.getMergeColumnDataType()));
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
new ImmutableLocalizedText(mergeColumnSession.getLabel()));
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
expression);
invocation = new OperationExecution(
operationDefinition.getOperationId(), map);
/*
switch (type) { switch (type) {
case ANNOTATION: case ANNOTATION:
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
@ -4701,7 +4736,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
break; break;
} }
*/
return invocation; return invocation;
} }

View File

@ -4,6 +4,8 @@ import java.io.Serializable;
import org.gcube.data.analysis.tabulardata.expression.Expression; import org.gcube.data.analysis.tabulardata.expression.Expression;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
/** /**
* *
@ -18,6 +20,8 @@ public class MergeColumnSession implements Serializable {
protected ColumnData columnData; protected ColumnData columnData;
protected String label; protected String label;
protected Expression expression; protected Expression expression;
protected ColumnTypeCode mergeColumnType;
protected ColumnDataType mergeColumnDataType;
public MergeColumnSession() { public MergeColumnSession() {
@ -27,13 +31,20 @@ public class MergeColumnSession implements Serializable {
* *
* @param columnData * @param columnData
* @param label * @param label
* @param mergeColumnType
* @param mergeColumnDataType
* @param expression * @param expression
*/ */
public MergeColumnSession(ColumnData columnData, String label, public MergeColumnSession(ColumnData columnData,
String label,
ColumnTypeCode mergeColumnType,
ColumnDataType mergeColumnDataType,
Expression expression) { Expression expression) {
this.columnData = columnData; this.columnData = columnData;
this.label = label; this.label = label;
this.expression = expression; this.expression = expression;
this.mergeColumnType=mergeColumnType;
this.mergeColumnDataType=mergeColumnDataType;
} }
@ -61,10 +72,32 @@ public class MergeColumnSession implements Serializable {
this.label = label; this.label = label;
} }
public ColumnTypeCode getMergeColumnType() {
return mergeColumnType;
}
public void setMergeColumnType(ColumnTypeCode mergeColumnType) {
this.mergeColumnType = mergeColumnType;
}
public ColumnDataType getMergeColumnDataType() {
return mergeColumnDataType;
}
public void setMergeColumnDataType(ColumnDataType mergeColumnDataType) {
this.mergeColumnDataType = mergeColumnDataType;
}
@Override @Override
public String toString() { public String toString() {
return "MergeColumnSession [columnData=" + columnData + ", label=" return "MergeColumnSession [columnData=" + columnData + ", label="
+ label + ", expression=" + expression + "]"; + label + ", expression=" + expression + ", mergeColumnType="
+ mergeColumnType + ", mergeColumnDataType="
+ mergeColumnDataType + "]";
} }
} }

View File

@ -5,6 +5,8 @@ import java.util.ArrayList;
import org.gcube.data.analysis.tabulardata.expression.Expression; import org.gcube.data.analysis.tabulardata.expression.Expression;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
/** /**
* *
@ -17,9 +19,13 @@ public class SplitColumnSession implements Serializable {
private static final long serialVersionUID = -1896235499708614266L; private static final long serialVersionUID = -1896235499708614266L;
protected ColumnData columnData; protected ColumnData columnData;
protected String label1;
protected String label2;
protected ArrayList<Expression> expressions; protected ArrayList<Expression> expressions;
protected String label1;
protected ColumnTypeCode firstSplitColumnType;
protected ColumnDataType firstSplitColumnDataType;
protected String label2;
protected ColumnTypeCode secondSplitColumnType;
protected ColumnDataType secondSplitColumnDataType;
public SplitColumnSession() { public SplitColumnSession() {
@ -28,16 +34,30 @@ public class SplitColumnSession implements Serializable {
/** /**
* *
* @param columnData * @param columnData
* @param label1
* @param label2
* @param expressions * @param expressions
* @param label1
* @param firstSplitColumnType
* @param firstSplitColumnDataType
* @param label2
* @param secondSplitColumnType
* @param secondSplitColumnDataType
*/ */
public SplitColumnSession(ColumnData columnData, String label1, public SplitColumnSession(ColumnData columnData,
String label2, ArrayList<Expression> expressions) { ArrayList<Expression> expressions,
String label1,
ColumnTypeCode firstSplitColumnType,
ColumnDataType firstSplitColumnDataType,
String label2,
ColumnTypeCode secondSplitColumnType,
ColumnDataType secondSplitColumnDataType) {
this.columnData = columnData; this.columnData = columnData;
this.label1 = label1;
this.label2 = label2;
this.expressions = expressions; this.expressions = expressions;
this.label1 = label1;
this.firstSplitColumnType = firstSplitColumnType;
this.firstSplitColumnDataType = firstSplitColumnDataType;
this.label2 = label2;
this.secondSplitColumnType = secondSplitColumnType;
this.secondSplitColumnDataType = secondSplitColumnDataType;
} }
@ -73,11 +93,50 @@ public class SplitColumnSession implements Serializable {
this.expressions = expressions; this.expressions = expressions;
} }
public ColumnTypeCode getFirstSplitColumnType() {
return firstSplitColumnType;
}
public void setFirstSplitColumnType(ColumnTypeCode firstSplitColumnType) {
this.firstSplitColumnType = firstSplitColumnType;
}
public ColumnTypeCode getSecondSplitColumnType() {
return secondSplitColumnType;
}
public void setSecondSplitColumnType(ColumnTypeCode secondSplitColumnType) {
this.secondSplitColumnType = secondSplitColumnType;
}
public ColumnDataType getFirstSplitColumnDataType() {
return firstSplitColumnDataType;
}
public void setFirstSplitColumnDataType(ColumnDataType firstSplitColumnDataType) {
this.firstSplitColumnDataType = firstSplitColumnDataType;
}
public ColumnDataType getSecondSplitColumnDataType() {
return secondSplitColumnDataType;
}
public void setSecondSplitColumnDataType(
ColumnDataType secondSplitColumnDataType) {
this.secondSplitColumnDataType = secondSplitColumnDataType;
}
@Override @Override
public String toString() { public String toString() {
return "SplitColumnSession [columnData=" + columnData + ", label1=" return "SplitColumnSession [columnData=" + columnData + ", label1="
+ label1 + ", label2=" + label2 + ", expressions=" + label1 + ", label2=" + label2 + ", expressions="
+ expressions + "]"; + expressions + ", firstSplitColumnType="
+ firstSplitColumnType + ", firstSplitColumnDataType="
+ firstSplitColumnDataType + ", secondSplitColumnType="
+ secondSplitColumnType + ", secondSplitColumnDataType="
+ secondSplitColumnDataType + "]";
} }
} }