Class MSequence

    • Constructor Detail

      • 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 Detail

      • getNextID

        public static int getNextID​(int AD_Client_ID,
                                    String TableName)
      • getNextID

        public static int getNextID​(int AD_Client_ID,
                                    String TableName,
                                    String trxName)
        Get next number for Key column = 0 is Error.
        Parameters:
        AD_Client_ID - client
        TableName - table name
        trxName -
        Returns:
        next no or (-1=not found, -2=error)
      • getDocumentNo

        public static String getDocumentNo​(int AD_Client_ID,
                                           String TableName,
                                           String trxName)
        Get Document No from 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 Document No from 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
      • getDocumentNo

        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 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 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)
      • createTableSequence

        public static boolean createTableSequence​(Properties ctx,
                                                  String TableName,
                                                  String trxName,
                                                  boolean tableID)
        Create Table ID Sequence
        Parameters:
        ctx - context
        TableName - table name
        trxName - transaction
        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,
                                    boolean tableID)
        Get Sequence
        Parameters:
        ctx - context
        tableName - table name
        trxName - optional transaction name
        tableID -
        Returns:
        Sequence
      • getNextID

        public int getNextID()
        Get Next No and increase current next
        Returns:
        next no to use
      • validateTableIDValue

        public String validateTableIDValue()
      • validateTableIDValue

        public String validateTableIDValue​(String trxName)
        Validate Table Sequence Values trxName the Transaction
        Returns:
        true if updated
      • main

        public static void main​(String[] args)
        Test
        Parameters:
        args - ignored
      • getNextOfficialID_HTTP

        public static int getNextOfficialID_HTTP​(String TableName)
        Get next number for Key column
        Parameters:
        TableName - table name
        Returns:
        next no or (-1=error)
      • getNextProjectID_HTTP

        public static int getNextProjectID_HTTP​(String TableName)
        Get next number for Key column
        Parameters:
        TableName - table name
        Returns:
        next no or (-1=error)
      • 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