Class MArchive

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

public class MArchive extends X_AD_Archive
Archive Model
Version:
$Id: MArchive.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Field Details

  • Constructor Details

    • MArchive

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

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

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

      public MArchive(Properties ctx, PrintInfo info, String trxName)
      Constructor
      Parameters:
      ctx - context
      info - print info
      trxName - transaction
  • Method Details

    • get

      public static MArchive[] get(Properties ctx, String whereClause)
      Get Archives
      Parameters:
      ctx - context
      whereClause - optional where clause (starting with AND)
      Returns:
      archives
    • get

      public static MArchive[] get(Properties ctx, String whereClause, String trxName)
      Get Archives
      Parameters:
      ctx - context
      whereClause - optional where clause (starting with AND)
      trxName - optional trx name
      Returns:
      archives
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class X_AD_Archive
      Returns:
      info
    • getBinaryData

      public byte[] getBinaryData()
      Get data as byte[] from storage provider
      Specified by:
      getBinaryData in interface I_AD_Archive
      Overrides:
      getBinaryData in class X_AD_Archive
      Returns:
      byte[] or null
    • getInputStream

      public InputStream getInputStream()
      Get Data as Input Stream
      Returns:
      input stream or null
    • setBinaryData

      public void setBinaryData(byte[] inflatedData)
      Save Binary Data through storage provider
      Specified by:
      setBinaryData in interface I_AD_Archive
      Overrides:
      setBinaryData in class X_AD_Archive
      Parameters:
      inflatedData - inflated data
    • getCreatedByName

      public String getCreatedByName()
      Get Created By (User) Name
      Returns:
      name
    • getArchivePathSnippet

      public String getArchivePathSnippet()
      Returns the archive path (snippet), containing client, org and archive id. The process, table and record id are only included when they are not null.
      Returns:
      archive path
    • getByteData

      public byte[] getByteData()
      Get byte data from BinaryData column. Usually, your code should call getBinaryData() instead (using provider).
      Returns:
      byte[]
    • setByteData

      public void setByteData(byte[] BinaryData)
      Store byte data to BinaryData column. Usually, your code should call setBinaryData() instead (using provider).
      Parameters:
      BinaryData -
    • 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 class PO
      Parameters:
      newRecord - true if it is a new record
      Returns:
      true if record can be saved
    • postDelete

      protected boolean postDelete()
      Ask provider to remove archive content
      Overrides:
      postDelete in class PO
      Returns:
      true if post delete is a success
    • saveNew_afterSetID

      protected void saveNew_afterSetID()
      Ask provider to flush buffer data (if any)
      Overrides:
      saveNew_afterSetID in class PO
    • setStorageProvider

      public void setStorageProvider(MStorageProvider p)
      Set Storage Provider. Also used temporarily for the migration of storage provider.
      Parameters:
      p - Storage provider
    • saveAsZip

      public File saveAsZip()
      Save the Archive as zip file, used by Pack Out when storage provider is not DB
      Returns:
      File - the temporary file
    • getReportAndDocumentCountByRecordId

      public static int[] getReportAndDocumentCountByRecordId(int AD_Table_ID, int Record_ID, String trxName)
      Get number of document and report archive by table and record id
      Parameters:
      AD_Table_ID -
      Record_ID -
      trxName -
      Returns:
      int[], [0] = report count and [1] = document count
    • getReportAndDocumentCountByRecordId

      public static int[] getReportAndDocumentCountByRecordId(int AD_Table_ID, int Record_ID, String Record_UU, String trxName)
      Get number of document and report archive by table and record UUID
      Parameters:
      AD_Table_ID -
      Record_ID - - record ID used when UUID is empty, or as C_BPartner_ID when searching for C_BPartner
      Record_UU - - record UUID
      trxName -
      Returns:
      int[], [0] = report count and [1] = document count
    • getReportCountByTableId

      public static int getReportCountByTableId(int AD_Table_ID, String trxName)
      Get number of report archive by table id
      Parameters:
      AD_Table_ID -
      trxName -
      Returns:
      Number of report archive for AD_Table_ID