Das SEPA-Nuclet stellt in der abstrakten Klasse AbstractSEPALogic die grundlegende Prozesslogik für die Erstellung von SEPA-Exporten bereit.
Jedoch ist diese Prozesslogik an drei Stellen anwendungsspezifisch für Ihre Geschäftspraxis anzupassen.
Die betrifft
Bei der Anbindung des SEPA-Nuclets sind hierfür die Klasse SEPALogic und SEPALogicFactory anzupassen.
Es wird empfohlen, die Klasse SEPALogic nur als Vorlage für eine eigene Implementierung zu verwenden. Näheres dazu finden Sie im nächsten Abschnitt 4.8.3.1. |
Klasse | Funktion | Java-Package | Anzupassende Methoden |
---|---|---|---|
SEPALogic | Template für anwendungspezifische Geschäftslogik | org.nuclet.sepa.logic |
|
SEPALogicFactory | Instanziierung der tatsächlich verwendeten Geschäftslogik | org.nuclet.sepa.logic |
|
Tabelle 4.8.3: Übersicht, Anpassungen in Prozesslogik
Bitte verwenden Sie die Klasse SEPALogic nur als Template für Ihre eigene Impementierung. Dazu führen Sie bitte die folgenden Schritte durch:
|
Die Klasse SEPALogic dient als Vorlage zur Ergänzung der grundlegenden Abläufe in der Prozesslogik.
Diese Logik ist an drei Stellen von Ihnen anwendungsspezifisch zu ergänzen:
Ein Beispiel dazu ist jeweils in einem Kommentarblock angegeben, dieses Beispiel ist an das tatsächlich genutzte Währungsbusinessobjekt (bzw. dessen BusinessObject-Klasse) anzupassen.
package org.nuclet.sepa.logic; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.bind.JAXBElement; import org.nuclos.api.businessobject.BusinessObject; import org.nuclos.api.businessobject.Query; import org.nuclos.api.context.JobContext; import org.nuclos.api.context.RuleContext; import org.nuclos.api.exception.BusinessException; import org.nuclos.api.provider.BusinessObjectProvider; import org.nuclos.api.provider.QueryProvider; import org.nuclet.bffs.logging.LogLevel; import org.nuclet.bffs.logic.AbstractBusinessLogic; import org.nuclet.sepa.SEPAExport; import org.nuclet.sepa.SEPAPaymentType; import org.nuclet.sepa.jaxb.Document; import org.nuclet.sepa.logic.*; import org.nuclet.sepa.logic.PAINDocumentCreator.PaymentType; import org.nuclet.sepa.logic.PAINDocumentCreator.SequenceType; import org.nuclet.sepa.wrapper.*; /** * Concrete class implementing the declarations found in abstract class AbstractSEPALogic * * @note This class is to be read as a dummy implementation. Its methods should be overwritten * and filled/adapted with application specific code. * * @usage org.nuclet.sepa.job.SEPAExportJob * * @version 1.0 * @date 21.03.2014 * @nuclet org.nuclet.SEPA * @nucletversion 1.0.0 * @sincenucletversion 1.0.0 * @since 21.03.2014 * * @author frank.lehmann@nuclos.de * */ public class SEPALogic extends AbstractSEPALogic { private static final LogLevel LOGLEVEL = LogLevel.DEBUG; public SEPALogic(final JobContext context) { super(context, LOGLEVEL); } public SEPALogic(final JobContext context, final LogLevel logLevel) { super(context, logLevel); } public SEPALogic(final RuleContext context, final LogLevel logLevel) { super(context, logLevel); } public SEPALogic(final RuleContext context) { super(context, LOGLEVEL); } /** * Builds a creditor identification, based on a given SEPA export * @note To be implemented in a dedicated subclass! * @see org.nuclet.sepa.logic.CreditorIdentification * * @param boSEPAExport A given oject of type <code>SEPAExport</code> * * @return a creditor identification, based on a given SEPA export * * @throws BusinessException * @throws BusinessException SPA.483.001 */ protected CreditorIdentification createCreditorIdentification(final SEPAExport boSEPAExport) throws BusinessException { // @replace! // final Query qryCreditor = QueryProvider.create(Person.class) // .where(Person.BffsStammdaten.eq(Boolean.TRUE)); // final List<Person> lstPersonen = QueryProvider.execute(qryCreditor); // // logDebug("Creditor list size:" + lstPersonen.size()); // // if (lstPersonen != null && lstPersonen.size() == 1) { // final Person boCreditor = lstPersonen.iterator().next(); // // final CreditorIdentification creditorId = new CreditorIdentification( // boCreditor.getName(), // boCreditor.getBic(), // boCreditor.getIban(), // boCreditor.getGlaeubigerIdSepa()); // // return creditorId; // } else if (lstPersonen != null && lstPersonen.size() > 1) { // throw new BusinessException("Es sind mehrere Personen-Datensätze als \"BFFS-Stammdaten\" gekennzeichnet!"); // } else { // throw new BusinessException("Der BFFS-Stammdatensatz in der Entität \"Person\" fehlt!"); // } return null; } /** * Builds the remittance information, related to the given debitor and reference * * @param debitor An object of type <code>AbstractDebitorWrapper</code>, representing the debitor * @param reference An object of type <code>AbstractReferenceWrapper</code>, representing the reference * @param bgdAmount The payment amount, related to the given debitor and reference * * @return the remittance information, related to the given debitor and reference * * @throws BusinessException */ public String createRemittanceInformation(final AbstractDebitorWrapper debitor, final AbstractReferenceWrapper reference, final BigDecimal bgdAmount) throws BusinessException { // @replace! // // final StringBuffer sbRemittanceInfo = new StringBuffer(); // // final Rechnung boRechnung = (Rechnung)reference.getBusinessObject(); // final Long lngRatenartId = boRechnung.getRatenartId(); // final Ratenart boRatenart = QueryProvider.getById(Ratenart.class, lngRatenartId); // // if ("monatlich".equals(boRatenart.getName())) { // sbRemittanceInfo.append("KTO. "); // sbRemittanceInfo.append(debitor.getSEPAMandateIdentification()); // sbRemittanceInfo.append(" DATUM "); // sbRemittanceInfo.append(reference.getReferenceDate()); // sbRemittanceInfo.append(" BETRAG "); // sbRemittanceInfo.append(bgdAmount); // sbRemittanceInfo.append(" RNR "); // sbRemittanceInfo.append(reference.getDirectDebitReference()); // sbRemittanceInfo.append(" INCL. GEBÜHR FÜR MONATLICHE ABBUCHUNG"); // } else { // sbRemittanceInfo.append("KTO. "); // sbRemittanceInfo.append(debitor.getSEPAMandateIdentification()); // sbRemittanceInfo.append(" DATUM "); // sbRemittanceInfo.append(reference.getReferenceDate()); // sbRemittanceInfo.append(" BETRAG "); // sbRemittanceInfo.append(bgdAmount); // sbRemittanceInfo.append(" RNR "); // sbRemittanceInfo.append(reference.getDirectDebitReference()); // } // // return sbRemittanceInfo.toString(); return null; } /** * Fetches all payment references that are to be included in a given SEPA export * * @param boSEPAExport A given SEPA export * * @throws BusinessException */ protected List<AbstractPaymentReferenceWrapper> fetchPaymentReferences(final SEPAExport boSEPAExport) throws BusinessException { // @replace! // // final List<AbstractPaymentReferenceWrapper> lstPaymentReferences = new ArrayList<AbstractPaymentReferenceWrapper>(); // // final Query qryForderungen = QueryProvider.create(Forderung.class) // .where(Forderung.Faelligkeitsdatum.Gte(boSEPAExport.getDateFrom())) // .and(Forderung.Faelligkeitsdatum.Lte(boSEPAExport.getDateUntil())) // .and(Forderung.ExportdatumSepa.isNull()) // .and(Forderung.Offen.eq(Boolean.TRUE)) // .orderBy(Forderung.Rechnung, Boolean.TRUE) // .orderBy(Forderung.Faelligkeitsdatum, Boolean.TRUE); // final List<Forderung> lstForderungen = QueryProvider.execute(qryForderungen); // // for (final Forderung boForderung : lstForderungen) { // lstPaymentReferences.add(new PaymentReferenceWrapper(boForderung)); // } // // return lstPaymentReferences; return null; } } |
test |