org.kuali.rice.ken.util
Class Util

java.lang.Object
  extended by org.kuali.rice.ken.util.Util

public final class Util
extends Object

A general Utility class for the Notification system.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
static String JAXP_SCHEMA_LANGUAGE
           
static NamespaceContext NOTIFICATION_NAMESPACE_CONTEXT
           
static String W3C_XML_SCHEMA
           
 
Method Summary
static NotificationBo cloneNotificationWithoutObjectReferences(NotificationBo notification)
          This method will clone a given Notification object, one level deep, returning a fresh new instance without any references.
static Element getChildElement(Node parent, String name)
          Returns a node child with the specified tag name of the specified parent node, or null if no such child node is found.
static String getCurrentDateTime()
          Returns the current date formatted for the UI
static EntityResolver getNotificationEntityResolver(NotificationContentTypeService notificationContentTypeService)
          Returns an EntityResolver to resolve XML entities (namely schema resources) in the notification system
static NamespaceContext getNotificationNamespaceContext(Document doc)
          Returns a compound NamespaceContext that defers to the preconfigured notification namespace context first, then delegates to the document prefix/namespace definitions second.
static String getNotificationSystemUser()
           
static Document parse(InputSource source, boolean validate, boolean namespaceAware, EntityResolver entityResolver)
          This method uses DOM to parse the input source of XML.
static Date parseUIDateTime(String s)
          Parses the string in UI date time format
static Document parseWithNotificationEntityResolver(InputSource source, boolean validate, boolean namespaceAware, NotificationContentTypeService notificationContentTypeService)
          This method uses DOM to parse the input source of XML, supplying a notification-system-specific entity resolver.
static Date parseXSDDateTime(String dateTimeString)
          Parses a date/time string under XSD dateTime type syntax
static
<T> T
retrieveFieldReference(String fieldName, String keyName, String keyValue, Class clazz, GenericDao boDao)
          This method generically retrieves a reference to foreign key objects that are part of the content, to get at the reference objects' pk fields so that those values can be used to store the notification with proper foreign key relationships in the database.
static String toUIDateTimeString(Date d)
          Returns the specified date formatted for the UI
static String toXSDDateTimeString(Date d)
          Formats a Date into XSD dateTime format
static String transformContent(NotificationBo notification)
          transformContent - transforms xml content in notification to a string using the xsl in the datastore for a given documentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXP_SCHEMA_LANGUAGE

public static final String JAXP_SCHEMA_LANGUAGE
See Also:
Constant Field Values

W3C_XML_SCHEMA

public static final String W3C_XML_SCHEMA
See Also:
Constant Field Values

NOTIFICATION_NAMESPACE_CONTEXT

public static final NamespaceContext NOTIFICATION_NAMESPACE_CONTEXT
Method Detail

getNotificationSystemUser

public static String getNotificationSystemUser()
Returns:
the name of the user configured to be the Notification system user

parseXSDDateTime

public static Date parseXSDDateTime(String dateTimeString)
                             throws ParseException
Parses a date/time string under XSD dateTime type syntax

Parameters:
dateTimeString - an XSD dateTime-formatted String
Returns:
a Date representing the time value of the String parameter
Throws:
ParseException - if an error occurs during parsing
See Also:
ZULU_FORMAT

toXSDDateTimeString

public static String toXSDDateTimeString(Date d)
Formats a Date into XSD dateTime format

Parameters:
d - the date value to format
Returns:
date value formatted into XSD dateTime format

getCurrentDateTime

public static String getCurrentDateTime()
Returns the current date formatted for the UI

Returns:
the current date formatted for the UI

toUIDateTimeString

public static String toUIDateTimeString(Date d)
Returns the specified date formatted for the UI

Returns:
the specified date formatted for the UI

parseUIDateTime

public static Date parseUIDateTime(String s)
                            throws ParseException
Parses the string in UI date time format

Returns:
the date parsed from UI date time format
Throws:
ParseException

getNotificationNamespaceContext

public static NamespaceContext getNotificationNamespaceContext(Document doc)
Returns a compound NamespaceContext that defers to the preconfigured notification namespace context first, then delegates to the document prefix/namespace definitions second.

Parameters:
doc - the Document to use for prefix/namespace resolution
Returns:
compound NamespaceContext

getNotificationEntityResolver

public static EntityResolver getNotificationEntityResolver(NotificationContentTypeService notificationContentTypeService)
Returns an EntityResolver to resolve XML entities (namely schema resources) in the notification system

Parameters:
notificationContentTypeService - the NotificationContentTypeService
Returns:
an EntityResolver to resolve XML entities (namely schema resources) in the notification system

transformContent

public static String transformContent(NotificationBo notification)
transformContent - transforms xml content in notification to a string using the xsl in the datastore for a given documentType

Parameters:
notification -
Returns:

parse

public static Document parse(InputSource source,
                             boolean validate,
                             boolean namespaceAware,
                             EntityResolver entityResolver)
                      throws ParserConfigurationException,
                             IOException,
                             SAXException
This method uses DOM to parse the input source of XML.

Parameters:
source - the input source
validate - whether to turn on validation
namespaceAware - whether to turn on namespace awareness
Returns:
Document the parsed (possibly validated) document
Throws:
ParserConfigurationException
IOException
SAXException

parseWithNotificationEntityResolver

public static Document parseWithNotificationEntityResolver(InputSource source,
                                                           boolean validate,
                                                           boolean namespaceAware,
                                                           NotificationContentTypeService notificationContentTypeService)
                                                    throws ParserConfigurationException,
                                                           IOException,
                                                           SAXException
This method uses DOM to parse the input source of XML, supplying a notification-system-specific entity resolver.

Parameters:
source - the input source
validate - whether to turn on validation
namespaceAware - whether to turn on namespace awareness
Returns:
Document the parsed (possibly validated) document
Throws:
ParserConfigurationException
IOException
SAXException

getChildElement

public static Element getChildElement(Node parent,
                                      String name)
Returns a node child with the specified tag name of the specified parent node, or null if no such child node is found.

Parameters:
parent - the parent node
name - the name of the child node
Returns:
child node if found, null otherwise

cloneNotificationWithoutObjectReferences

public static final NotificationBo cloneNotificationWithoutObjectReferences(NotificationBo notification)
This method will clone a given Notification object, one level deep, returning a fresh new instance without any references.

Parameters:
notification - the object to clone
Returns:
Notification a fresh instance

retrieveFieldReference

public static <T> T retrieveFieldReference(String fieldName,
                                           String keyName,
                                           String keyValue,
                                           Class clazz,
                                           GenericDao boDao)
                                throws IllegalArgumentException
This method generically retrieves a reference to foreign key objects that are part of the content, to get at the reference objects' pk fields so that those values can be used to store the notification with proper foreign key relationships in the database.

Type Parameters:
T -
Parameters:
fieldName -
keyName -
keyValue -
clazz -
boDao -
Returns:
T
Throws:
IllegalArgumentException


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.