Class SepaWorkflowService

java.lang.Object
org.imixs.workflow.sepa.services.SepaWorkflowService

@DeclareRoles("org.imixs.ACCESSLEVEL.MANAGERACCESS") @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS") public class SepaWorkflowService extends Object
This EJB provides methods to process invoiced during a sepa run.
Author:
rsoika
See Also:
  • SepaImportService
  • Field Details

  • Constructor Details

    • SepaWorkflowService

      public SepaWorkflowService()
  • Method Details

    • processInvoices

      public void processInvoices(org.imixs.workflow.ItemCollection sepaExport, List<org.imixs.workflow.ItemCollection> invoices, org.imixs.workflow.ItemCollection event, org.imixs.workflow.ItemCollection configuration) throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException, org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException
      This method expects a list of Subprocess definitions. The method updates and processes each existing invoice.

      The definition is expected in the following format (were regular expressions are allowed)

       
       <sepa name="invoice_update">
          <modelversion>1.0.0</modelversion>
          <task>100</task>
          <event>20</event>
       </sepa>
       
       
      Parameters:
      sepaExport - - sepa export workitem
      invoices - - list of invoices
      event - - current sepa export event containing the invoice_update definition.
      Throws:
      org.imixs.workflow.exceptions.AccessDeniedException
      org.imixs.workflow.exceptions.ProcessingErrorException
      org.imixs.workflow.exceptions.PluginException
      org.imixs.workflow.exceptions.ModelException
      See Also:
      • org.imixs.workflow.engine.plugins.SplitAndJoinPlugin.java
    • logMessage

      public void logMessage(String message, org.imixs.workflow.ItemCollection configuration, org.imixs.workflow.ItemCollection workitem)
      Creates a new log entry stored in the item _scheduler_log. The log can be writen optional to the configuraiton and the workitem
      Parameters:
      message -
      configuration -
    • findBankDataByPaymentType

      public org.imixs.workflow.ItemCollection findBankDataByPaymentType(String paymentType, org.imixs.workflow.ItemCollection configuration, String configType)
      This method returns a ItemColleciton containing the bank data (Name/IBAN/BIC) for a given configuration type (dbtr|cdtr)
      Parameters:
      paymentType - - name of the payment
      configuration - - the sepa configuration document
      configType - - the config type (ITEM_DBTR_CONFIG | ITEM_CDTR_CONFIG)
      Returns:
    • computeKey

      public String computeKey(org.imixs.workflow.ItemCollection invoice, org.imixs.workflow.ItemCollection event) throws org.imixs.workflow.exceptions.PluginException
      Helper Method to compute the grouping key from a workitem. The default key is the item "dbtr.iban". Optional the key can be overwritten by the model with a itemvalue expression provided in the event.

      Example:

       
           <sepa-export name="key">
              <itemvalue>dbtr.iban</itemvalue>-<itemvalue>currency</itemvalue>
           </sepa-export>
          

      The method throws a PluginException if the given invoice did not provide a dbtr.iban item.

      Returns:
      Throws:
      org.imixs.workflow.exceptions.PluginException
    • createNewSEPAExport

      public org.imixs.workflow.ItemCollection createNewSEPAExport(String key, org.imixs.workflow.ItemCollection workitem, org.imixs.workflow.ItemCollection event) throws org.imixs.workflow.exceptions.ModelException, org.imixs.workflow.exceptions.PluginException
      Helper method to create a new SEPA Export workitem
      Parameters:
      key -
      workitem -
      Returns:
      Throws:
      org.imixs.workflow.exceptions.ModelException
      org.imixs.workflow.exceptions.PluginException
    • processSEPAExport

      public org.imixs.workflow.ItemCollection processSEPAExport(org.imixs.workflow.ItemCollection datevExport) throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException, org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException
      Helper method to process a SEPA Exprot with on manager access level.
      Parameters:
      datevExport -
      Returns:
      Throws:
      org.imixs.workflow.exceptions.ModelException
      org.imixs.workflow.exceptions.PluginException
      org.imixs.workflow.exceptions.ProcessingErrorException
      org.imixs.workflow.exceptions.AccessDeniedException
    • findSEPAExportByTask

      public org.imixs.workflow.ItemCollection findSEPAExportByTask(String key, int taskID) throws org.imixs.workflow.exceptions.QueryException
      Helper method verifies all open SEPA exports and returns the latest for the given key name. If no open SEPA export exists the method returns null.
      Parameters:
      key -
      taskID - - optional can be used to restrict the lookup for a specific task
      Returns:
      Throws:
      org.imixs.workflow.exceptions.QueryException
    • updateDbtrDefaultData

      public void updateDbtrDefaultData(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginException
      This method adds the DBTR default information to a workitem if the workitem did not yet provide any debitor data. The data it read form the configuration dbtr list and the payment.type stored in the workitem.

      As payment can be distinguished between in and out. The method first test if the workitem contains a item payment.out.type. If not the item payment.type is taken. In this way a workitem can provide different payment types for outgoing payments and incoming payments (direct debit).

      The method throws a PluginException in case not dbtr data is available

      Parameters:
      workitem -
      Throws:
      org.imixs.workflow.exceptions.PluginException - - if dbtr data is missing
    • validateCdtrData

      public void validateCdtrData(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginException
      This method validates if the current workitem has cdtr data. If not a exception is thrown.
      Parameters:
      workitem -
      Throws:
      org.imixs.workflow.exceptions.PluginException
    • updateCdtrDefaultData

      public void updateCdtrDefaultData(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginException
      This method adds the CDTR default information to a workitem if the workitem did not yet provide any creditor data. The data it read form the configuration cdtr list and the payment.type stored in the workitem.

      As payment can be distinguished between in and out. The method first test if the worktiem contains a item payment.in.type. If not the item payment.type is taken. In this way a workitem can provide different payment types for outgoing payments and incoming payments (direct debit).

      Parameters:
      workitem -
      Throws:
      org.imixs.workflow.exceptions.PluginException - - if cdtr data is missing
    • validateDbtrData

      public void validateDbtrData(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginException
      This method validates if the current workitem has cdtr data. If not a exception is thrown.
      Parameters:
      workitem -
      Throws:
      org.imixs.workflow.exceptions.PluginException
    • findSEPAExport

      public org.imixs.workflow.ItemCollection findSEPAExport(String key) throws org.imixs.workflow.exceptions.QueryException
      Helper method verifies all open SEPA exports and returns the latest for the given key name. If no open SEPA export exists the method returns null.

      This method does not restrict the lookup for a specific taskID. This is used for removal

      Parameters:
      key -
      taskID - - optional can be used to restrict the lookup for a specific task
      Returns:
      Throws:
      org.imixs.workflow.exceptions.QueryException
    • harmonizeSEPAItem

      public org.imixs.workflow.ItemCollection harmonizeSEPAItem(org.imixs.workflow.ItemCollection invoice, String itemName)
      Remove characters like '&', '<' and '>' form sepa fields
      Parameters:
      invoice -
      Returns:
    • loadConfiguration

      public org.imixs.workflow.ItemCollection loadConfiguration()
      Helper method to load the SEPA scheduler configuration entity. The method returns null if no scheduler configuration exits.
      Returns:
    • loadInvoice

      public org.imixs.workflow.ItemCollection loadInvoice(String ref)
      Helper method to find and load a invoice on manager access level.
      Parameters:
      ref -
      Returns: