Adempiere 3.5.2a

org.compiere.impexp
Class OFXBankStatementHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.compiere.impexp.OFXBankStatementHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
OFXFileBankStatementLoader

public abstract class OFXBankStatementHandler
extends DefaultHandler

Parser for OFX bank statements This class is a parser for OFX bankstatements. OFX versions from 102 to 202 and MS-Money OFC message sets are supported. Only fully XML compliant OFX data is supported. Files that are not XML compliant, e.g. OFX versions older then 200, will be preprocessed by the OFX1ToXML class before parsing. This class should be extended by a class that obtains the data to be parsed for example from a file, or using HTTP.

Version:
$Id: OFXBankStatementHandler.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
Author:
Eldir Tomassen

Field Summary
protected  int HEADER_SIZE
           
protected  String m_bankAccountNo
           
protected  MBankStatementLoader m_controller
           
protected  String m_currency
           
protected  Timestamp m_dateLastRun
           
protected  String m_errorDescription
           
protected  String m_errorMessage
           
protected  org.compiere.impexp.OFXBankStatementHandler.StatementLine m_line
           
protected  SAXParser m_parser
           
protected  BufferedReader m_reader
           
protected  String m_routingNo
           
protected  Timestamp m_statementDate
           
protected  boolean m_success
           
protected  boolean m_test
           
static String XML_ACCTID_TAG
          XML ACCTID Tag
static String XML_ACCTKEY_TAG
          Checksum
static String XML_ACCTTYPE_TAG
          Type of account
static String XML_ACCTTYPE2_TAG
          Type of account
static String XML_AVAILBAL_TAG
          XML AVAILBAL Tag
static String XML_BALAMT_TAG
          XML BALAMT Tag
static String XML_BANKACCTFROM_TAG
          Account-from aggregate
static String XML_BANKID_TAG
          Bank identifier
static String XML_BANKTRANLIST_TAG
          XML BANKTRANLIST Tag
static String XML_BRANCHID_TAG
          Branch identifier
static String XML_CHECKNUM_TAG
          XML CHECKNUM Tag
static String XML_CHKNUM_TAG
          XML CHKNUM Tag (MS-Money OFC)
static String XML_CURDEF_TAG
          XML CURDEF Tag
static String XML_DTASOF_TAG
          XML DTASOF Tag
static String XML_DTAVAIL_TAG
          Effective date
static String XML_DTEND_TAG
          XML DTEND Tag
static String XML_DTPOSTED_TAG
          Transaction date
static String XML_DTPROFUP_TAG
          Date and rime last update to profile information
static String XML_DTSERVER_TAG
          Date and time of the server response
static String XML_DTSTART_TAG
          XML DTSTART Tag
static String XML_FITID_TAG
          XML FITID Tag
static String XML_LANGUAGE_TAG
          Language
static String XML_LEDGERBAL_TAG
          XML LEDGERBAL Tag
static String XML_MEMO_TAG
          Transaction Memo
static String XML_MKTGINFO_TAG
          XML MKTGINFO Tag
static String XML_NAME_TAG
          XML NAME Tag
static String XML_OFX_TAG
          XML OFX Tag
static String XML_PAYEE_TAG
          TXML PAYEE Tag
static String XML_PAYEEID_TAG
          XML PAYEEID Tag
static String XML_REFNUM_TAG
          XML REFNUM Tag
static String XML_SIGNONMSGSRSV1_TAG
          XML SIGNONMSGSRSV1 Tag
static String XML_SIGNONMSGSRSV2_TAG
          XML SIGNONMSGSRSV2 Tag
static String XML_SONRS_TAG
          Record-response aggregate
static String XML_STATUS_TAG
          Status aggregate
static String XML_STMTRS_TAG
          Statement-response aggregate
static String XML_STMTTRN_TAG
          XML STMTTRN Tag
static String XML_TRNAMT_TAG
          XML TRNAMT Tag
static String XML_TRNTYPE_TAG
          XML TRNTYPE Tag
static String XML_TSKEYEXPIRE_TAG
          Date and time that USERKEY expires
