Class Utils


  • public final class Utils
    extends Object
    Defines common methods that are used for the whole project.
    • Method Detail

      • validateChartAttributes

        public static int validateChartAttributes​(String attribute,
                                                  int defaultValue)
        Validate chart attributes returning a valid value to the object.
        Parameters:
        attribute - the attribute: width, height, number of days
        defaultValue - default value for the attribute
        Returns:
        int attribute valid value
      • getLastDate

        public static LocalDate getLastDate​(List<Job> jobs)
        For the given list of jobs, this will search all jobs and return the last run date of all.
        Parameters:
        jobs - a list of jobs from the DashBoard Portlet view
        Returns:
        LocalDate the last date of all jobs that belogs to Dashboard View.
      • roundFLoat

        public static float roundFLoat​(int scale,
                                       int roundingMode,
                                       float value)
        Method for rounding float values according to the requested mode.
        Parameters:
        scale - the rounding scale
        roundingMode - the rounding direction @see java.math.RoundingMode
        value - the value to be rounded
        Returns:
        the rounded value
      • calendarToLocalData

        public static LocalDate calendarToLocalData​(Calendar calendar)
        Converts from Calendar type (jenkins job default) to java.time.LocalDat.
        Parameters:
        calendar - input from Jenkins job
        Returns:
        LocalDate date