Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

Die Prüfung, ob ein eingehender Datensatz aus dem MT940-Import bereits in der Datenbank vorhanden ist, wird in der Methode doesBankTransactionAlreadyExist() der abstrakten Klasse org.nuclet.mt940.logic.AbstractMT940Logic realisiert. Standardmäßig werden bei diesem Abgleich die folgenden Attribute berücksichtigt:

  • Buchungsdatum (entry date)
  • Valutadatum (value date)
  • Betrag (amount)
  • Soll-Haben-Kennzeichen (debit credit mark)
  • Bankgeschäftsvorfall (business transaction type code/bank transaction type)
  • Mehrzweckfeld (information to account owner)

Soll diese Regelung modifiziert werden (bspw. dahingehend, dass die Prüfung weniger strikt erfolgt), ist hier anzusetzen. Nach Möglichkeit sollte die Änderung nicht direkt in der Klasse AbstractMT940Logic vorgenommen werden. Die dafür vorgesehene Sourcecode-Stelle in der konkreten Implementierung MT940Logic ist entsprechend mit einem @replace!-Tag markiert.

 

Hinweis

Es wird empfohlen, die Änderungen in der konkreten Implementierung MT940Logic oder in einer eigenen Klasse vorzunehmen, die von der abstrakten Klasse AbstractMT940Logic erbt.


Codeblock
languagejava
titleorg.nuclet.mt940.AbstractMT940Logic
firstline393
linenumberstrue
collapsetrue
/**
     * Checks, if a representation of the given bank transaction has already been stored to the database.
     * 
     * Identifiying criteria could be a combination of:
     * 
     * - entry date
     * - value date
     * - amount
     * - debit credit mark
     * - business transaction type code / bank transaction type
     * - information to account owner 
     * - remittance information
     * 
     * @param transaction a given bank transaction, representated by a <code>Mt940Transaction</code> object
     * 
     * @return true, if a representation of the given bank transaction has already been stored to the database
     * 
     * @throws BusinessException might be thrown in case of errors or other exceptions
     */
    public boolean doesBankTransactionAlreadyExist(MT940Transaction transaction) throws BusinessException
    {
        Query<BankTransaction> qryGetExistingBankTransactions = QueryProvider.create(BankTransaction.class);          
        final DebitCreditMark debitCreditMark = debitCreditMarkFacade.getDebitCreditMark(transaction.getDebitCreditMark().getName());
        BankTransactionType bankTransactionType = null;
        
        if (transaction.getBusinessTransactionTypeCode() != null) {
            bankTransactionType = bankTransactionTypeFacade.getBankTransactionType(transaction.getBusinessTransactionTypeCode());
            
            qryGetExistingBankTransactions.where(BankTransaction.EntryDate.eq(transaction.getEntryDate()))
               .and(BankTransaction.ValueDate.eq(transaction.getValueDate()))
               .and(BankTransaction.Amount.eq(transaction.getAmount()))
               .and(BankTransaction.DebitCreditMark.eq(debitCreditMark.getId()))
               .and(BankTransaction.BankTransactionType.eq(bankTransactionType.getId()))
               .and(BankTransaction.InformationToAccountOwner.eq(transaction.getInformationToAccountOwner()));
        } else {
        
            qryGetExistingBankTransactions.where(BankTransaction.EntryDate.eq(transaction.getEntryDate()))
                   .and(BankTransaction.ValueDate.eq(transaction.getValueDate()))
                   .and(BankTransaction.Amount.eq(transaction.getAmount()))
                   .and(BankTransaction.DebitCreditMark.eq(debitCreditMark.getId()))
                   .and(BankTransaction.InformationToAccountOwner.eq(transaction.getInformationToAccountOwner()));
        }
                                                                                                                       
        final List<BankTransaction> lstBankTransactions = QueryProvider.execute(qryGetExistingBankTransactions);               
        
        return (lstBankTransactions != null && lstBankTransactions.size() > 0);
    }