static String XML_USERKEY_TAG
          Use USERKEY instead of USERID and USEPASS
 
Constructor Summary
OFXBankStatementHandler()
           
 
Method Summary
protected  boolean attachInput(InputStream is)
          Attach OFX input source, detect whether we are dealing with OFX1 (SGML) or OFX2 (XML).
 void characters(char[] ch, int start, int length)
          Characters read from XML are assigned to a variable, based on the current m_context.
 void endElement(String uri, String localName, String qName)
          Check for valid XML structure.
 String getBankAccountNo()
          Method getBankAccountNo
 BigDecimal getChargeAmt()
          Method getChargeAmt
 String getChargeName()
          Method getChargeName
 String getCheckNo()
          Method getCheckNo
 String getCurrency()
          Method getCurrency
 Timestamp getDateLastRun()
          Method getDateLastRun
 BigDecimal getInterestAmt()
          Method getInterestAmount
 boolean getIsReversal()
          Method getIsReversal
 String getLastErrorDescription()
          Method getLastErrorDescription
 String getLastErrorMessage()
          Method getLastErrorMessage
 String getMemo()
          Method getMemo
 String getPayeeAccountNo()
          Method getPayeeAccountNo
 String getPayeeName()
          Method getPayeeName
 String getReference()
          Method getReference
 String getRoutingNo()
          Method getRoutingNo
 Timestamp getStatementDate()
          Method getStatementDate
 Timestamp getStatementLineDate()
          Method getStatementLineDate
 String getStatementReference()
          Method getStatementReference
 BigDecimal getStmtAmt()
          Method getStmtAmt
 BigDecimal getTrxAmt()
          Method getTrxAmt
 String getTrxID()
          Method getTrxID
 String getTrxType()
          Method getTrxType
 Timestamp getValutaDate()
          Method getValutaDate
 boolean importSuccessfull()
          Check wether the import was succesfull
protected  boolean init(MBankStatementLoader controller)
          Initialize the loader * @param controller Reference to the BankStatementLoaderController
 boolean isValid()
          Verify the validity of the OFX data
 boolean loadLines()
          Read statementlines from InputStream.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          New XML element detected.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_controller

protected MBankStatementLoader m_controller

m_errorMessage

protected String m_errorMessage

m_errorDescription

protected String m_errorDescription

m_reader

protected BufferedReader m_reader

m_parser

protected SAXParser m_parser

m_success

protected boolean m_success

m_line

protected org.compiere.impexp.OFXBankStatementHandler.StatementLine m_line

m_routingNo

protected String m_routingNo

m_bankAccountNo

protected String m_bankAccountNo

m_currency

protected String m_currency

HEADER_SIZE

protected int HEADER_SIZE

m_test

protected boolean m_test

m_dateLastRun

protected Timestamp m_dateLastRun

m_statementDate

protected Timestamp m_statementDate

XML_OFX_TAG

public static final String XML_OFX_TAG
XML OFX Tag

See Also:
Constant Field Values

XML_SIGNONMSGSRSV2_TAG

public static final String XML_SIGNONMSGSRSV2_TAG
XML SIGNONMSGSRSV2 Tag

See Also:
Constant Field Values

XML_SIGNONMSGSRSV1_TAG

public static final String XML_SIGNONMSGSRSV1_TAG
XML SIGNONMSGSRSV1 Tag

See Also:
Constant Field Values

XML_SONRS_TAG

public static final String XML_SONRS_TAG
Record-response aggregate

See Also:
Constant Field Values

XML_DTSERVER_TAG

public static final String XML_DTSERVER_TAG
Date and time of the server response

See Also:
Constant Field Values

XML_USERKEY_TAG

public static final String XML_USERKEY_TAG
Use USERKEY instead of USERID and USEPASS

See Also:
Constant Field Values

XML_TSKEYEXPIRE_TAG

public static final String XML_TSKEYEXPIRE_TAG
Date and time that USERKEY expires

See Also:
Constant Field Values

XML_LANGUAGE_TAG

public static final String XML_LANGUAGE_TAG
Language

See Also:
Constant Field Values

XML_DTPROFUP_TAG

