Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
5656-app - EDI-Tweaks
Browse files Browse the repository at this point in the history
application.properties :
- add sftp related properties
- overhaul properties names
metasfresh/metasfresh#5656
  • Loading branch information
metas-ts committed Oct 17, 2019
1 parent b76885a commit 0bde0b6
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 79 deletions.
32 changes: 24 additions & 8 deletions pom.xml
Expand Up @@ -24,6 +24,11 @@
<!-- Testing -->
<junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<!--
3.8.0 is currently the latest and greatest. Spring boot declares some 2.x version that
see http://docs.spring.io/spring-boot/docs/1.2.3.RELEASE/reference/htmlsingle/#howto-customize-dependency-versions-with-maven
-->
<assertj.version>3.8.0</assertj.version>

<!-- https://github.com/codecentric/spring-boot-admin -->
<spring-boot-admin.version>2.1.5</spring-boot-admin.version>
Expand Down Expand Up @@ -52,19 +57,24 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
<version>${hamcrest.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
<version>${assertj.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -169,7 +179,6 @@
<artifactId>camel-ftp</artifactId>
</dependency>


<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -212,11 +221,18 @@
<version>3.13</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>

</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Expand Up @@ -13,8 +13,8 @@ public enum MeasurementUnit
CBMT("MTQ"),
PIEC("PCE"),
PACK("TU"),
//COLI("PCE"),
//DISP("PCE"),
COLI("COLI"),
DISP("DISP"),
CART("KRT");

private final String cuom;
Expand Down
Expand Up @@ -25,7 +25,7 @@ public class CompuDataInvoicRoute extends AbstractEDIRoute
{
public static final String ROUTE_ID = "MF-Invoic-To-COMPUDATA-Invoic";

private static final String EDI_INVOICE_FILENAME_PATTERN = "edi.file.invoice.compudata.filename";
private static final String EDI_INVOICE_FILENAME_PATTERN = "edi.file.invoic.compudata.filename";

public static final String EP_EDI_COMPUDATA_INVOICE_CONSUMER = "direct:edi.invoice.consumer";

Expand All @@ -38,7 +38,7 @@ public class CompuDataInvoicRoute extends AbstractEDIRoute
/**
* The FILE folder where the EDI file will be stored
*/
public static final String EP_EDI_FILE_INVOICE = "{{edi.file.invoice.compudata}}";
public static final String EP_EDI_FILE_INVOICE = "{{edi.file.invoic.compudata}}";

@Override
public void configureEDIRoute(final DataFormat jaxb, final DecimalFormat decimalFormat)
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class StepComXMLInvoicRoute extends AbstractEDIRoute
{
public static final String ROUTE_ID = "MF-Invoice-To-STEPCOM-XML-Invoic";

private static final String EDI_STEPCOM_XML_INVOICE_FILENAME_PATTERN = "edi.file.invoice.stepcom-xml.filename";
private static final String EDI_STEPCOM_XML_INVOICE_FILENAME_PATTERN = "edi.file.invoic.stepcom-xml.filename";

public static final String EP_EDI_STEPCOM_XML_INVOICE_CONSUMER = "direct:edi.invoice.stepcom-xml.consumer";
public static final String EP_EDI_STEPCOM_XML_INVOICE_CONSUMER = "direct:edi.invoic.stepcom-xml.consumer";

public static final String EDI_XML_OWNER_ID = "edi.props.stepcom.owner.id";
public static final String EDI_XML_APPLICATION_REF = "edi.props.stepcom.application.ref";
Expand All @@ -61,7 +61,7 @@ public class StepComXMLInvoicRoute extends AbstractEDIRoute
private final static QName EDIInvoiceFeedback_QNAME = Constants.JAXB_ObjectFactory.createEDIInvoiceFeedback(null).getName();
private static final String METHOD_setCInvoiceID = "setCInvoiceID";

private static final String EP_EDI_XML_FILE_INVOICE = "{{edi.file.invoice.stepcom-xml}}";
private static final String EP_EDI_XML_FILE_INVOICE = "{{edi.file.invoic.stepcom-xml}}";

private static final String JAXB_INVOIC_CONTEXTPATH = ObjectFactory.class.getPackage().getName();

Expand Down
Expand Up @@ -27,7 +27,7 @@
@Component
public class CompuDataOrdersRoute extends AbstractEDIRoute
{
public static final String EDI_INPUT_ORDERS = "{{edi.input.orders.computdata.filename}}";
public static final String EDI_INPUT_ORDERS = "{{edi.file.orders.compudata}}";

private static final Set<Class<?>> pojoTypes = new HashSet<Class<?>>();
static
Expand Down
Expand Up @@ -45,7 +45,7 @@ public class StepComXMLOrdersRoute
{
public static final String ROUTE_NAME = "STEPCOM-XML-Orders-To-MF-OLCand";

private static final String XML_INPUT_ORDERS = "{{edi.input.orders.stepcom-xml.filename}}";
private static final String XML_INPUT_ORDERS = "{{edi.file.orders.stepcom-xml}}";

private static final String JAXB_ORDER_CONTEXTPATH = ObjectFactory.class.getPackage().getName();

Expand Down
109 changes: 47 additions & 62 deletions src/main/resources/application.properties
Expand Up @@ -5,6 +5,38 @@ spring.application.title=metasfresh edi esb-service
#camel.springboot.jmx-enabled = false
server.port=8184

# Specifies that the BPartner with EDI recipient GLN 1234567890123 get the PARTNERID==STEPCOM-PARTNERI in the stepCOM EDI file that we export
edi.stepcom.partnerId.of.ediRecipientGLN.1234567890123=STEPCOM-PARTNERID

# SFTP settings
edi.sftpserver.hostAndPort=editeststorage.metasfresh.com:22
# to be placed into {{edi.local.dir}}/ssh/ when using SFTP
edi.sftpserver.privateKeyFile=mySshPrivateKeyFileName

#
#Endpoint URLs for imported and exported EDI files
#
# ORDERS
edi.file.orders.compudata=file://{{edi.local.dir}}/{{edi.file.orders.subdir}}/compudata?preMove=.processed&move=.done&moveFailed=.error
#edi.file.orders.compudata=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.orders.subdir}}?charset={{edi.compudata.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}
#
edi.file.orders.stepcom-xml=file://{{edi.local.dir}}/{{edi.file.orders.subdir}}/stepcom-xml?charset={{edi.stepcom.charset.name}}&preMove=processessing&move=../done&moveFailed=../error
#edi.file.orders.stepcom-xml=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.orders.subdir}}?charset={{edi.stepcom.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}
#
# DESADV
edi.file.desadv.compudata=file://{{edi.local.dir}}/{{edi.file.desadv.subdir}}/compudata?charset={{edi.compudata.charset.name}}
#edi.file.desadv.compudata=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.desadv.subdir}}?charset={{edi.compudata.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}
#
edi.file.desadv.stepcom-xml=file://{{edi.local.dir}}/{{edi.file.desadv.subdir}}/stepcom-xml?charset={{edi.stepcom.charset.name}}
#edi.file.desadv.stepcom-xml=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.desadv.subdir}}?charset={{edi.stepcom.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}
#
## INVOIC
edi.file.invoic.compudata=file://{{edi.local.dir}}/{{edi.file.invoic.subdir}}/compudata?charset={{edi.compudata.charset.name}}
#edi.file.invoic.compudata=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.invoic.subdir}}?charset={{edi.compudata.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}
#
edi.file.invoic.stepcom-xml=file://{{edi.local.dir}}/{{edi.file.invoic.subdir}}/stepcom-xml?charset={{edi.stepcom.charset.name}}
#edi.file.invoic.stepcom-xml=sftp://{{edi.sftpserver.hostAndPort}}/{{edi.file.invoic.subdir}}?charset={{edi.stepcom.charset.name}}&privateKeyFile={{edi.local.dir}}/ssh/{{edi.sftpserver.privateKeyFile}}

#rabbitmq config
#note: when running within docker, our startup-script overrides these 4 properties
camel.component.rabbitmq.hostname=localhost
Expand All @@ -28,68 +60,35 @@ de.metas.esb.to.metasfresh.durable=de.metas.esb.to.metasfresh.durable
#If the processing bundle is temporarily down, messages are stored until it comes up again
rabbitmq.in.exchange.durable=de.metas.esb.from.metasfresh.durable

edi.local.dir={{java.io.tmpdir}}/edi-standalone
edi.local.dir={{java.io.tmpdir}}/edi
#edi.local.dir=/home/esb/edi

#
# EDI Error Logging EndPoint Configuration
#
edi.log.exception.handler=log:de.metas.esb.edi.exceptionHandler?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true&multiline=true
# helper properties, not directly read by the esb bundle
#

#
# customer's EDI clearing center (compudata) needs the files to be in "ANSI"
# customer's EDI clearing centers (compudata and stepCOM) need the files to be in "ANSI"
edi.compudata.charset.name=Cp1252

edi.stepcom.charset.name=Cp1252

# Specifies that the BPartner with EDI recipient GLN 1234567890123 get the PARTNERID==STEPCOM-PARTNERI in the StepCOM EDI file that we export
edi.stepcom.partnerId.of.ediRecipientGLN.1234567890123=STEPCOM-PARTNERID
edi.file.orders.subdir=input/orders

##
# The following properties configure where generated EDI files are stored
##

#
# Invoice FTP/File properties (ftp is currently not used!)
#
# helper properties, not directly read by the esb bundle
edi.file.invoice.dir={{edi.local.dir}}/output/invoic
#edi.ftp.invoice.username=p22783f2
#edi.ftp.invoice.password=
#edi.ftp.invoice.server=
#edi.ftp.invoice.folder=ftp-ep-fresh-edi

# INVOIC files are stored with this file name, no matter if FTP or local file system; this property is directly read by the esb bundle
edi.file.invoice.compudata.filename=invoic-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.edi
edi.file.invoice.stepcom-xml.filename=rech-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.xml
edi.file.desadv.subdir=output/desadv
edi.file.invoic.subdir=output/invoic


#Endpoint URL for generated EDI INVOIC files
#Note that we need the charset URI param, even though we call .convertBodyTo(byte[].class, charsetName) within our route
edi.file.invoice.compudata=file://{{edi.file.invoice.dir}}/computdata?charset={{edi.compudata.charset.name}}
edi.file.invoice.stepcom-xml=file://{{edi.file.invoice.dir}}/stepcom-xml?charset={{edi.stepcom.charset.name}}
#FTP is currently disabled, instead we store the EDI file locally
#edi.file.invoice=ftp://{{edi.ftp.invoice.username}}@{{edi.ftp.invoice.server}}{{edi.ftp.invoice.folder}}password={{edi.ftp.invoice.password}}
#
# DESADV FTP/File properties (ftp is currently not used!)
#
# helper properties, not directly read by the esb bundle
edi.file.desadv.dir={{edi.local.dir}}/output/desadv
#edi.ftp.desadv.username=p22783f2
#edi.ftp.desadv.password=
#edi.ftp.desadv.server=
#edi.ftp.desadv.folder=ftp-ep-fresh-edi

# DESADV files are stored with this file name, no matter if FTP or local file system; this property is directly read by the esb bundle
edi.file.desadv.compudata.filename=desadv-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.edi
edi.file.desadv.stepcom-xml.filename=lief-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.xml

#Endpoint URL for generated EDI INVOIC files
#Note that we need the charset URI param, even though we call .convertBodyTo(byte[].class, charsetName) within our route
edi.file.desadv.compudata=file://{{edi.file.desadv.dir}}/computdata?charset={{edi.compudata.charset.name}}
edi.file.desadv.stepcom-xml=file://{{edi.file.desadv.dir}}/stepcom-xml?charset={{edi.stepcom.charset.name}}
#FTP is currently disabled, instead we store the EDI file locally
#edi.file.desadv=ftp://{{edi.ftp.desadv.username}}@{{edi.ftp.desadv.server}}{{edi.ftp.desadv.folder}}password={{edi.ftp.desadv.password}}

# INVOIC files are stored with this file name, no matter if FTP or local file system; this property is directly read by the esb bundle
edi.file.invoic.compudata.filename=invoic-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.edi
edi.file.invoic.stepcom-xml.filename=rech-$simple{date:now:ddMMyyyy-hhmmss-SSSZ}.xml


#
# Properties that are set when mapping the POJOs
#
Expand Down Expand Up @@ -119,8 +118,6 @@ edi.local.error=file://{{edi.local.dir}}/error
#
# Usually there is no need to edit the following properties
#
edi.ftp.invoice=ftp://{{edi.ftp.invoice.username}}@{{edi.ftp.invoice.server}}/{{edi.ftp.invoice.folder}}?password={{edi.ftp.invoice.password}}
edi.ftp.desadv=ftp://{{edi.ftp.desadv.username}}@{{edi.ftp.desadv.server}}/{{edi.ftp.desadv.folder}}?password={{edi.ftp.desadv.password}}

ep.rabbitmq.from.ad=rabbitmq:{{rabbitmq.in.exchange.durable}}?exchangeType=topic&durable=true&autoDelete=false&routingKey={{rabbitmq.in.exchange.durable}}&queue={{rabbitmq.in.exchange.durable}}
ep.rabbitmq.to.ad=rabbitmq:{{rabbitmq.out.exchange.durable}}?exchangeType=topic&durable=true&autoDelete=false&routingKey={{rabbitmq.out.exchange.durable}}&queue={{rabbitmq.out.exchange.durable}}
Expand Down Expand Up @@ -160,17 +157,6 @@ edi.smooks.config.xml.orders.T100=/marshal-config/smooks/orders/edi-smooks-compu
#Note: do use external files from the file system, you can do e.g.:
#edi.smooks.config.xml.orders.H000=file://{{edi.local.dir}}/marshal-config/smooks/orders/edi-smooks-compudata-orders-H000.xml

# reading from local file; see http://camel.apache.org/ftp.html on how to get the EDI data via FTP
edi.input=file://{{edi.local.dir}}/input

#
# Input compudata-ORDERS to XML
edi.input.orders.computdata.filename={{edi.input}}/orders/compudata?preMove=.processed&move=.done&moveFailed=.error

#
# Input stepcom-ORDERS-XML to XML
edi.input.orders.stepcom-xml.filename={{edi.input}}/orders/stepcom-xml?charset={{edi.stepcom.charset.name}}&preMove=processing&move=../done&moveFailed=../error

#
# Feedback CHARSET_NAME
#
Expand All @@ -197,7 +183,7 @@ edi.order.ad_user_enteredby_id=150

# A=available, F=force
edi.order.deliveryrule=F
# P=pickup, S=shipped
# P=pickup, S=shipper
edi.order.deliveryviarule=S

#
Expand All @@ -216,11 +202,10 @@ edi.props.invoic.stepcom-xml.isTest=T
# determines if the incoming invoic data should be saved as XML (true or false)
edi.props.invoic.isStepComXML=true


#
# Excel Orders Import (task 08839)
# Code reference: XLSConfigurationContext
xls.order.input={{edi.input}}/olcand
xls.order.input=file://{{edi.local.dir}}/{{edi.file.orders.subdir}}/mf-excel-pricelist
xls.order.currency=CHF
xls.order.ad_client_value={{edi.order.ad_client_value}}
xls.order.ad_org_id={{edi.order.ad_org_id}}
Expand Down

0 comments on commit 0bde0b6

Please sign in to comment.