com.sage.orion.sdata.servlet
Class SDataHelper

java.lang.Object
  extended by com.sage.orion.sdata.servlet.SDataHelper

public final class SDataHelper
extends java.lang.Object

Class for general SData helper routines.

Author:
cliwa01

Field Summary
static java.lang.String BASE_TAG
           
static java.lang.String CATEGORY_TAG
           
static java.lang.String CONTENT_TAG
           
static java.lang.String DELETE_MISSING_TAG
           
static java.lang.String DESCRIPTOR_TAG
           
static java.lang.String E_TAG
           
static java.lang.String ENTRY_TAG
           
static java.lang.String FEED_TAG
           
static java.lang.String ID_TAG
           
static java.lang.String INLINE_SCHEMA_TAG
           
static java.lang.String IS_DELETED_TAG
           
static java.lang.String KEY_TAG
           
static java.lang.String LOOKUP_TAG
           
static java.lang.String MAX_OCCURS_TAG
           
static java.lang.String MEMBER_TYPES_TAG
           
static java.lang.String MIN_OCCURS_TAG
           
static java.lang.String NAME_TAG
           
static java.lang.String NILLABLE_TAG
           
static java.lang.String NUMBER_1_TAG
          Deprecated. 
static java.lang.String NUMBER_ONE_VALUE
           
static java.lang.String NUMBER_ZERO_TAG
          Deprecated. 
static java.lang.String NUMBER_ZERO_VALUE
           
static java.lang.String PAYLOAD_TAG
           
static java.lang.String REQUEST_TAG
           
static java.lang.String RESOURCE_KIND_TAG
           
static java.lang.String RESPONSE_TAG
           
static java.lang.String RFC3987_INPUT_ENCODING
           
static java.lang.String RFC3987InputEncoding
          Deprecated. 
static java.lang.String SCHEMA_VERSION_TAG
           
static java.lang.String SME_AVERAGE_LENGTH_ATTR
           
static java.lang.String SME_BATCHING_MODE_TAG
           
static java.lang.String SME_CAN_DELETE_TAG
           
static java.lang.String SME_CAN_FILTER_TAG
           
static java.lang.String SME_CAN_GET_TAG
           
static java.lang.String SME_CAN_PAGE_INDEX_TAG
           
static java.lang.String SME_CAN_PAGE_NEXT_TAG
           
static java.lang.String SME_CAN_PAGE_PREVIOUS_TAG
           
static java.lang.String SME_CAN_POST_TAG
           
static java.lang.String SME_CAN_PUT_TAG
           
static java.lang.String SME_CAN_SORT_TAG
           
static java.lang.String SME_FRACTION_DIGITS_ATTR
           
static java.lang.String SME_IS_COLLECTION_TAG
           
static java.lang.String SME_IS_MANDATORY_TAG
           
static java.lang.String SME_IS_READ_ONLY_TAG
           
static java.lang.String SME_LABEL_TAG
           
static java.lang.String SME_MAX_LENGTH_ATTR
           
static java.lang.String SME_PLURAL_NAME
           
static java.lang.String SME_PRECEDENCE_TAG
           
static java.lang.String SME_RELATIONSHIP_TAG
           
static java.lang.String SME_RELATIONSHIP_VALUE_ASSOC
           
static java.lang.String SME_RELATIONSHIP_VALUE_CHILD
           
static java.lang.String SME_RELATIONSHIP_VALUE_PARENT
           
static java.lang.String SME_RELATIONSHIP_VALUE_REF
           
static java.lang.String SME_ROLE_TAG
           
static java.lang.String SME_SUPPORTS_ETAG_TAG
           
static java.lang.String SME_TOTAL_DIGITS_ATTR
           
static java.lang.String SYNC_OR_ASYNC_TAG
           
static java.lang.String TAG_WITH_NULL_VALUE_FIELD
           
static java.lang.String TITLE_TAG
           
static java.lang.String TNS_TAG
           
static java.lang.String TYPE_TAG
           
static java.lang.String UNBOUNDED_TAG
           
static char URL_SEPARATOR
           
static java.lang.String URL_TAG
           
static java.lang.String UTF8_ENCODING
           
static java.lang.String UTF8Encoding
          Deprecated. 
static java.lang.String UUID
           
static java.lang.String VALUE_TAG
           
