MT940 Nuclet – 4.8.3 uniqueness check. |
Language: Deutsch · English
4.8.3 Uniqueness check – part of the MT940 Nuclet documentation (duplicate check for imported MT940 transactions).
On this page |
This page was machine-translated from German as a first draft and is currently under review. The authoritative source remains the German original (see the language switch above). |
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:
If this rule is to be modified (e.g. so that the check is less strict), this is the place to start. If possible, the change should not be made directly in the class AbstractMT940Logic. The source code location provided for this in the concrete implementation MT940Logic is marked accordingly with an @replace! tag.
It is recommended to make the changes in the concrete implementation MT940Logic or in your own class that inherits from the abstract class AbstractMT940Logic. |
/**
* 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);
} |