/** Prepare - e.g., get Parameters. */ @Override protected void prepare() { ProcessInfoParameter[] para = getParameter(); for (ProcessInfoParameter element : para) { String name = element.getParameterName(); if (element.getParameter() == null) ; else log.log(Level.SEVERE, "Unknown Parameter: " + name); } m_matchers = MBankStatementMatcher.getMatchers(getCtx(), get_TrxName()); } // prepare
/** * Perform Match * * @param ibs import bank statement line * @return Message */ private String match(X_I_BankStatement ibs) { if (m_matchers == null || ibs == null || ibs.getC_Payment_ID() != 0) return "--"; log.fine("" + ibs); BankStatementMatchInfo info = null; for (MBankStatementMatcher element : m_matchers) { if (element.isMatcherValid()) { info = element.getMatcher().findMatch(ibs); if (info != null && info.isMatched()) { if (info.getC_Payment_ID() > 0) ibs.setC_Payment_ID(info.getC_Payment_ID()); if (info.getC_Invoice_ID() > 0) ibs.setC_Invoice_ID(info.getC_Invoice_ID()); if (info.getC_BPartner_ID() > 0) ibs.setC_BPartner_ID(info.getC_BPartner_ID()); ibs.save(); return "OK"; } } } // for all matchers return "--"; } // match
/** * Perform Match * * @param bsl bank statement line * @return Message */ private String match(MBankStatementLine bsl) { if (m_matchers == null || bsl == null || bsl.getC_Payment_ID() != 0) return "--"; log.fine("match - " + bsl); BankStatementMatchInfo info = null; for (MBankStatementMatcher element : m_matchers) { if (element.isMatcherValid()) { info = element.getMatcher().findMatch(bsl); if (info != null && info.isMatched()) { if (info.getC_Payment_ID() > 0) bsl.setC_Payment_ID(info.getC_Payment_ID()); if (info.getC_Invoice_ID() > 0) bsl.setC_Invoice_ID(info.getC_Invoice_ID()); if (info.getC_BPartner_ID() > 0) bsl.setC_BPartner_ID(info.getC_BPartner_ID()); bsl.save(); return "OK"; } } } // for all matchers return "--"; } // match