IDEMPIERE-236 Centralization of hardcoded IDs / display types - preparing class for IDEMPIERE-3970

This commit is contained in:
Carlos Ruiz 2019-05-16 11:27:05 +02:00
parent a54fd56ffd
commit 4f72545787
1 changed files with 23 additions and 22 deletions

View File

@ -34,6 +34,7 @@ import org.compiere.model.X_AD_Package_Imp_Backup;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
/**
@ -193,15 +194,15 @@ public class PackRollProcess extends SvrProcess {
int v_AD_Reference_ID = backup.getAD_Reference_ID();
// Update columns that are Strings adjusting
// for single quotes
if (v_AD_Reference_ID == 10
|| v_AD_Reference_ID == 14
|| v_AD_Reference_ID == 34
|| v_AD_Reference_ID == 17
if (v_AD_Reference_ID == DisplayType.String
|| v_AD_Reference_ID == DisplayType.Text
|| v_AD_Reference_ID == DisplayType.Memo
|| v_AD_Reference_ID == DisplayType.List
// Carlos Ruiz globalqss, special
// treatment for EntityType
// it's a Table reference but must
// be treated as String
|| (v_AD_Reference_ID == 18 && columnName
|| (v_AD_Reference_ID == DisplayType.Table && columnName
.equalsIgnoreCase("EntityType"))) {
if (backup.getColValue().toString().equals("null")) {
;// Ignore null values
@ -216,8 +217,8 @@ public class PackRollProcess extends SvrProcess {
parameters = new Object[]{backup.getColValue()};
}
// Update true/false columns
} else if (v_AD_Reference_ID == 20
|| v_AD_Reference_ID == 28) {
} else if (v_AD_Reference_ID == DisplayType.YesNo
|| v_AD_Reference_ID == DisplayType.Button) {
sqlC = new StringBuffer("UPDATE "
+ tableName
@ -231,15 +232,15 @@ public class PackRollProcess extends SvrProcess {
}
// Update columns that are Strings adjusting
// for single quotes
else if (v_AD_Reference_ID == 13
|| v_AD_Reference_ID == 18
|| v_AD_Reference_ID == 19
|| v_AD_Reference_ID == 21
|| v_AD_Reference_ID == 25
|| v_AD_Reference_ID == 27
|| v_AD_Reference_ID == 30
|| v_AD_Reference_ID == 31
|| v_AD_Reference_ID == 35)
else if (v_AD_Reference_ID == DisplayType.ID
|| v_AD_Reference_ID == DisplayType.Table
|| v_AD_Reference_ID == DisplayType.TableDir
|| v_AD_Reference_ID == DisplayType.Location
|| v_AD_Reference_ID == DisplayType.Account
|| v_AD_Reference_ID == DisplayType.Color
|| v_AD_Reference_ID == DisplayType.Search
|| v_AD_Reference_ID == DisplayType.Locator
|| v_AD_Reference_ID == DisplayType.PAttribute)
{
sqlC = new StringBuffer("UPDATE "
@ -252,10 +253,10 @@ public class PackRollProcess extends SvrProcess {
parameters = new Object[]{backup.getColValue()};
}
// Update columns that are numbers
else if (v_AD_Reference_ID == 11
|| v_AD_Reference_ID == 12
|| v_AD_Reference_ID == 22
|| v_AD_Reference_ID == 29)
else if (v_AD_Reference_ID == DisplayType.Integer
|| v_AD_Reference_ID == DisplayType.Amount
|| v_AD_Reference_ID == DisplayType.Number
|| v_AD_Reference_ID == DisplayType.Quantity)
{
sqlC = new StringBuffer("UPDATE "
+ tableName
@ -267,8 +268,8 @@ public class PackRollProcess extends SvrProcess {
parameters = new Object[]{backup.getColValue()};
}
// Update columns that are dates
else if (v_AD_Reference_ID == 15
|| v_AD_Reference_ID == 16)
else if (v_AD_Reference_ID == DisplayType.Date
|| v_AD_Reference_ID == DisplayType.DateTime)
{
Timestamp ts = null;
try {