Package org.kuali.rice.ken.util
Class Util
java.lang.Object
org.kuali.rice.ken.util.Util
A general Utility class for the Notification system.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final NamespaceContextstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic final NotificationBocloneNotificationWithoutObjectReferences(NotificationBo notification) This method will clone a given Notification object, one level deep, returning a fresh new instance without any references.static ElementgetChildElement(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 StringReturns the current date formatted for the UIstatic EntityResolvergetNotificationEntityResolver(NotificationContentTypeService notificationContentTypeService) Returns an EntityResolver to resolve XML entities (namely schema resources) in the notification systemstatic NamespaceContextReturns a compound NamespaceContext that defers to the preconfigured notification namespace context first, then delegates to the document prefix/namespace definitions second.static Stringstatic Documentparse(InputSource source, boolean validate, boolean namespaceAware, EntityResolver entityResolver) This method uses DOM to parse the input source of XML.static DateParses the string in UI date time formatstatic DocumentparseWithNotificationEntityResolver(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 DateparseXSDDateTime(String dateTimeString) Parses a date/time string under XSD dateTime type syntaxstatic <T> TretrieveFieldReference(String fieldName, String keyName, String keyValue, Class clazz, org.kuali.rice.krad.data.DataObjectService dataObjectService) static <T> TretrieveFieldReference(String fieldName, String keyName, String keyValue, Class clazz, org.kuali.rice.krad.data.DataObjectService dataObjectService, Boolean searchCurrentField) 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 StringReturns the specified date formatted for the UIstatic StringFormats a Date into XSD dateTime formatstatic StringtransformContent(NotificationBo notification) transformContent - transforms xml content in notification to a string using the xsl in the datastore for a given documentType
-
Field Details
-
JAXP_SCHEMA_LANGUAGE
- See Also:
-
W3C_XML_SCHEMA
- See Also:
-
NOTIFICATION_NAMESPACE_CONTEXT
-
-
Method Details
-
getNotificationSystemUser
- Returns:
- the name of the user configured to be the Notification system user
-
parseXSDDateTime
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:
-
toXSDDateTimeString
Formats a Date into XSD dateTime format- Parameters:
d- the date value to format- Returns:
- date value formatted into XSD dateTime format
-
getCurrentDateTime
Returns the current date formatted for the UI- Returns:
- the current date formatted for the UI
-
toUIDateTimeString
Returns the specified date formatted for the UI- Returns:
- the specified date formatted for the UI
-
parseUIDateTime
Parses the string in UI date time format- Returns:
- the date parsed from UI date time format
- Throws:
ParseException
-
getNotificationNamespaceContext
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
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 sourcevalidate- whether to turn on validationnamespaceAware- whether to turn on namespace awareness- Returns:
- Document the parsed (possibly validated) document
- Throws:
ParserConfigurationExceptionIOExceptionSAXException
-
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 sourcevalidate- whether to turn on validationnamespaceAware- whether to turn on namespace awareness- Returns:
- Document the parsed (possibly validated) document
- Throws:
ParserConfigurationExceptionIOExceptionSAXException
-
getChildElement
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 nodename- 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, org.kuali.rice.krad.data.DataObjectService dataObjectService, Boolean searchCurrentField) throws RuntimeException 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-dataObjectService-- Returns:
- T
- Throws:
IllegalArgumentExceptionRuntimeException
-
retrieveFieldReference
public static <T> T retrieveFieldReference(String fieldName, String keyName, String keyValue, Class clazz, org.kuali.rice.krad.data.DataObjectService dataObjectService) throws RuntimeException - Throws:
RuntimeException
-