From dc1183f706e83068977e8e260c29a479cf6aa96b Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 7 Mar 2008 23:41:20 +0000 Subject: [PATCH] * 2pack - Add support for new field added. --- .../pipo/handler/ColumnElementHandler.java | 8 ++-- .../pipo/handler/FieldElementHandler.java | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/base/src/org/adempiere/pipo/handler/ColumnElementHandler.java b/base/src/org/adempiere/pipo/handler/ColumnElementHandler.java index a51c63e5be..c10fe796b8 100644 --- a/base/src/org/adempiere/pipo/handler/ColumnElementHandler.java +++ b/base/src/org/adempiere/pipo/handler/ColumnElementHandler.java @@ -97,9 +97,6 @@ public class ColumnElementHandler extends AbstractElementHandler { id = get_IDWithColumn(ctx, "AD_Process", "Name", Name); m_Column.setAD_Process_ID(id); Name = atts.getValue("ADReferenceNameID"); - // log.info("Column Name1 ->"+Name); - // log.info("Database Name ->"+m_DatabaseType); - // log.info("Column Name2 ->"+Name); id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name); m_Column.setAD_Reference_ID(id); // log.info("Column ID ->"+id); @@ -159,6 +156,8 @@ public class ColumnElementHandler extends AbstractElementHandler { m_Column.setValueMin(atts.getValue("ValueMin")); if (getStringValue(atts, "Version") != null) m_Column.setVersion(new BigDecimal(atts.getValue("Version"))); + + m_Column.setInfoFactoryClass(getStringValue(atts, "InfoFactoryClass")); // Setup Element. id = get_IDWithColumn(ctx, "AD_Element", "ColumnName", m_Column @@ -497,6 +496,9 @@ public class ColumnElementHandler extends AbstractElementHandler { atts.addAttribute("", "", "Version", "CDATA", (m_Column.getVersion() != null ? "" + m_Column.getVersion() : "0.0")); + atts.addAttribute("", "", "InfoFactoryClass", "CDATA", (m_Column.getInfoFactoryClass() != null + ? m_Column.getInfoFactoryClass() : "")); + return atts; } } diff --git a/base/src/org/adempiere/pipo/handler/FieldElementHandler.java b/base/src/org/adempiere/pipo/handler/FieldElementHandler.java index cd3239c69d..38c6c43833 100644 --- a/base/src/org/adempiere/pipo/handler/FieldElementHandler.java +++ b/base/src/org/adempiere/pipo/handler/FieldElementHandler.java @@ -143,6 +143,19 @@ public class FieldElementHandler extends AbstractElementHandler { if (sortNo != null) m_Field.setSortNo(new BigDecimal(sortNo)); m_Field.setDisplayLogic(getStringValue(atts, "DisplayLogic")); + + String Name = atts.getValue("ADReferenceNameID"); + id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name); + m_Field.setAD_Reference_ID(id); + + Name = atts.getValue("ADValRuleNameID"); + id = get_IDWithColumn(ctx, "AD_Val_Rule", "Name", Name); + m_Field.setAD_Val_Rule_ID(id); + Name = atts.getValue("ADReferenceNameValueID"); + id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name); + m_Field.setAD_Reference_Value_ID(id); + m_Field.setInfoFactoryClass(getStringValue(atts, "InfoFactoryClass")); + if (m_Field.save(getTrxName(ctx)) == true) { record_log(ctx, 1, m_Field.getName(), "Field", m_Field .get_ID(), AD_Backup_ID, Object_Status, "AD_Field", @@ -261,6 +274,32 @@ public class FieldElementHandler extends AbstractElementHandler { .getDisplayLogic() != null ? m_Field.getDisplayLogic() : "")); atts.addAttribute("", "", "ObscureType", "CDATA", (m_Field .getObscureType() != null ? m_Field.getObscureType() : "")); + + atts.addAttribute("", "", "InfoFactoryClass", "CDATA", (m_Field.getInfoFactoryClass() != null + ? m_Field.getInfoFactoryClass() : "")); + + if (m_Field.getAD_Reference_ID() > 0) { + sql = "SELECT Name FROM AD_Reference WHERE AD_Reference_ID=?"; + name = DB.getSQLValueString(null, sql, m_Field + .getAD_Reference_ID()); + atts.addAttribute("", "", "ADReferenceNameID", "CDATA", name); + } else + atts.addAttribute("", "", "ADReferenceNameID", "CDATA", ""); + if (m_Field.getAD_Reference_Value_ID() > 0) { + sql = "SELECT Name FROM AD_Reference WHERE AD_Reference_ID=?"; + name = DB.getSQLValueString(null, sql, m_Field + .getAD_Reference_Value_ID()); + atts.addAttribute("", "", "ADReferenceNameValueID", "CDATA", name); + } else + atts.addAttribute("", "", "ADReferenceNameValueID", "CDATA", ""); + if (m_Field.getAD_Val_Rule_ID() > 0) { + sql = "SELECT Name FROM AD_Val_Rule WHERE AD_Val_Rule_ID=?"; + name = DB + .getSQLValueString(null, sql, m_Field.getAD_Val_Rule_ID()); + atts.addAttribute("", "", "ADValRuleNameID", "CDATA", name); + } else + atts.addAttribute("", "", "ADValRuleNameID", "CDATA", ""); + return atts; } }