Fix Edit Bug

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99124 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-30 16:59:03 +00:00
parent 800bb9199d
commit 95efe6be86
2 changed files with 24 additions and 2 deletions

View File

@ -17,6 +17,7 @@ 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.table.TableId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -41,7 +42,8 @@ public class ValueMap {
protected SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public ArrayList<Map<String,Object>> genValueMap(EditRowSession editRowSession){
public ArrayList<Map<String,Object>> genValueMap(EditRowSession editRowSession)
throws TDGWTServiceException {
ArrayList<Map<String,Object>> composit=new ArrayList<Map<String,Object>>();
if(editRowSession.getMaps()==null){
@ -67,6 +69,10 @@ public class ValueMap {
ColumnTypeCode.DIMENSION.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.TIMEDIMENSION.toString()) == 0) {
if(value==null){
logger.error("Error, null value for on dimension or timedimension column is not valid");
continue;
}
TDInteger tdDim=new TDInteger(new Integer(value));
ColumnLocalId columnId=new ColumnLocalId(key);
ColumnReference colRef=new ColumnReference(tableId, columnId);
@ -78,6 +84,9 @@ public class ValueMap {
} else {
if (col.getDataTypeName().compareTo(
ColumnDataType.Boolean.toString()) == 0) {
if(value==null){
continue;
}
TDBoolean tdBoolean=new TDBoolean(new Boolean(value));
ColumnLocalId columnId=new ColumnLocalId(key);
ColumnReference colRef=new ColumnReference(tableId, columnId);
@ -104,7 +113,11 @@ public class ValueMap {
} else {
if (col.getDataTypeName().compareTo(
ColumnDataType.Text.toString()) == 0) {
if(value==null){
continue;
}
TDText tdText=new TDText(value);
ColumnLocalId columnId=new ColumnLocalId(key);
ColumnReference colRef=new ColumnReference(tableId, columnId);
Map<String,Object> valueMap=new HashMap<String,Object>();
@ -114,6 +127,9 @@ public class ValueMap {
} else {
if (col.getDataTypeName().compareTo(
ColumnDataType.Geometry.toString()) == 0) {
if(value==null){
continue;
}
TDText tdGeometry=new TDText(value);
ColumnLocalId columnId=new ColumnLocalId(key);
ColumnReference colRef=new ColumnReference(tableId, columnId);
@ -124,6 +140,9 @@ public class ValueMap {
} else {
if (col.getDataTypeName().compareTo(
ColumnDataType.Integer.toString()) == 0) {
if(value==null){
continue;
}
Integer integ;
try{
integ=new Integer(value);
@ -140,6 +159,9 @@ public class ValueMap {
} else {
if (col.getDataTypeName().compareTo(
ColumnDataType.Numeric.toString()) == 0) {
if(value==null){
continue;
}
Float numeric;
try{
numeric=new Float(value);

View File

@ -22,7 +22,7 @@ import org.junit.Test;
*/
public class TestServiceTable {
private final static long trId = 264;
private final static long searchTableId=75;
private final static long searchTableId=693;
private String user=Constants.DEFAULT_USER;
private String scope=Constants.DEFAULT_SCOPE;