public static final String XML_DTPROFUP_TAG
Date and rime last update to profile information

See Also:
Constant Field Values

XML_STATUS_TAG

public static final String XML_STATUS_TAG
Status aggregate

See Also:
Constant Field Values

XML_STMTRS_TAG

public static final String XML_STMTRS_TAG
Statement-response aggregate

See Also:
Constant Field Values

XML_CURDEF_TAG

public static final String XML_CURDEF_TAG
XML CURDEF Tag

See Also:
Constant Field Values

XML_BANKACCTFROM_TAG

public static final String XML_BANKACCTFROM_TAG
Account-from aggregate

See Also:
Constant Field Values

XML_BANKID_TAG

public static final String XML_BANKID_TAG
Bank identifier

See Also:
Constant Field Values

XML_BRANCHID_TAG

public static final String XML_BRANCHID_TAG
Branch identifier

See Also:
Constant Field Values

XML_ACCTID_TAG

public static final String XML_ACCTID_TAG
XML ACCTID Tag

See Also:
Constant Field Values

XML_ACCTTYPE_TAG

public static final String XML_ACCTTYPE_TAG
Type of account

See Also:
Constant Field Values

XML_ACCTTYPE2_TAG

public static final String XML_ACCTTYPE2_TAG
Type of account

See Also:
Constant Field Values

XML_ACCTKEY_TAG

public static final String XML_ACCTKEY_TAG
Checksum

See Also:
Constant Field Values

XML_BANKTRANLIST_TAG

public static final String XML_BANKTRANLIST_TAG
XML BANKTRANLIST Tag

See Also:
Constant Field Values

XML_DTSTART_TAG

public static final String XML_DTSTART_TAG
XML DTSTART Tag

See Also:
Constant Field Values

XML_DTEND_TAG

public static final String XML_DTEND_TAG
XML DTEND Tag

See Also:
Constant Field Values

XML_STMTTRN_TAG

public static final String XML_STMTTRN_TAG
XML STMTTRN Tag

See Also:
Constant Field Values

XML_TRNTYPE_TAG

public static final String XML_TRNTYPE_TAG
XML TRNTYPE Tag

See Also:
Constant Field Values

XML_TRNAMT_TAG

public static final String XML_TRNAMT_TAG
XML TRNAMT Tag

See Also:
Constant Field Values

XML_DTPOSTED_TAG

public static final String XML_DTPOSTED_TAG
Transaction date

See Also:
Constant Field Values

XML_DTAVAIL_TAG

public static final String XML_DTAVAIL_TAG
Effective date

See Also:
Constant Field Values

XML_FITID_TAG

public static final String XML_FITID_TAG
XML FITID Tag

See Also:
Constant Field Values

XML_CHECKNUM_TAG

public static final String XML_CHECKNUM_TAG
XML CHECKNUM Tag

See Also:
Constant Field Values

XML_CHKNUM_TAG

public static final String XML_CHKNUM_TAG
XML CHKNUM Tag (MS-Money OFC)

See Also:
Constant Field Values

XML_REFNUM_TAG

public static final String XML_REFNUM_TAG
XML REFNUM Tag

See Also:
Constant Field Values

XML_MEMO_TAG

public static final String XML_MEMO_TAG
Transaction Memo

See Also:
Constant Field Values

XML_NAME_TAG

public static final String XML_NAME_TAG
XML NAME Tag

See Also:
Constant Field Values

XML_PAYEEID_TAG

public static final String XML_PAYEEID_TAG
XML PAYEEID Tag

See Also:
Constant Field Values

XML_PAYEE_TAG

public static final String XML_PAYEE_TAG
TXML PAYEE Tag

See Also:
Constant Field Values

XML_LEDGERBAL_TAG

public static final String XML_LEDGERBAL_TAG
XML LEDGERBAL Tag

See Also:
Constant Field Values

XML_BALAMT_TAG

public static final String XML_BALAMT_TAG
XML BALAMT Tag

See Also:
Constant Field Values

XML_DTASOF_TAG

public static final String XML_DTASOF_TAG
XML DTASOF Tag

See Also:
Constant Field Values

