Package com.fourjs.report.facturx
Class AbstractInvoice
- java.lang.Object
-
- com.fourjs.report.facturx.AbstractInvoice
-
-
Field Summary
Fields Modifier and Type Field Description static booleancomputeBT131static booleandebugintdebugIndentationLevelbooleanrecompute
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static BigDecimalassertNotNull(String lValueVariableClassName, String rValueVariableClassName, BigDecimal variable)static AbstractInvoicefromPDFFile(String fileName, boolean recompute)Creates and Invoice instance from a Factur-X hybrid PDF document.static AbstractInvoicefromXMLFile(String fileName, boolean recompute)Creates and Invoice instance from a Factur-X XML document.StringgetIndentedDebugPrefix(String prefix)StringgetXMLAsDataURL()static StringjoinVeryLongString(String[] chunks)Deprecated.UseUtil.joinVeryLongString(java.lang.String[])instead.static voidmain(String[] args)static LocalDateparseDate(String s)Deprecated.UseUtil.parseDate(java.lang.String)instead.voidsetRecompute(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.abstract voidtoJUnitJavaSourceCode(PrintStream out, String packageName, String className, String referenceFilesDirectory)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.voidtoXML(PrintStream out)Serializes to a Factur-X XML document that matches the profile specific XML Schema.abstract voidtoXML(PrintWriter out)Serializes to a Factur-X XML document that matches the profile specific XML Schema.
-
-
-
Method Detail
-
toXML
public void toXML(PrintStream out) throws IOException, FacturXException
Serializes to a Factur-X XML document that matches the profile specific XML Schema.- Parameters:
out- the print stream to write to- Throws:
IOExceptionFacturXException
-
toXML
public abstract void toXML(PrintWriter out) throws IOException, FacturXException
Serializes to a Factur-X XML document that matches the profile specific XML Schema.- Parameters:
out- the print stream to write to- Throws:
IOExceptionFacturXException
-
getXMLAsDataURL
public String getXMLAsDataURL() throws IOException, FacturXException
- Throws:
IOExceptionFacturXException
-
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 topackageName- the package name to use in the package declarationclassName- the name to use as class name for the test classreferenceFilesDirectory- the directory in which the test expects the reference output xml file that is namedclassName+".xml"- Throws:
FacturXException
-
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 fromrecompute- 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 fromrecompute- 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
-
assertNotNull
public static BigDecimal assertNotNull(String lValueVariableClassName, String rValueVariableClassName, BigDecimal variable) throws ComputationException
- Throws:
ComputationException
-
parseDate
public static LocalDate parseDate(String s) throws DateTimeParseException
Deprecated.UseUtil.parseDate(java.lang.String)instead.parses dates in the Factur-x format YYYYMMDD- Throws:
DateTimeParseException
-
joinVeryLongString
public static String joinVeryLongString(String[] chunks)
Deprecated.UseUtil.joinVeryLongString(java.lang.String[])instead.to be used for strings exceeding the compiler limit of 2^16 bytes for a string constant
-
-