Package org.compiere.model
Class MColumn
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_AD_Column
-
- org.compiere.model.MColumn
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_Column
,I_Persistent
,Evaluatee
,ImmutablePOSupport
public class MColumn extends X_AD_Column implements ImmutablePOSupport
Persistent Column Model- Version:
- $Id: MColumn.java,v 1.6 2006/08/09 05:23:49 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_AD_Column
ENTITYTYPE_AD_Reference_ID, FKCONSTRAINTTYPE_AD_Reference_ID, FKCONSTRAINTTYPE_Cascade, FKCONSTRAINTTYPE_DoNotCreate, FKCONSTRAINTTYPE_ModelCascade, FKCONSTRAINTTYPE_NoAction, FKCONSTRAINTTYPE_SetNull, ISENCRYPTED_AD_Reference_ID, ISENCRYPTED_Encrypted, ISENCRYPTED_NotEncrypted, ISTOOLBARBUTTON_AD_Reference_ID, ISTOOLBARBUTTON_Both, ISTOOLBARBUTTON_Toolbar, ISTOOLBARBUTTON_Window
-
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_Column
accessLevel, COLUMNNAME_AD_Chart_ID, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Column_ID, COLUMNNAME_AD_Column_UU, COLUMNNAME_AD_Element_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Process_ID, COLUMNNAME_AD_Reference_ID, COLUMNNAME_AD_Reference_Value_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AD_Val_Rule_ID, COLUMNNAME_AD_Val_Rule_Lookup_ID, COLUMNNAME_Callout, COLUMNNAME_ColumnName, COLUMNNAME_ColumnSQL, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DefaultValue, COLUMNNAME_Description, COLUMNNAME_EntityType, COLUMNNAME_FieldLength, COLUMNNAME_FKConstraintName, COLUMNNAME_FKConstraintType, COLUMNNAME_FormatPattern, COLUMNNAME_Help, COLUMNNAME_IsActive, COLUMNNAME_IsAllowCopy, COLUMNNAME_IsAllowLogging, COLUMNNAME_IsAlwaysUpdateable, COLUMNNAME_IsAutocomplete, COLUMNNAME_IsEncrypted, COLUMNNAME_IsHtml, COLUMNNAME_IsIdentifier, COLUMNNAME_IsKey, COLUMNNAME_IsMandatory, COLUMNNAME_IsParent, COLUMNNAME_IsSecure, COLUMNNAME_IsSelectionColumn, COLUMNNAME_IsSyncDatabase, COLUMNNAME_IsToolbarButton, COLUMNNAME_IsTranslated, COLUMNNAME_IsUpdateable, COLUMNNAME_MandatoryLogic, COLUMNNAME_Name, COLUMNNAME_PA_DashboardContent_ID, COLUMNNAME_Placeholder, COLUMNNAME_ReadOnlyLogic, COLUMNNAME_SeqNo, COLUMNNAME_SeqNoSelection, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValueMax, COLUMNNAME_ValueMin, COLUMNNAME_Version, COLUMNNAME_VFormat, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MColumn(Properties ctx, int AD_Column_ID, String trxName)
Standard ConstructorMColumn(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMColumn(Properties ctx, MColumn copy)
MColumn(Properties ctx, MColumn copy, String trxName)
MColumn(MColumn copy)
MColumn(MTable parent)
Parent Constructor
-
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 Savestatic MColumn
get(int AD_Column_ID)
Get MColumn from Cache (immutable)static MColumn
get(Properties ctx, int AD_Column_ID)
Get MColumn from Cache (immutable)static MColumn
get(Properties ctx, int AD_Column_ID, String trxName)
Get MColumn from Cache (immutable)static MColumn
get(Properties ctx, String tableName, String columnName)
Get MColumn given TableName and ColumnNamestatic MColumn
get(Properties ctx, String tableName, String columnName, String trxName)
Get MColumn given TableName and ColumnNameI_AD_Table
getAD_Table()
static int
getColumn_ID(String TableName, String columnName)
get Column IDstatic String
getColumnName(Properties ctx, int AD_Column_ID)
static String
getColumnName(Properties ctx, int AD_Column_ID, String trxName)
Get Column NameString
getColumnSQL(boolean nullForUI)
String
getColumnSQL(boolean nullForUI, boolean nullForSearch)
String
getConstraint(String tableName)
Get Table Constraintstatic MColumn
getCopy(Properties ctx, int AD_Column_ID, String trxName)
Get updateable copy of MColumn from cachestatic String
getForeignKeyConstraint(DatabaseMetaData md, MTable table, MColumn column)
static String
getForeignKeyConstraintSql(DatabaseMetaData md, String catalog, String schema, String tableName, MTable table, MColumn column, boolean isNoTable)
static DatabaseKey
getPrimaryKey(DatabaseMetaData md, String primaryTableName)
String
getReferenceTableName()
String
getSQLAdd(MTable table)
Get SQL Add commandString
getSQLDataType()
Get SQL Data TypeString
getSQLDDL()
Get SQL DDLString
getSQLModify(MTable table, boolean setNullOption)
Get SQL Modify commandstatic int
getTable_ID(Properties ctx, int AD_Column_ID, String trxName)
Get Table Id for a columnboolean
isAdvanced()
Is Advancedboolean
isEncrypted()
Is the Column Encrypted?boolean
isStandardColumn()
Is Standard Columnstatic boolean
isSuggestSelectionColumn(String columnName, boolean caseSensitive)
boolean
isUUIDColumn()
Is UUID Columnboolean
isVirtualColumn()
Is Virtual Columnboolean
isVirtualDBColumn()
Is Virtual DB Columnboolean
isVirtualSearchColumn()
Is Virtual Search Columnboolean
isVirtualUIColumn()
Is Virtual UI ColumnMColumn
markImmutable()
mark PO as immutableString
renameDBColumn(String newColumnName)
void
setIsEncrypted(boolean IsEncrypted)
Set Encryptedvoid
setSmartDefaults()
String
toString()
String Representation-
Methods inherited from class org.compiere.model.X_AD_Column
get_AccessLevel, getAD_Chart, getAD_Chart_ID, getAD_Column_ID, getAD_Column_UU, getAD_Element, getAD_Element_ID, getAD_Process, getAD_Process_ID, getAD_Reference, getAD_Reference_ID, getAD_Reference_Value, getAD_Reference_Value_ID, getAD_Table_ID, getAD_Val_Rule, getAD_Val_Rule_ID, getAD_Val_Rule_Lookup, getAD_Val_Rule_Lookup_ID, getCallout, getColumnName, getColumnSQL, getDefaultValue, getDescription, getEntityType, getFieldLength, getFKConstraintName, getFKConstraintType, getFormatPattern, getHelp, getIsEncrypted, getIsSyncDatabase, getIsToolbarButton, getKeyNamePair, getMandatoryLogic, getName, getPA_DashboardContent, getPA_DashboardContent_ID, getPlaceholder, getReadOnlyLogic, getSeqNo, getSeqNoSelection, getValueMax, getValueMin, getVersion, getVFormat, initPO, isAllowCopy, isAllowLogging, isAlwaysUpdateable, isAutocomplete, isHtml, isIdentifier, isKey, isMandatory, isParent, isSecure, isSelectionColumn, isTranslated, isUpdateable, setAD_Chart_ID, setAD_Column_ID, setAD_Column_UU, setAD_Element_ID, setAD_Process_ID, setAD_Reference_ID, setAD_Reference_Value_ID, setAD_Table_ID, setAD_Val_Rule_ID, setAD_Val_Rule_Lookup_ID, setCallout, setColumnName, setColumnSQL, setDefaultValue, setDescription, setEntityType, setFieldLength, setFKConstraintName, setFKConstraintType, setFormatPattern, setHelp, setIsAllowCopy, setIsAllowLogging, setIsAlwaysUpdateable, setIsAutocomplete, setIsEncrypted, setIsHtml, setIsIdentifier, setIsKey, setIsMandatory, setIsParent, setIsSecure, setIsSelectionColumn, setIsSyncDatabase, setIsToolbarButton, setIsTranslated, setIsUpdateable, setMandatoryLogic, setName, setPA_DashboardContent_ID, setPlaceholder, setReadOnlyLogic, setSeqNo, setSeqNoSelection, setValueMax, setValueMin, setVersion, setVFormat
-
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_Column
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
-
-
-
-
Constructor Detail
-
MColumn
public MColumn(Properties ctx, int AD_Column_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextAD_Column_ID
-trxName
- transaction
-
MColumn
public MColumn(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MColumn
public MColumn(MTable parent)
Parent Constructor- Parameters:
parent
- table
-
MColumn
public MColumn(MColumn copy)
- Parameters:
copy
-
-
MColumn
public MColumn(Properties ctx, MColumn copy)
- Parameters:
ctx
-copy
-
-
MColumn
public MColumn(Properties ctx, MColumn copy, String trxName)
- Parameters:
ctx
-copy
-trxName
-
-
-
Method Detail
-
get
public static MColumn get(int AD_Column_ID)
Get MColumn from Cache (immutable)- Parameters:
AD_Column_ID
- id- Returns:
- MColumn
-
get
public static MColumn get(Properties ctx, int AD_Column_ID)
Get MColumn from Cache (immutable)- Parameters:
ctx
- contextAD_Column_ID
- id- Returns:
- MColumn
-
get
public static MColumn get(Properties ctx, int AD_Column_ID, String trxName)
Get MColumn from Cache (immutable)- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- trx- Returns:
- MColumn
-
getCopy
public static MColumn getCopy(Properties ctx, int AD_Column_ID, String trxName)
Get updateable copy of MColumn from cache- Parameters:
ctx
-AD_Column_ID
-trxName
-- Returns:
- MColumn
-
get
public static MColumn get(Properties ctx, String tableName, String columnName)
Get MColumn given TableName and ColumnName- Parameters:
ctx
- contexttableName
-columnName
-- Returns:
- MColumn
-
get
public static MColumn get(Properties ctx, String tableName, String columnName, String trxName)
Get MColumn given TableName and ColumnName- Parameters:
ctx
- contexttableName
-columnName
-trxName
-- Returns:
- MColumn
-
getColumnName
public static String getColumnName(Properties ctx, int AD_Column_ID)
-
getColumnName
public static String getColumnName(Properties ctx, int AD_Column_ID, String trxName)
Get Column Name- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- transaction- Returns:
- Column Name or null
-
isStandardColumn
public boolean isStandardColumn()
Is Standard Column- Returns:
- true for AD_Client_ID, etc.
-
isUUIDColumn
public boolean isUUIDColumn()
Is UUID Column- Returns:
- true for UUID column
-
isVirtualColumn
public boolean isVirtualColumn()
Is Virtual Column- Returns:
- true if virtual column
-
isVirtualDBColumn
public boolean isVirtualDBColumn()
Is Virtual DB Column- Returns:
- true if virtual DB column
-
isVirtualUIColumn
public boolean isVirtualUIColumn()
Is Virtual UI Column- Returns:
- true if virtual UI column
-
isVirtualSearchColumn
public boolean isVirtualSearchColumn()
Is Virtual Search Column- Returns:
- true if virtual search column
-
isEncrypted
public boolean isEncrypted()
Is the Column Encrypted?- Returns:
- true if encrypted
-
setIsEncrypted
public void setIsEncrypted(boolean IsEncrypted)
Set Encrypted- Parameters:
IsEncrypted
- encrypted
-
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
-
getSQLAdd
public String getSQLAdd(MTable table)
Get SQL Add command- Parameters:
table
- table- Returns:
- sql
-
getSQLDDL
public String getSQLDDL()
Get SQL DDL- Returns:
- columnName datataype ..
-
getSQLModify
public String getSQLModify(MTable table, boolean setNullOption)
Get SQL Modify command- Parameters:
table
- tablesetNullOption
- generate null / not null statement- Returns:
- sql separated by ;
-
getSQLDataType
public String getSQLDataType()
Get SQL Data Type- Returns:
- e.g. NVARCHAR2(60)
-
getConstraint
public String getConstraint(String tableName)
Get Table Constraint- Parameters:
tableName
- table name- Returns:
- table constraint
-
toString
public String toString()
String Representation- Overrides:
toString
in classX_AD_Column
- Returns:
- info
-
getColumn_ID
public static int getColumn_ID(String TableName, String columnName)
get Column ID- Parameters:
TableName
-columnName
-- Returns:
- int retValue
-
getTable_ID
public static int getTable_ID(Properties ctx, int AD_Column_ID, String trxName)
Get Table Id for a column- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- transaction- Returns:
- MColumn
-
isSuggestSelectionColumn
public static boolean isSuggestSelectionColumn(String columnName, boolean caseSensitive)
-
getReferenceTableName
public String getReferenceTableName()
-
setSmartDefaults
public void setSmartDefaults()
-
getAD_Table
public I_AD_Table getAD_Table() throws RuntimeException
- Specified by:
getAD_Table
in interfaceI_AD_Column
- Overrides:
getAD_Table
in classX_AD_Column
- Throws:
RuntimeException
-
getForeignKeyConstraintSql
public static String getForeignKeyConstraintSql(DatabaseMetaData md, String catalog, String schema, String tableName, MTable table, MColumn column, boolean isNoTable) throws Exception
- Throws:
Exception
-
getPrimaryKey
public static DatabaseKey getPrimaryKey(DatabaseMetaData md, String primaryTableName) throws Exception
- Throws:
Exception
-
getForeignKeyConstraint
public static String getForeignKeyConstraint(DatabaseMetaData md, MTable table, MColumn column) throws Exception
- Throws:
Exception
-
isAdvanced
public boolean isAdvanced()
Is Advanced- Returns:
- true if the column has any field marked as advanced or part of an advanced tab
-
getColumnSQL
public String getColumnSQL(boolean nullForUI)
-
getColumnSQL
public String getColumnSQL(boolean nullForUI, boolean nullForSearch)
-
markImmutable
public MColumn markImmutable()
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
-