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 ObjectThis EJB provides methods to process invoiced during a sepa run.- Author:
- rsoika
- See Also:
SepaImportService
-
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_MISSING_DATAstatic intEVENT_ADD_REFstatic intEVENT_FAILEDstatic intEVENT_REMOVE_REFstatic intEVENT_STARTstatic intEVENT_SUCCESSstatic StringINVOICE_UPDATEstatic StringITEM_CDTR_BICstatic StringITEM_CDTR_CONFIGstatic StringITEM_CDTR_IBANstatic StringITEM_CDTR_NAMEstatic StringITEM_DBTR_BICstatic StringITEM_DBTR_CONFIGstatic StringITEM_DBTR_IBANstatic StringITEM_DBTR_NAMEstatic StringITEM_INITIAL_TASKstatic StringITEM_MODEL_VERSIONstatic StringITEM_PAYMENT_TYPEstatic StringITEM_SEPA_REPORTstatic StringLINK_PROPERTYstatic StringREPORT_ERRORstatic StringSEPA_CONFIGURATION
-
Constructor Summary
Constructors Constructor Description SepaWorkflowService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcomputeKey(org.imixs.workflow.ItemCollection invoice, org.imixs.workflow.ItemCollection event)Helper Method to compute the grouping key from a workitem.org.imixs.workflow.ItemCollectioncreateNewSEPAExport(String key, org.imixs.workflow.ItemCollection workitem, org.imixs.workflow.ItemCollection event)Helper method to create a new SEPA Export workitemorg.imixs.workflow.ItemCollectionfindBankDataByPaymentType(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)org.imixs.workflow.ItemCollectionfindSEPAExport(String key)Helper method verifies all open SEPA exports and returns the latest for the given key name.org.imixs.workflow.ItemCollectionfindSEPAExportByTask(String key, int taskID)Helper method verifies all open SEPA exports and returns the latest for the given key name.org.imixs.workflow.ItemCollectionharmonizeSEPAItem(org.imixs.workflow.ItemCollection invoice, String itemName)Remove characters like '&', '<' and '>' form sepa fieldsorg.imixs.workflow.ItemCollectionloadConfiguration()Helper method to load the SEPA scheduler configuration entity.org.imixs.workflow.ItemCollectionloadInvoice(String ref)Helper method to find and load a invoice on manager access level.voidlogMessage(String message, org.imixs.workflow.ItemCollection configuration, org.imixs.workflow.ItemCollection workitem)Creates a new log entry stored in the item _scheduler_log.voidprocessInvoices(org.imixs.workflow.ItemCollection sepaExport, List<org.imixs.workflow.ItemCollection> invoices, org.imixs.workflow.ItemCollection event, org.imixs.workflow.ItemCollection configuration)This method expects a list of Subprocess definitions.org.imixs.workflow.ItemCollectionprocessSEPAExport(org.imixs.workflow.ItemCollection datevExport)Helper method to process a SEPA Exprot with on manager access level.voidupdateCdtrDefaultData(org.imixs.workflow.ItemCollection workitem)This method adds the CDTR default information to a workitem if the workitem did not yet provide any creditor data.voidupdateDbtrDefaultData(org.imixs.workflow.ItemCollection workitem)This method adds the DBTR default information to a workitem if the workitem did not yet provide any debitor data.
-
-
-
Field Detail
-
SEPA_CONFIGURATION
public static final String SEPA_CONFIGURATION
- See Also:
- Constant Field Values
-
ERROR_MISSING_DATA
public static final String ERROR_MISSING_DATA
- See Also:
- Constant Field Values
-
EVENT_START
public static final int EVENT_START
- See Also:
- Constant Field Values
-
EVENT_SUCCESS
public static final int EVENT_SUCCESS
- See Also:
- Constant Field Values
-
EVENT_FAILED
public static final int EVENT_FAILED
- See Also:
- Constant Field Values
-
EVENT_ADD_REF
public static final int EVENT_ADD_REF
- See Also:
- Constant Field Values
-
EVENT_REMOVE_REF
public static final int EVENT_REMOVE_REF
- See Also:
- Constant Field Values
-
INVOICE_UPDATE
public static final String INVOICE_UPDATE
- See Also:
- Constant Field Values
-
LINK_PROPERTY
public static final String LINK_PROPERTY
- See Also:
- Constant Field Values
-
ITEM_MODEL_VERSION
public static final String ITEM_MODEL_VERSION
- See Also:
- Constant Field Values
-
ITEM_INITIAL_TASK
public static final String ITEM_INITIAL_TASK
- See Also:
- Constant Field Values
-
ITEM_PAYMENT_TYPE
public static final String ITEM_PAYMENT_TYPE
- See Also:
- Constant Field Values
-
ITEM_SEPA_REPORT
public static final String ITEM_SEPA_REPORT
- See Also:
- Constant Field Values
-
ITEM_DBTR_IBAN
public static final String ITEM_DBTR_IBAN
- See Also:
- Constant Field Values
-
ITEM_DBTR_BIC
public static final String ITEM_DBTR_BIC
- See Also:
- Constant Field Values
-
ITEM_DBTR_NAME
public static final String ITEM_DBTR_NAME
- See Also:
- Constant Field Values
-
ITEM_CDTR_IBAN
public static final String ITEM_CDTR_IBAN
- See Also:
- Constant Field Values
-
ITEM_CDTR_BIC
public static final String ITEM_CDTR_BIC
- See Also:
- Constant Field Values
-
ITEM_CDTR_NAME
public static final String ITEM_CDTR_NAME
- See Also:
- Constant Field Values
-
ITEM_DBTR_CONFIG
public static final String ITEM_DBTR_CONFIG
- See Also:
- Constant Field Values
-
ITEM_CDTR_CONFIG
public static final String ITEM_CDTR_CONFIG
- See Also:
- Constant Field Values
-
REPORT_ERROR
public static final String REPORT_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.ModelExceptionThis 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 workiteminvoices- - list of invoicesevent- - current sepa export event containing the invoice_update definition.- Throws:
org.imixs.workflow.exceptions.AccessDeniedExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.PluginExceptionorg.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 paymentconfiguration- - the sepa configuration documentconfigType- - 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.ModelExceptionorg.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.ModelExceptionHelper method to process a SEPA Exprot with on manager access level.- Parameters:
datevExport-- Returns:
- Throws:
org.imixs.workflow.exceptions.ModelExceptionorg.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.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.PluginExceptionThis 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 worktiem contains a item
payment.out.type. If not the itempayment.typeis 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
-
updateCdtrDefaultData
public void updateCdtrDefaultData(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginExceptionThis 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 itempayment.typeis 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
-
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:
-
-