BigDecimals in EJC classes

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

BigDecimals in EJC classes

Dr Immo Benjes
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012


Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012



Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012




Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012





Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Hi Immo.  No probs on the name mix-up... just winding you up a bit :)  I'm always making those kinds of mistakes so "people in glass houses..." etc etc :)

Right.... so we obviously didn't update those build scripts post the 1.5 release.  Try changing the maven script(s), replacing "1.5-SNAPSHOT" with "1.5.1" and see where you get then.

Regards,

Tom.

On 07/12/2012 11:01, Dr Immo Benjes wrote:
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012






Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
Hi Tom,

I've replaced 1.5-SNAPSHOT with 1.5.1 in all the pom files and the gridle.build file.

Now it fails with a different problem 

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

So this time it can't find the dependency org.eclipse.xsd

Regards

Immo

Immo-Benjess-MacBook-Pro-2:unedifact-master immo$ gradle
The 'urls' property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the 'url' property to define the core maven repository & the 'artifactUrls' property to define any additional artifact locations.
:d00a/binding:processResources UP-TO-DATE
:d00a/mapping:compileJava UP-TO-DATE
:d00a/mapping:processResources
:d00a/mapping:classes
:d00a/mapping:ect
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3 mins 34.693 secs
Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 11:34, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  No probs on the name mix-up... just winding you up a bit :)  I'm always making those kinds of mistakes so "people in glass houses..." etc etc :)

Right.... so we obviously didn't update those build scripts post the 1.5 release.  Try changing the maven script(s), replacing "1.5-SNAPSHOT" with "1.5.1" and see where you get then.

Regards,

Tom.

On 07/12/2012 11:01, Dr Immo Benjes wrote:
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012







Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
Hi Tom,

I am not an maven expert but this seems to be an odd one. I've checked my local repository and I have the group: org.eclipse.xsd
 artifact: org.eclipse.xsd version 2.6.0.v20100914-1218 in my local repository already (added yesterday, must have added it when I run it with 1.5-SNAPSHOT?)

So why isn't the script using the local repository?

Your help is really appreciated

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 13:40, Dr Immo Benjes <[hidden email]> wrote:

Hi Tom,

I've replaced 1.5-SNAPSHOT with 1.5.1 in all the pom files and the gridle.build file.

Now it fails with a different problem 

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

So this time it can't find the dependency org.eclipse.xsd

Regards

Immo

Immo-Benjess-MacBook-Pro-2:unedifact-master immo$ gradle
The 'urls' property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the 'url' property to define the core maven repository & the 'artifactUrls' property to define any additional artifact locations.
:d00a/binding:processResources UP-TO-DATE
:d00a/mapping:compileJava UP-TO-DATE
:d00a/mapping:processResources
:d00a/mapping:classes
:d00a/mapping:ect
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3 mins 34.693 secs
Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 11:34, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  No probs on the name mix-up... just winding you up a bit :)  I'm always making those kinds of mistakes so "people in glass houses..." etc etc :)

Right.... so we obviously didn't update those build scripts post the 1.5 release.  Try changing the maven script(s), replacing "1.5-SNAPSHOT" with "1.5.1" and see where you get then.

Regards,

Tom.

On 07/12/2012 11:01, Dr Immo Benjes wrote:
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012








Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Ah yes... that eclipse stuff has always caused trouble.  I'll ask Renat and see if he has any ideas.

T.

On 07/12/2012 16:56, Dr Immo Benjes wrote:
Hi Tom,

I am not an maven expert but this seems to be an odd one. I've checked my local repository and I have the group: org.eclipse.xsd
 artifact: org.eclipse.xsd version 2.6.0.v20100914-1218 in my local repository already (added yesterday, must have added it when I run it with 1.5-SNAPSHOT?)

So why isn't the script using the local repository?

Your help is really appreciated

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 13:40, Dr Immo Benjes <[hidden email]> wrote:

Hi Tom,

I've replaced 1.5-SNAPSHOT with 1.5.1 in all the pom files and the gridle.build file.

Now it fails with a different problem 

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

So this time it can't find the dependency org.eclipse.xsd

Regards

Immo

Immo-Benjess-MacBook-Pro-2:unedifact-master immo$ gradle
The 'urls' property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the 'url' property to define the core maven repository & the 'artifactUrls' property to define any additional artifact locations.
:d00a/binding:processResources UP-TO-DATE
:d00a/mapping:compileJava UP-TO-DATE
:d00a/mapping:processResources
:d00a/mapping:classes
:d00a/mapping:ect
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3 mins 34.693 secs
Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 11:34, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  No probs on the name mix-up... just winding you up a bit :)  I'm always making those kinds of mistakes so "people in glass houses..." etc etc :)

