diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java new file mode 100644 index 0000000..c02a15f --- /dev/null +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java @@ -0,0 +1,159 @@ +/******************************************************************************* + * Imixs Workflow Technology + * Copyright (C) 2003, 2008 Imixs Software Solutions GmbH, + * http://www.imixs.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You can receive a copy of the GNU General Public + * License at http://www.gnu.org/licenses/gpl.html + * + * Contributors: + * Imixs Software Solutions GmbH - initial API and implementation + * Ralph Soika + * + *******************************************************************************/ +package com.alexanderlogistics; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.imixs.workflow.ItemCollection; +import org.imixs.workflow.engine.DocumentService; +import org.imixs.workflow.exceptions.AccessDeniedException; +import org.imixs.workflow.faces.data.WorkflowEvent; + +import jakarta.ejb.EJB; +import jakarta.enterprise.event.Observes; +import jakarta.faces.view.ViewScoped; +import jakarta.inject.Named; + +/** + * Der BusinessPartnerController stellt methoden für die BusinessPartner Forms + * bereit. + * + * + * @author rsoika + * @version 1.0 + */ + +@Named +@ViewScoped +public class BusinessPartnerController implements Serializable { + + private static final long serialVersionUID = 1L; + + protected List ibanList = null; + + @EJB + DocumentService documentService; + + private static Logger logger = Logger.getLogger(BusinessPartnerController.class.getName()); + + /** + * WorkflowEvent listener to convert the IBAN child list embeded HashMaps into + * ItemCollections and + * reconvert them before processing + * + * @param workflowEvent + * @throws AccessDeniedException + */ + public void onWorkflowEvent(@Observes WorkflowEvent workflowEvent) throws AccessDeniedException { + + int eventType = workflowEvent.getEventType(); + ItemCollection workitem = workflowEvent.getWorkitem(); + if (workitem == null) { + return; + } + + // reset orderItems if workItem has changed + if (WorkflowEvent.WORKITEM_CHANGED == eventType || WorkflowEvent.WORKITEM_CREATED == eventType) { + // reset state + explodeIBANList(workitem); + } + + // before the workitem is saved we update the field txtOrderItems + if (WorkflowEvent.WORKITEM_BEFORE_PROCESS == eventType) { + implodeIBANList(workitem); + } + + if (WorkflowEvent.WORKITEM_AFTER_PROCESS == eventType) { + // reset state + explodeIBANList(workitem); + } + + } + + public List getIbanList() { + return ibanList; + } + + public void addIBAN() { + if (ibanList == null) { + ibanList = new ArrayList(); + } + ItemCollection source = new ItemCollection(); + ibanList.add(source); + } + + /** + * Removes an dbtr item from the list + * + * @param name - name of dbtr + */ + public void removeIBAN(String name) { + if (name != null && ibanList != null) { + for (ItemCollection cdtr : ibanList) { + if (name.equals(cdtr.getItemValueString("name"))) { + ibanList.remove(cdtr); + break; + } + } + } + } + + protected void implodeIBANList(ItemCollection workitem) { + List mapOrderItems = new ArrayList(); + if (this.ibanList != null) { + logger.fine("Convert child items into Map..."); + Iterator var3 = this.ibanList.iterator(); + + while (var3.hasNext()) { + ItemCollection orderItem = (ItemCollection) var3.next(); + mapOrderItems.add(orderItem.getAllItems()); + } + + workitem.replaceItemValue("partner.iban.list", mapOrderItems); + } + + } + + protected void explodeIBANList(ItemCollection workitem) { + this.ibanList = new ArrayList(); + List mapOrderItems = workitem.getItemValue("partner.iban.list"); + Iterator var4 = mapOrderItems.iterator(); + while (var4.hasNext()) { + Object mapOderItem = var4.next(); + if (mapOderItem instanceof Map) { + ItemCollection itemCol = new ItemCollection((Map) mapOderItem); + + this.ibanList.add(itemCol); + + } + } + + } + +} diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_businesspartner_ibanlist.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_businesspartner_ibanlist.xhtml new file mode 100644 index 0000000..bee7855 --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_businesspartner_ibanlist.xhtml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
NameBank + *IBANBIC +
+ + + + + + + + + + + + +
+ + + + +
+
+ + + + + + + + + + +
\ No newline at end of file diff --git a/workflow/businesspartner-de-1.0.0.bpmn b/workflow/businesspartner-de-1.0.0.bpmn index 8ac2ec2..8872381 100644 --- a/workflow/businesspartner-de-1.0.0.bpmn +++ b/workflow/businesspartner-de-1.0.0.bpmn @@ -1,5 +1,5 @@ - + @@ -43,6 +43,7 @@ event_aSdkwg event_Tr0aug dataObject_UQIXAQ + event_vwH0cA @@ -69,6 +70,7 @@ sequenceFlow_knUYpQ sequenceFlow_2uNvPw sequenceFlow_NNbMhg + sequenceFlow_avahXg @@ -87,7 +89,12 @@ - + + + + + + sequenceFlow_2uNvPw sequenceFlow_1mXO8A @@ -108,60 +115,67 @@ - + + - - - + + - - + + - - - - - - + + + + + + + - - - - - - - - - + + + + ]]> + + + sequenceFlow_avahXg + + + + + + + + - + - + - + - + - + @@ -170,63 +184,83 @@ - - + + - + - + - + - + - - + + - - + + - + - + - - + + - - + + - - + + - - - + + + - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + +