Class MessageGenerateUtils


  • public class MessageGenerateUtils
    extends java.lang.Object
    Class containing help utils when populating data in messages.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static char[] hexArray  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String bytesToHex​(byte[] bytes)  
      static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendar​(java.util.Date date)
      Method to convert a date to a XML gregorian calendar
      static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendar​(java.util.Date date, java.util.TimeZone timeZone)
      Method to convert a date to a XML gregorian calendar using a specific timezone
      static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendarNoTimeZone​(java.util.Date date)
      Method to convert a date to a XML gregorian calendar without time zone.
      static java.lang.String generateRandomUUID()
      Help method to generate a unique UUID according the the message header specification
      static java.util.Date xMLGregorianCalendarToDate​(javax.xml.datatype.XMLGregorianCalendar calendarDate)
      Method to convert a XML gregorian calendar to a date
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hexArray

        protected static final char[] hexArray
    • Constructor Detail

      • MessageGenerateUtils

        public MessageGenerateUtils()
    • Method Detail

      • generateRandomUUID

        public static java.lang.String generateRandomUUID()
        Help method to generate a unique UUID according the the message header specification

        Pattern: [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[8-9a-bA-B][0-9a-fA-F]{3}-[0-9a-fA-F]{12}

        Returns:
        a newly generated UUID
      • dateToXMLGregorianCalendar

        public static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendar​(java.util.Date date)
                                                                                  throws MessageProcessingException
        Method to convert a date to a XML gregorian calendar
        Parameters:
        date - the date to convert
        Returns:
        a XMLGregorianCalendar object or null if date is null.
        Throws:
        MessageProcessingException - if internal problems occurred converting the date.
      • dateToXMLGregorianCalendar

        public static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendar​(java.util.Date date,
                                                                                         java.util.TimeZone timeZone)
                                                                                  throws MessageProcessingException
        Method to convert a date to a XML gregorian calendar using a specific timezone
        Parameters:
        date - the date to convert
        timeZone - Timezone to use or null if default timezone should be used.
        Returns:
        a XMLGregorianCalendar object or null if date is null.
        Throws:
        MessageProcessingException - if internal problems occurred converting the date.
      • dateToXMLGregorianCalendarNoTimeZone

        public static javax.xml.datatype.XMLGregorianCalendar dateToXMLGregorianCalendarNoTimeZone​(java.util.Date date)
                                                                                            throws MessageProcessingException
        Method to convert a date to a XML gregorian calendar without time zone.
        Parameters:
        date - the date to convert
        Returns:
        a XMLGregorianCalendar object or null if date is null.
        Throws:
        MessageProcessingException - if internal problems occurred converting the date.
      • xMLGregorianCalendarToDate

        public static java.util.Date xMLGregorianCalendarToDate​(javax.xml.datatype.XMLGregorianCalendar calendarDate)
                                                         throws MessageProcessingException
        Method to convert a XML gregorian calendar to a date
        Parameters:
        calendarDate - the date to convert
        Returns:
        a Date object or null if calendarDate is null.
        Throws:
        MessageProcessingException - if internal problems occurred converting the date.
      • bytesToHex

        public static java.lang.String bytesToHex​(byte[] bytes)