Open Business Objects for EDI
v3.6.0

com.americancoders.util
Class Util

java.lang.Object
  |
  +--com.americancoders.util.Util

public class Util
extends java.lang.Object

class of utility routines


Field Summary
static java.lang.String baseDirectory
          used by transactionsetfactor
static java.lang.String checkPropertyFileForChanges
          test to see user wants property file reread if its timestamp has changed since last read.
static java.lang.String doPrevalidate
          used to indicate if the first mandatory idlist object should be used like a primary key and therefore allow for prevalidation
static java.lang.String errorLevelToReport
          used solely by DocumentErrors and XMLError classes
static java.lang.String lineFeed
          line separator character used by local operating system.
static java.lang.String realNumbersRetainPrecision
          test to see if Real Data elements should maintain the precision based on how the fields was initially set.
static java.lang.String searchDirective
          used by transactionsetfactor
static java.lang.String throwParsingException
          used to indicate if the parser should throw an exception when it complete parsing and there is an exception
static java.lang.String useNamespace
          used by transactionsetfactor
static java.lang.String useObject
          used to indicate if the transactionset and evelope factory classes should use the object file form of the object being built or to always build from the xml rules file.
static java.lang.String validCharacterSet
           
static java.lang.String xmlPath
          used to find path/location of rules files
 
Constructor Summary
Util()
           
 
Method Summary
static void closeOBOEProperty()
          use this if you need to reset the property file which is usually left open
static void copyFile(java.lang.String inputFile, java.lang.String outputFile)
          copy file using string file name
static java.lang.String currentDate()
           
static java.lang.String currentTime()
           
static void deepCopy(java.io.Externalizable fromObj, java.io.Externalizable toObj)
          returns a deep copy of an object
JavaWorld Javatip 76 by Dave Miller
http://www.javaworld.com/javaworld/javatips/jw-javatip76.html
static java.lang.String denormalizeNonUnicode(java.lang.String inString)
          normlizes the string to replace NonUnicode characters.
static java.lang.String getCES()
          gets and returns the x12 composite element seperator character
static java.lang.String getOBOEProperty(java.lang.String inString)
           
static java.lang.String getXMLPath()
          returns the xmlPath directive in OBOE.properties file
static boolean isInteger(java.lang.String arg)
          somewhat like Character.isDigit expect checks whole string and only checks roman characters
static boolean isLog4JNotConfigured()
          Returns true if it appears that log4j have been previously configured.
static int isValidForCharacterSet(java.lang.String arg)
          checks to see if string is valid depending on OBOE.properties "validCharacters" If property is not defined then always returns -1, all are valid.
static void main(java.lang.String[] args)
           
static java.lang.String normalize(java.lang.String inString)
          normlizes the string to remove XML characters.
static java.lang.String normalizeNonUnicode(java.lang.String inString)
          normlizes the string to remove NonUnicode characters.
static boolean propertyFileIndicatesDoPrevalidate()
          routine to test to see if we want to do the prevalidation logic
prevalidation is the function of segments to check to see if there valid by the first id code field in the container
static boolean propertyFileIndicatesRealNumbersRetainPrecision()
          routine to test to see if Real Data elements should maintain the precision based on how the fields was initially set.
static boolean propertyFileIndicatesThrowParsingException()
          routine to test to see if parsers should throw exceptions or based on property in OBOE.properties file "throwParsingException"
static boolean propertyFileIndicatesUseObject()
          routine to test to see if parsers allows try to use object files based on property in OBOE.properties file "useObject"
static java.io.Reader removeCRLFFromReader(java.io.Reader inReader)
          input blocked data.
static java.io.InputStream removeCRLFFromStream(java.io.InputStream inIS)
          input blocked data.
static void resetValids()
          used by junit tests
static java.lang.String rightTrim(java.lang.String inString)
          removes trailing spaces
static java.lang.String searchForFile(java.lang.String inFilename, java.lang.String inStopAtDir)
          starting with the full file name search down the specified absolute path to find the file
static void setOBOEProperty(java.lang.String inName, java.lang.String inValue)
           
static void setServletContextPath(java.lang.String inPath)
           
static java.lang.String unEscape(java.lang.String inString, java.lang.String inEscString)
          removes escape characters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlPath

public static final java.lang.String xmlPath
used to find path/location of rules files

See Also:
Constant Field Values

errorLevelToReport

public static final java.lang.String errorLevelToReport
used solely by DocumentErrors and XMLError classes

See Also:
Constant Field Values

searchDirective

public static final java.lang.String searchDirective
used by transactionsetfactor

See Also:
Constant Field Values

baseDirectory

public static final java.lang.String baseDirectory
used by transactionsetfactor

See Also:
Constant Field Values

useNamespace

public static final java.lang.String useNamespace
used by transactionsetfactor

See Also:
Constant Field Values

throwParsingException

public static final java.lang.String throwParsingException
used to indicate if the parser should throw an exception when it complete parsing and there is an exception

See Also:
Constant Field Values

doPrevalidate

public static final java.lang.String doPrevalidate
used to indicate if the first mandatory idlist object should be used like a primary key and therefore allow for prevalidation

See Also:
Constant Field Values

useObject

public static final java.lang.String useObject
used to indicate if the transactionset and evelope factory classes should use the object file form of the object being built or to always build from the xml rules file.

See Also:
Constant Field Values

realNumbersRetainPrecision

public static final java.lang.String realNumbersRetainPrecision
test to see if Real Data elements should maintain the precision based on how the fields was initially set.

See Also:
Constant Field Values

checkPropertyFileForChanges

public static final java.lang.String checkPropertyFileForChanges
test to see user wants property file reread if its timestamp has changed since last read.

