Class PO

    • Field Detail

      • ENTITYTYPE_UserMaintained

        public static final String ENTITYTYPE_UserMaintained
        User Maintained Entity Type
        See Also:
        Constant Field Values
      • ENTITYTYPE_Dictionary

        public static final String ENTITYTYPE_Dictionary
        Dictionary Maintained Entity Type
        See Also:
        Constant Field Values
      • log

        protected transient CLogger log
        Logger
      • p_ctx

        protected transient Properties p_ctx
        Context
      • p_info

        protected transient volatile POInfo p_info
        Model Info
      • I_ZERO

        protected static final Integer I_ZERO
        Zero Integer
      • ACCESSLEVEL_SYSTEM

        public static final int ACCESSLEVEL_SYSTEM
        Access Level S__ 100 4 System info
        See Also:
        Constant Field Values
      • ACCESSLEVEL_CLIENT

        public static final int ACCESSLEVEL_CLIENT
        Access Level _C_ 010 2 Client info
        See Also:
        Constant Field Values
      • ACCESSLEVEL_ORG

        public static final int ACCESSLEVEL_ORG
        Access Level __O 001 1 Organization info
        See Also:
        Constant Field Values
      • ACCESSLEVEL_ALL

        public static final int ACCESSLEVEL_ALL
        Access Level SCO 111 7 System shared info
        See Also:
        Constant Field Values
      • ACCESSLEVEL_SYSTEMCLIENT

        public static final int ACCESSLEVEL_SYSTEMCLIENT
        Access Level SC_ 110 6 System/Client info
        See Also:
        Constant Field Values
      • ACCESSLEVEL_CLIENTORG

        public static final int ACCESSLEVEL_CLIENTORG
        Access Level _CO 011 3 Client shared info
        See Also:
        Constant Field Values
      • XML_ATTRIBUTE_AD_Table_ID

        protected static final String XML_ATTRIBUTE_AD_Table_ID
        Table ID Attribute
        See Also:
        Constant Field Values
    • Constructor Detail

      • PO

        public PO​(Properties ctx)
        Create New Persistent Object
        Parameters:
        ctx - context
      • PO

        public PO​(Properties ctx,
                  int ID,
                  String trxName)
        Create and Load existing Persistent Object
        Parameters:
        ID - The unique ID of the object
        ctx - context
        trxName - transaction name
      • PO

        public PO​(Properties ctx,
                  ResultSet rs,
                  String trxName)
        Create and Load existing Persistent Object.
        Parameters:
        ctx - context
        rs - optional - load from current result set position (no navigation, not closed) if null, a new record is created.
        trxName - transaction name
      • PO

        public PO​(Properties ctx,
                  int ID,
                  String trxName,
                  ResultSet rs)
        Create and Load existing Persistent Object.
          You load
                        - an existing single key record with    new PO (ctx, Record_ID)
                                or                                                                      new PO (ctx, Record_ID, trxName)
                                or                                                                      new PO (ctx, rs, get_TrxName())
                        - a new single key record with                  new PO (ctx, 0)
                        - an existing multi key record with             new PO (ctx, rs, get_TrxName())
                        - a new multi key record with                   new PO (ctx, null)
          The ID for new single key records is created automatically,
          you need to set the IDs for multi-key records explicitly.
                
        Parameters:
        ctx - context
        ID - the ID if 0, the record defaults are applied - ignored if re exists
        trxName - transaction name
        rs - optional - load from current result set position (no navigation, not closed)
      • PO

        public PO​(Properties ctx,
                  PO source,
                  int AD_Client_ID,
                  int AD_Org_ID)
        Create New PO by Copying existing (key not copied).
        Parameters:
        ctx - context
        source - source object
        AD_Client_ID - client
        AD_Org_ID - org
    • Method Detail

      • setDocWorkflowMgr

        public static void setDocWorkflowMgr​(DocWorkflowMgr docWFMgr)
        Set Document Value Workflow Manager
        Parameters:
        docWFMgr - mgr
      • copyPO

        protected void copyPO​(PO copy)
        Copy all properties from copy. Method to help the implementation of copy constructor.
        Parameters:
        copy -
      • initPO

        protected abstract POInfo initPO​(Properties ctx)
        Initialize and return PO_Info
        Parameters:
        ctx - context
        Returns:
        POInfo
      • get_AccessLevel

        protected abstract int get_AccessLevel()
        Get Table Access Level
        Returns:
        Access Level
      • toString

        public String toString()
        String representation
        Overrides:
        toString in class Object
        Returns:
        String representation
      • equals

        public boolean equals​(Object cmp)
        Equals based on ID
        Specified by:
        equals in interface Comparator<Object>
        Overrides:
        equals in class Object
        Parameters:
        cmp - comparator
        Returns:
        true if ID the same
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • compare

        public int compare​(Object o1,
                           Object o2)
        Compare based on DocumentNo, Value, Name, Description
        Specified by:
        compare in interface Comparator<Object>
        Parameters:
        o1 - Object 1
        o2 - Object 2
        Returns:
        -1 if o1 < o2
      • get_TableName

        public String get_TableName()
        Get TableName.
        Returns:
        table name
      • get_KeyColumns

        public String[] get_KeyColumns()
        Get Key Columns.
        Returns:
        table name
      • get_Table_ID

        public int get_Table_ID()
        Get Table ID.
        Returns:
        table id
      • get_ID

        public int get_ID()
        Return Single Key Record ID
        Returns:
        ID or 0
      • get_IDOld

        public int get_IDOld()
        Return Deleted Single Key Record ID
        Returns:
        ID or 0
      • getCtx

        public Properties getCtx()
        Get Context
        Returns:
        context
      • get_Logger

        public CLogger get_Logger()
        Get Logger
        Returns:
        logger
      • get_Value

        public final Object get_Value​(int index)
        Get Value
        Parameters:
        index - index
        Returns:
        value
      • get_ValueAsInt

        public int get_ValueAsInt​(int index)
        Get Value as int
        Parameters:
        index - index
        Returns:
        int value or 0
      • get_Value

        public final Object get_Value​(String columnName)
        Get Value
        Parameters:
        columnName - column name
        Returns:
        value or null
      • get_ValueE

        protected final Object get_ValueE​(String columnName)
        Get Encrypted Value
        Parameters:
        columnName - column name
        Returns:
        value or null
      • get_ValueAsString

        public String get_ValueAsString​(String variableName)
        Get Column Value
        Specified by:
        get_ValueAsString in interface Evaluatee
        Parameters:
        variableName - name
        Returns:
        value or ""
      • get_ValueOfColumn

        public final Object get_ValueOfColumn​(int AD_Column_ID)
        Get Value of Column
        Parameters:
        AD_Column_ID - column
        Returns:
        value or null
      • get_ValueOld

        public final Object get_ValueOld​(int index)
        Get Old Value
        Parameters:
        index - index
        Returns:
        value
      • get_ValueOld

        public final Object get_ValueOld​(String columnName)
        Get Old Value
        Parameters:
        columnName - column name
        Returns:
        value or null
      • get_ValueOldAsInt

        public int get_ValueOldAsInt​(String columnName)
        Get Old Value as int
        Parameters:
        columnName - column name
        Returns:
        int value or 0
      • is_ValueChanged

        public final boolean is_ValueChanged​(int index)
        Is Value Changed
        Parameters:
        index - index
        Returns:
        true if changed
      • is_ValueChanged

        public final boolean is_ValueChanged​(String columnName)
        Is Value Changed
        Parameters:
        columnName - column name
        Returns:
        true if changed
      • get_ValueDifference

        public final Object get_ValueDifference​(int index)
        Return new - old. - New Value if Old Value is null - New Value - Old Value if Number - otherwise null
        Parameters:
        index - index
        Returns:
        new - old or null if not appropriate or not changed
      • get_ValueDifference

        public final Object get_ValueDifference​(String columnName)
        Return new - old. - New Value if Old Value is null - New Value - Old Value if Number - otherwise null
        Parameters:
        columnName - column name
        Returns:
        new - old or null if not appropriate or not changed
      • set_Value

        protected final boolean set_Value​(String ColumnName,
                                          Object value)
        Set Value
        Parameters:
        ColumnName - column name
        value - value
        Returns:
        true if value set
      • set_Value

        protected final boolean set_Value​(String ColumnName,
                                          Object value,
                                          boolean checkWritable)
        Set Value
        Parameters:
        ColumnName - column name
        value - value
        checkWritable -
        Returns:
        true if value set
      • set_ValueE

        protected final boolean set_ValueE​(String ColumnName,
                                           Object value)
        Set Encrypted Value
        Parameters:
        ColumnName - column name
        value - value
        Returns:
        true if value set
      • set_Value

        protected final boolean set_Value​(int index,
                                          Object value)
        Set Value if updateable and correct class. (and to NULL if not mandatory)
        Parameters:
        index - index
        value - value
        Returns:
        true if value set
      • set_Value

        protected final boolean set_Value​(int index,
                                          Object value,
                                          boolean checkWritable)
        Set Value if updateable and correct class. (and to NULL if not mandatory)
        Parameters:
        index - index
        value - value
        checkWritable -
        Returns:
        true if value set
      • setProcessedOn

        public void setProcessedOn​(String ColumnName,
                                   Object value,
                                   Object oldValue)
      • set_ValueNoCheck

        public final boolean set_ValueNoCheck​(String ColumnName,
                                              Object value)
        Set Value w/o check (update, r/o, ..). Used when Column is R/O Required for key and parent values
        Parameters:
        ColumnName - column name
        value - value
        Returns:
        true if value set
      • set_ValueNoCheckE

        protected final boolean set_ValueNoCheckE​(String ColumnName,
                                                  Object value)
        Set Encrypted Value w/o check (update, r/o, ..). Used when Column is R/O Required for key and parent values
        Parameters:
        ColumnName - column name
        value - value
        Returns:
        true if value set
      • set_ValueOfColumn

        public final void set_ValueOfColumn​(String columnName,
                                            Object value)
        Set value of Column
        Parameters:
        columnName -
        value -
      • set_ValueOfColumnReturningBoolean

        public final boolean set_ValueOfColumnReturningBoolean​(String columnName,
                                                               Object value)
        Set value of Column returning boolean
        Parameters:
        columnName -
        value -
      • set_ValueOfColumn

        public final void set_ValueOfColumn​(int AD_Column_ID,
                                            Object value)
        Set Value of Column
        Parameters:
        AD_Column_ID - column
        value - value
      • set_ValueOfColumnReturningBoolean

        public final boolean set_ValueOfColumnReturningBoolean​(int AD_Column_ID,
                                                               Object value)
        Set Value of Column
        Parameters:
        AD_Column_ID - column
        value - value
      • set_CustomColumn

        public final void set_CustomColumn​(String columnName,
                                           Object value)
        Set Custom Column
        Parameters:
        columnName - column
        value - value
      • set_CustomColumnReturningBoolean

        public final boolean set_CustomColumnReturningBoolean​(String columnName,
                                                              Object value)
        Set Custom Column returning boolean
        Parameters:
        columnName - column
        value - value
      • get_ColumnCount

        public int get_ColumnCount()
        Get Column Count
        Returns:
        column count
      • get_ColumnName

        public String get_ColumnName​(int index)
        Get Column Name
        Parameters:
        index - index
        Returns:
        ColumnName
      • get_ColumnLabel

        protected String get_ColumnLabel​(int index)
        Get Column Label
        Parameters:
        index - index
        Returns:
        Column Label
      • get_ColumnDescription

        protected String get_ColumnDescription​(int index)
        Get Column Description
        Parameters:
        index - index
        Returns:
        column description
      • isColumnMandatory

        protected boolean isColumnMandatory​(int index)
        Is Column Mandatory
        Parameters:
        index - index
        Returns:
        true if column mandatory
      • isColumnUpdateable

        protected boolean isColumnUpdateable​(int index)
        Is Column Updateable
        Parameters:
        index - index
        Returns:
        true if column updateable
      • set_ColumnUpdateable

        protected void set_ColumnUpdateable​(int index,
                                            boolean updateable)
        Set Column Updateable
        Parameters:
        index - index
        updateable - column updateable
      • setUpdateable

        protected void setUpdateable​(boolean updateable)
        Set all columns updateable
        Parameters:
        updateable - updateable
      • get_ColumnDisplayType

        protected int get_ColumnDisplayType​(int index)
        Get Column DisplayType
        Parameters:
        index - index
        Returns:
        display type
      • get_ColumnLookup

        protected Lookup get_ColumnLookup​(int index)
        Get Lookup
        Parameters:
        index - index
        Returns:
        Lookup or null
      • get_ColumnIndex

        public final int get_ColumnIndex​(String columnName)
        Get Column Index
        Parameters:
        columnName - column name
        Returns:
        index of column with ColumnName or -1 if not found
      • get_DisplayValue

        public String get_DisplayValue​(String columnName,
                                       boolean currentValue)
        Get Display Value of value
        Parameters:
        columnName - columnName
        currentValue - current value
        Returns:
        String value with "./." as null
      • copyValues

        protected static void copyValues​(PO from,
                                         PO to,
                                         int AD_Client_ID,
                                         int AD_Org_ID)
        Copy old values of From to new values of To. Does not copy Keys
        Parameters:
        from - old, existing and unchanged PO
        to - new, not saved PO
        AD_Client_ID - client
        AD_Org_ID - org
      • copyValues

        public static void copyValues​(PO from,
                                      PO to)
        Copy old values of From to new values of To. Does not copy Keys and AD_Client_ID/AD_Org_ID
        Parameters:
        from - old, existing and unchanged PO
        to - new, not saved PO
      • load

        protected void load​(int ID,
                            String trxName)
        Load record with ID
        Parameters:
        ID - ID
        trxName - transaction name
      • loadByUU

        public void loadByUU​(String uuID,
                             String trxName)
        Load record with UUID
        Parameters:
        uuID - UUID
        trxName - transaction name
      • load

        public boolean load​(String trxName)
        (re)Load record with m_ID[*]
        Parameters:
        trxName - transaction
        Returns:
        true if loaded
      • load

        protected boolean load​(String uuID,
                               String trxName)
        (re)Load record with uuID
        Parameters:
        uuID - RecrodUU
        trxName - transaction
        Returns:
        true if loaded
      • load

        protected boolean load​(ResultSet rs)
        Load from the current position of a ResultSet
        Parameters:
        rs - result set
        Returns:
        true if loaded
      • load

        protected boolean load​(HashMap<String,​String> hmIn)
        Load from HashMap
        Parameters:
        hmIn - hash map
        Returns:
        true if loaded
      • checkImmutable

        protected void checkImmutable()
      • get_HashMap

        protected HashMap<String,​String> get_HashMap()
        Create Hashmap with data as Strings
        Returns:
        HashMap
      • loadSpecial

        protected Object loadSpecial​(ResultSet rs,
                                     int index)
                              throws SQLException
        Load Special data (images, ..). To be extended by sub-classes
        Parameters:
        rs - result set
        index - zero based index
        Returns:
        value value
        Throws:
        SQLException
      • loadComplete

        protected void loadComplete​(boolean success)
        Load is complete
        Parameters:
        success - success To be extended by sub-classes
      • loadDefaults

        protected void loadDefaults()
        Load Defaults
      • setStandardDefaults

        protected void setStandardDefaults()
        Set Default values. Client, Org, Created/Updated, *By, IsActive
      • isMandatoryOK

        protected boolean isMandatoryOK()
        Are all mandatory Fields filled (i.e. can we save)?. Stops at first null mandatory field
        Returns:
        true if all mandatory fields are ok
      • setAD_Client_ID

        protected final void setAD_Client_ID​(int AD_Client_ID)
        Set AD_Client
        Parameters:
        AD_Client_ID - client
      • getAD_Client_ID

        public final int getAD_Client_ID()
        Get AD_Client
        Returns:
        AD_Client_ID
      • setAD_Org_ID

        public final void setAD_Org_ID​(int AD_Org_ID)
        Set AD_Org
        Parameters:
        AD_Org_ID - org
      • getAD_Org_ID

        public int getAD_Org_ID()
        Get AD_Org
        Returns:
        AD_Org_ID
      • setClientOrg

        protected void setClientOrg​(int AD_Client_ID,
                                    int AD_Org_ID)
        Overwrite Client Org if different
        Parameters:
        AD_Client_ID - client
        AD_Org_ID - org
      • setClientOrg

        protected void setClientOrg​(PO po)
        Overwrite Client Org if different
        Parameters:
        po - persistent object
      • setIsActive

        public final void setIsActive​(boolean active)
        Set Active
        Parameters:
        active - active
      • isActive

        public final boolean isActive()
        Is Active
        Returns:
        is active
      • getCreated

        public final Timestamp getCreated()
        Get Created
        Returns:
        created
      • getUpdated

        public final Timestamp getUpdated()
        Get Updated
        Returns:
        updated
      • getCreatedBy

        public final int getCreatedBy()
        Get CreatedBy
        Returns:
        AD_User_ID
      • getUpdatedBy

        public final int getUpdatedBy()
        Get UpdatedBy
        Returns:
        AD_User_ID
      • setUpdatedBy

        protected final void setUpdatedBy​(int AD_User_ID)
        Set UpdatedBy
        Parameters:
        AD_User_ID - user
      • get_Translation

        public String get_Translation​(String columnName,
                                      String AD_Language)
      • get_Translation

        public String get_Translation​(String columnName,
                                      String AD_Language,
                                      boolean reload,
                                      boolean fallback)
        Get Translation of column (if needed). It checks if the base language is used or the column is not translated. If there is no translation then it fallback to original value.
        Parameters:
        columnName -
        AD_Language -
        reload - don't use cache, reload from DB
        fallback - fallback to base if no translation found
        Returns:
        translated string
        Throws:
        IllegalArgumentException - if columnName or AD_Language is null or model has multiple PK
      • get_Translation

        public String get_Translation​(String columnName)
        Get Translation of column
        Parameters:
        columnName -
      • get_Translation

        public String get_Translation​(String columnName,
                                      String AD_Language,
                                      boolean reload)
        Get Translation of column
        Parameters:
        columnName -
        AD_Language -
        reload - don't use cache, reload from DB
      • get_Translation

        public String get_Translation​(String columnName,
                                      boolean fallback)
        Get Translation of column
        Parameters:
        columnName -
        fallback - fallback to base if no translation found
        Returns:
        translation
      • is_new

        public boolean is_new()
        Is new record
        Returns:
        true if new
      • save

        public boolean save()
        Update Value or create new record. To reload call load() - not updated
        Returns:
        true if saved
      • save

        public boolean save​(String trxName)
        Update Value or create new record. To reload call load() - not updated
        Parameters:
        trxName - transaction
        Returns:
        true if saved
      • is_Changed

        public boolean is_Changed()
        Is there a Change to be saved?
        Returns:
        true if record changed
      • beforeSave

        protected boolean beforeSave​(boolean newRecord)
        Called before Save for Pre-Save Operation
        Parameters:
        newRecord - new record
        Returns:
        true if record can be saved
      • afterSave

        protected boolean afterSave​(boolean newRecord,
                                    boolean success)
        Called after Save for Post-Save Operation
        Parameters:
        newRecord - new record
        success - true if save operation was success
        Returns:
        if save was a success
      • saveUpdate

        protected boolean saveUpdate()
        Update Record directly
        Returns:
        true if updated
      • is_UseOptimisticLocking

        public boolean is_UseOptimisticLocking()
        Returns:
        true if optimistic locking is enable
      • set_UseOptimisticLocking

        public void set_UseOptimisticLocking​(boolean enable)
        enable/disable optimistic locking
        Parameters:
        enable -
      • get_OptimisticLockingColumns

        public String[] get_OptimisticLockingColumns()
        Returns:
        optimistic locking columns
      • set_OptimisticLockingColumns

        public void set_OptimisticLockingColumns​(String[] columns)
        set columns use for optimistic locking (auto add to where clause for update and delete)
        Parameters:
        columns -
      • saveNew_getID

        protected int saveNew_getID()
        Get ID for new record during save. You can overwrite this to explicitly set the ID
        Returns:
        ID to be used or 0 for default logic
      • saveNew_afterSetID

        protected void saveNew_afterSetID()
        Call after ID have been assigned for new record
      • get_WhereClause

        public String get_WhereClause​(boolean withValues)
        Create Single/Multi Key Where Clause
        Parameters:
        withValues - if true uses actual values otherwise ?
        Returns:
        where clause
      • get_WhereClause

        public String get_WhereClause​(boolean withValues,
                                      String uuID)
        Create Single/Multi Key Where Clause
        Parameters:
        withValues - if true uses actual values otherwise ?
        uuID - RecordUU
        Returns:
        where clause
      • saveNewSpecial

        protected String saveNewSpecial​(Object value,
                                        int index)
        Save Special Data. To be extended by sub-classes
        Parameters:
        value - value
        index - index
        Returns:
        SQL code for INSERT VALUES clause
      • delete

        public boolean delete​(boolean force)
        Delete Current Record
        Parameters:
        force - delete also processed records
        Returns:
        true if deleted
      • delete

        public boolean delete​(boolean force,
                              String trxName)
        Delete Current Record
        Parameters:
        force - delete also processed records
        trxName - transaction
        Returns:
        true if deleted
      • deleteEx

        public void deleteEx​(boolean force,
                             String trxName)
                      throws AdempiereException
        Delete Current Record
        Parameters:
        force - delete also processed records
        trxName - transaction
        Throws:
        AdempiereException
      • beforeDelete

        protected boolean beforeDelete()
        Executed before Delete operation.
        Returns:
        true if record can be deleted
      • afterDelete

        protected boolean afterDelete​(boolean success)
        Executed after Delete operation.
        Parameters:
        success - true if record deleted
        Returns:
        true if delete is a success
      • postDelete

        protected boolean postDelete()
        Executed after the Delete operation is committed in the database.
        Returns:
        true if post delete is a success
      • insert_Accounting

        protected boolean insert_Accounting​(String acctTableName,
                                            String acctBaseTable,
                                            String whereClause)
        Insert Accounting Records
        Parameters:
        acctTableName - accounting sub table
        acctBaseTable - acct table to get data from
        whereClause - optional where clause with alias "p" for acctBaseTable
        Returns:
        true if records inserted
      • delete_Accounting

        @Deprecated
        protected boolean delete_Accounting​(String acctTable)
        Deprecated.
        Delete Accounting records. NOP - done by database constraints
        Parameters:
        acctTable - accounting sub table
        Returns:
        true
      • insert_Tree

        protected boolean insert_Tree​(String treeType)
        Insert id data into Tree
        Parameters:
        treeType - MTree TREETYPE_*
        Returns:
        true if inserted
      • insert_Tree

        protected boolean insert_Tree​(String treeType,
                                      int C_Element_ID)
        Insert id data into Tree
        Parameters:
        treeType - MTree TREETYPE_*
        C_Element_ID - element for accounting element values
        Returns:
        true if inserted
      • update_Tree

        public void update_Tree​(String treeType)
        Update parent key and seqno based on value if the tree is driven by value
        Parameters:
        treeType - MTree TREETYPE_*
      • retrieveIdOfParentValue

        public static int retrieveIdOfParentValue​(String value,
                                                  String tableName,
                                                  int clientID,
                                                  String trxName)
        Returns the summary node with the corresponding value
      • retrieveIdOfParentValue

        public static int retrieveIdOfParentValue​(String value,
                                                  String tableName,
                                                  String linkCol,
                                                  int linkID,
                                                  int clientID,
                                                  String trxName)
      • delete_Tree

        protected boolean delete_Tree​(String treeType)
        Delete ID Tree Nodes
        Parameters:
        treeType - MTree TREETYPE_*
        Returns:
        true if deleted
      • lock

        public boolean lock()
        Lock it.
        Returns:
        true if locked
      • unlock

        public boolean unlock​(String trxName)
        UnLock it
        Parameters:
        trxName - transaction
        Returns:
        true if unlocked (false only if unlock fails)
      • set_TrxName

        public void set_TrxName​(String trxName)
        Set Trx
        Parameters:
        trxName - transaction
      • get_TrxName

        public String get_TrxName()
        Get Trx
        Returns:
        transaction
      • getAttachment

        public MAttachment getAttachment()
        Get Attachments. An attachment may have multiple entries
        Returns:
        Attachment or null
      • getAttachment

        public MAttachment getAttachment​(boolean requery)
        Get Attachments
        Parameters:
        requery - requery
        Returns:
        Attachment or null
      • createAttachment

        public MAttachment createAttachment()
        Create/return Attachment for PO. If not exist, create new
        Returns:
        attachment
      • isAttachment

        public boolean isAttachment​(String extension)
        Do we have a Attachment of type
        Parameters:
        extension - extension e.g. .pdf
        Returns:
        true if there is a attachment of type
      • getAttachmentData

        public byte[] getAttachmentData​(String extension)
        Get Attachment Data of type
        Parameters:
        extension - extension e.g. .pdf
        Returns:
        data or null
      • isPdfAttachment

        public boolean isPdfAttachment()
        Do we have a PDF Attachment
        Returns:
        true if there is a PDF attachment
      • getPdfAttachment

        public byte[] getPdfAttachment()
        Get PDF Attachment Data
        Returns:
        data or null
      • dump

        public void dump()
        Dump Record
      • dump

        public void dump​(int index)
        Dump column
        Parameters:
        index - index
      • getAllIDs

        public static int[] getAllIDs​(String TableName,
                                      String WhereClause,
                                      String trxName)
        Get All IDs of Table. Used for listing all Entities
        
        	 	int[] IDs = PO.getAllIDs ("AD_PrintFont", null);
        		for (int i = 0; i < IDs.length; i++)
        		{
        			pf = new MPrintFont(Env.getCtx(), IDs[i]);
        			System.out.println(IDs[i] + " = " + pf.getFont());
        		}
        	
        Parameters:
        TableName - table name (key column with _ID)
        WhereClause - optional where clause
        trxName - transaction
        Returns:
        array of IDs or null
      • getFindParameter

        protected static String getFindParameter​(String query)
        Get Find parameter. Convert to upper case and add % at the end
        Parameters:
        query - in string
        Returns:
        out string
      • get_xmlString

        public StringBuffer get_xmlString​(StringBuffer xml)
        Get Object xml representation as string
        Parameters:
        xml - optional string buffer
        Returns:
        updated/new string buffer header is only added once
      • get_xmlDocument

        public Document get_xmlDocument​(boolean noComment)
        Get XML Document representation
        Parameters:
        noComment - do not add comment
        Returns:
        XML document
      • setDoc

        public void setDoc​(Doc doc)
        Set the accounting document associated to the PO - for use in POST ModelValidator
        Parameters:
        doc - Document
      • setReplication

        public void setReplication​(boolean isFromReplication)
      • isReplication

        public boolean isReplication()
      • getDoc

        public Doc getDoc()
        Set the accounting document associated to the PO - for use in POST ModelValidator
        Returns:
        Doc Document
      • set_TrxName

        public static void set_TrxName​(PO[] lines,
                                       String trxName)
        PO.setTrxName - set given trxName to an array of POs As suggested by teo in [ 1854603 ]
      • get_ValueAsInt

        public int get_ValueAsInt​(String columnName)
        Get Integer Value
        Parameters:
        columnName -
        Returns:
        int value
      • get_ValueAsBoolean

        public boolean get_ValueAsBoolean​(String columnName)
        Get value as Boolean
        Parameters:
        columnName -
        Returns:
        boolean value
      • getUUIDColumnName

        public String getUUIDColumnName()
        Returns:
        uuid column name
      • getUUIDColumnName

        public static String getUUIDColumnName​(String tableName)
        Parameters:
        tableName -
        Returns:
        uuid column name
      • set_Attribute

        public void set_Attribute​(String attributeName,
                                  Object value)
        set attribute value
        Parameters:
        attributeName -
        value -
      • get_Attribute

        public Object get_Attribute​(String attributeName)
        Parameters:
        attributeName -
        Returns:
        attribute value
      • get_Attributes

        public HashMap<String,​Object> get_Attributes()
        Returns:
        map of attributes
      • makeImmutable

        protected void makeImmutable()
        Turn on immutable check
      • is_Immutable

        public boolean is_Immutable()
        Returns:
        true if PO is immutable, false otherwise
      • setCrossTenantSafe

        public static void setCrossTenantSafe()
      • clearCrossTenantSafe

        public static void clearCrossTenantSafe()
      • validForeignKeys

        public boolean validForeignKeys()
        Validate Foreign keys for cross tenant to be called programmatically before saving in programs that can receive arbitrary values in IDs This is an expensive operation in terms of database, use it wisely TODO: there is huge room for performance improvement, for example: - caching the valid values found on foreign tables - caching the column ID of the foreign column - caching the systemAccess
        Returns:
        true if all the foreign keys are valid
      • columnExists

        public boolean columnExists​(String columnName,
                                    boolean throwException)
        Verify if a column exists
        Parameters:
        columnName -
        throwException - - must throw an exception when the column doesn't exist
        Returns:
      • columnExists

        public boolean columnExists​(String columnName)
        Verify if a column exists
        Parameters:
        columnName -
        Returns:
        boolean