Package org.compiere.model
Class MTable
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_AD_Table
-
- org.compiere.model.MTable
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_Table
,I_Persistent
,Evaluatee
,ImmutablePOSupport
public class MTable extends X_AD_Table implements ImmutablePOSupport
Persistent Table ModelChange log:
- 2007-02-01 - teo_sarca - [ 1648850 ] MTable.getClass works incorrect for table "Fact_Acct"
- 2007-08-30 - vpj-cd - [ 1784588 ] Use ModelPackage of EntityType to Find Model Class
- Version:
- $Id: MTable.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, teo.sarca@gmail.com
- BF [ 3017117 ] MTable.getClass returns bad class https://sourceforge.net/p/adempiere/bugs/2433/
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_OFFICIAL_ID
-
Fields inherited from class org.compiere.model.X_AD_Table
ACCESSLEVEL_AD_Reference_ID, ACCESSLEVEL_All, ACCESSLEVEL_ClientOnly, ACCESSLEVEL_ClientPlusOrganization, ACCESSLEVEL_Organization, ACCESSLEVEL_SystemOnly, ACCESSLEVEL_SystemPlusClient, ENTITYTYPE_AD_Reference_ID, REPLICATIONTYPE_AD_Reference_ID, REPLICATIONTYPE_Broadcast, REPLICATIONTYPE_Local, REPLICATIONTYPE_Merge, REPLICATIONTYPE_Reference
-
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_AD_Table
accessLevel, COLUMNNAME_AccessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AD_Table_UU, COLUMNNAME_AD_Val_Rule_ID, COLUMNNAME_AD_Window_ID, COLUMNNAME_CopyColumnsFromTable, COLUMNNAME_CopyComponentsFromView, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_CreateWindowFromTable, COLUMNNAME_DatabaseViewDrop, COLUMNNAME_Description, COLUMNNAME_EntityType, COLUMNNAME_Help, COLUMNNAME_ImportTable, COLUMNNAME_IsActive, COLUMNNAME_IsCentrallyMaintained, COLUMNNAME_IsChangeLog, COLUMNNAME_IsDeleteable, COLUMNNAME_IsHighVolume, COLUMNNAME_IsSecurityEnabled, COLUMNNAME_IsView, COLUMNNAME_LoadSeq, COLUMNNAME_Name, COLUMNNAME_PO_Window_ID, COLUMNNAME_Processing, COLUMNNAME_ReplicationType, COLUMNNAME_TableName, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MTable(Properties ctx, int AD_Table_ID, String trxName)
Standard ConstructorMTable(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMTable(Properties ctx, MTable copy)
MTable(Properties ctx, MTable copy, String trxName)
MTable(MTable copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
afterSave(boolean newRecord, boolean success)
After Saveprotected boolean
beforeSave(boolean newRecord)
Before Saveboolean
columnExistsInDB(String ColumnName)
Column exists and is not virtual?boolean
columnExistsInDictionary(String ColumnName)
Column exists?Query
createQuery(String whereClause, String trxName)
Create query to retrieve one or more PO.static MTable
get(int AD_Table_ID)
Get Table from Cache (immutable)static MTable
get(Properties ctx, int AD_Table_ID)
Get Table from Cache (immutable)static MTable
get(Properties ctx, int AD_Table_ID, String trxName)
Get Table from Cache (immutable)static MTable
get(Properties ctx, String tableName)
Get Table from Cachestatic MTable
get(Properties ctx, String tableName, String trxName)
Get Table from Cachestatic Class<?>
getClass(String tableName)
Get Persistence Class for TableMColumn
getColumn(String columnName)
Get Columnint
getColumnIndex(int AD_Column_ID)
Get Column Indexint
getColumnIndex(String ColumnName)
Get Column IndexMColumn[]
getColumns(boolean requery)
Get Columnsstatic MTable
getCopy(Properties ctx, int AD_Table_ID, String trxName)
Get updateable copy of MTable from cacheString[]
getIdentifierColumns()
Get Identifier Columns of TableString[]
getKeyColumns()
Get Key Columns of TablePO
getPO(int Record_ID, String trxName)
Get PO Class InstancePO
getPO(String whereClause, Object[] params, String trxName)
Get PO class instancePO
getPO(String whereClause, String trxName)
Get PO Class InstancePO
getPO(ResultSet rs, String trxName)
Get PO Class InstancePO
getPOByUU(String uuID, String trxName)
Get PO Class InstanceString
getSQLCreate()
Get SQL Createstatic int
getTable_ID(String tableName)
static int
getTable_ID(String tableName, String trxName)
Grant independence to GenerateModel from AD_Table_IDstatic String
getTableName(Properties ctx, int AD_Table_ID)
Get Table NameMViewComponent[]
getViewComponent(boolean reload)
Get view componentsboolean
isSingleKey()
Table has a single Keystatic boolean
isZeroIDTable(String tablename)
Verify if the table contains ID=0MTable
markImmutable()
mark PO as immutableString
toString()
String Representation-
Methods inherited from class org.compiere.model.X_AD_Table
get_AccessLevel, getAccessLevel, getAD_Table_ID, getAD_Table_UU, getAD_Val_Rule, getAD_Val_Rule_ID, getAD_Window, getAD_Window_ID, getCopyColumnsFromTable, getCopyComponentsFromView, getCreateWindowFromTable, getDatabaseViewDrop, getDescription, getEntityType, getHelp, getImportTable, getKeyNamePair, getLoadSeq, getName, getPO_Window, getPO_Window_ID, getReplicationType, getTableName, initPO, isCentrallyMaintained, isChangeLog, isDeleteable, isHighVolume, isProcessing, isSecurityEnabled, isView, setAccessLevel, setAD_Table_ID, setAD_Table_UU, setAD_Val_Rule_ID, setAD_Window_ID, setCopyColumnsFromTable, setCopyComponentsFromView, setCreateWindowFromTable, setDatabaseViewDrop, setDescription, setEntityType, setHelp, setImportTable, setIsCentrallyMaintained, setIsChangeLog, setIsDeleteable, setIsHighVolume, setIsSecurityEnabled, setIsView, setLoadSeq, setName, setPO_Window_ID, setProcessing, setReplicationType, setTableName
-
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock, update_Tree, validForeignKeys
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.compiere.model.I_AD_Table
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
-
Methods inherited from interface org.compiere.model.I_Persistent
save
-
-
-
-
Field Detail
-
MAX_OFFICIAL_ID
public static final int MAX_OFFICIAL_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MTable
public MTable(Properties ctx, int AD_Table_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextAD_Table_ID
- idtrxName
- transaction
-
MTable
public MTable(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MTable
public MTable(MTable copy)
- Parameters:
copy
-
-
MTable
public MTable(Properties ctx, MTable copy)
- Parameters:
ctx
-copy
-
-
MTable
public MTable(Properties ctx, MTable copy, String trxName)
- Parameters:
ctx
-copy
-trxName
-
-
-
Method Detail
-
get
public static MTable get(int AD_Table_ID)
Get Table from Cache (immutable)- Parameters:
AD_Table_ID
- id- Returns:
- MTable
-
get
public static MTable get(Properties ctx, int AD_Table_ID)
Get Table from Cache (immutable)- Parameters:
ctx
- contextAD_Table_ID
- id- Returns:
- MTable
-
get
public static MTable get(Properties ctx, int AD_Table_ID, String trxName)
Get Table from Cache (immutable)- Parameters:
ctx
- contextAD_Table_ID
- idtrxName
- transaction- Returns:
- MTable
-
getCopy
public static MTable getCopy(Properties ctx, int AD_Table_ID, String trxName)
Get updateable copy of MTable from cache- Parameters:
ctx
-AD_Table_ID
-trxName
-- Returns:
- MTable
-
get
public static MTable get(Properties ctx, String tableName)
Get Table from Cache- Parameters:
ctx
- contexttableName
- case insensitive table name- Returns:
- Table
-
get
public static MTable get(Properties ctx, String tableName, String trxName)
Get Table from Cache- Parameters:
ctx
- contexttableName
- case insensitive table name- Returns:
- Table
-
getTableName
public static String getTableName(Properties ctx, int AD_Table_ID)
Get Table Name- Parameters:
ctx
- contextAD_Table_ID
- table- Returns:
- tavle name
-
getClass
public static Class<?> getClass(String tableName)
Get Persistence Class for Table- Parameters:
tableName
- table name- Returns:
- class or null
-
getColumns
public MColumn[] getColumns(boolean requery)
Get Columns- Parameters:
requery
- requery- Returns:
- array of columns
-
getColumn
public MColumn getColumn(String columnName)
Get Column- Parameters:
columnName
- (case insensitive)- Returns:
- column if found
-
getColumnIndex
public int getColumnIndex(String ColumnName)
Get Column Index- Parameters:
ColumnName
- column name- Returns:
- index of column with ColumnName or -1 if not found
-
columnExistsInDB
public boolean columnExistsInDB(String ColumnName)
Column exists and is not virtual?- Parameters:
ColumnName
- column name- Returns:
- boolean - true indicating that the column exists in the table and is not virtual
-
columnExistsInDictionary
public boolean columnExistsInDictionary(String ColumnName)
Column exists?- Parameters:
ColumnName
- column name- Returns:
- boolean - true indicating that the column exists in dictionary
-
getColumnIndex
public int getColumnIndex(int AD_Column_ID)
Get Column Index- Parameters:
AD_Column_ID
- column- Returns:
- index of column with ColumnName or -1 if not found
-
isSingleKey
public boolean isSingleKey()
Table has a single Key- Returns:
- true if table has single key column
-
getKeyColumns
public String[] getKeyColumns()
Get Key Columns of Table- Returns:
- key columns
-
getIdentifierColumns
public String[] getIdentifierColumns()
Get Identifier Columns of Table- Returns:
- Identifier columns
-
getPO
public PO getPO(int Record_ID, String trxName)
Get PO Class Instance- Parameters:
Record_ID
- recordtrxName
-- Returns:
- PO for Record or null
-
getPO
public PO getPO(ResultSet rs, String trxName)
Get PO Class Instance- Parameters:
rs
- result settrxName
- transaction- Returns:
- PO for Record or null
-
getPOByUU
public PO getPOByUU(String uuID, String trxName)
Get PO Class Instance- Parameters:
uuID
- UUIDtrxName
- transaction- Returns:
- PO for Record
-
getPO
public PO getPO(String whereClause, String trxName)
Get PO Class Instance- Parameters:
whereClause
- where clausetrxName
- transaction- Returns:
- PO for Record or null
-
getPO
public PO getPO(String whereClause, Object[] params, String trxName)
Get PO class instance- Parameters:
whereClause
-params
-trxName
-- Returns:
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success)
After Save
-
getSQLCreate
public String getSQLCreate()
Get SQL Create- Returns:
- create table DDL
-
getTable_ID
public static int getTable_ID(String tableName)
-
getTable_ID
public static int getTable_ID(String tableName, String trxName)
Grant independence to GenerateModel from AD_Table_ID- Parameters:
tableName
- StringtrxName
-- Returns:
- int retValue
-
createQuery
public Query createQuery(String whereClause, String trxName)
Create query to retrieve one or more PO.- Parameters:
whereClause
-trxName
-- Returns:
- Query
-
getViewComponent
public MViewComponent[] getViewComponent(boolean reload)
Get view components- Parameters:
reload
- reload data- Returns:
- array of view component
-
toString
public String toString()
String Representation- Overrides:
toString
in classX_AD_Table
- Returns:
- info
-
isZeroIDTable
public static boolean isZeroIDTable(String tablename)
Verify if the table contains ID=0- Returns:
- true if table has zero ID
-
markImmutable
public MTable markImmutable()
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
-