Versionen im Vergleich

Schlüssel

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

...

Klasse
Funktion
Java-Package
Anzupassende Methoden
SEPALogicTemplate für anwendungspezifische Prozesslogikorg.nuclet.sepa.logic
  • createCreditorIdentification(SEPAExport)
  • createDebitorIdentification(SEPAExport)
  • createRemittanceInformation(AbstractCreditorWrapper, AbstractReferenceWrapper, BigDecimal)
  • createRemittanceInformation(AbstractDebitorWrapper, AbstractReferenceWrapper, BigDecimal)
  • fetchCreditTansferReferences(SEPAExport)
  • fetchDirectDebitReferencesfetchPaymentReferences(SEPAExport)
ExportSEPAMessageerstellt eine Vorschau der zu exportierenden SEPA-Zahlungenorg.nuclet.sepa.rulecustom(CustomContext)
ExportSEPAMessageAndProcessReferenceserzeugt einen SEPA-Export und markiert die exportierten Objekteorg.nuclet.sepa.rulechangeState(StateChangeContext)

...

Codeblock
languagejava
titleorg.nuclet.sepa.logic.SEPALogic
linenumberstrue
collapsetrue
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.common.logging.LogLevel;
import org.nuclet.common.logic.AbstractBusinessLogic;

import org.nuclet.sepa.SEPAExport;
import org.nuclet.sepa.SEPAPaymentType;
import org.nuclet.sepa.jaxb.sdd.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.*;

// @replace!
//
// import org.nuclet.businesstemplate.Client;
// import org.nuclet.businesstemplate.ClientBilling;
// import org.nuclet.businesstemplate.ClientBillingPosition;
// import org.nuclet.businesstemplate.Supplier;
// import org.nuclet.businesstemplate.SupplierBilling;
// import org.nuclet.businesstemplate.SupplierBillingPosition;


/**
 * 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 12.0
 * @date 2103.0302.20142015
 * @nuclet org.nuclet.SEPA
 * @nucletversion 12.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, LOGLEVELsuper(context, LOGLEVEL);        
    }
    
    
    /**
     * Builds a creditor identification, based on a given SEPA export
 (direct debit initiation)
 * 
 * @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!
        //
        // Im folgenden Beispiel wird der Kreditorenstammdatensatz in der Tabelle
        // der Kunden ("Client") gespeichert und als "intern" ("is internal") gekennzeichnet.
        // Die Kreditorenkennung wird also aus genau jenem Stammdatensatz erzeugt.
 //
 // final Query    //
        // final Query qryCreditor qryCreditor = QueryProvider.create(Client.class)
        //     .where(Client.IsInternal.eq(Boolean.TRUE));
        // final List<Client> lstCliebtslstClients = QueryProvider.execute(qryCreditor);
        // 
        // logDebug("Creditor list size: " + lstClients.size());
        // 
 // if      // if (lstClients (lstClients != null && lstClients.size() == 1) {
        //     final Client boCreditor = lstClients.iterator().next();
        //     
        //     final CreditorIdentification creditorId = new CreditorIdentification(
        //         boCreditor.getName(),
        //         boCreditorboCreditor.getBic(),
        //         boCreditor.getIban(),
        //         boCreditor.getSEPACreditorId());
 // 
 // return   creditorId;
 // } else if (lstClients != null && lstClients.size() 
>        //     return creditorId;
        // } else if (lstClients != null && lstClients.size() > 1) {
        //    1) {
 // throw new BusinessException("More than one clients marked as \"internal\" exist!");
        // } else {
        //     throw new BusinessException("Client marked as \"internal\" is missing!");
        // } 
 
 return null;
 }
 
 /**
 * Builds a creditor identification, based on a 
given SEPA export (credit transfer initiation)
 *  
 * @note To be implemented in a returndedicated null;subclass!
 * @see  }org.nuclet.sepa.logic.CreditorIdentification
 * 
 * @param boSEPAExport 
A given oject of type <code>SEPAExport</**code>
 * 
   * Builds@return thea remittancedebitor informationidentification, relatedbased toon thea given debitorSEPA and referenceexport
     * 
 * @throws BusinessException 
 * @param@throws 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 ClientBilling boClientBilling = (ClientBilling)reference.getBusinessObject();
        // final StringBuffer sbRemittanceInfo = new StringBuffer();
        //
        // sbRemittanceInfo.append("ACCT. ");
        // sbRemittanceInfo.append(debitor.getSEPAMandateIdentification());
        // sbRemittanceInfo.append(" DATE ");
        // sbRemittanceInfo.append(reference.getReferenceDate());
        // sbRemittanceInfo.append(" AMNT. ");
        // sbRemittanceInfo.append(bgdAmount);
        // sbRemittanceInfo.append(" BGNR ");
        // 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 qryClientBillingPositions = QueryProvider.create(ClientBillingPosition.class)
        //     .where(ClientBillingPosition.DueDate.Gte(boSEPAExport.getDateFrom()))
        //     .and(ClientBillingPosition.Faelligkeitsdatum.Lte(boSEPAExport.getDateUntil()))
        //     .and(ClientBillingPosition.SEPAExportDate.isNull())
        //     .and(ClientBillingPosition.IsOpen.eq(Boolean.TRUE))
        //     .orderBy(ClientBillingPosition.ClientBilling, Boolean.TRUE)
        //     .orderBy(ClientBillingPosition.DueDate, Boolean.TRUE);
        // final List<ClientBillingPosition> lstClientBillingPositions = QueryProvider.execute(qryClientBillingPositions);
        // 
        // for (final ClientBillingPosition boClientBillingPosition : lstClientBillingPositions) {
        //     lstPaymentReferences.add(new PaymentReferenceWrapper(boClientBillingPosition));
        // }
        // 
        // return lstPaymentReferences;
        
        return null;
    }
        
    
}

 

4.8.3.2 ExportSEPAMessage

In der Klasse ExportSEPAMessage ist die Klasse SEPALogic gegen die von Ihnen im Abschnitt 4.8.3.1 erstellte Prozesslogik auszutauschen.

Codeblock
languagejava
titleorg.nuclet.sepa.rule.ExportSEPAMessage
linenumberstrue
collapsetrue
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.3 ExportSEPAMessageAndProcessReferences

In der Klasse ExportSEPAMessageAndProcessReferences ist die Klasse SEPALogic gegen die von Ihnen im Abschnitt 4.8.3.1 erstellte Prozesslogik auszutauschen.

BusinessException SPA.483.001 
 */
 protected DebitorIdentification createDebitorIdentification(final SEPAExport boSEPAExport) throws BusinessException
 {
 // @replace!
 //
 // Im folgenden Beispiel wird der Debitorenstammdatensatz in der Tabelle
 // der Kunden ("Client") gespeichert und als "intern" ("is internal") gekennzeichnet.
 // Die Debitorenkennung wird also aus genau jenem Stammdatensatz erzeugt.
 //
 // final Query qryDebitor = QueryProvider.create(Client.class)
 // .where(Client.IsInternal.eq(Boolean.TRUE));
 // final List<Client> lstClients = QueryProvider.execute(qryDebitor);
 // 
 // logDebug("Debitor list size: " + lstClients.size());
 // 
 // if (lstClients != null && lstClients.size() == 1) {
 // final Client boDebitor = lstClients.iterator().next();
 // 
 // final DebitorIdentification debitorId = new DebitorIdentification(
 // boDebitor.getName(),
 // boDebitor.getBic(),
 // boDebitor.getIban(),
 // boDebitor.getSEPACreditorId());
 // 
 // return debitorId;
 // } else if (lstClients != null && lstClients.size() > 1) {
 // throw new BusinessException("More than one clients marked as \"internal\" exist!");
 // } else {
 // throw new BusinessException("Client marked as \"internal\" is missing!");
 // } 
 
 return null;
 }
 
 /**
 * Builds the remittance information, related to the given creditor and reference
 * 
 * @param creditor An object of type <code>AbstractCreditorWrapper</code>, representing the debitor
 * @param reference An object of type <code>AbstractCreditorReferenceWrapper</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 AbstractCreditorWrapper debitor, 
 final AbstractCreditorReferenceWrapper reference,
 final BigDecimal bgdAmount) throws BusinessException
 {
 // @replace!
 // 
 // final SupplierBilling boSupplierBilling = (SupplierBilling)reference.getBusinessObject();
 // final StringBuffer sbRemittanceInfo = new StringBuffer();
 //
 // sbRemittanceInfo.append("ACCT. ");
 // sbRemittanceInfo.append(creditor.getSEPAMandateIdentification());
 // sbRemittanceInfo.append(" DATE ");
 // sbRemittanceInfo.append(reference.getReferenceDate());
 // sbRemittanceInfo.append(" AMNT. ");
 // sbRemittanceInfo.append(bgdAmount);
 // sbRemittanceInfo.append(" BGNR ");
 // sbRemittanceInfo.append(reference.getCreditTransferReference());
 // 
 // return sbRemittanceInfo.toString();
 
 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 AbstractDebitorReferenceWrapper reference,
 final BigDecimal bgdAmount) throws BusinessException
 {
 // @replace!
 // 
 // final ClientBilling boClientBilling = (ClientBilling)reference.getBusinessObject();
 // final StringBuffer sbRemittanceInfo = new StringBuffer();
 //
 // sbRemittanceInfo.append("ACCT. ");
 // sbRemittanceInfo.append(debitor.getSEPAMandateIdentification());
 // sbRemittanceInfo.append(" DATE ");
 // sbRemittanceInfo.append(reference.getReferenceDate());
 // sbRemittanceInfo.append(" AMNT. ");
 // sbRemittanceInfo.append(bgdAmount);
 // sbRemittanceInfo.append(" BGNR ");
 // sbRemittanceInfo.append(reference.getDirectDebitReference());
 // 
 // return sbRemittanceInfo.toString();
 
 return null;
 } 
 
 /**
 * Fetches all credit transfer references that are to be included in a given SEPA export (credit transfer initiation)
 * 
 * @param boSEPAExport A given SEPA export
 * 
 * @throws BusinessException
 */
 protected List<AbstractCreditTransferReferenceWrapper> fetchCreditTransferReferences(final SEPAExport boSEPAExport) 
 throws 
 BusinessException
 {
 // @replace!
 // 
 // final List<AbstractCreditTransferReferenceWrapper> lstCreditTransferReferences = new ArrayList<AbstractCreditTransferReferenceWrapper>();
 // 
 // final Query qrySupplierBillingPositions = QueryProvider.create(SupplierBillingPosition.class)
 // .where(SupplierBillingPosition.DueDate.Gte(boSEPAExport.getDateFrom()))
 // .and(SupplierBillingPosition.Faelligkeitsdatum.Lte(boSEPAExport.getDateUntil()))
 // .and(SupplierBillingPosition.SEPAExportDate.isNull())
 // .and(SupplierBillingPosition.IsOpen.eq(Boolean.TRUE))
 // .orderBy(SupplierBillingPosition.SupplierBilling, Boolean.TRUE)
 // .orderBy(SupplierBillingPosition.DueDate, Boolean.TRUE);
 // final List<SupplierBillingPosition> lstSupplierBillingPositions = QueryProvider.execute(qrySupplierBillingPositions);
 // 
 // for (final SupplierBillingPosition boSupplierBillingPosition : lstSupplierBillingPositions) {
 // lstCreditTransferReferences.add(creditTransferReferenceFacade.getWrapper(boSupplierBillingPosition));
 // }
 // 
 // return lstCreditTransferReferences;
 
 return null;
 }
 
 /**
 * Fetches all direct debit references that are to be included in a given SEPA export (direct debit initiation)
 * 
 * @param boSEPAExport A given SEPA export
 * 
 * @throws BusinessException
 */
 protected List<AbstractDirectDebitReferenceWrapper> fetchDirectDebitReferences(final SEPAExport boSEPAExport) 
 throws 
 BusinessException
 {
 // @replace!
 // 
 // final List<AbstractDirectDebitReferenceWrapper> lstDirectDebitReferences = new ArrayList<AbstractDirectDebitReferenceWrapper>();
 // 
 // final Query qryClientBillingPositions = QueryProvider.create(ClientBillingPosition.class)
 // .where(ClientBillingPosition.DueDate.Gte(boSEPAExport.getDateFrom()))
 // .and(ClientBillingPosition.Faelligkeitsdatum.Lte(boSEPAExport.getDateUntil()))
 // .and(ClientBillingPosition.SEPAExportDate.isNull())
 // .and(ClientBillingPosition.IsOpen.eq(Boolean.TRUE))
 // .orderBy(ClientBillingPosition.ClientBilling, Boolean.TRUE)
 // .orderBy(ClientBillingPosition.DueDate, Boolean.TRUE);
 // final List<ClientBillingPosition> lstClientBillingPositions = QueryProvider.execute(qryClientBillingPositions);
 // 
 // for (final ClientBillingPosition boClientBillingPosition : lstClientBillingPositions) {
 // lstDirectDebitReferences.add(directDebitReferenceFacade.getWrapper(boClientBillingPosition));
 // }
 // 
 // return lstDirectDebitReferences;
 
 return null;
 }
 
 
}

