toolbox.oracle.xpath.ext
Class MapperExtensionFunctions

java.lang.Object
  extended by toolbox.oracle.xpath.ext.MapperExtensionFunctions

public class MapperExtensionFunctions
extends java.lang.Object

Contains various extension functions that can be used in conjuction with the Oracle XSLT mapper.

Author:
Hannes Holtzhausen

Method Summary
static java.lang.String concatTextNodesXSLImpl(oracle.xml.parser.v2.XMLNodeList tree)
          Concatenates the contents of all text() nodes in the given XML tree.
static java.lang.Long currentDateTimeToMillisXSLImpl()
          Return the current time in milliseconds.
static java.lang.Long dateTimeToMillisXSLImpl(java.lang.String dateStr)
          Return the provided XSD dateTime value in milliseconds.
static java.lang.String digestXSLImpl(java.lang.String message, java.lang.String algorithm, java.lang.String output)
          Perform a one-way hash on the given string and return either a hexadecimal or base64 representation of the hash.
static java.lang.String getSystemPropertyXSLImpl(java.lang.String property, java.lang.String defaultVal)
          Return the named Java System Property.
static java.lang.String maskXSLImpl(java.lang.String input, java.lang.String mode, java.lang.String maskChar, int count)
          Perform simple String masking operations.
static java.lang.String millisToDateTimeXSLImpl(java.lang.Double time)
          Convert the given milliseconds value into a valid XSD dateTime string.
static java.lang.String parseDateTimeXSLImpl(java.lang.String dateStr, java.lang.String format, java.lang.String output)
          Convert (parse) the given string into a valid XSD dateTime string using the provided format string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

concatTextNodesXSLImpl

public static java.lang.String concatTextNodesXSLImpl(oracle.xml.parser.v2.XMLNodeList tree)
Concatenates the contents of all text() nodes in the given XML tree.

Parameters:
tree - XMLNodeList containing one element that represents the XML tree.
Returns:
String containing the contents of all text nodes in the given XML tree.

digestXSLImpl

public static java.lang.String digestXSLImpl(java.lang.String message,
                                             java.lang.String algorithm,
                                             java.lang.String output)
Perform a one-way hash on the given string and return either a hexadecimal or base64 representation of the hash.

Parameters:
message - String containing the message to perform the hash on.
algorithm - String indicating which digest algorithm to use.
output - HEX or BASE64.
Returns:
String containing the message hash.

maskXSLImpl

public static java.lang.String maskXSLImpl(java.lang.String input,
                                           java.lang.String mode,
                                           java.lang.String maskChar,
                                           int count)
Perform simple String masking operations.

This method can perform three types of masking operations:

Parameters:
input - String containing the data that must be masked.
mode - String indicating the masking mode: first, last, all.
maskChar - String containing the masking character.
count - An int indicating the character count.
Returns:
String containing the masked data.

getSystemPropertyXSLImpl

public static java.lang.String getSystemPropertyXSLImpl(java.lang.String property,
                                                        java.lang.String defaultVal)
Return the named Java System Property.

Parameters:
property - String containing the name of the property that must be returned.
defaultVal - String containing a default value if the property does not exist.
Returns:
String containing the property value or the default value.

currentDateTimeToMillisXSLImpl

public static java.lang.Long currentDateTimeToMillisXSLImpl()
Return the current time in milliseconds.

Returns:
Long value representing the current time in milliseconds.

dateTimeToMillisXSLImpl

public static java.lang.Long dateTimeToMillisXSLImpl(java.lang.String dateStr)
Return the provided XSD dateTime value in milliseconds.

Parameters:
dateStr - Sting containing a valid XSD dateTime value.
Returns:
long value that represents the given date string in milliseconds.

millisToDateTimeXSLImpl

public static java.lang.String millisToDateTimeXSLImpl(java.lang.Double time)
Convert the given milliseconds value into a valid XSD dateTime string.

Parameters:
time - Double value that represents a time stamp.
Returns:
String containing a valid XSD dateTime value.

parseDateTimeXSLImpl

public static java.lang.String parseDateTimeXSLImpl(java.lang.String dateStr,
                                                    java.lang.String format,
                                                    java.lang.String output)
Convert (parse) the given string into a valid XSD dateTime string using the provided format string.

Parameters:
dateStr - String containing the XSD dateTime value to parse.
format - A valid java.text.SimpleDateFormat pattern.
output - String indicating which part of the dateTime must returned. date|time|datetime.
Returns:
String containing a valide XSD dateTime value.