XML_AVAILBAL_TAG

public static final String XML_AVAILBAL_TAG
XML AVAILBAL Tag

See Also:
Constant Field Values

XML_MKTGINFO_TAG

public static final String XML_MKTGINFO_TAG
XML MKTGINFO Tag

See Also:
Constant Field Values
Constructor Detail

OFXBankStatementHandler

public OFXBankStatementHandler()
Method Detail

init

protected boolean init(MBankStatementLoader controller)
Initialize the loader * @param controller Reference to the BankStatementLoaderController

Returns:
Initialized succesfully

attachInput

protected boolean attachInput(InputStream is)
Attach OFX input source, detect whether we are dealing with OFX1 (SGML) or OFX2 (XML). In case of OFX1, process the data to create valid XML.

Parameters:
is - Reference to the BankStatementLoaderController
Returns:
true if input is valid OFX data

isValid

public boolean isValid()
Verify the validity of the OFX data

Returns:
true if input is valid OFX data

importSuccessfull

public boolean importSuccessfull()
Check wether the import was succesfull

Returns:
true if all statement lines have been imported succesfully

loadLines

public boolean loadLines()
Read statementlines from InputStream.

Returns:
load success This method will be invoked from ImportController.

getDateLastRun

public Timestamp getDateLastRun()
Method getDateLastRun

Returns:
Timestamp

getRoutingNo

public String getRoutingNo()
Method getRoutingNo

Returns:
String

getBankAccountNo

public String getBankAccountNo()
Method getBankAccountNo

Returns:
String

getStatementReference

public String getStatementReference()
Method getStatementReference

Returns:
String

getStatementDate

public Timestamp getStatementDate()
Method getStatementDate

Returns:
Timestamp

getReference

public String getReference()
Method getReference

Returns:
String

getStatementLineDate

public Timestamp getStatementLineDate()
Method getStatementLineDate

Returns:
Timestamp

getValutaDate

public Timestamp getValutaDate()
Method getValutaDate

Returns:
Timestamp

getTrxType

public String getTrxType()
Method getTrxType

Returns:
String

getIsReversal

public boolean getIsReversal()
Method getIsReversal

Returns:
boolean

getCurrency

public String getCurrency()
Method getCurrency

Returns:
String

getStmtAmt

public BigDecimal getStmtAmt()
Method getStmtAmt

Returns:
BigDecimal

getTrxAmt

public BigDecimal getTrxAmt()
Method getTrxAmt

Returns:
Transaction Amount

getInterestAmt

public BigDecimal getInterestAmt()
Method getInterestAmount

Returns:
Interest Amount

getMemo

public String getMemo()
Method getMemo

Returns:
String

getChargeName

public String getChargeName()
Method getChargeName

Returns:
String

getChargeAmt

public BigDecimal getChargeAmt()
Method getChargeAmt

Returns:
BigDecimal

getTrxID

public String getTrxID()
Method getTrxID

Returns:
String

getPayeeAccountNo

public String getPayeeAccountNo()
Method getPayeeAccountNo

Returns:
String

getPayeeName

public String getPayeeName()
Method getPayeeName

Returns:
String

getCheckNo

public String getCheckNo()
Method getCheckNo

Returns:
String

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
New XML element detected. The XML nesting structure is saved on the m_context stack.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri - String
localName - String
qName - String
attributes - Attributes
Throws:
SAXException
See Also:
ContentHandler.startElement(String, String, String, Attributes)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Characters read from XML are assigned to a variable, based on the current m_context. No checks are being done, it is assumed that the context is correct.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch - char[]
start - int
length - int
Throws:
SAXException
See Also:
ContentHandler.characters(char[], int, int)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Check for valid XML structure. (all tags are properly ended). The statements are passed to ImportController when the statement end () is detected.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
uri - String
localName - String
qName - String
Throws:
SAXException
See Also:
ContentHandler.endElement(String, String, String)

getLastErrorMessage

public String getLastErrorMessage()
Method getLastErrorMessage

Returns:
String

getLastErrorDescription

public String getLastErrorDescription()
Method getLastErrorDescription

Returns:
String

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.