From ab55ed8406500c69b4456aeda9ce6ab929e71430 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 14 Aug 2012 15:11:43 -0500 Subject: [PATCH] IDEMPIERE-236 - Centralization of hardcoded IDs --- .../pipo/AbstractElementHandler.java | 10 +++++-- .../src/org/adempiere/pipo/PackOut.java | 2 +- .../src/org/adempiere/pipo/PackRoll.java | 26 ++++++++++++++++--- .../handler/CommonTranslationHandler.java | 2 +- .../pipo/handler/MenuElementHandler.java | 6 +++-- .../webui/panel/AbstractMenuPanel.java | 5 ++-- 6 files changed, 40 insertions(+), 11 deletions(-) diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java index 9c70c00f3e..dca8af00e7 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java @@ -16,6 +16,13 @@ *****************************************************************************/ package org.adempiere.pipo; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_BUTTON; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LIST; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MEMO; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_STRING; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TEXT; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; + import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -28,7 +35,6 @@ import javax.xml.transform.sax.TransformerHandler; import org.compiere.model.PO; import org.compiere.model.POInfo; -import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -37,7 +43,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -public abstract class AbstractElementHandler implements ElementHandler, SystemIDs { +public abstract class AbstractElementHandler implements ElementHandler { protected CLogger log = CLogger.getCLogger("PackIn"); diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackOut.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackOut.java index 300075db7f..541c6e5e9a 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackOut.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackOut.java @@ -786,7 +786,7 @@ public class PackOut extends SvrProcess */ public void createTranslations (String parentTableName, int parentID, TransformerHandler packOutDocument) throws SAXException { - if (MSysConfig.getBooleanValue("2PACK_HANDLE_TRANSLATIONS", false)) { + if (MSysConfig.getBooleanValue(MSysConfig.TWOPACK_HANDLE_TRANSLATIONS, false)) { Env.setContext(getCtx(), CommonTranslationHandler.CONTEXT_KEY__PARENT_TABLE, parentTableName); diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java index 8216e5de83..8e7af1ab4e 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java @@ -16,6 +16,26 @@ *****************************************************************************/ package org.adempiere.pipo; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_ACCOUNT; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_AMOUNT; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_BUTTON; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_COLOR; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DATE; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DATETIME; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_INTEGER; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LIST; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LOCATION; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LOCATOR; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MEMO; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_NUMBER; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PRODUCTATTRIBUTE; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_QUANTITY; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SEARCH; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLE; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLEDIR; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TEXT; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; + import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -37,7 +57,7 @@ import org.compiere.util.Env; * @author Robert Klein * */ -public class PackRoll extends SvrProcess implements SystemIDs { +public class PackRoll extends SvrProcess { /** Package from Record */ private int m_AD_Package_Imp_ID = 0; private String m_Processing = null; @@ -266,7 +286,7 @@ public class PackRoll extends SvrProcess implements SystemIDs { // treatment for EntityType // it's a Table reference but must // be treated as String - || (v_AD_Reference_ID == REFERENCE_DATATYPE_TABLE && columnName + || (v_AD_Reference_ID == SystemIDs.REFERENCE_DATATYPE_TABLE && columnName .equalsIgnoreCase("EntityType"))) if (rs2.getObject("ColValue") .toString().equals("null")) { @@ -302,7 +322,7 @@ public class PackRoll extends SvrProcess implements SystemIDs { } // Update columns that are Strings adjusting // for single quotes - else if (v_AD_Reference_ID == REFERENCE_DATATYPE_ID + else if (v_AD_Reference_ID == SystemIDs.REFERENCE_DATATYPE_ID || v_AD_Reference_ID == REFERENCE_DATATYPE_TABLE || v_AD_Reference_ID == REFERENCE_DATATYPE_TABLEDIR || v_AD_Reference_ID == REFERENCE_DATATYPE_LOCATION diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/CommonTranslationHandler.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/CommonTranslationHandler.java index 3813b67b30..689fcc55a9 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/CommonTranslationHandler.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/CommonTranslationHandler.java @@ -33,7 +33,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements public void startElement(Properties ctx, Element element) throws SAXException { - if(! MSysConfig.getBooleanValue("2PACK_HANDLE_TRANSLATIONS", false)){ + if(! MSysConfig.getBooleanValue(MSysConfig.TWOPACK_HANDLE_TRANSLATIONS, false)){ return;//translation import option is disabled } diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java index 2dd5174b12..52f3463994 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java @@ -16,6 +16,9 @@ *****************************************************************************/ package org.adempiere.pipo.handler; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_BUTTON; +import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; @@ -27,7 +30,6 @@ import javax.xml.transform.sax.TransformerHandler; import org.adempiere.pipo.AbstractElementHandler; import org.adempiere.pipo.Element; import org.adempiere.pipo.PackOut; -import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Menu; import org.compiere.util.DB; import org.compiere.util.Env; @@ -35,7 +37,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -public class MenuElementHandler extends AbstractElementHandler implements SystemIDs { +public class MenuElementHandler extends AbstractElementHandler { public void startElement(Properties ctx, Element element) throws SAXException { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java index 36fc04fb50..6a3f567bb8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java @@ -14,6 +14,8 @@ package org.adempiere.webui.panel; +import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY; + import java.util.Collection; import java.util.Enumeration; import java.util.Properties; @@ -29,7 +31,6 @@ import org.compiere.model.MMenu; import org.compiere.model.MQuery; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; -import org.compiere.model.SystemIDs; import org.compiere.util.DB; import org.compiere.util.Env; import org.zkoss.zk.ui.Component; @@ -53,7 +54,7 @@ import org.zkoss.zul.Treerow; * @author Elaine * @date July 31, 2012 */ -public abstract class AbstractMenuPanel extends Panel implements EventListener, SystemIDs { +public abstract class AbstractMenuPanel extends Panel implements EventListener { /** *