Class MImportTemplate

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

public class MImportTemplate extends X_AD_ImportTemplate implements ImmutablePOSupport
Import Template Model
Author:
Carlos Ruiz - GlobalQSS
See Also:
  • Field Details

  • Constructor Details

    • MImportTemplate

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

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

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

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

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

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

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

      public static List<MImportTemplate> getTemplates(int roleid, int tabid)
      Get accessible import templates
      Parameters:
      roleid - AD_Role_ID
      tabid - AD_Tab_ID
      Returns:
      list of MImportTemplate
    • isAllowed

      public boolean isAllowed(String importMode, int roleID)
      Parameters:
      importMode - I (Insert), U (Update) or M (Merge)
      roleID - AD_Role_ID
      Returns:
      true if role can perform importMode with this template
    • validateFile

      public InputStream validateFile(InputStream in)
      - If needed preProcess the file when an Excel file and generate a CSV file, then
      - Validate that InputStream header is CSVHeader or AliasCSVHeader.
      - If the header is AliasCSVHeader it replaces it with the CSVHeader so it can be processed.
      Parameters:
      in - input file
      Returns:
      InputStream with the CSVHeader that can be processed by CsvMapReader
    • convertExcelToCSV

      public InputStream convertExcelToCSV(InputStream excelIs) throws IOException
      Convert an Excel (XLS or XLSX) file to CSV
      Parameters:
      excelIs - input stream containing XLS/XLSX
      Returns:
      input stream containing CSV
      Throws:
      IOException
    • markImmutable

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