From 4e886dacfb36b8648bd98f864c7354b1b9901167 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Mon, 14 Dec 2020 11:42:53 +0100 Subject: [PATCH] docu --- README.md | 27 +++++++- .../com/alexanderlogistics/FTPConnector.java | 13 ++-- .../resources/bundle/custom_de.properties | 8 ++- .../resources/bundle/custom_en.properties | 8 ++- .../forms/alexander/sub_positionen_read.xhtml | 63 +++++------------- .../java/com/alexanderlogistics/TestFTP.java | 65 +++++++++++++++++++ workflow/rechnungseingang-de-1.0.1.bpmn | 12 +++- 7 files changed, 139 insertions(+), 57 deletions(-) create mode 100644 office-alexander-logistics-app/src/test/java/com/alexanderlogistics/TestFTP.java diff --git a/README.md b/README.md index 9614459..fb2d9b5 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,18 @@ Die Zugangsdaten lauten: ### Cargosoft Schnittstelle +Für cargosoft verwenden wir einen Subaccoutn der auf das Verzeichns: + + + /office-alexander-logistics/cargosoft + +zeigt. + Benutzername: u248962-sub2 Passwort: aXa61n9Un3jDNQlL +Schnittstellen Details siehe unten + ## E-Mail Schnittstelle Es gibt ein Email Konto das wir für den Import von Rechnungen nutzen @@ -49,8 +58,24 @@ Es gibt ein Email Konto das wir f $ mvn clean install -Pdocker -## Push to Ixchel Cloud +### Push to Ixchel Cloud $ mvn clean install -Pkubernetes + +# Cargosoft + +Die Cargosoft Schnittstelle besteht aus einem eigenen Export modell "cargosoft-export-1.0.0". In diesem wird der CargoosftExportAdapter getriggert, der +die Daten einer Rechnung an den FTP Server übermittelt. + +Die Konfiguration der FTP Schnittstelle erfolgt über den Konfigurationsdialog im Office-Workflow mit den folgenden Werten: + + cargosoft.export.ftp.host=u248962.your-storagebox.de + cargosoft.export.ftp.path=/ + cargosoft.export.ftp.user=u248962-sub2 + cargosoft.export.ftp.password=aXa61n9Un3jDNQlL + + + + \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/FTPConnector.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/FTPConnector.java index b5b39e4..faa3e9f 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/FTPConnector.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/FTPConnector.java @@ -71,7 +71,7 @@ public class FTPConnector { @Inject @ConfigProperty(name = ENV_EXPORT_FTP_PORT, defaultValue = "21") - int ftpPort; + Optional ftpPort; @Inject @ConfigProperty(name = ENV_EXPORT_FTP_USER) @@ -93,7 +93,7 @@ public class FTPConnector { throw new PluginException(CargosoftExportAdapter.class.getSimpleName(), FTP_ERROR, "FTP file transfer failed: no ftp host name provided (" + ENV_EXPORT_FTP_HOST + ")!"); } - + String fileName = fileData.getName(); // Compute file path @@ -110,16 +110,14 @@ public class FTPConnector { try { logger.finest("......put " + fileName + " to FTP server: " + ftpServer + "..."); ftpClient = new FTPSClient("TLS", false); - ftpClient.setControlEncoding("UTF-8"); - ftpClient.connect(ftpServer.get(), ftpPort); + ftpClient.setBufferSize(8192); + ftpClient.connect(ftpServer.get(), ftpPort.get().intValue()); if (ftpClient.login(ftpUser.get(), ftpPassword.get()) == false) { throw new PluginException(CargosoftExportAdapter.class.getSimpleName(), FTP_ERROR, "FTP file transfer failed: login failed!"); } - ftpClient.enterLocalPassiveMode(); - // ftpClient.setFileType(FTP.ASCII_FILE_TYPE); - ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + ftpClient.setFileType(FTP.ASCII_FILE_TYPE); ftpClient.setControlEncoding("UTF-8"); // verify directories @@ -221,4 +219,5 @@ public class FTPConnector { "FTP file transfer failed: " + e.getMessage(), e); } } + } diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties index 836cabc..f030f0e 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties @@ -1,3 +1,9 @@ # Custom resource bundle -app.application_title=Alexander Global Logistics \ No newline at end of file +app.application_title=Alexander Global Logistics + +alexander_form_basic= +alexander_form_basic_read= +alexander_sub_positionen= +alexander_sub_positionen_read= +alexander_sub_responsible= \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties index 836cabc..f030f0e 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties @@ -1,3 +1,9 @@ # Custom resource bundle -app.application_title=Alexander Global Logistics \ No newline at end of file +app.application_title=Alexander Global Logistics + +alexander_form_basic= +alexander_form_basic_read= +alexander_sub_positionen= +alexander_sub_positionen_read= +alexander_sub_responsible= \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen_read.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen_read.xhtml index d408da9..7ee7008 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen_read.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen_read.xhtml @@ -12,14 +12,12 @@ - - - - - - - - + + + + + + @@ -33,23 +31,17 @@ - - - - - - - + + + - - - + + + @@ -63,9 +55,9 @@ @@ -82,28 +74,9 @@ diff --git a/office-alexander-logistics-app/src/test/java/com/alexanderlogistics/TestFTP.java b/office-alexander-logistics-app/src/test/java/com/alexanderlogistics/TestFTP.java new file mode 100644 index 0000000..a796787 --- /dev/null +++ b/office-alexander-logistics-app/src/test/java/com/alexanderlogistics/TestFTP.java @@ -0,0 +1,65 @@ +package com.alexanderlogistics; + + +import java.util.Optional; +import java.util.logging.Logger; + +import org.imixs.workflow.FileData; +import org.imixs.workflow.exceptions.PluginException; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import junit.framework.Assert; + +/** + * This test generates random test data + * + * @author rsoika + * + */ +public class TestFTP { + + + final static String FILE = "/DTVF_SKBeschrift_21010.csv"; + + private final static Logger logger = Logger.getLogger(TestFTP.class.getName()); + + @Before + public void setUp() throws Exception { + + } + + /** + * Test Kreditoren import + */ + @Ignore + @Test + public void testPutFileToFTP() { + + FTPConnector ftpc=new FTPConnector(); + + ftpc.ftpServer=Optional.ofNullable("u248962.your-storagebox.de"); + ftpc.ftpPort=Optional.ofNullable(21); + ftpc.ftpUser=Optional.ofNullable("u248962-sub2"); + ftpc.ftpPassword=Optional.ofNullable("aXa61n9Un3jDNQlL"); + ftpc.ftpPath=Optional.ofNullable("/"); + + + + + FileData fileData=new FileData("test.txt","some data...".getBytes(),"text",null); + try { + ftpc.put(fileData); + logger.info("test finished..."); + } catch ( PluginException e) { + + e.printStackTrace(); + Assert.fail(); + } + + } + + + +} diff --git a/workflow/rechnungseingang-de-1.0.1.bpmn b/workflow/rechnungseingang-de-1.0.1.bpmn index 7a59f4b..b32c0d6 100644 --- a/workflow/rechnungseingang-de-1.0.1.bpmn +++ b/workflow/rechnungseingang-de-1.0.1.bpmn @@ -387,7 +387,15 @@ Betrag: _amount (Brutto € _amount_brutto home -space.name]]> +space.name + + + cargosoft-export-1.0 + 1000 + 100 + (?!txtworkflowhistory)(^[a-zA-Z]|^_) + +]]> @@ -417,7 +425,7 @@ var b= workitem.get("order.total")[0]; SequenceFlow_8 SequenceFlow_51 - +
Pos.LeistungsbezeichnungEinheitMengeNetto-Preis / ME in €Gesamt in €#Positionsnummer *BuchungsperiodeSteuerNettoBrutto
- - +
- + Summe: - +