Right.... so we obviously didn't update those build scripts post the 1.5 release.  Try changing the maven script(s), replacing "1.5-SNAPSHOT" with "1.5.1" and see where you get then.

Regards,

Tom.

On 07/12/2012 11:01, Dr Immo Benjes wrote:
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012









Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Renat Zubairov-4
Hi

I assume some of the dependencies of EMF bundle are missing, try to take the full-EMF/Modelling distribution, one JAR file is not enough.

Best regards,
Renat Zubairov

--
Product Owner ESB Tooling
Talend Application Integration Division
Phone: +49 228 763 77 652
Mobile: +49 160 963 89 304


Von: Tom Fennelly <[hidden email]>
Antworten an: "[hidden email]" <[hidden email]>
Datum: Freitag, 7. Dezember 2012 18:10
An: "[hidden email]" <[hidden email]>
Betreff: Re: [milyn-user] BigDecimals in EJC classes

Ah yes... that eclipse stuff has always caused trouble.  I'll ask Renat and see if he has any ideas.

T.

On 07/12/2012 16:56, Dr Immo Benjes wrote:
Hi Tom,

I am not an maven expert but this seems to be an odd one. I've checked my local repository and I have the group: org.eclipse.xsd
 artifact: org.eclipse.xsd version 2.6.0.v20100914-1218 in my local repository already (added yesterday, must have added it when I run it with 1.5-SNAPSHOT?)

So why isn't the script using the local repository?

Your help is really appreciated

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 13:40, Dr Immo Benjes <[hidden email]> wrote:

Hi Tom,

I've replaced 1.5-SNAPSHOT with 1.5.1 in all the pom files and the gridle.build file.

Now it fails with a different problem 

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

So this time it can't find the dependency org.eclipse.xsd

Regards

Immo

Immo-Benjess-MacBook-Pro-2:unedifact-master immo$ gradle
The 'urls' property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the 'url' property to define the core maven repository & the 'artifactUrls' property to define any additional artifact locations.
:d00a/binding:processResources UP-TO-DATE
:d00a/mapping:compileJava UP-TO-DATE
:d00a/mapping:processResources
:d00a/mapping:classes
:d00a/mapping:ect
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
SimpleHttpConnectionManager being used incorrectly.  Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/immo/development/smooks1.5/unedifact-master/build.gradle' line: 101

* What went wrong:
Execution failed for task ':d00a/mapping:ect'.
Cause: Could not resolve all dependencies for configuration ':d00a/mapping:runtime'.
Cause: Could not resolve group:org.eclipse.xsd, module:org.eclipse.xsd, version:2.6.0.v20100914-1218.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5.1 > org.milyn:milyn-smooks-ect:1.5.1
Cause: several problems occurred while resolving :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3 mins 34.693 secs
Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 11:34, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  No probs on the name mix-up... just winding you up a bit :)  I'm always making those kinds of mistakes so "people in glass houses..." etc etc :)

Right.... so we obviously didn't update those build scripts post the 1.5 release.  Try changing the maven script(s), replacing "1.5-SNAPSHOT" with "1.5.1" and see where you get then.

Regards,

Tom.

On 07/12/2012 11:01, Dr Immo Benjes wrote:
Hi Tom (sorry for that)

I tried to run it but got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:org.milyn, module:milyn-smooks-edi-test, version:1.5-SNAPSHOT.
Required by:
    org.milyn.edi.unedifact:d00a/mapping:1.5-SNAPSHOT
Cause: Could not GET 'http://repository.jboss.org/maven2/org/milyn/milyn-smooks-edi-test/1.5-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden




Is the path correct. All the other stuff was downloaded from 

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:33, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  "Tom" here :)

The build source for the UNEDIFACT modules is here... https://github.com/smooks/unedifact.  You can check them out and build them yourself.

Will have a look again later and see if I can figure it out.

Regards,

Tom.

On 07/12/2012 10:02, Dr Immo Benjes wrote:
Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  privatesynchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012









Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
In reply to this post by Dr Immo Benjes
Hi Tom,

I didn't manage to get the gradle to work but strangely enough when I call the build.sh script directly it goes off and builds all the classes.

However I have been looking at the sources and I can't see where you would specify the formatting (you certainly can't on the actual EJC class. 

The DABigDecimalDecoder is used to encode the BigDecimal to String in EDIFACT segments that have  BigDecimals and there doesn't seem to be a way to replace this decoder or set the format on the DABigDecimalDecoder. 

