Class AbstractInvoice

  • Direct Known Subclasses:
    Invoice, Invoice, Invoice, Invoice, Invoice

    public abstract class AbstractInvoice
    extends Object
    BG-0:Invoice

    Cross Industry Invoice

    XPath:/rsm:CrossIndustryInvoice

    Abstract base class for the profile specific implementations

    • Field Detail

      • debug

        public static final boolean debug
      • computeBT131

        public static final boolean computeBT131
      • debugIndentationLevel

        public int debugIndentationLevel
      • recompute

        public boolean recompute
    • Method Detail

      • toJUnitJavaSourceCode

        public abstract void toJUnitJavaSourceCode​(PrintStream out,
                                                   String packageName,
                                                   String className,
                                                   String referenceFilesDirectory)
                                            throws FacturXException
        Creates JUnit Java source code that will construct an Invoice instance identical with this Invoice from API calls and compare the produced XML against a reference file.
        Parameters:
        out - the print stream to write to
        packageName - the package name to use in the package declaration
        className - the name to use as class name for the test class
        referenceFilesDirectory - the directory in which the test expects the reference output xml file that is named className+".xml"
        Throws:
        FacturXException
      • getIndentedDebugPrefix

        public String getIndentedDebugPrefix​(String prefix)
      • setRecompute

        public void setRecompute​(boolean value)
        Controls the computation of computed fields like #getInvoiceTotalAmountWithoutVAT() By default the values are always computed but in the case that the values were explicitly set (e.g. after creating and instance via #fromXML(String,boolean)), it might be desirable to obtain the explicitly set values instead.
        Parameters:
        value - whether or not to ignore explicitly set values of computed fields and work with computed values instead
      • fromXMLFile

        public static AbstractInvoice fromXMLFile​(String fileName,
                                                  boolean recompute)
                                           throws IOException
        Creates and Invoice instance from a Factur-X XML document.
        Parameters:
        fileName - the Factur-X XML file to read from
        recompute - specifies whether or not computed fields are computed or the values from the file are used instead
        Throws:
        IOException
      • fromPDFFile

        public static AbstractInvoice fromPDFFile​(String fileName,
                                                  boolean recompute)
                                           throws IOException
        Creates and Invoice instance from a Factur-X hybrid PDF document.
        Parameters:
        fileName - the Factur-X hybrid PDF file to read from
        recompute - specifies whether or not computed fields are computed or the values from the file are used instead
        Returns:
        an Invoice instance or null if the PDF does not contain a file attachment named "factur-x.xml".
        Throws:
        IOException