See Also:
Constant Field Values

validCharacterSet

public static final java.lang.String validCharacterSet
See Also:
Constant Field Values

lineFeed

public static final java.lang.String lineFeed
line separator character used by local operating system.

Constructor Detail

Util

public Util()
Method Detail

setServletContextPath

public static void setServletContextPath(java.lang.String inPath)

currentDate

public static java.lang.String currentDate()
Returns:
String date in format CCYYMMDD

currentTime

public static java.lang.String currentTime()
Returns:
String time in format HHMM 24hour

normalize

public static java.lang.String normalize(java.lang.String inString)
normlizes the string to remove XML characters.

Parameters:
inString - to be normalized
Returns:
String normalized

normalizeNonUnicode

public static java.lang.String normalizeNonUnicode(java.lang.String inString)
normlizes the string to remove NonUnicode characters.

Parameters:
inString - to be normalized
Returns:
String normalized

denormalizeNonUnicode

public static java.lang.String denormalizeNonUnicode(java.lang.String inString)
normlizes the string to replace NonUnicode characters.

Parameters:
inString - to be normalized
Returns:
String normalized

unEscape

public static java.lang.String unEscape(java.lang.String inString,
                                        java.lang.String inEscString)
removes escape characters

Parameters:
inString -
inEscString -
Returns:
String

searchForFile

public static java.lang.String searchForFile(java.lang.String inFilename,
                                             java.lang.String inStopAtDir)
starting with the full file name search down the specified absolute path to find the file

Parameters:
inFilename - - String, full path name for file
inStopAtDir - - String, stop looking after reaching this directory.
Returns:
String the file name found
Throws:
OBOEException - - file not found

propertyFileIndicatesThrowParsingException

public static boolean propertyFileIndicatesThrowParsingException()
routine to test to see if parsers should throw exceptions or based on property in OBOE.properties file "throwParsingException"

Returns:
boolean

propertyFileIndicatesDoPrevalidate

public static boolean propertyFileIndicatesDoPrevalidate()
routine to test to see if we want to do the prevalidation logic
prevalidation is the function of segments to check to see if there valid by the first id code field in the container

Returns:
boolean

copyFile

public static void copyFile(java.lang.String inputFile,
                            java.lang.String outputFile)
                     throws java.io.IOException
copy file using string file name

Parameters:
inputFile -
outputFile -
Throws:
java.io.IOException

propertyFileIndicatesUseObject

public static boolean propertyFileIndicatesUseObject()
routine to test to see if parsers allows try to use object files based on property in OBOE.properties file "useObject"

Returns:
boolean, default value is false

propertyFileIndicatesRealNumbersRetainPrecision

public static boolean propertyFileIndicatesRealNumbersRetainPrecision()
routine to test to see if Real Data elements should maintain the precision based on how the fields was initially set.
based on property in OBOE.properties file "realNumbersRetainPrecision"

Returns:
boolean, default value is false

getXMLPath

public static java.lang.String getXMLPath()
                                   throws java.io.IOException
returns the xmlPath directive in OBOE.properties file

Returns:
String
Throws:
java.io.IOException

rightTrim

public static java.lang.String rightTrim(java.lang.String inString)
removes trailing spaces

Parameters:
inString -
Returns:
String

setOBOEProperty

public static void setOBOEProperty(java.lang.String inName,
                                   java.lang.String inValue)

getOBOEProperty

public static java.lang.String getOBOEProperty(java.lang.String inString)
                                        throws java.io.IOException
java.io.IOException

closeOBOEProperty

public static void closeOBOEProperty()
use this if you need to reset the property file which is usually left open


getCES

public static java.lang.String getCES()
gets and returns the x12 composite element seperator character


removeCRLFFromStream

public static java.io.InputStream removeCRLFFromStream(java.io.InputStream inIS)
                                                throws java.io.IOException
input blocked data. returns it as a stream. data blocked by cr/lf.

Parameters:
inIS - InputStream object
Returns:
InputStream object
Throws:
java.io.IOException

removeCRLFFromReader

public static java.io.Reader removeCRLFFromReader(java.io.Reader inReader)
                                           throws java.io.IOException
input blocked data. returns it as a stream. data blocked by cr/lf.

Parameters:
inReader - Reader object
Returns:
Reader object
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)

isLog4JNotConfigured

public static boolean isLog4JNotConfigured()
Returns true if it appears that log4j have been previously configured. This code checks to see if there are any appenders defined for log4j which is the definitive way to tell if log4j is already initialized


deepCopy

public static void deepCopy(java.io.Externalizable fromObj,
                            java.io.Externalizable toObj)
returns a deep copy of an object
JavaWorld Javatip 76 by Dave Miller
http://www.javaworld.com/javaworld/javatips/jw-javatip76.html

Parameters:
fromObj -
toObj -

isInteger

public static boolean isInteger(java.lang.String arg)
somewhat like Character.isDigit expect checks whole string and only checks roman characters

Parameters:
arg -
Returns:
true if all characters in string a digits (0-9)

resetValids

public static void resetValids()
used by junit tests


isValidForCharacterSet

public static int isValidForCharacterSet(java.lang.String arg)
checks to see if string is valid depending on OBOE.properties "validCharacters" If property is not defined then always returns -1, all are valid.

Parameters:
arg - String
Returns:
character position of first undefined character in input string, otherwise -1 if all are valid.
Throws:
java.io.IOException

Open Business Objects for EDI
v3.6.0


OBOE is a trademark or registered trademark of American Coders, Ltd. in the US and other countries.
Copyright 1999-2004 American Coders, Ltd.
POB 97462
Raleigh NC 27624 USA
All Rights Reserved.