This commit is contained in:
Ralph Soika 2025-07-23 12:30:55 +02:00
parent 67affba4d7
commit 60d2d90114
5 changed files with 136 additions and 29 deletions

View file

@ -21,7 +21,7 @@ import org.imixs.workflow.office.util.SequenceService;
import jakarta.inject.Inject; import jakarta.inject.Inject;
/** /**
* Der CargosoftSplitAdapter erezeugt anhand der Positionstablelle eignee * Der CargosoftSplitAdapter erzeugt anhand der Positionstablelle
* cargosoft export workitems, getrennt für jede Buchungsperdiode. Dies ist * cargosoft export workitems, getrennt für jede Buchungsperdiode. Dies ist
* notwendig, da Cargosoft selbst nicht mit unterschiedlichen Buchungsperioden * notwendig, da Cargosoft selbst nicht mit unterschiedlichen Buchungsperioden
* in einer Rechnung umgehen kann. * in einer Rechnung umgehen kann.
@ -45,10 +45,13 @@ import jakarta.inject.Inject;
} }
* </pre> * </pre>
* <p> * <p>
* Because we also export the attachment data to cargosoft, the adaper lookups * Because we also export the attachment data to cargosoft, the adapter lookups
* the conente of the attachment in the snapshot of the origin workitem * the conente of the attachment in the snapshot of the origin workitem
* *
* *
* Der Adapter validiert zusätzlich ob die Kreditorennnummer cdtr.number gültig
* ist.
*
* @version 1.0 * @version 1.0
* @author rsoika * @author rsoika
*/ */
@ -63,6 +66,9 @@ public class CargosoftSplitAdapter implements SignalAdapter {
@Inject @Inject
SequenceService sequenceService; SequenceService sequenceService;
@Inject
BusinessPartnerService businessPartnerService;
/** /**
* This method computes the cargosoft export data file * This method computes the cargosoft export data file
* *
@ -76,6 +82,14 @@ public class CargosoftSplitAdapter implements SignalAdapter {
logger.info("......starting export..."); logger.info("......starting export...");
try { try {
// check cdtr.number
String cdtrNumber = workitem.getItemValueString("cdtr.number");
ItemCollection partner = businessPartnerService.getBusinessPartnerByID(InvoiceUtil.buildBPID(cdtrNumber));
if (partner == null) {
throw new PluginException(CargosoftSplitAdapter.class.getSimpleName(), CONFIG_ERROR,
"Missing or wrong Creditor Number, please check your data.");
}
// read the cargosoft split options // read the cargosoft split options
ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "cargosoft", workitem, false); ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "cargosoft", workitem, false);
@ -90,7 +104,7 @@ public class CargosoftSplitAdapter implements SignalAdapter {
if (model.isEmpty() || taskID == 0 || eventID == 0) { if (model.isEmpty() || taskID == 0 || eventID == 0) {
throw new PluginException(CargosoftSplitAdapter.class.getSimpleName(), CONFIG_ERROR, throw new PluginException(CargosoftSplitAdapter.class.getSimpleName(), CONFIG_ERROR,
"missign cargosoft configuration 'model', 'task', 'event' - please check model configuration"); "missing cargosoft configuration 'model', 'task', 'event' - please check model configuration");
} }
// Zunaechst müssen wir festelstellen, ob es mehrere unterschiedliche // Zunaechst müssen wir festelstellen, ob es mehrere unterschiedliche

View file

@ -12,22 +12,6 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Imixs Office Workflow Remote Test Client</name> <name>Imixs Office Workflow Remote Test Client</name>
<properties>
<java.source>11</java.source>
<java.target>11</java.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Dependency Versions -->
<jakarta.version>10.0.0</jakarta.version>
<org.imixs.workflow.version>6.0.9</org.imixs.workflow.version>
<org.imixs.marty.version>5.0.0</org.imixs.marty.version>
<!-- test dependencies -->
<junit.jupiter.version>5.9.2</junit.jupiter.version>
<mockito.version>5.8.0</mockito.version>
</properties>
<build> <build>
<resources> <resources>
<!-- enable resource filtering for multi language version --> <!-- enable resource filtering for multi language version -->
@ -87,13 +71,10 @@
<version>${org.imixs.workflow.version}</version> <version>${org.imixs.workflow.version}</version>
</dependency> </dependency>
<!-- Testing -->
<dependency> <dependency>
<groupId>org.imixs.workflow</groupId> <groupId>org.imixs.workflow</groupId>
<artifactId>imixs-melman</artifactId> <artifactId>imixs-melman</artifactId>
<version>${org.imixs.melman.version}</version> <version>${org.imixs.melman.version}</version>
<scope>test</scope>
</dependency> </dependency>
<!-- JUnit 5 Dependencies --> <!-- JUnit 5 Dependencies -->
<dependency> <dependency>

View file

@ -0,0 +1,105 @@
package com.alexanderlogistics.rest;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.imixs.melman.EventLogClient;
import org.imixs.melman.FormAuthenticator;
import org.imixs.melman.RestAPIException;
import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.exceptions.PluginException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* A test to explore a corgosoft invoice event
*
*/
// @Disabled
public class TestCargosoftEvents {
private static Logger logger = Logger.getLogger(TestCargosoftEvents.class.getName());
EventLogClient client = null;
String restAPI = "https://test.alexander-logistics.office-workflow.de/api";
// String restAPI = "http://localhost:8080/api";
String userID = "kutzner-service";
String password = "imixs";
/**
* Setup a new Rest Client
*
* @throws PluginException
*/
@BeforeEach
public void setup() throws PluginException {
client = new EventLogClient(restAPI);
FormAuthenticator aut;
try {
aut = new FormAuthenticator(restAPI, userID, password);
client.registerClientRequestFilter(aut);
} catch (RestAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Disabled
@Test
public void getXMLData() {
logger.info("start...");
try {
List<ItemCollection> list = client.searchEventLog("TOPIC_CARGOSOFT_INVOICE");
logger.info("found " + list.size() + " log entries");
for (ItemCollection entry : list) {
List<?> dataList = entry.getItemValue("data");
if (dataList != null && dataList.size() > 0) {
ItemCollection data = new ItemCollection((Map<String, List<Object>>) dataList.get(0));
logger.info("Data=" + data.getItemValueString("some-data"));
logger.info("XML Data=" + data.getItemValueString("xml-data"));
}
}
} catch (RestAPIException e) {
logger.severe("Failed to read event log entry: " + e.getMessage());
e.printStackTrace();
}
}
/**
* Deletes the 10 last topics
*/
@Test
public void deleteXMLData() {
logger.info("start...");
int count = 0;
try {
client.setPageSize(1000);
List<ItemCollection> list = client.searchEventLog("topictest", "TOPIC_CARGOSOFT_INVOICE");
// List<ItemCollection> list = client.searchEventLog("");
logger.info("found " + list.size() + " log entries");
for (ItemCollection entry : list) {
String id = entry.getItemValueString("id");
logger.info("delete event log entry id=" + id);
client.deleteEventLogEntry(id);
count++;
if (count >= 635000) {
break;
}
}
logger.info(count + " log entries deleted");
} catch (
RestAPIException e) {
logger.severe("Failed to read event log entry: " + e.getMessage());
e.printStackTrace();
}
}
}

11
pom.xml
View file

@ -29,9 +29,9 @@
<org.imixs.office.version>5.0.4</org.imixs.office.version> <org.imixs.office.version>5.0.4</org.imixs.office.version>
<org.imixs.workflow.version>6.0.9</org.imixs.workflow.version> <org.imixs.workflow.version>6.0.9</org.imixs.workflow.version>
<org.imixs.marty.version>5.0.0</org.imixs.marty.version> <org.imixs.marty.version>5.0.0</org.imixs.marty.version>
<org.imixs.archive.version>3.1.1</org.imixs.archive.version> <org.imixs.archive.version>3.1.2-SNAPSHOT</org.imixs.archive.version>
<org.imixs.adapters.version>3.0.3</org.imixs.adapters.version> <org.imixs.adapters.version>3.0.3</org.imixs.adapters.version>
<org.imixs.melman.version>2.1.0</org.imixs.melman.version> <org.imixs.melman.version>2.1.1-SNAPSHOT</org.imixs.melman.version>
<microprofile.version>6.0</microprofile.version> <microprofile.version>6.0</microprofile.version>
<net.sf.saxon.version>9.9.1-4</net.sf.saxon.version> <net.sf.saxon.version>9.9.1-4</net.sf.saxon.version>
<apache.pdfbox.version>2.0.26</apache.pdfbox.version> <apache.pdfbox.version>2.0.26</apache.pdfbox.version>
@ -285,6 +285,13 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- Melman Version Management hinzufügen -->
<dependency>
<groupId>org.imixs.workflow</groupId>
<artifactId>imixs-melman</artifactId>
<version>${org.imixs.melman.version}</version>
<scope>compile</scope>
</dependency>
<!-- xsl 2.0 support for Reporting / Chart Diagrams --> <!-- xsl 2.0 support for Reporting / Chart Diagrams -->
<dependency> <dependency>

View file

@ -6383,10 +6383,10 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
<bpmn2:association id="Association_3" sourceRef="TextAnnotation_2" targetRef="Task_5000"> <bpmn2:association id="Association_3" sourceRef="TextAnnotation_2" targetRef="Task_5000">
<bpmn2:documentation id="documentation_M9b4eQ"/> <bpmn2:documentation id="documentation_M9b4eQ"/>
</bpmn2:association> </bpmn2:association>
<bpmn2:textAnnotation id="TextAnnotation_1"> <bpmn2:textAnnotation id="TextAnnotation_1" textFormat="">
<bpmn2:text>Datenübergabe an Cargosoft. <bpmn2:text><![CDATA[Datenübergabe an Cargosoft.
Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export'</bpmn2:text> Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']]></bpmn2:text>
<bpmn2:documentation id="documentation_sMel1A"/> <bpmn2:documentation id="documentation_sMel1A"/>
</bpmn2:textAnnotation> </bpmn2:textAnnotation>
<bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="IntermediateCatchEvent_5005-20"> <bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="IntermediateCatchEvent_5005-20">
@ -8101,8 +8101,8 @@ Betrag: <itemvalue>invoice.total</itemvalue> <itemvalue>invoice.currency</itemva
<bpmndi:BPMNLabel id="BPMNLabel_216"/> <bpmndi:BPMNLabel id="BPMNLabel_216"/>
<di:waypoint x="725.0" y="1380.0"/> <di:waypoint x="725.0" y="1380.0"/>
<di:waypoint x="725.0" y="1315.0"/> <di:waypoint x="725.0" y="1315.0"/>
<di:waypoint x="860.0" y="1315.0"/> <di:waypoint x="865.0" y="1315.0"/>
<di:waypoint x="860.0" y="1062.0"/> <di:waypoint x="865.0" y="1063.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_112" id="BPMNEdge_SequenceFlow_113" sourceElement="BPMNShape_Task_20" targetElement="BPMNShape_IntermediateCatchEvent_57"> <bpmndi:BPMNEdge bpmnElement="SequenceFlow_112" id="BPMNEdge_SequenceFlow_113" sourceElement="BPMNShape_Task_20" targetElement="BPMNShape_IntermediateCatchEvent_57">
<bpmndi:BPMNLabel id="BPMNLabel_219"/> <bpmndi:BPMNLabel id="BPMNLabel_219"/>