Seitenhistorie
...
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.bffscommon.logging.LogLevel; import org.nuclet.bffscommon.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.*; // @replace! // // import org.nuclet.businesstemplate.Client; // import org.nuclet.businesstemplate.ClientBilling; // import org.nuclet.businesstemplate.ClientBillingPosition; /** * 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) // Im folgenden Beispiel wird //der Kreditorenstammdatensatz in .where(Person.BffsStammdaten.eq(Boolean.TRUE));der Tabelle // finalder List<Person> lstPersonen = QueryProvider.execute(qryCreditor);Kunden ("Client") gespeichert und als "intern" ("is internal") gekennzeichnet. // Die Kreditorenkennung wird also aus genau jenem // logDebug("Creditor list size:" + lstPersonen.size());Stammdatensatz erzeugt. // // if (lstPersonen != null && lstPersonen.size() == 1) {final Query qryCreditor = QueryProvider.create(Client.class) // final Person boCreditor = lstPersonen.iterator().next(.where(Client.IsInternal.eq(Boolean.TRUE)); // final List<Client> lstCliebts = QueryProvider.execute(qryCreditor); // final CreditorIdentification creditorId = new CreditorIdentification( // logDebug("Creditor list size:" + boCreditor.getName(),lstClients.size()); // boCreditor.getBic(), // if (lstClients != null && lstClients.size() == boCreditor.getIban(),1) { // final Client boCreditor = boCreditorlstClients.getGlaeubigerIdSepaiterator().next(); // // final returnCreditorIdentification creditorId; = new CreditorIdentification( // } else if (lstPersonen != null && lstPersonenboCreditor.sizegetName() > 1) {, // throw new BusinessException("Es sind mehrere Personen-Datensätze als \"BFFS-Stammdaten\" gekennzeichnet!"); boCreditor.getBic(), // } else { //boCreditor.getIban(), // throw new BusinessException("Der BFFS-Stammdatensatz in der Entität \"Person\" fehlt!" boCreditor.getSEPACreditorId()); // } // return nullcreditorId; } //** } else if (lstClients *!= Buildsnull 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 *&& lstClients.size() > 1) { // throw new BusinessException("More than one clients marked as "internal" exist!"); // } else { // throw new BusinessException("Client marked as "internal" is missing!"); // } * @throws BusinessException return null; */} public String createRemittanceInformation(final AbstractDebitorWrapper debitor, /** * Builds the finalremittance AbstractReferenceWrapper referenceinformation, related to the given debitor and reference final BigDecimal bgdAmount) throws* BusinessException { * @param debitor An object of type <code>AbstractDebitorWrapper<// @replace! code>, representing the debitor * //@param reference An object of type // 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())) { <code>AbstractReferenceWrapper</code>, representing the reference * @param bgdAmount The payment amount, related to the given debitor and reference // sbRemittanceInfo.append("KTO. "); * * @return the remittance //information, related to the given sbRemittanceInfo.append(debitor.getSEPAMandateIdentification()); and reference // * sbRemittanceInfo.append(" DATUM "); * @throws BusinessException *// sbRemittanceInfo.append(reference.getReferenceDate()); public String createRemittanceInformation(final AbstractDebitorWrapper debitor, // final sbRemittanceInfo.append(" BETRAG "); AbstractReferenceWrapper reference, final //BigDecimal bgdAmount) throws BusinessException sbRemittanceInfo.append(bgdAmount); { // @replace! sbRemittanceInfo.append(" RNR "); // // final ClientBilling boClientBilling = sbRemittanceInfo.append(ClientBilling)reference.getDirectDebitReferencegetBusinessObject()); // final StringBuffer sbRemittanceInfo.append(" INCL. GEBÜHR FÜR MONATLICHE ABBUCHUNG" = new StringBuffer(); // } else { // // sbRemittanceInfo.append("KTOACCT. "); // sbRemittanceInfo.append(debitor.getSEPAMandateIdentification()); // sbRemittanceInfo.append(" DATUMDATE "); // sbRemittanceInfo.append(reference.getReferenceDate()); // sbRemittanceInfo.append(" BETRAGAMNT. "); // sbRemittanceInfo.append(bgdAmount); // sbRemittanceInfo.append(" RNRBGNR "); // sbRemittanceInfo.append(reference.getDirectDebitReference()); // } // return sbRemittanceInfo.toString(); // 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 qryForderungenqryClientBillingPositions = QueryProvider.create(ForderungClientBillingPosition.class) // .where(ForderungClientBillingPosition.FaelligkeitsdatumDueDate.Gte(boSEPAExport.getDateFrom())) // .and(ForderungClientBillingPosition.Faelligkeitsdatum.Lte(boSEPAExport.getDateUntil())) // .and(ForderungClientBillingPosition.ExportdatumSepaSEPAExportDate.isNull()) // .and(ForderungClientBillingPosition.OffenIsOpen.eq(Boolean.TRUE)) // .orderBy(ForderungClientBillingPosition.RechnungClientBilling, Boolean.TRUE) // .orderBy(ForderungClientBillingPosition.FaelligkeitsdatumDueDate, Boolean.TRUE); // final List<Forderung>List<ClientBillingPosition> lstForderungenlstClientBillingPositions = QueryProvider.execute(qryForderungenqryClientBillingPositions); // // for (final ForderungClientBillingPosition boForderungboClientBillingPosition : lstForderungenlstClientBillingPositions) { // lstPaymentReferences.add(new PaymentReferenceWrapper(boForderungboClientBillingPosition)); // } // // return lstPaymentReferences; return null; } } |
4.8.3.2 ExportSEPAMessage
...
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