static java.lang.String XS_ALL_TAG
           
static java.lang.String XS_ANY_ATTRIBUTE
           
static java.lang.String XS_BASE64_BINARY_TYPE_TAG
           
static java.lang.String XS_BOOLEAN_TYPE_TAG
           
static java.lang.String XS_COMPLEXTYPE_TAG
           
static java.lang.String XS_DATE_TYPE_TAG
           
static java.lang.String XS_DECIMAL_TYPE_TAG
           
static java.lang.String XS_DOUBLE_TYPE_TAG
           
static java.lang.String XS_ELEMENT_TAG
           
static java.lang.String XS_ENUMERATION_TAG
           
static java.lang.String XS_INTEGER_TYPE_TAG
           
static java.lang.String XS_PATTERN_TAG
           
static java.lang.String XS_RESTRICTION_TAG
           
static java.lang.String XS_SCHEMA_TAG
           
static java.lang.String XS_SEQUENCE_TAG
           
static java.lang.String XS_SHORT_TYPE_TAG
           
static java.lang.String XS_SIMPLETYPE_TAG
           
static java.lang.String XS_STRING_TYPE_TAG
           
static java.lang.String XS_TIME_TYPE_TAG
           
static java.lang.String XS_UNION_TAG
           
 
Method Summary
static boolean bothNullOrEqual(java.lang.String one, java.lang.String other)
          Test if two strings are both null or equal (case insensitive)
static org.w3c.dom.Document createDocument()
          Create a new Document
static java.lang.String createFilePath(java.lang.String... s)
          Creates a filepath out of a list of directories and filenames.
static org.w3c.dom.Element createSchemaElement(org.w3c.dom.Document document, java.lang.String namespace)
          creates a schema DOM Element and returns it.
static java.lang.String encodeRFC3987String(java.lang.String decoded)
          Convert the given string to a String of US-ASCII characters in RFC3987 encoded form, so that it can be passed as part of a URL.
static java.lang.String escapeQuotes(java.lang.String in)
          escapeQuotes This method is intended for use in constructing browse strings.
static java.io.File fileOf(java.lang.String... s)
          Creates a file with a path of a list of directories and filenames.
static java.lang.String getCurrentGMTDateTime()
          Returns the current DateTime as a string in ISO 8601 format, (yyyy-MM-ddTHH:mm:ssZ)
static java.util.Date getDateFromSData(java.lang.String sdataDate)
          Given a SData date YYYY-MM-DD returns a date.
static java.lang.String getFileAsString(java.lang.String file, java.lang.String charsetName)
          Gets content of the file as a String.
static java.lang.String getFileExtension(java.lang.String filename)
          Gets the file extension from the given filename.
static java.lang.String getLocalizedDate(java.util.Date date)
          Gets the localized date in a localized simple date format.
static java.util.List<java.lang.String> getMapFilenames(java.lang.String basePath, java.lang.String file, java.util.regex.Pattern pattern, boolean optionalFilesFirst)
          Gets the unmodifiable list of map XML files.
static java.lang.String getSDataBytes(byte[] byteArray)
          Given a byte array, returns an SData complaint string which is base64Binary.
static java.lang.String getSDataDate(java.util.Date date)
          Given the date, returns an SData complaint string date.
static java.lang.String getSDataTime(java.util.Date time)
          Returns an SData String representation of the given time.
