Class DataUtils


  • public class DataUtils
    extends Object
    This class provides utility methods used by DAOs around data manipulation. It is not considered part of the public TM API and may be modified without notice.
    Since:
    4.1.0
    • Field Detail

      • PERIOD_TYPE_HOUR

        public static final String PERIOD_TYPE_HOUR
        The constant indicating that a set of data should be grouped by hour
        See Also:
        Constant Field Values
      • PERIOD_TYPE_DAY

        public static final String PERIOD_TYPE_DAY
        The constant indicating that a set of data should be grouped by day
        See Also:
        Constant Field Values
    • Constructor Detail

      • DataUtils

        public DataUtils()
    • Method Detail

      • getTrendDateString

        public static String getTrendDateString​(org.apache.cayenne.DataRow dataRow,
                                                String periodType)
        This method creates a date string used to reference trend data for a specific period. This method is used internally by DAOs and may be modified without warning. The resulting strings are not suitable for display but merely for providing a value for use as a key in maps and the like. Also note that the year is not used, and so the strings are not suitable for data spanning a year or more.
        Parameters:
        dataRow - the data row holding period information in the numeric fields "month", "day" and (if grouping by hour) "hour"
        periodType - PERIOD_TYPE_DAY or PERIOD_TYPE_HOUR
        Returns:
        a string identifying the period for the data row and period type, e.g. "08-22" for day-based data or "08-22-15" for hour-based data corresponding to August 22, 15:00
      • getTrendDateString

        public static String getTrendDateString​(org.joda.time.DateTime date,
                                                String periodType)
        This method creates a date string used to reference trend data for a specific period. This method is used internally by DAOs and may be modified without warning. The resulting strings are not suitable for display but merely for providing a value for use as a key in maps and the like. Also note that the year is not used, and so the strings are not suitable for data spanning a year or more.
        Parameters:
        date - the date/time holding period information
        periodType - PERIOD_TYPE_DAY or PERIOD_TYPE_HOUR
        Returns:
        a string identifying the period for the date and period type, e.g. "08-22" for day-based data or "08-22-15" for hour-based data corresponding to August 22, 15:00