Seitenhistorie
...
Info |
---|
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. |
Außerdem ist die Initialisierung der tatsächlich eingesetzten Prozesslogik in zwei Regeln einzusetzen.
Klasse | Funktion | Java-Package | Anzupassende Methoden | |
---|---|---|---|---|
SEPALogic | Template für anwendungspezifische GeschäftslogikProzesslogik | org.nuclet.sepa.logic |
| |
SEPALogicFactoryExportSEPAMessageInstanziierung der tatsächlich verwendeten Geschäftslogik | erstellt eine Vorschau der zu exportierenden SEPA-Zahlungen | org.nuclet.sepa.rule | custom(CustomContext) | |
ExportSEPAMessageAndProcessReferences | erzeugt einen SEPA-Export und markiert die exportierten Objekte | org.nuclet.sepa. | logicrule | getSEPALogicchangeState(StateChangeContext) |
Tabelle 4.8.3: Übersicht, Anpassungen in Prozesslogik
...
Codeblock | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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; } } |
4.8.3.2
...
ExportSEPAMessage
Codeblock | ||||||||
---|---|---|---|---|---|---|---|---|
| test||||||||
package org.nuclet.sepa.rule;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.context.CustomContext;
import org.nuclos.api.exception.BusinessException;
import org.nuclos.api.rule.CustomRule;
import org.nuclet.sepa.*;
import org.nuclet.sepa.logic.*;
// @replace!
//
// Bitte an dieser Stelle Ihre eigene Prozesslogik einsetzen
// import de.ihrefirma.sepa.logic.SEPALogic;
/**
* @name ExportSEPAMesssage
* @description Export the SEPA messsage that is related to a given SEPA export
* @usage
* @change
*
* @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
*
*/
@Rule(name="ExportSEPAMesssage", description="Export SEPA Messsage")
public class ExportSEPAMesssage implements CustomRule
{
public void custom(CustomContext context) throws BusinessException
{
// @replace!
//
// Bitte an dieser Stelle Ihre eigene Prozesslogik einsetzen
SEPALogic logic = new SEPALogic(context);
logic.initialize(context);
logic.export(context.getBusinessObject(SEPAExport.class));
}
} |
4.8.3.2 ExportSEPAMessageAndProcessReferences
Codeblock | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
package org.nuclet.sepa.rule;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.context.StateChangeContext;
import org.nuclos.api.exception.BusinessException;
import org.nuclos.api.rule.StateChangeRule;
import org.nuclet.bffs.sepa.BFFSSepaLogic;
import org.nuclet.sepa.*;
import org.nuclet.sepa.logic.*;
// @replace!
//
// Bitte an dieser Stelle Ihre eigene Prozesslogik einsetzen
// import de.ihrefirma.sepa.logic.SEPALogic;
/**
* @name ExportSEPAMesssageAndProcessReferences
* @description Export the SEPA messsage that is related to a given SEPA export and process all references
* @usage
* @change
*
* @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
*
*/
@Rule(name="ExportSEPAMesssageAndProcessReferences", description="Export SEPA messsage and process references")
public class ExportSEPAMesssageAndProcessReferences implements StateChangeRule
{
public void changeState(StateChangeContext context) throws BusinessException
{
final SEPAExport boSEPAExport = context.getBusinessObject(SEPAExport.class);
// @replace!
//
// Bitte an dieser Stelle Ihre eigene Prozesslogik einsetzen
SEPALogic logic = new SEPALogic(context);
logic.initialize(context);
logic.export(boSEPAExport);
logic.processReferences(boSEPAExport);
}
} |
Überblick
Inhalte