Class JcrDataConverter


  • public class JcrDataConverter
    extends Object
    A converter of some data handled in the JCR, such as node paths and dates. It converts the data from and for the JCR world and the Silverpeas world.
    Author:
    Emmanuel Hugonnet
    • Constructor Detail

      • JcrDataConverter

        public JcrDataConverter()
    • Method Detail

      • encodeJcrPath

        public static final String encodeJcrPath​(String path)
        Encodes the JCR path to a Xpath compatible path.
        Parameters:
        path - the JCR path to be encoded for Xpath.
        Returns:
        the corresponding xpath.
      • convertToJcrPath

        public static String convertToJcrPath​(String name)
        Replace all whitespace to SPACE_TOKEN.
        Parameters:
        name - the String o be converted.
        Returns:
        the resulting String.
      • escapeIllegalJcrChars

        public static String escapeIllegalJcrChars​(String name)
      • unescapeQuote

        public static String unescapeQuote​(String text)
        Replace all %39 with the char'
        Parameters:
        text -
        Returns:
        a String with all %39 replaced by quotes
      • convertFromJcrPath

        public static String convertFromJcrPath​(String name)
        Replace all SPACE_TOKEN to whitespace.
        Parameters:
        name - the String o be converted.
        Returns:
        the resulting String.
      • parseDate

        public static Date parseDate​(String date)
                              throws ParseException
        Parse a String of format yyyy/MM/dd and return the corresponding Date.
        Parameters:
        date - the String to be parsed.
        Returns:
        the corresponding date.
        Throws:
        ParseException
      • formatDate

        public static String formatDate​(Date date)
        Format a Date to a String of format yyyy/MM/dd.
        Parameters:
        date - the date to be formatted.
        Returns:
        the formatted String.
      • formatDate

        public static String formatDate​(Calendar calend)
        Format a Calendar to a String of format yyyy/MM/dd.
        Parameters:
        calend - the date to be formatted.
        Returns:
        the formatted String.
      • setTime

        public static void setTime​(Calendar calend,
                                   String time)
        Parse a String of format HH:mm and set the corresponding hours and minutes to the specified Calendar.
        Parameters:
        time - the String to be parsed.
        calend - the calendar to be updated.
      • formatTime

        public static String formatTime​(Date date)
        Format a Date to a String of format HH:mm.
        Parameters:
        date - the date to be formatted.
        Returns:
        the formatted String.
      • formatTime

        public static String formatTime​(Calendar calend)
        Format a Calendar to a String of format HH:mm.
        Parameters:
        calend - the date to be formatted.
        Returns:
        the formatted String.
      • formatDateForXpath

        public static String formatDateForXpath​(Date date)
      • formatCalendarForXpath

        public static String formatCalendarForXpath​(Calendar date)
      • getTimeZone

        protected static String getTimeZone​(Date date)
      • getXpathFormattedTime

        protected static String getXpathFormattedTime​(Date date)
      • getXpathFormattedDate

        protected static String getXpathFormattedDate​(Date date)