IDEMPIERE-236 - Centralization of hardcoded IDs

This commit is contained in:
Carlos Ruiz 2012-08-14 15:11:43 -05:00
parent d3392c5549
commit ab55ed8406
6 changed files with 40 additions and 11 deletions

View File

@ -16,6 +16,13 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.pipo; 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.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -28,7 +35,6 @@ import javax.xml.transform.sax.TransformerHandler;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.model.POInfo; import org.compiere.model.POInfo;
import org.compiere.model.SystemIDs;
import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -37,7 +43,7 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl; 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"); protected CLogger log = CLogger.getCLogger("PackIn");

View File

@ -786,7 +786,7 @@ public class PackOut extends SvrProcess
*/ */
public void createTranslations (String parentTableName, int parentID, TransformerHandler packOutDocument) throws SAXException 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, Env.setContext(getCtx(), CommonTranslationHandler.CONTEXT_KEY__PARENT_TABLE,
parentTableName); parentTableName);

View File

@ -16,6 +16,26 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.pipo; 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.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -37,7 +57,7 @@ import org.compiere.util.Env;
* @author Robert Klein * @author Robert Klein
* *
*/ */
public class PackRoll extends SvrProcess implements SystemIDs { public class PackRoll extends SvrProcess {
/** Package from Record */ /** Package from Record */
private int m_AD_Package_Imp_ID = 0; private int m_AD_Package_Imp_ID = 0;
private String m_Processing = null; private String m_Processing = null;
@ -266,7 +286,7 @@ public class PackRoll extends SvrProcess implements SystemIDs {
// treatment for EntityType // treatment for EntityType
// it's a Table reference but must // it's a Table reference but must
// be treated as String // be treated as String
|| (v_AD_Reference_ID == REFERENCE_DATATYPE_TABLE && columnName || (v_AD_Reference_ID == SystemIDs.REFERENCE_DATATYPE_TABLE && columnName
.equalsIgnoreCase("EntityType"))) .equalsIgnoreCase("EntityType")))
if (rs2.getObject("ColValue") if (rs2.getObject("ColValue")
.toString().equals("null")) { .toString().equals("null")) {
@ -302,7 +322,7 @@ public class PackRoll extends SvrProcess implements SystemIDs {
} }
// Update columns that are Strings adjusting // Update columns that are Strings adjusting
// for single quotes // 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_TABLE
|| v_AD_Reference_ID == REFERENCE_DATATYPE_TABLEDIR || v_AD_Reference_ID == REFERENCE_DATATYPE_TABLEDIR
|| v_AD_Reference_ID == REFERENCE_DATATYPE_LOCATION || v_AD_Reference_ID == REFERENCE_DATATYPE_LOCATION

View File

@ -33,7 +33,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
public void startElement(Properties ctx, Element element) throws SAXException { 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 return;//translation import option is disabled
} }

View File

@ -16,6 +16,9 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.pipo.handler; 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.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
@ -27,7 +30,6 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo.AbstractElementHandler; import org.adempiere.pipo.AbstractElementHandler;
import org.adempiere.pipo.Element; import org.adempiere.pipo.Element;
import org.adempiere.pipo.PackOut; import org.adempiere.pipo.PackOut;
import org.compiere.model.SystemIDs;
import org.compiere.model.X_AD_Menu; import org.compiere.model.X_AD_Menu;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -35,7 +37,7 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl; 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) public void startElement(Properties ctx, Element element)
throws SAXException { throws SAXException {

View File

@ -14,6 +14,8 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY;
import java.util.Collection; import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Properties; import java.util.Properties;
@ -29,7 +31,6 @@ import org.compiere.model.MMenu;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MTree; import org.compiere.model.MTree;
import org.compiere.model.MTreeNode; import org.compiere.model.MTreeNode;
import org.compiere.model.SystemIDs;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
@ -53,7 +54,7 @@ import org.zkoss.zul.Treerow;
* @author Elaine * @author Elaine
* @date July 31, 2012 * @date July 31, 2012
*/ */
public abstract class AbstractMenuPanel extends Panel implements EventListener<Event>, SystemIDs { public abstract class AbstractMenuPanel extends Panel implements EventListener<Event> {
/** /**
* *