Class OrgModelTools
java.lang.Object
de.aristaflow.adept2.model.orgmodel.OrgModelTools
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 Summary
Modifier and TypeMethodDescriptionstatic DatecreateDate(long timeInMillis) Creates a date from the given time in milliseconds, i.e.static DateFormatReturns a newDateFormatto handle dates (w/o time) in the formatyyyy-MM-dd.static DateFormatReturns a newDateFormatto handle date + time (= timestamp) in the formatyyyy-MM-dd HH:mm:ss.static DatecreateTime(long timeInMillis) Creates a time from the given time in milliseconds, i.e.static DateFormatReturns a newDateFormatto handle times (w/o date) in the formatHH:mm:ss.static DatecreateTimestamp(long timeInMillis) Creates a timestamp from the given time in milliseconds, i.e.static DateFormatReturns a newDateFormatto handle date + time (= timestamp) in the formatyyyy-MM-dd HH:mm:ss.static booleanisValidAttributeName(String attrName) Returns whether the given string is a valid attribute name for entity types.static booleanparameterUsedAsValue(ParameterRefReplacer replacer) Returns if the current parameter reference in the specified replacer is used as placeholder for a value.static StringtoPolicyToken(Object value) Formats the value object to a string that can be used in OrgPolicies.
-
Method Details
-
isValidAttributeName
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
Creates a date from the given time in milliseconds, i.e. hours, minutes, seconds and milliseconds will be set to0; 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
Creates a time from the given time in milliseconds, i.e. the year will be set to1970, month to0, day to1, milliseconds to0; 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
Creates a timestamp from the given time in milliseconds, i.e. milliseconds will be set to0; all other values remain.- Parameters:
timeInMillis- time in milliseconds to create the timestamp from- Returns:
- a timestamp from the given time in milliseconds
-
createDateFormat
Returns a newDateFormatto handle dates (w/o time) in the formatyyyy-MM-dd. The assumed time zone is UTC.- Returns:
- a new
DateFormatto handle dates (w/o time)
-
createTimeFormat
Returns a newDateFormatto handle times (w/o date) in the formatHH:mm:ss. The assumed time zone is UTC.- Returns:
- a new
DateFormatto handle times (w/o date)
-
createTimestampFormat
Returns a newDateFormatto handle date + time (= timestamp) in the formatyyyy-MM-dd HH:mm:ss. The assumed time zone is UTC.- Returns:
- a new
DateFormatto handle date + time
-
createDisplayTimestampFormat
Returns a newDateFormatto handle date + time (= timestamp) in the formatyyyy-MM-dd HH:mm:ss.- Parameters:
tz- the time zone to be used- Returns:
- a new
DateFormatto handle date + time
-
toPolicyToken
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_stringwill 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
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:
trueif the current parameter reference in the specified formatter is used as a value;falseif it's used as an entity expression
-