Check if the target PO column existing value is different before set it to the value in the xml file.

This commit is contained in:
Heng Sin Low 2010-12-27 08:31:21 +08:00
parent 1fa4f0c384
commit 1ebc0d87ec
1 changed files with 35 additions and 6 deletions

View File

@ -45,6 +45,12 @@ public class PoFiller{
value = "".equals(value) ? null : value;
Object oldValue = po.get_Value(columnName);
if (value == null && oldValue == null)
return;
else if (oldValue != null && oldValue.toString().equals(value))
return;
else
po.set_ValueOfColumn(columnName, value);
}
@ -59,6 +65,9 @@ public class PoFiller{
boolean bool = "true".equals(value) ? true : false;
if (po.get_Value(columnName) != null && po.get_ValueAsBoolean(columnName) == bool)
return;
else
po.set_ValueOfColumn(columnName, bool);
}
@ -74,6 +83,12 @@ public class PoFiller{
value = null;
Timestamp ts = value != null ? Timestamp.valueOf(value) : null;
Object oldValue = po.get_Value(qName);
if (oldValue == null && ts == null)
return;
else if (oldValue != null && oldValue.equals(ts))
return;
else
po.set_ValueOfColumn(qName, ts);
}
@ -89,6 +104,12 @@ public class PoFiller{
value = null;
Integer i = value != null ? new Integer(value) : null;
Object oldValue = po.get_Value(qName);
if (oldValue == null && i == null)
return;
else if (oldValue != null && oldValue.equals(i))
return;
else
po.set_ValueOfColumn(qName, i);
}
@ -104,6 +125,12 @@ public class PoFiller{
value = null;
BigDecimal bd = value != null ? new BigDecimal(value) : null;
Object oldValue = po.get_Value(qName);
if (oldValue == null && bd == null)
return;
else if (oldValue != null && oldValue.equals(bd))
return;
else
po.set_ValueOfColumn(qName, bd);
}
@ -150,7 +177,9 @@ public class PoFiller{
}
if (po.get_ColumnIndex(columnName) >= 0) {
if (id > 0) {
if (po.get_ValueAsInt(columnName) != id) {
po.set_ValueOfColumn(columnName, id);
}
return id;
}
return -1;