static java.util.Date getTimeFromSData(java.lang.String sdataTime)
          returns the time (as a Date from its SData string form.
static boolean isSDataDate(java.lang.String s)
          Determines if the given string should be an SData date.
static boolean isSDataString(java.lang.String s)
          Determines if the given string is an SData string.
static boolean isSDataTime(java.lang.String s)
          Gest whether the value of the string is in the SData Time format.
static java.lang.String quotedEncodedLiteral(java.lang.String decoded)
          Forms the single-quote-delimited RFC3987-encoded form of a string literal, complete with doubling any embedded single quotes.
static void sdataLog(org.slf4j.Logger logger, SDataDiagnosis.Severity severity, java.lang.String message)
          log the given message.
static void sdataLog(org.slf4j.Logger logger, java.lang.Throwable t)
          log the given Throwable.
static void sdataLog(org.slf4j.Logger logger, java.lang.Throwable t, java.lang.String message)
          log the given Throwable and message.
static java.lang.String trimQuotes(java.lang.String s)
          Returns a String with any outer quotes (either single quotes or double quotes) removed.
static java.lang.String trimRight(java.lang.String s)
          Returns a String with the spaces being right trimmed even within quotes (both single quotes and double quotes)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_TAG

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

CONTENT_TAG

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

E_TAG

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

ENTRY_TAG

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

FEED_TAG

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

ID_TAG

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

PAYLOAD_TAG

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

INLINE_SCHEMA_TAG

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

KEY_TAG

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

URL_TAG

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

DESCRIPTOR_TAG

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

LOOKUP_TAG

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

DELETE_MISSING_TAG

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

IS_DELETED_TAG

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

TITLE_TAG

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

TAG_WITH_NULL_VALUE_FIELD

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

REQUEST_TAG

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

RESPONSE_TAG

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

NAME_TAG

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

TYPE_TAG

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

VALUE_TAG

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

BASE_TAG

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

NILLABLE_TAG

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

UNBOUNDED_TAG

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

MAX_OCCURS_TAG

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

MIN_OCCURS_TAG

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

SYNC_OR_ASYNC_TAG

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

RESOURCE_KIND_TAG

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

MEMBER_TYPES_TAG

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

SME_CAN_FILTER_TAG

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

SME_CAN_GET_TAG

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

SME_CAN_POST_TAG

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

SME_CAN_PUT_TAG

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

SME_CAN_SORT_TAG

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

SME_CAN_DELETE_TAG

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

SME_CAN_PAGE_NEXT_TAG

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

SME_CAN_PAGE_PREVIOUS_TAG

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

SME_CAN_PAGE_INDEX_TAG

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

SME_SUPPORTS_ETAG_TAG

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

SME_BATCHING_MODE_TAG

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

SME_LABEL_TAG

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

SME_MAX_LENGTH_ATTR

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

SME_AVERAGE_LENGTH_ATTR

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

SME_TOTAL_DIGITS_ATTR

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

SME_FRACTION_DIGITS_ATTR

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

SME_PLURAL_NAME

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

SME_IS_READ_ONLY_TAG

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

SME_IS_MANDATORY_TAG

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

SME_RELATIONSHIP_TAG

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

SME_RELATIONSHIP_VALUE_CHILD

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

SME_RELATIONSHIP_VALUE_PARENT

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

SME_RELATIONSHIP_VALUE_REF

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

SME_RELATIONSHIP_VALUE_ASSOC

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

SME_IS_COLLECTION_TAG

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

SME_ROLE_TAG

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

SME_PRECEDENCE_TAG

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

XS_STRING_TYPE_TAG

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

XS_DATE_TYPE_TAG

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

XS_BOOLEAN_TYPE_TAG

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

XS_DOUBLE_TYPE_TAG

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

XS_DECIMAL_TYPE_TAG

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

XS_INTEGER_TYPE_TAG

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

XS_SHORT_TYPE_TAG

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

XS_TIME_TYPE_TAG

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

XS_BASE64_BINARY_TYPE_TAG

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

XS_ELEMENT_TAG

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

XS_COMPLEXTYPE_TAG

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

XS_SIMPLETYPE_TAG

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

XS_ANY_ATTRIBUTE

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

XS_RESTRICTION_TAG

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

XS_ENUMERATION_TAG

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

XS_PATTERN_TAG

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

XS_ALL_TAG

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

XS_SEQUENCE_TAG

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

XS_UNION_TAG

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

NUMBER_ZERO_TAG

@Deprecated
public static final java.lang.String NUMBER_ZERO_TAG
Deprecated. 
User NUMBER_ZERO_VALUE

See Also:
Constant Field Values

NUMBER_1_TAG

@Deprecated
public static final java.lang.String NUMBER_1_TAG
Deprecated. 
User NUMBER_ONE_VALUE

See Also:
Constant Field Values

NUMBER_ZERO_VALUE

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

NUMBER_ONE_VALUE

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

UUID

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

RFC3987InputEncoding

@Deprecated
public static final java.lang.String RFC3987InputEncoding
Deprecated. 
Use RFC3987_INPUT_ENCODING

See Also:
Constant Field Values

UTF8Encoding

@Deprecated
public static final java.lang.String UTF8Encoding
Deprecated. 
Use UTF8_ENCODING

See Also:
Constant Field Values

RFC3987_INPUT_ENCODING

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

UTF8_ENCODING

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

TNS_TAG

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

XS_SCHEMA_TAG

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

SCHEMA_VERSION_TAG

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

URL_SEPARATOR

public static final char URL_SEPARATOR
See Also:
Constant Field Values
Method Detail

getDateFromSData

public static java.util.Date getDateFromSData(java.lang.String sdataDate)
                                       throws MalformedPayloadException
Given a SData date YYYY-MM-DD returns a date.

Parameters:
sdataDate - date from SData
Returns:
the date Date
Throws:
MalformedPayloadException - when the number of data elements is not 3

getTimeFromSData

public static java.util.Date getTimeFromSData(java.lang.String sdataTime)
                                       throws MalformedPayloadException
returns the time (as a Date from its SData string form.

Parameters:
sdataTime - the time in its string form. This is as specified by the canonical representation of http://www.w3.org/TR/xmlschema-2/#time
Returns:
the time in its Date form
Throws:
MalformedPayloadException - if the time is not in a valid form

getSDataBytes

public static java.lang.String getSDataBytes(byte[] byteArray)
Given a byte array, returns an SData complaint string which is base64Binary.

Parameters:
byteArray - SData byte array
Returns:
the byteArray in base64Binary encoded format

getSDataDate

public static java.lang.String getSDataDate(java.util.Date date)
Given the date, returns an SData complaint string date.

Parameters:
date - date of the Date data type that needs to be transformed into an SData compliant date.
Returns:
the date in "@YYYY-MM-DD@" format

getLocalizedDate

public static java.lang.String getLocalizedDate(java.util.Date date)
Gets the localized date in a localized simple date format.

Parameters:
date - Date
Returns:
formatted string value of the date in a localized simple date format.

getSDataTime

public static java.lang.String getSDataTime(java.util.Date time)
Returns an SData String representation of the given time.

Parameters:
time - Date time value that requires SData string representation.
Returns:
the time in "HH:MM:SS" format.

getCurrentGMTDateTime

public static java.lang.String getCurrentGMTDateTime()
Returns the current DateTime as a string in ISO 8601 format, (yyyy-MM-ddTHH:mm:ssZ)

Returns:
current datetime string.

trimQuotes

public static java.lang.String trimQuotes(java.lang.String s)
Returns a String with any outer quotes (either single quotes or double quotes) removed.

Parameters:
s - the string, with surrounding quotes
Returns:
the trimmed string.

isSDataDate

public static boolean isSDataDate(java.lang.String s)
Determines if the given string should be an SData date.

This is determined by a leading '@' and a trailing '@' at the end of the string.

Note: This does not determine if the SData date is a valid date.

Parameters:
s - String value to check if in SData Date format.
Returns:
true if the given string is an SData date.

isSDataTime

public static boolean isSDataTime(java.lang.String s)
Gest whether the value of the string is in the SData Time format.

Parameters:
s - String value to check for SData Time format
Returns:
true if in the SData Time format, false otherwise.

isSDataString

public static boolean isSDataString(java.lang.String s)
Determines if the given string is an SData string.

This is determined by leading and trailing single quotes.

Parameters:
s - String to check if it contains leading and trailing quotes.
Returns:
true if the give string is an SData string.

encodeRFC3987String

public static java.lang.String encodeRFC3987String(java.lang.String decoded)
Convert the given string to a String of US-ASCII characters in RFC3987 encoded form, so that it can be passed as part of a URL.

This encodes all those characters that need to be encoded to prevent confusion. For example it also encodes the forward slash, question mark and hash mark that have special meaning in a URL.

Parameters:
decoded - the string in its normal (decoded) form
Returns:
the encoded version of the string
Throws:
MalformedURLException - if there is a conversion error

quotedEncodedLiteral

public static java.lang.String quotedEncodedLiteral(java.lang.String decoded)
Forms the single-quote-delimited RFC3987-encoded form of a string literal, complete with doubling any embedded single quotes.

Parameters:
decoded - the string to encode. If this is a key then it should already have the application-level encoding applied that allows for any multi-segment keys etc.
Returns:
a string containing only ASCII characters and even then many have been percent-encoded.

escapeQuotes

public static java.lang.String escapeQuotes(java.lang.String in)
escapeQuotes This method is intended for use in constructing browse strings. The string is checked for double-quote characters ('"'); any found are replaced with an escaped double-quote ('\"') so that they can be used in browse expressions. In addition, a trailing space is added (' '), so that a trailing backslash won't escape the closing double quote.

Parameters:
in - The string to be escaped.
Returns:
The escaped string Note: this is intended to work the same as the old EscapeQuotes() in VB (as implemented in OECOMMON).

createFilePath

public static java.lang.String createFilePath(java.lang.String... s)
Creates a filepath out of a list of directories and filenames.

Adds the system dependent file separator between the paths and filenames (if not already included).

Parameters:
s - array including path, directories and filename.
Returns:
path

fileOf

public static java.io.File fileOf(java.lang.String... s)
Creates a file with a path of a list of directories and filenames.

Adds the system dependent file separator between the paths and filenames (if not already included).

Parameters:
s - array including path, directories and filename.
Returns:
File

trimRight

public static java.lang.String trimRight(java.lang.String s)
Returns a String with the spaces being right trimmed even within quotes (both single quotes and double quotes)

Parameters:
s - SData String String to trim
Returns:
the right trimmed string.

createDocument

public static org.w3c.dom.Document createDocument()
Create a new Document

Returns:
Document

createSchemaElement

public static org.w3c.dom.Element createSchemaElement(org.w3c.dom.Document document,
                                                      java.lang.String namespace)
creates a schema DOM Element and returns it.

The Element is created with the basic SData schema namespaces:

The caller may add further attributes to the Element returned if they need to add namespaces for their own use. This method makes no guarantees as to what namespaces and abbreviations it may use in the future, so collision is a possibility.

Parameters:
document - the document that is to own the Element
namespace - the namespace to be used for the target namespace
Returns:
the created Element

sdataLog

public static void sdataLog(org.slf4j.Logger logger,
                            SDataDiagnosis.Severity severity,
                            java.lang.String message)
log the given message.

Parameters:
logger - the logger
severity - the SDataDiagnosis's severity
message - the message to log

sdataLog

public static void sdataLog(org.slf4j.Logger logger,
                            java.lang.Throwable t)
log the given Throwable.

Parameters:
logger - the logger
t - the Throwable to log

sdataLog

public static void sdataLog(org.slf4j.Logger logger,
                            java.lang.Throwable t,
                            java.lang.String message)
log the given Throwable and message.

Parameters:
logger - the logger
t - the Throwable to log
message - the message to log. If not provided, use the Throwable.getMessage()

bothNullOrEqual

public static boolean bothNullOrEqual(java.lang.String one,
                                      java.lang.String other)
Test if two strings are both null or equal (case insensitive)

Parameters:
one - comparison String which may be null or empty.
other - comparison String which may be null or empty.
Returns:
true if the two strings are both null or equal (case insensitive), false otherwise

getFileExtension

public static java.lang.String getFileExtension(java.lang.String filename)
Gets the file extension from the given filename.

Parameters:
filename - name of the file with which to get the extension.
Returns:
the file extension.

getMapFilenames

public static java.util.List<java.lang.String> getMapFilenames(java.lang.String basePath,
                                                               java.lang.String file,
                                                               java.util.regex.Pattern pattern,
                                                               boolean optionalFilesFirst)
Gets the unmodifiable list of map XML files. The list starts with the default map.xml file and then is followed by any optional map_*.xml files (where those optional files are in alphabetical order).

Parameters:
basePath - The path to directory where the map files are located (in this case it is the sageERP directory under WEB-INF/configuration).
file - Default map file name.
pattern - Map file name pattern.
optionalFilesFirst - The order of filenames. Should tbe optional files be listed first.
Returns:
The unmodifiable list of map XML files, in the order in which their contents should be added to the combined map.

getFileAsString

public static java.lang.String getFileAsString(java.lang.String file,
                                               java.lang.String charsetName)
Gets content of the file as a String.

Parameters:
file - file name
charsetName - the name of the character set of the bytes in the file
Returns:
string representing the file's content, if the file does not exist or cannot be opened and read the method returns empty string


Copyright © 2011 Sage Software, Inc. All rights reserved.