camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suresh_camel <sureshkumari...@gmail.com>
Subject EDIFACT EJC Maven Plugin Cofiguration for Custom Decoders
Date Mon, 25 Nov 2013 06:37:32 GMT
 UN/EDIFACT Interchange Processing with Smooks v1.5.1 where i have to
configure the "Custom Decoder for DataTypes"

  <build> 
    <plugins> 
      <plugin> 
        <groupId>org.milyn</groupId> 
        <artifactId>maven-ejc-plugin</artifactId> 
        <version>1.5.1</version> 
        <configuration> 
         
<ediMappingModel>urn:org.milyn.edi.unedifact:d03b-mapping:1.0-SNAPSHOT</ediMappingModel>
          <packageName>se.tullverket.edifact</packageName> 
        </configuration> 
        <executions> 
          <execution> 
            <goals> 
              <goal>generate</goal> 
            </goals> 
          </execution> 
        </executions> 
        <dependencies> 
          <dependency> 
            <groupId>org.milyn.edi.unedifact</groupId> 
            <artifactId>d03b-mapping</artifactId> 
            <version>1.0-SNAPSHOT</version> 
          </dependency> 
        </dependencies> 
      </plugin> 
    </plugins> 
  </build>

For Eg: I need to configure the following Decoder for BigDecimal Type.

import java.math.BigDecimal;
import org.milyn.edisax.model.internal.Delimiters;
import org.milyn.javabean.DataDecodeException;
import org.milyn.javabean.DecodeType;
import org.milyn.javabean.decoders.DABigDecimalDecoder;

@DecodeType(BigDecimal.class)
public class EDIBigDecimalDecoder extends DABigDecimalDecoder{
	private static final long serialVersionUID = 337613680383128890L;
	   public String encode(Object object) throws DataDecodeException {
		   String format = super.encode(object);
		   Delimiters delimiters = super.getContextDelimiters();
		   String[] str = format.split(delimiters.getDecimalSeparator());
		   if(str.length > 1){
			   int intVal = Integer.parseInt(str[1]);
			   if(intVal > 0){
				   return format;
			   }
                           return str[0];
		   }
		   return format;
	    }
}

Kindly Assist me.





--
View this message in context: http://camel.465427.n5.nabble.com/EDIFACT-EJC-Maven-Plugin-Cofiguration-for-Custom-Decoders-tp5743777.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message