Can you remember how this was supposed to work? Where would you specify the formatting?

I would propose to change the hardcoded format string from the DABigDecimalDecoder:

now:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

IMHO better:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

Ideally you would want to be able to specify a format. The EJC compiler would need to have a getter/setter for the format which would then be set on the actual decoder/encoder. But I wouldn't know where to change that.

Regards

Immo



Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:02, Dr Immo Benjes <[hidden email]> wrote:

Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012




Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Hi Immo.

I honestly don't remember.  I'd need to dig into the code to find out and I just don't have the bandwidth to do that atm.  I think if you can modify the DABigDecimalDecoder to use the formatting you require then that will sort it for you, right? Maybe you could pull the formatting value from a System property, defaulting to the format you suggested as being better.

Sorry I can't be of more help.

Regards,

Tom.

On 10/12/2012 10:15, Dr Immo Benjes wrote:
Hi Tom,

I didn't manage to get the gradle to work but strangely enough when I call the build.sh script directly it goes off and builds all the classes.

However I have been looking at the sources and I can't see where you would specify the formatting (you certainly can't on the actual EJC class. 

The DABigDecimalDecoder is used to encode the BigDecimal to String in EDIFACT segments that have  BigDecimals and there doesn't seem to be a way to replace this decoder or set the format on the DABigDecimalDecoder. 

Can you remember how this was supposed to work? Where would you specify the formatting?

I would propose to change the hardcoded format string from the DABigDecimalDecoder:

now:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

IMHO better:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

Ideally you would want to be able to specify a format. The EJC compiler would need to have a getter/setter for the format which would then be set on the actual decoder/encoder. But I wouldn't know where to change that.

Regards

Immo



Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:02, Dr Immo Benjes <[hidden email]> wrote:

Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012





Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Dr Immo Benjes
Hi Tom,

