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
Column Model
- Version:
- $Id: MColumn.java,v 1.6 2006/08/09 05:23:49 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_AD_Column
ENTITYTYPE_AD_Reference_ID, FKCONSTRAINTTYPE_AD_Reference_ID, FKCONSTRAINTTYPE_Cascade, FKCONSTRAINTTYPE_DoNotCreate_Ignore, FKCONSTRAINTTYPE_ModelCascade, FKCONSTRAINTTYPE_ModelNoAction_ForbidDeletion, FKCONSTRAINTTYPE_ModelSetNull, FKCONSTRAINTTYPE_NoAction_ForbidDeletion, FKCONSTRAINTTYPE_SetNull, ISENCRYPTED_AD_Reference_ID, ISENCRYPTED_Encrypted, ISENCRYPTED_NotEncrypted, ISTOOLBARBUTTON_AD_Reference_ID, ISTOOLBARBUTTON_Both, ISTOOLBARBUTTON_Toolbar, ISTOOLBARBUTTON_Window, PARTITIONINGMETHOD_AD_Reference_ID, PARTITIONINGMETHOD_List, PARTITIONINGMETHOD_Range
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, UUID_NEW_RECORD, 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_InfoWindow_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_AlwaysUpdatableLogic, COLUMNNAME_Callout, COLUMNNAME_ColumnName, COLUMNNAME_ColumnSQL, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DefaultValue, COLUMNNAME_Description, COLUMNNAME_EntityType, COLUMNNAME_FieldLength, COLUMNNAME_FKConstraintMsg_ID, 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_IsPartitionKey, COLUMNNAME_IsSecure, COLUMNNAME_IsSelectionColumn, COLUMNNAME_IsSyncDatabase, COLUMNNAME_IsToolbarButton, COLUMNNAME_IsTranslated, COLUMNNAME_IsUpdateable, COLUMNNAME_MandatoryLogic, COLUMNNAME_Name, COLUMNNAME_PA_DashboardContent_ID, COLUMNNAME_PartitioningMethod, COLUMNNAME_Placeholder, COLUMNNAME_RangePartitionInterval, COLUMNNAME_ReadOnlyLogic, COLUMNNAME_SeqNo, COLUMNNAME_SeqNoPartition, COLUMNNAME_SeqNoSelection, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValueMax, COLUMNNAME_ValueMin, COLUMNNAME_Version, COLUMNNAME_VFormat, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMColumn
(Properties ctx, int AD_Column_ID, String trxName) Standard ConstructorMColumn
(Properties ctx, String AD_Column_UU, String trxName) UUID based ConstructorMColumn
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMColumn
(Properties ctx, MColumn copy) Copy constructorMColumn
(Properties ctx, MColumn copy, String trxName) Copy constructorCopy constructorParent Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
afterSave
(boolean newRecord, boolean success) Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.protected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static 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 ColumnNamestatic 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 NamegetColumnSQL
(boolean nullForUI) getColumnSQL
(boolean nullForUI, boolean nullForSearch) 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) Get the foreign table name that relates to this column when the column is multi selectionstatic DatabaseKey
getPrimaryKey
(DatabaseMetaData md, String primaryTableName) Get the foreign table name that relates to this columnGet SQL Add commandGet SQL Data TypeGet SQL DDLgetSQLModify
(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
Is Advancedboolean
Is the Column Encrypted?boolean
Is Standard Columnstatic boolean
isSuggestSelectionColumn
(String columnName, boolean caseSensitive) boolean
Is UUID Columnboolean
Is Virtual Columnboolean
Is Virtual DB Columnboolean
Is Virtual Search Columnboolean
Is Virtual UI Columnmark PO as immutablerenameDBColumn
(String newColumnName) void
setIsEncrypted
(boolean IsEncrypted) Set Encryptedvoid
Set default values for new columntoString()
String RepresentationMethods 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_InfoWindow, getAD_InfoWindow_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, getAlwaysUpdatableLogic, getCallout, getColumnName, getColumnSQL, getDefaultValue, getDescription, getEntityType, getFieldLength, getFKConstraintMsg, getFKConstraintMsg_ID, getFKConstraintName, getFKConstraintType, getFormatPattern, getHelp, getIsEncrypted, getIsSyncDatabase, getIsToolbarButton, getKeyNamePair, getMandatoryLogic, getName, getPA_DashboardContent, getPA_DashboardContent_ID, getPartitioningMethod, getPlaceholder, getRangePartitionInterval, getReadOnlyLogic, getSeqNo, getSeqNoPartition, getSeqNoSelection, getValueMax, getValueMin, getVersion, getVFormat, initPO, isAllowCopy, isAllowLogging, isAlwaysUpdateable, isAutocomplete, isHtml, isIdentifier, isKey, isMandatory, isParent, isPartitionKey, isSecure, isSelectionColumn, isTranslated, isUpdateable, setAD_Chart_ID, setAD_Column_ID, setAD_Column_UU, setAD_Element_ID, setAD_InfoWindow_ID, setAD_Process_ID, setAD_Reference_ID, setAD_Reference_Value_ID, setAD_Table_ID, setAD_Val_Rule_ID, setAD_Val_Rule_Lookup_ID, setAlwaysUpdatableLogic, setCallout, setColumnName, setColumnSQL, setDefaultValue, setDescription, setEntityType, setFieldLength, setFKConstraintMsg_ID, setFKConstraintName, setFKConstraintType, setFormatPattern, setHelp, setIsAllowCopy, setIsAllowLogging, setIsAlwaysUpdateable, setIsAutocomplete, setIsEncrypted, setIsHtml, setIsIdentifier, setIsKey, setIsMandatory, setIsParent, setIsPartitionKey, setIsSecure, setIsSelectionColumn, setIsSyncDatabase, setIsToolbarButton, setIsTranslated, setIsUpdateable, setMandatoryLogic, setName, setPA_DashboardContent_ID, setPartitioningMethod, setPlaceholder, setRangePartitionInterval, setReadOnlyLogic, setSeqNo, setSeqNoPartition, setSeqNoSelection, setValueMax, setValueMin, setVersion, setVFormat
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, 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_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, 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, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, 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, toInsertSQL, 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
-
Field Details
-
VIRTUAL_SEARCH_COLUMN_PREFIX
- See Also:
-
VIRTUAL_UI_COLUMN_PREFIX
- See Also:
-
-
Constructor Details
-
MColumn
UUID based Constructor- Parameters:
ctx
- ContextAD_Column_UU
- UUID keytrxName
- Transaction
-
MColumn
Standard Constructor- Parameters:
ctx
- contextAD_Column_ID
-trxName
- transaction
-
MColumn
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MColumn
Parent Constructor- Parameters:
parent
- table
-
MColumn
Copy constructor- Parameters:
copy
-
-
MColumn
Copy constructor- Parameters:
ctx
-copy
-
-
MColumn
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
get
Get MColumn from Cache (immutable)- Parameters:
AD_Column_ID
- id- Returns:
- MColumn
-
get
Get MColumn from Cache (immutable)- Parameters:
ctx
- contextAD_Column_ID
- id- Returns:
- MColumn
-
get
Get MColumn from Cache (immutable)- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- trx- Returns:
- MColumn
-
getCopy
Get updateable copy of MColumn from cache- Parameters:
ctx
-AD_Column_ID
-trxName
-- Returns:
- MColumn
-
get
Get MColumn given TableName and ColumnName- Parameters:
ctx
- contexttableName
-columnName
-- Returns:
- MColumn
-
get
Get MColumn given TableName and ColumnName- Parameters:
ctx
- contexttableName
-columnName
-trxName
-- Returns:
- MColumn
-
getColumnName
- Parameters:
ctx
-AD_Column_ID
-- Returns:
- Column name or null
-
getColumnName
Get Column Name- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- transaction- Returns:
- Column Name or null
-
isStandardColumn
public boolean isStandardColumn()Is Standard Column- Returns:
- true if this column is one of the 8 standard column that should exists in every table.
- AD_Client_ID, AD_Org_ID, IsActive, Created, Created By, Updated, Updated By or Processing
-
isUUIDColumn
public boolean isUUIDColumn()Is UUID Column- Returns:
- true for UUID column
-
isVirtualColumn
public boolean isVirtualColumn()Is Virtual Column- Returns:
- true if virtual column (using column SQL)
-
isVirtualDBColumn
public boolean isVirtualDBColumn()Is Virtual DB Column- Returns:
- true if virtual DB column (using column SQL and is not using @SQL= or @SQLFIND=)
-
isVirtualUIColumn
public boolean isVirtualUIColumn()Is Virtual UI Column- Returns:
- true if virtual UI column (using column SQL that starts with @SQL=)
-
isVirtualSearchColumn
public boolean isVirtualSearchColumn()Is Virtual Search Column- Returns:
- true if virtual search column (using column SQL that starts with @SQLFIND=)
-
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) Description copied from class:PO
Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- true if it is a new record- Returns:
- true if record can be saved
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success) Description copied from class:PO
Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it. -
getSQLAdd
Get SQL Add command- Parameters:
table
- table- Returns:
- SQL to add new column
-
getSQLDDL
Get SQL DDL- Returns:
- DDL for column
-
getSQLModify
Get SQL Modify command- Parameters:
table
- tablesetNullOption
- generate null / not null statement- Returns:
- SQL to modify existing column
-
getSQLDataType
Get SQL Data Type- Returns:
- SQL data type (e.g. NVARCHAR2(60))
-
getConstraint
Get Table Constraint- Parameters:
tableName
- table name- Returns:
- table constraint clause
-
toString
String Representation- Overrides:
toString
in classX_AD_Column
- Returns:
- info
-
getColumn_ID
get Column ID- Parameters:
TableName
-columnName
-- Returns:
- AD_Column_ID
-
getTable_ID
Get Table Id for a column- Parameters:
ctx
- contextAD_Column_ID
- idtrxName
- transaction- Returns:
- AD_Table_ID
-
isSuggestSelectionColumn
- Parameters:
columnName
-caseSensitive
-- Returns:
- true if column should be included as selection column
-
getMultiReferenceTableName
Get the foreign table name that relates to this column when the column is multi selection- Returns:
- foreign table name or null
-
getReferenceTableName
Get the foreign table name that relates to this column- Returns:
- foreign table name or null
-
setSmartDefaults
public void setSmartDefaults()Set default values for new column -
getAD_Table
- 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 - Parameters:
md
-catalog
-schema
-tableName
-table
-column
-isNoTable
-- Returns:
- SQL to add or replace foreign key constraint
- Throws:
Exception
-
getPrimaryKey
public static DatabaseKey getPrimaryKey(DatabaseMetaData md, String primaryTableName) throws Exception - Parameters:
md
-primaryTableName
-- Returns:
- primary key
- Throws:
Exception
-
getForeignKeyConstraint
public static String getForeignKeyConstraint(DatabaseMetaData md, MTable table, MColumn column) throws Exception - Parameters:
md
-table
-column
-- Returns:
- Foreign key constraint clause
- 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
- Parameters:
nullForUI
- true to return the string "NULL" for @SQL=- Returns:
- column SQL (without the @SQL= or @SQLFIND= prefix) or null
-
getColumnSQL
- Parameters:
nullForUI
- true to return the string "NULL" for @SQL=nullForSearch
- true to return the string "NULL" for @SQLFIND=- Returns:
- column SQL (without the @SQL= or @SQLFIND= prefix) or null
-
renameDBColumn
- Parameters:
newColumnName
-- Returns:
- new column name + " - " + SQL executed to rename column
-
markImmutable
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-