Skip to content

Commit

Permalink
EDI - Allow getting excel-files from remote sftp
Browse files Browse the repository at this point in the history
- application.properties: change xls.order.* to excel.order.* to make it clearer
- also rename class files from XLS* to Excel*
- ExcelOLCandRoute: introduce optional remote-to-local-route

#6801
  • Loading branch information
metas-ts committed Jun 5, 2020
1 parent 1dd2ee8 commit 09ebb9a
Show file tree
Hide file tree
Showing 11 changed files with 1,071 additions and 1,055 deletions.
2 changes: 2 additions & 0 deletions misc/services/edi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ de.metas.endcustomer.mf15/metasfresh.properties
#Ignore IDEA files
*.iml
**/.idea

#ignore scrects that we might need for local dev and testing
secrect_dont_commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.metas.edi.esb.bean.imports.xls;
package de.metas.edi.esb.bean.imports.excel;

/*
* #%L
Expand Down Expand Up @@ -39,28 +39,28 @@
* @task 08839
*/
// @Immutable
public final class XLSConfigurationContext
public final class ExcelConfigurationContext
{
/**
* Creates the configuration by extracting the values from given {@link Exchange}'s properties
*
* NOTE: the properties were set Exchange by {@link #asSetPropertiesToExchangeProcessor()}.
*/
public static XLSConfigurationContext createFromExchange(final Exchange exchange)
public static ExcelConfigurationContext createFromExchange(final Exchange exchange)
{
return new XLSConfigurationContext(exchange);
return new ExcelConfigurationContext(exchange);
}

/**
* Creates the configuration by extracting the values from given {@link CamelContext}'s properties
*/
public static XLSConfigurationContext createFromCamelContext(final CamelContext camelContext)
public static ExcelConfigurationContext createFromCamelContext(final CamelContext camelContext)
{
return new XLSConfigurationContext(camelContext);
return new ExcelConfigurationContext(camelContext);
}

/** Config properties context root */
private static final String CONTEXT_XLS_ROOT = "xls.order.";
private static final String CONTEXT_XLS_ROOT = "excel.order.";

private final String CamelFileName;
//
Expand All @@ -85,7 +85,7 @@ public static XLSConfigurationContext createFromCamelContext(final CamelContext
private final String currencyISOCode;

/** Constructs the configuration by fetching the values from given {@link Exchange} properties */
private XLSConfigurationContext(final Exchange exchange)
private ExcelConfigurationContext(final Exchange exchange)
{
this.CamelFileName = exchange.getProperty(Exchange.FILE_NAME, String.class);
// this.EDIMessageDatePattern = exchange.getProperty(CONTEXT_EDIMessageDatePattern, String.class);
Expand All @@ -100,7 +100,7 @@ private XLSConfigurationContext(final Exchange exchange)
this.currencyISOCode = exchange.getProperty(CONTEXT_CurrencyISOCode, String.class);
}

private XLSConfigurationContext(final CamelContext camelContext)
private ExcelConfigurationContext(final CamelContext camelContext)
{
this.CamelFileName = null; // NOT available
// this.EDIMessageDatePattern = Util.resolvePropertyPlaceholders(camelContext, CONTEXT_EDIMessageDatePattern);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package de.metas.edi.esb.jaxb;

/*
* #%L
* de.metas.edi.esb
* de-metas-edi-esb-camel
* %%
* Copyright (C) 2015 metas GmbH
* Copyright (C) 2020 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
Expand All @@ -13,23 +11,22 @@
*
* 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

package de.metas.edi.esb.bean.imports.excel;

import static de.metas.edi.esb.commons.Util.resolveGenericLookup;

import java.math.BigDecimal;
import java.math.BigInteger;

import de.metas.edi.esb.bean.imports.xls.XLSConfigurationContext;
import de.metas.edi.esb.bean.imports.xls.XLS_OLCand_Row;
import de.metas.edi.esb.commons.Constants;
import de.metas.edi.esb.commons.Util;
import de.metas.edi.esb.jaxb.metasfresh.COrderDeliveryRuleEnum;
Expand All @@ -48,16 +45,16 @@
* @author tsa
* @task 08839
*/
public class XLSImpCOLCandTypeBuilder
public class ExcelImpCOLCandTypeBuilder
{
public static final XLSImpCOLCandTypeBuilder newBuilder()
public static final ExcelImpCOLCandTypeBuilder newBuilder()
{
return new XLSImpCOLCandTypeBuilder();
return new ExcelImpCOLCandTypeBuilder();
}

private final XLSImpCOLCandType olcand;

private XLSImpCOLCandTypeBuilder()
private ExcelImpCOLCandTypeBuilder()
{
super();

Expand All @@ -75,7 +72,7 @@ public XLSImpCOLCandType build()
return olcand;
}

public XLSImpCOLCandTypeBuilder setFromContext(final XLSConfigurationContext ctx)
public ExcelImpCOLCandTypeBuilder setFromContext(final ExcelConfigurationContext ctx)
{
// set ReplicationTrx attribute
olcand.setTrxNameAttr(ctx.getCamelFileName());
Expand Down Expand Up @@ -108,7 +105,7 @@ public XLSImpCOLCandTypeBuilder setFromContext(final XLSConfigurationContext ctx
return this;
}

public XLSImpCOLCandTypeBuilder setFromRow(final XLS_OLCand_Row row)
public ExcelImpCOLCandTypeBuilder setFromRow(final Excel_OLCand_Row row)
{
olcand.setLine(toBigIntegerOrNull(row.getLineNo()));
olcand.setPOReference(row.getPOReference());
Expand Down

0 comments on commit 09ebb9a

Please sign in to comment.