Class MSequence

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

public class MSequence extends X_AD_Sequence
Sequence Model.
Version:
$Id: MSequence.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Field Details

  • Constructor Details

    • MSequence

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

      public MSequence(Properties ctx, int AD_Sequence_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      AD_Sequence_ID - id
      trxName - transaction
    • MSequence

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

      public MSequence(Properties ctx, int AD_Client_ID, String tableName, String trxName)
      New Document Sequence Constructor
      Parameters:
      ctx - context
      AD_Client_ID - owner
      tableName - name
      trxName - transaction
    • MSequence

      public MSequence(Properties ctx, int AD_Client_ID, String sequenceName, int StartNo, String trxName)
      New Document Sequence Constructor
      Parameters:
      ctx - context
      AD_Client_ID - owner
      sequenceName - name
      StartNo - start
      trxName - trx
  • Method Details

    • getNextID

      public static int getNextID(int AD_Client_ID, String TableName)
      Parameters:
      AD_Client_ID -
      TableName -
      Returns:
      next id from table id sequence
    • getNextID

      public static int getNextID(int AD_Client_ID, String TableName, String trxName)
      Get next number from table id sequence
      Parameters:
      AD_Client_ID - client
      TableName - table name
      trxName -
      Returns:
      next id or (-1=not found, -2=error)
    • getDocumentNo

      public static String getDocumentNo(int AD_Client_ID, String TableName, String trxName)
      Get next Document No for table
      Parameters:
      AD_Client_ID - client
      TableName - table name
      trxName - optional Transaction Name
      Returns:
      document no or null
    • getDocumentNo

      public static String getDocumentNo(int AD_Client_ID, String TableName, String trxName, PO po)
      Get next Document No for table (when the document doesn't have a c_doctype)
      Parameters:
      AD_Client_ID - client
      TableName - table name
      trxName - optional Transaction Name
      po - - used to get the date, org and parse context variables
      Returns:
      document no or null
    • getDocumentNoFromSeq

      public static String getDocumentNoFromSeq(MSequence seq, String trxName, PO po)
      Get next document no from sequence
      Parameters:
      seq -
      trxName -
      po -
      Returns:
      document no or null
    • getDocumentNo

      @Deprecated public static String getDocumentNo(int C_DocType_ID, String trxName)
      Deprecated.
      Get Document No based on Document Type
      Parameters:
      C_DocType_ID - document type
      trxName - optional Transaction Name
      Returns:
      document no or null
    • getDocumentNo

      public static String getDocumentNo(int C_DocType_ID, String trxName, boolean definite)
      Get next Document No based on Document Type
      Parameters:
      C_DocType_ID - document type
      trxName - optional Transaction Name
      definite - asking for a definitive or temporary sequence
      Returns:
      document no or null
    • getDocumentNo

      public static String getDocumentNo(int C_DocType_ID, String trxName, boolean definite, PO po)
      Get next Document No based on Document Type
      Parameters:
      C_DocType_ID - document type
      trxName - optional Transaction Name
      definite - asking for a definitive or temporary sequence
      po -
      Returns:
      document no or null
    • checkClientSequences

      public static boolean checkClientSequences(Properties ctx, int AD_Client_ID, String trxName)
      Check/Initialize Client DocumentNo/Value Sequences
      Parameters:
      ctx - context
      AD_Client_ID - client
      trxName - transaction
      Returns:
      true if no error
    • createTableSequence

      public static boolean createTableSequence(Properties ctx, String TableName, String trxName)
      Create Table ID Sequence
      Parameters:
      ctx -
      TableName -
      trxName -
      Returns:
      true if created
    • createTableSequence

      public static boolean createTableSequence(Properties ctx, String TableName, String trxName, boolean tableID)
      Create Table Sequence
      Parameters:
      ctx - context
      TableName - table name
      trxName - transaction
      tableID - true for table id sequence, false for documentno/value sequence
      Returns:
      true if created
    • get

      public static MSequence get(Properties ctx, String tableName)
      Get Sequence
      Parameters:
      ctx - context
      tableName - table name
      Returns:
      Sequence
    • get

      public static MSequence get(Properties ctx, String tableName, String trxName)
      Get the tableID sequence based on the TableName
      Parameters:
      ctx -
      tableName -
      trxName -
      Returns:
      sequence
    • get

      public static MSequence get(Properties ctx, String tableName, String trxName, boolean tableID)
      Get Sequence
      Parameters:
      ctx - context
      tableName - table name
      trxName - optional transaction name
      tableID - IsTableID flag
      Returns:
      Sequence
    • getNextID

      @Deprecated public int getNextID()
      Deprecated.
      use the static getNextID or getDocumentNo method instead
      Get Next No and increase current next
      Returns:
      next no to use
    • validateTableIDValue

      public String validateTableIDValue()
      Validate Table Sequence Values
      Returns:
      info
    • validateTableIDValue

      public String validateTableIDValue(String trxName)
      Validate Table Sequence Values trxName the Transaction
      Returns:
      info
    • getCurrentNext

      public int getCurrentNext()
      Description copied from class: X_AD_Sequence
      Get Current Next.
      Specified by:
      getCurrentNext in interface I_AD_Sequence
      Overrides:
      getCurrentNext in class X_AD_Sequence
      Returns:
      The next number to be used
    • setCurrentNext

      public void setCurrentNext(int CurrentNext)
      Description copied from class: X_AD_Sequence
      Set Current Next.
      Specified by:
      setCurrentNext in interface I_AD_Sequence
      Overrides:
      setCurrentNext in class X_AD_Sequence
      Parameters:
      CurrentNext - The next number to be used
    • getNextOfficialID_HTTP

      public static int getNextOfficialID_HTTP(String TableName)
      Get next official id through http call
      Parameters:
      TableName - table name
      Returns:
      next official id or (-1=error)
    • getNextProjectID_HTTP

      public static int getNextProjectID_HTTP(String TableName)
      Get next centralized id through http call
      Parameters:
      TableName - table name
      Returns:
      next centralized id or (-1=error)
    • isExceptionCentralized

      public static boolean isExceptionCentralized(String tableName)
      Parameters:
      tableName -
      Returns:
      true if centralized id shouldn't be used for tableName
    • isTableWithEntityType

      public static boolean isTableWithEntityType(String tableName)
      Parameters:
      tableName -
      Returns:
      true if table has entity type column
    • beforeSave

      protected boolean beforeSave(boolean newRecord)
      Description copied from class: PO
      Called before Save for Pre-Save Operation
      Overrides:
      beforeSave in class PO
      Parameters:
      newRecord - new record
      Returns:
      true if record can be saved
    • getPreliminaryNo

      public static String getPreliminaryNo(GridTab tab, int AD_Sequence_ID)
      Get preliminary document no by year
      Parameters:
      tab -
      AD_Sequence_ID -
      Returns:
      Preliminary document no
    • getOrgColumn

      public String getOrgColumn()
      Description copied from class: X_AD_Sequence
      Get Org Column.
      Specified by:
      getOrgColumn in interface I_AD_Sequence
      Overrides:
      getOrgColumn in class X_AD_Sequence
      Returns:
      Fully qualified Organization column (AD_Org_ID)