4.8.3.2 ExportSEPAMessage

In der Klasse ExportSEPAMessage ist die Klasse SEPALogic gegen die von Ihnen im Abschnitt 4.8.3.1 erstellte Prozesslogik auszutauschen.

Codeblock
languagejava
titleorg.nuclet.sepa.rule.ExportSEPAMessage
linenumberstrue
collapsetrue
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.SEPAExport;
import org.nuclet.sepa.logic.SEPALogic;

 
/** 
 * @name ExportSEPAMesssage 
 * @description Export SEPA message without processing the references
 * @usage 
 * @change
 * 
 * @version 2.0
 * @date 30.01.2015
 * @nuclet org.nuclet.SEPA
 * @nucletversion 2.0.0
 * @sincenucletversion 1.0.0
 * @since 14.03.2013
 * 
 * @author frank.lehmann@nuclos.de
 */ 
@Rule(name="ExportSEPAMesssage", description="Export SEPA Messsage")
public class ExportSEPAMesssage implements CustomRule 
{
 
 public void custom(CustomContext context) throws BusinessException 
 {
 final SEPAExport boSEPAExport = context.getBusinessObject(SEPAExport.class);
 
 SEPALogic logic = new SEPALogic(context);
 logic.initialize(context, boSEPAExport);
 logic.export();
 }
}

 

4.8.3.3 ExportSEPAMessageAndProcessReferences

In der Klasse ExportSEPAMessageAndProcessReferences ist die Klasse SEPALogic gegen die von Ihnen im Abschnitt 4.8.3.1 erstellte Prozesslogik auszutauschen.

Codeblock
languagejava
titleorg.nuclet.sepa.rule.ExportSEPAMessageAndProcessReferences
linenumberstrue
collapsetrue
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.sepa.SEPAExport;
import org.nuclet.sepa.logic.SEPALogic;

 
/** 
 * @name ExportSEPAMesssageAndProcessReferences 
 * @description Export SEPA messsage and process references
 * @usage 
 * @change 
 * 
 * @version 2.0
 * @date 30.01.2015
 * @nuclet org.nuclet.SEPA
 * @nucletversion 2.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);
 
Codeblock
languagejava
titleorg.nuclet.sepa.rule.ExportSEPAMessageAndProcessReferences
linenumberstrue
collapsetrue
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, boSEPAExport);
        logic.export(boSEPAExport);
        logic.processReferences(boSEPAExport); 
    }
}

...