Class Util

java.lang.Object
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 Details

  • Method Details

    • 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, 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:
      IllegalArgumentException
      RuntimeException
    • 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