I can see that there is a configuration method on the parent class NumberDecoder of DABigDecimalDecoder:

  public void setConfiguration(Properties config) throws SmooksConfigurationException {
        super.setConfiguration(config);
        String pattern = config.getProperty(FORMAT);
        String typeConfig = config.getProperty(TYPE);
        Locale locale = getLocale();
...

However I can't see how I could use this method! The DABigDecimalDecoder is not visible to me.

The DABigDecimalDecoder is private and has no getter/setter on an EJC class:

public class GIDGoodsItemDetails implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private BigDecimal e1496GoodsItemNumber;
    private DABigDecimalDecoder e1496GoodsItemNumberEncoder;
    private C2131NumberAndTypeOfPackages c2131NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2132NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2133NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2134NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2135NumberAndTypeOfPackages;

    public GIDGoodsItemDetails() {
        
        e1496GoodsItemNumberEncoder = new DABigDecimalDecoder();
    }


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 10 Dec 2012, at 17:51, Tom Fennelly <[hidden email]> wrote:

Hi Immo.

I honestly don't remember.  I'd need to dig into the code to find out and I just don't have the bandwidth to do that atm.  I think if you can modify the DABigDecimalDecoder to use the formatting you require then that will sort it for you, right? Maybe you could pull the formatting value from a System property, defaulting to the format you suggested as being better.

Sorry I can't be of more help.

Regards,

Tom.

On 10/12/2012 10:15, Dr Immo Benjes wrote:
Hi Tom,

I didn't manage to get the gradle to work but strangely enough when I call the build.sh script directly it goes off and builds all the classes.

However I have been looking at the sources and I can't see where you would specify the formatting (you certainly can't on the actual EJC class. 

The DABigDecimalDecoder is used to encode the BigDecimal to String in EDIFACT segments that have  BigDecimals and there doesn't seem to be a way to replace this decoder or set the format on the DABigDecimalDecoder. 

Can you remember how this was supposed to work? Where would you specify the formatting?

I would propose to change the hardcoded format string from the DABigDecimalDecoder:

now:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

IMHO better:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

Ideally you would want to be able to specify a format. The EJC compiler would need to have a getter/setter for the format which would then be set on the actual decoder/encoder. But I wouldn't know where to change that.

Regards

Immo



Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:02, Dr Immo Benjes <[hidden email]> wrote:

Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012






Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Hi Immo.

Yeah, seems like the only way around this for you is to modify that class and recompile.

Regards,

Tom.

On 12/12/2012 17:10, Dr Immo Benjes wrote:
Hi Tom,

I can see that there is a configuration method on the parent class NumberDecoder of DABigDecimalDecoder:

  public void setConfiguration(Properties config) throws SmooksConfigurationException {
        super.setConfiguration(config);
        String pattern = config.getProperty(FORMAT);
        String typeConfig = config.getProperty(TYPE);
        Locale locale = getLocale();
...

However I can't see how I could use this method! The DABigDecimalDecoder is not visible to me.

The DABigDecimalDecoder is private and has no getter/setter on an EJC class:

public class GIDGoodsItemDetails implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private BigDecimal e1496GoodsItemNumber;
    private DABigDecimalDecoder e1496GoodsItemNumberEncoder;
    private C2131NumberAndTypeOfPackages c2131NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2132NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2133NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2134NumberAndTypeOfPackages;
    private C2131NumberAndTypeOfPackages c2135NumberAndTypeOfPackages;

    public GIDGoodsItemDetails() {
        
        e1496GoodsItemNumberEncoder = new DABigDecimalDecoder();
    }


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 10 Dec 2012, at 17:51, Tom Fennelly <[hidden email]> wrote:

Hi Immo.

I honestly don't remember.  I'd need to dig into the code to find out and I just don't have the bandwidth to do that atm.  I think if you can modify the DABigDecimalDecoder to use the formatting you require then that will sort it for you, right? Maybe you could pull the formatting value from a System property, defaulting to the format you suggested as being better.

Sorry I can't be of more help.

Regards,

Tom.

On 10/12/2012 10:15, Dr Immo Benjes wrote:
Hi Tom,

I didn't manage to get the gradle to work but strangely enough when I call the build.sh script directly it goes off and builds all the classes.

However I have been looking at the sources and I can't see where you would specify the formatting (you certainly can't on the actual EJC class. 

The DABigDecimalDecoder is used to encode the BigDecimal to String in EDIFACT segments that have  BigDecimals and there doesn't seem to be a way to replace this decoder or set the format on the DABigDecimalDecoder. 

Can you remember how this was supposed to work? Where would you specify the formatting?

I would propose to change the hardcoded format string from the DABigDecimalDecoder:

now:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

IMHO better:
 private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

Ideally you would want to be able to specify a format. The EJC compiler would need to have a getter/setter for the format which would then be set on the actual decoder/encoder. But I wouldn't know where to change that.

Regards

Immo



Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.


Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 7 Dec 2012, at 10:02, Dr Immo Benjes <[hidden email]> wrote:

Hi Tim,

I have been trying to download the precompiled EDIFACT EJC classes from the repository for version 1.5 but it seems they don't exist.

only has 1.0 and 1.4

Can I use the 1.4 classes with smooks 1.5?

I had a look at the code and I can see that the DABigDecimalDecoder is used to convert the BigDecimal to a string:

 //Thread safe function to encode with delimiters awareness
    public String encode(Object object, Delimiters interchangeDelimiters) throws DataDecodeException {
        DecimalFormat decimalFormat = getDecimalFormat();
        setDecimalPointFormat(decimalFormat, interchangeDelimiters);
        return decimalFormat.format(object);
    }

  private synchronized void setDecimalPointFormat(DecimalFormat decimalFormat, Delimiters interchangeDelimiters) {
        DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols();

        decimalFormat.applyPattern("#0.0#");
        if (interchangeDelimiters != null) {
            dfs.setDecimalSeparator(interchangeDelimiters.getDecimalSeparator().charAt(0));
        }
        decimalFormat.setDecimalFormatSymbols(dfs);
    }

It doesn't look like the format can be changed as it is hard coded (this is from version 1.5). So the only chance would be to replace the DABigDecimalDecoder with a subclass.

I've found the org.milyn.javabean.Value which might be what I need:

 Smooks smooks = new Smooks();

 Value customerNumberValue = new Value( "customerNumber", "customer/@number")
                                   .setDecoder("Integer");
 Value customerNameValue = new Value( "customerName", "customer")
                                   .setDefault("Unknown");

 smooks.addVisitors(customerNumberValue);
 smooks.addVisitors(customerNameValue);

However I don't quite understand how the "customerNumber", "customer/@number"
works and how that would apply to the generated EDIFACT classes.

There seems to be something wrong in that example anyway as the setDecorder() method takes a DataDecoder (which can implement the DataEncoder interface).

Is this only used for unmarshalling or for marshalling as well?

Thank you for your help

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012

On 6 Dec 2012, at 18:11, Tom Fennelly <[hidden email]> wrote:

Hi Immo.  I know we added support for numeric value formatting in the Smooks JavaBean cartridge (on which EJC is built) and I'm fairly sure we added supprt for specifying these formats in EJC at some stage, but not sure if it was there for v1.4.  You'll need to get the source code and check.

Regards,

Tom.

On 06/12/2012 14:01, Dr Immo Benjes wrote:
Hi,

I am having a problem with BigDecimal in EJC generated classes (I am using the pre-compiled classes for v 1.4)

I have one Segment for EDIFACT version D00B:

GID - GoodsItemDetails

GID GOODS ITEM DETAILS

Function: To indicate totals of a goods item. 010 1496 GOODS ITEM NUMBER C 1 n..5 020 C213 NUMBER AND TYPE OF PACKAGES C 1 7224 Package quantity C n..8 7065 Package type description code C an..17 1131 Code list identification code C an..17 3055 Code list responsible agency code C an..3 7064 Type of packages C an..35 7233 Packaging related description code C an..3
The 1496 field  is a BigDecimal in the EJC generated class

If I set this:
gid.setGoodsItemNumber(new BigDecimal(1));

the output is 
GID+1.0+.....

when I do 
gid.setGoodsItemNumber(new BigDecimal(1).setScale(0,RoundingMode.UNNECESSARY));

the output is still
GID+1.0+.....

Is that a known issue with the version 1.4 classes? Has this been fixed in 1.5?

Regards

Immo
  

Dr. Immo Benjes
Senior Software Architect 

Locus Software Ltd
Castle Court
41 London Road
Reigate
Surrey RH2 9RJ
United Kingdom
Tel: +44 (0)1737 735012







Reply | Threaded
Open this post in threaded view
|

Ignoring CSV records based on date comparisions of a field with current date.

Vishal Changrani-2
In reply to this post by Dr Immo Benjes
Hi,
 
I have a huge CSV file which I need to load into a table. Each record of the CSV file has a start_time and a start_date field.
e.g.

8191|20130310|02:00|N|1800|2276801|||||None|||N|||N|N|N||N||||N|Ins|1446

The 20130310 and 2:00 are the date and time respectively. Is there a way in Smooks such that I could ignore records which don't meet a criteria such as - Current date and time - some number of days.

So for example I would like to ignore all records which have a start_time and start_date of today's date minus 2 days.

The XPATH selector for Smooks doesn't support such date functions as per the documentation.

<csv:reader fields = "sourceid, startdate, starttime, istimeapproximate, duration, programid, seriesid, tvrating, tvadvisory, programshowingtype, captiontype, audiolevel, threedlevel, sap, colortype, airingtype, subtitled, joinedinprogress, subjecttoblackout, aspectratio, dvs, partnumber, totalnumberofparts, hdtvlevel, syndicated, delta, scheduleid" separator="|" encoding="UTF-16" quote="^">

<csv:singleBinding beanId="schedule" class="com.xyz.plugin.bean.Schedule"/>

</csv:reader>

 I am not sure how to do it in MVEL either.

<db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

<condition>What should I put in here?</condition>

<db:statement>my update statment goes here</db:statement>

</db:executor>

 

Thanks in advance,

Vishal

 

 

Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

ponderMuse
In reply to this post by Tom Fennelly
Hi,

I am currently experiencing a similar issue to the one originally posted in this thread and would like to know whether this has now been resolved.

If so, what would be the steps needed to override a directory spec's mapping model so that specific segment values can be treated as a different type? e.g. Treat a value as a BigInteger or a String instead of a BigDecimal. So far I have been unable to figure out how to achieve this!

Thanks,
PM.
Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Alex Proca
In reply to this post by Dr Immo Benjes
We have a similar issue and for work around this we postprocess the edifact output and remove the unnecesarly ".0" bit with a regular expression like this:

"edifactString.replaceAll(":([0-9]+)\\.0:", ":$1:");"
Reply | Threaded
Open this post in threaded view
|

Re: BigDecimals in EJC classes

Tom Fennelly
Depending on how you're using the EDIFACT stuff in Smooks, this should
also be possible by applying a custom visitor to the event stream i.e.
inline the "postprocessing".

On 12/05/2014 13:34, Alex Proca wrote:

> We have a similar issue and for work around this we postprocess the edifact
> output and remove the unnecesarly ".0" bit with a regular expression like
> this:
>
> "edifactString.replaceAll(":([0-9]+)\\.0:", ":$1:");"
>
>
>
> --
> View this message in context: http://milyn.996300.n3.nabble.com/BigDecimals-in-EJC-classes-tp3301p8872.html
> Sent from the milyn - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email