org.milyn.edisax.util
Class EDIUtils

java.lang.Object
  extended by org.milyn.edisax.util.EDIUtils

public class EDIUtils
extends Object

EDIUtils contain different helper-methods for handling edifact.

Author:
bardl

Field Summary
static String EDI_MAPPING_MODEL_INTERCHANGE_PROPERTIES_FILE
           
static String EDI_MAPPING_MODEL_URN
           
static String EDI_MAPPING_MODEL_ZIP_LIST_FILE
           
static Description MODEL_SET_DEFINITIONS_DESCRIPTION
          Most model sets contain a set of common definitions (common types).
static String MODEL_SET_DEFINITIONS_DESCRIPTION_LOOKUP_NAME
          Lookup name (string representation) of MODEL_SET_DEFINITIONS_DESCRIPTION
static HashSet<String> reservedKeywords
           
 
Constructor Summary
EDIUtils()
           
 
Method Summary
static void assertLegalName(String name)
          Checks that the name is not a reserved word in java.
static String concatAndTruncate(List<String> nodeTokens, DelimiterType outerDelimiterType, Delimiters delimiters)
           
static String deleteWithPascalNotation(String value, char deleteChar)
          Removes all occurances of deleteChar and sets next character in value to uppercase.
static String encodeAttributeName(org.milyn.javabean.pojogen.JType type, String name)
          Encodes a String into standard java attribute name convention.
static String encodeAttributeName(String name)
           
static String encodeClassName(String name)
          Encodes a String into standard java class name convention.
static String encodeJavaIdentifier(String identifier)
           
static Properties getInterchangeProperties(String ediMappingModel)
           
static List<String> getMappingModelList(InputStream modelListStream)
           
static void loadMappingModels(Map<String,EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels)
           
static void loadMappingModels(String mappingModelFiles, Map<String,EdifactModel> mappingModels, URI baseURI)
           
static String[] split(String value, String delimiter, String escape)
          Splits a String by delimiter as long as delimiter does not follow an escape sequence.
static String toLookupName(Description description)
          Convert Description to the string representation that is used for lookup in the hashmaps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDI_MAPPING_MODEL_ZIP_LIST_FILE

public static final String EDI_MAPPING_MODEL_ZIP_LIST_FILE
See Also:
Constant Field Values

EDI_MAPPING_MODEL_INTERCHANGE_PROPERTIES_FILE

public static final String EDI_MAPPING_MODEL_INTERCHANGE_PROPERTIES_FILE
See Also:
Constant Field Values

EDI_MAPPING_MODEL_URN

public static final String EDI_MAPPING_MODEL_URN
See Also:
Constant Field Values

MODEL_SET_DEFINITIONS_DESCRIPTION

public static final Description MODEL_SET_DEFINITIONS_DESCRIPTION
Most model sets contain a set of common definitions (common types).


MODEL_SET_DEFINITIONS_DESCRIPTION_LOOKUP_NAME

public static final String MODEL_SET_DEFINITIONS_DESCRIPTION_LOOKUP_NAME
Lookup name (string representation) of MODEL_SET_DEFINITIONS_DESCRIPTION


reservedKeywords

public static HashSet<String> reservedKeywords
Constructor Detail

EDIUtils

public EDIUtils()
Method Detail

split

public static String[] split(String value,
                             String delimiter,
                             String escape)
Splits a String by delimiter as long as delimiter does not follow an escape sequence. The split method follows the same behavior as the method splitPreserveAllTokens(String, String) in StringUtils.

Parameters:
value - the string to split, may be null.
delimiter - the delimiter sequence. A null delimiter splits on whitespace.
escape - the escape sequence. A null escape is allowed, and result will be consistent with the splitPreserveAllTokens method.
Returns:
an array of split edi-sequences, null if null string input.

loadMappingModels

public static void loadMappingModels(String mappingModelFiles,
                                     Map<String,EdifactModel> mappingModels,
                                     URI baseURI)
                              throws EDIConfigurationException,
                                     IOException,
                                     SAXException
Throws:
EDIConfigurationException
IOException
SAXException

loadMappingModels

public static void loadMappingModels(Map<String,EdifactModel> mappingModels,
                                     URI baseURI,
                                     List<String> rootMappingModels)
                              throws IOException,
                                     SAXException,
                                     EDIConfigurationException
Throws:
IOException
SAXException
EDIConfigurationException

getInterchangeProperties

public static Properties getInterchangeProperties(String ediMappingModel)
                                           throws IOException
Throws:
IOException

concatAndTruncate

public static String concatAndTruncate(List<String> nodeTokens,
                                       DelimiterType outerDelimiterType,
                                       Delimiters delimiters)

getMappingModelList

public static List<String> getMappingModelList(InputStream modelListStream)
                                        throws IOException
Throws:
IOException

encodeClassName

public static String encodeClassName(String name)
                              throws IllegalNameException
Encodes a String into standard java class name convention. The following steps are performed on the name: 1. First character is set to upper case. 2. Illegal characters like '-' and whitespace are removed.

Parameters:
name - the original class name.
Returns:
the class name complying with standard java class name convention.
Throws:
IllegalNameException - when class name is a reserved keyword in java.

encodeAttributeName

public static String encodeAttributeName(org.milyn.javabean.pojogen.JType type,
                                         String name)
                                  throws IllegalNameException
Encodes a String into standard java attribute name convention. The following steps are performed on the name: 1. First character is set to lower case. 2. Illegal characters like '-' and whitespace are removed. 3. If attributetype is a Collection a 's'-character is appended.

Parameters:
type - the type of attribute.
name - the original attribut name.
Returns:
the attribute name complying with standard java attribute name convention.
Throws:
IllegalNameException - when attribute name is a reserved keyword in java.

encodeAttributeName

public static String encodeAttributeName(String name)

encodeJavaIdentifier

public static String encodeJavaIdentifier(String identifier)

deleteWithPascalNotation

public static String deleteWithPascalNotation(String value,
                                              char deleteChar)
Removes all occurances of deleteChar and sets next character in value to uppercase.

Parameters:
value - the String to perform deletion on.
deleteChar - the character to delete.
Returns:
the pascal notated String.

assertLegalName

public static void assertLegalName(String name)
                            throws IllegalNameException
Checks that the name is not a reserved word in java.

Parameters:
name - the value to check.
Throws:
IllegalNameException - when name is a reserved keyword in java.

toLookupName

public static String toLookupName(Description description)
Convert Description to the string representation that is used for lookup in the hashmaps

Parameters:
description -
Returns:


Copyright © 2018. All rights reserved.