Class OrgModelTools


  • public final class OrgModelTools
    extends Object
    This class contains static methods to provide some common functionality in the context of the Org Model and org policies / staff assignment rules.
    Author:
    Patrick Schmidt
    • Method Detail

      • isValidAttributeName

        public static boolean isValidAttributeName​(String attrName)
        Returns whether the given string is a valid attribute name for entity types. A valid attribute name can contain letters (a to z), number (0 to 9) and the underscore (_). However, numbers are not allowed as first character!
        Parameters:
        attrName - the string to be tested
        Returns:
        whether the given string is a valid attribute name
      • createDate

        public static Date createDate​(long timeInMillis)
        Creates a date from the given time in milliseconds, i.e. hours, minutes, seconds and milliseconds will be set to 0; only year, month and day remain.
        Parameters:
        timeInMillis - time in milliseconds to create the date from
        Returns:
        a date from the given time in milliseconds
      • createTime

        public static Date createTime​(long timeInMillis)
        Creates a time from the given time in milliseconds, i.e. the year will be set to 1970, month to 0, day to 1, milliseconds to 0; while hours, minutes and seconds remain.
        Parameters:
        timeInMillis - time in milliseconds to create the time from
        Returns:
        a time from the given time in milliseconds
      • createTimestamp

        public static Date createTimestamp​(long timeInMillis)
        Creates a timestamp from the given time in milliseconds, i.e. milliseconds will be set to 0; all other values remain.
        Parameters:
        timeInMillis - time in milliseconds to create the timestamp from
        Returns:
        a timestamp from the given time in milliseconds
      • createDateFormat

        public static DateFormat createDateFormat()
        Returns a new DateFormat to handle dates (w/o time) in the format yyyy-MM-dd. The assumed time zone is UTC.
        Returns:
        a new DateFormat to handle dates (w/o time)
      • createTimeFormat

        public static DateFormat createTimeFormat()
        Returns a new DateFormat to handle times (w/o date) in the format HH:mm:ss. The assumed time zone is UTC.
        Returns:
        a new DateFormat to handle times (w/o date)
      • createTimestampFormat

        public static DateFormat createTimestampFormat()
        Returns a new DateFormat to handle date + time (= timestamp) in the format yyyy-MM-dd HH:mm:ss. The assumed time zone is UTC.
        Returns:
        a new DateFormat to handle date + time
      • createDisplayTimestampFormat

        public static DateFormat createDisplayTimestampFormat​(TimeZone tz)
        Returns a new DateFormat to handle date + time (= timestamp) in the format yyyy-MM-dd HH:mm:ss.
        Parameters:
        tz - the time zone to be used
        Returns:
        a new DateFormat to handle date + time
      • toPolicyToken

        public static String toPolicyToken​(Object value)
        Formats the value object to a string that can be used in OrgPolicies. A string value e.g. will be surrounded by single quotes: s_simple_string will result in 's_simple_string'.
        Parameters:
        value - the value object to be formatted
        Returns:
        the value object formatted as a string that can be used in OrgPolicies
      • parameterUsedAsValue

        public static boolean parameterUsedAsValue​(ParameterRefReplacer replacer)
        Returns if the current parameter reference in the specified replacer is used as placeholder for a value. Otherwise it's used as placeholder for an entity expression.
        Parameters:
        replacer - the used replacer
        Returns:
        true if the current parameter reference in the specified formatter is used as a value; false if it's used as an entity expression