Class MColumn

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_Column, I_Persistent, Evaluatee, ImmutablePOSupport

public class MColumn extends X_AD_Column implements ImmutablePOSupport
Column Model
Version:
$Id: MColumn.java,v 1.6 2006/08/09 05:23:49 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Field Details

  • Constructor Details

    • MColumn

      public MColumn(Properties ctx, String AD_Column_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      AD_Column_UU - UUID key
      trxName - Transaction
    • MColumn

      public MColumn(Properties ctx, int AD_Column_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      AD_Column_ID -
      trxName - transaction
    • MColumn

      public MColumn(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - context
      rs - result set
      trxName - transaction
    • MColumn

      public MColumn(MTable parent)
      Parent Constructor
      Parameters:
      parent - table
    • MColumn

      public MColumn(MColumn copy)
      Copy constructor
      Parameters:
      copy -
    • MColumn

      public MColumn(Properties ctx, MColumn copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MColumn

      public MColumn(Properties ctx, MColumn copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • 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 - context
      AD_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 - context
      AD_Column_ID - id
      trxName - 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 - context
      tableName -
      columnName -
      Returns:
      MColumn
    • get

      public static MColumn get(Properties ctx, String tableName, String columnName, String trxName)
      Get MColumn given TableName and ColumnName
      Parameters:
      ctx - context
      tableName -
      columnName -
      trxName -
      Returns:
      MColumn
    • getColumnName

      public static String getColumnName(Properties ctx, int AD_Column_ID)
      Parameters:
      ctx -
      AD_Column_ID -
      Returns:
      Column name or null
    • getColumnName

      public static String getColumnName(Properties ctx, int AD_Column_ID, String trxName)
      Get Column Name
      Parameters:
      ctx - context
      AD_Column_ID - id
      trxName - 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)
      Before Save
      Overrides:
      beforeSave in class PO
      Parameters:
      newRecord - new
      Returns:
      true
    • afterSave

      protected boolean afterSave(boolean newRecord, boolean success)
      After Save
      Overrides:
      afterSave in class PO
      Parameters:
      newRecord - new
      success - success
      Returns:
      success
    • getSQLAdd

      public String getSQLAdd(MTable table)
      Get SQL Add command
      Parameters:
      table - table
      Returns:
      SQL to add new column
    • getSQLDDL

      public String getSQLDDL()
      Get SQL DDL
      Returns:
      DDL for column
    • getSQLModify

      public String getSQLModify(MTable table, boolean setNullOption)
      Get SQL Modify command
      Parameters:
      table - table
      setNullOption - generate null / not null statement
      Returns:
      SQL to modify existing column
    • getSQLDataType

      public String getSQLDataType()
      Get SQL Data Type
      Returns:
      SQL data type (e.g. NVARCHAR2(60))
    • getConstraint

      public String getConstraint(String tableName)
      Get Table Constraint
      Parameters:
      tableName - table name
      Returns:
      table constraint clause
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class X_AD_Column
      Returns:
      info
    • getColumn_ID

      public static int getColumn_ID(String TableName, String columnName)
      get Column ID
      Parameters:
      TableName -
      columnName -
      Returns:
      AD_Column_ID
    • getTable_ID

      public static int getTable_ID(Properties ctx, int AD_Column_ID, String trxName)
      Get Table Id for a column
      Parameters:
      ctx - context
      AD_Column_ID - id
      trxName - transaction
      Returns:
      AD_Table_ID
    • isSuggestSelectionColumn

      public static boolean isSuggestSelectionColumn(String columnName, boolean caseSensitive)
      Parameters:
      columnName -
      caseSensitive -
      Returns:
      true if column should be included as selection column
    • getMultiReferenceTableName

      public String getMultiReferenceTableName()
      Get the foreign table name that relates to this column when the column is multi selection
      Returns:
      foreign table name or null
    • getReferenceTableName

      public String 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

      public I_AD_Table getAD_Table() throws RuntimeException
      Specified by:
      getAD_Table in interface I_AD_Column
      Overrides:
      getAD_Table in class X_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

      public String getColumnSQL(boolean nullForUI)
      Parameters:
      nullForUI - true to return the string "NULL" for @SQL=
      Returns:
      column SQL (without the @SQL= or @SQLFIND= prefix) or null
    • getColumnSQL

      public String getColumnSQL(boolean nullForUI, boolean nullForSearch)
      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

      public String renameDBColumn(String newColumnName)
      Parameters:
      newColumnName -
      Returns:
      new column name + " - " + SQL executed to rename column
    • markImmutable

      public MColumn markImmutable()
      Description copied from interface: ImmutablePOSupport
      mark PO as immutable
      Specified by:
      markImmutable in interface ImmutablePOSupport
      Returns:
      PO