Class BasicExpressionFunctions
The functions should be written to support scripting-like comfort. It means that they all needs to be null-safe, automatically convert data types as necessary and so on.
- Author:
- Radovan Semancik
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Tracestatic final XMLGregorianCalendarSpecial value that is too far in the past.static final String
- 
Constructor SummaryConstructorsConstructorDescriptionBasicExpressionFunctions(PrismContext prismContext, Protector protector, Clock clock) 
- 
Method SummaryModifier and TypeMethodDescriptionaddDuration(XMLGregorianCalendar now, String duration) addDuration(XMLGregorianCalendar now, Duration duration) addMillis(XMLGregorianCalendar now, long duration) static StringCreates a valid LDAP distinguished name from the wide range of components.static StringcomposeDnWithSuffix(Object... components) Creates a valid LDAP distinguished name from the wide range of components assuming that the last component is a suffix.concatName(Object... components) Concatenates the arguments to create a name.booleanbooleancontainsIgnoreCase(Object object, Object search) static Stringstatic Stringdecrypt(ProtectedStringType protectedString) determineLdapSingleAttributeValue(String dn, String attributeName, Collection<?> values) determineLdapSingleAttributeValue(Collection<String> dns, String attributeName, PrismProperty attribute) determineLdapSingleAttributeValue(Collection<String> dns, String attributeName, Collection<String> values) booleanendsWith(PolyString polyString, String value) Checks whether the given normalized string ends with the specified valuebooleanChecks whether the given normalized string ends with the specified value by first normalizing it.formatDateTime(String format, Long millis) formatDateTime(String format, XMLGregorianCalendar xmlCal) getAttributeStringValues(ShadowType shadow, groovy.namespace.QName attributeQname) getAttributeStringValues(ShadowType shadow, String attributeNamespace, String attributeLocalPart) getAttributeStringValues(ShadowType shadow, QName attributeQname) <T> TgetAttributeValue(ShadowType shadow, groovy.namespace.QName attributeQname) <T> TgetAttributeValue(ShadowType shadow, String attributeLocalPart) The namespace of the attribute is assumed to be "ri:"<T> TgetAttributeValue(ShadowType shadow, String attributeNamespace, String attributeLocalPart) <T> TgetAttributeValue(ShadowType shadow, QName attributeQname) <T> Collection<T>getAttributeValues(ShadowType shadow, groovy.namespace.QName attributeQname) <T> Collection<T>getAttributeValues(ShadowType shadow, String attributeLocalPart) <T> Collection<T>getAttributeValues(ShadowType shadow, String attributeNamespace, String attributeLocalPart) <T> Collection<T>getAttributeValues(ShadowType shadow, QName attributeQname) <T> TgetExtensionPropertyValue(Containerable containerable, @NotNull String localPart) <T> TgetExtensionPropertyValue(Containerable containerable, groovy.namespace.QName propertyQname) <T> TgetExtensionPropertyValue(Containerable containerable, String namespace, @NotNull String localPart) <T> TgetExtensionPropertyValue(Containerable containerable, QName propertyQname) Returns the real value of an extension property (of an object, assignment, or similar structure), ornullif no value exists.<T> @NotNull Collection<T>getExtensionPropertyValues(Containerable object, groovy.namespace.QName propertyQname) <T> @NotNull Collection<T>getExtensionPropertyValues(Containerable containerable, String namespace, @NotNull String localPart) Returns real values of an extension property (of an object, assignment, or similar structure).<T> @NotNull Collection<T>getExtensionPropertyValues(Containerable object, QName propertyQname) @Nullable ReferencablegetExtensionReferenceValue(Containerable containerable, String namespace, @NotNull String localPart) @Nullable ReferencablegetExtensionReferenceValue(Containerable containerable, QName itemQName) Returns the value of an extension reference item (of an object, assignment, or similar structure), ornullif no value exists.<T> TgetIdentifierValue(ShadowType shadow) @NotNull Collection<?>getMetadataExtensionValues(PrismValue value, String itemLocalPart) Simplified version of getMetadataValue aimed at fetching single-segment extension paths.@NotNull Collection<?>getMetadataValues(PrismValue value, Object... pathSegments) Generic method to extract all metadata values pointed-to by given item path (specified as segments).@NotNull Collection<?>getMetadataValues(PrismValue value, String path) getOids(ObjectReferenceType refs) getOids(ObjectType refs) getOids(Collection<ObjectReferenceType> refs) <T> TgetPropertyValue(Containerable c, ItemPathType path) <T> TgetPropertyValue(Containerable c, String path) <T> TgetPropertyValue(PrismContainerValue<?> pcv, ItemPathType path) <T> TgetPropertyValue(PrismContainerValue<?> pcv, String path) <T> Collection<T>getPropertyValues(Containerable c, ItemPathType path) <T> Collection<T>getPropertyValues(Containerable c, String path) <T> Collection<T>getPropertyValues(PrismContainerValue<?> pcv, ItemPathType path) <T> Collection<T>getPropertyValues(PrismContainerValue<?> pcv, String path) <T> TgetResourceIcfConfigurationPropertyValue(ResourceType resource, String propertyLocalPart) <T> TgetResourceIcfConfigurationPropertyValue(ResourceType resource, QName propertyQname) <T> ThashLdapPassword(byte[] clearBytes, String alg) Hashes cleartext password in an (unofficial) LDAP password format.hashLdapPassword(ProtectedStringType protectedString, String alg) Hashes cleartext password in an (unofficial) LDAP password format.hashLdapPassword(String clearString, String alg) Hashes cleartext password in an (unofficial) LDAP password format.booleanstatic StringConvert string to lower case.longAgo()norm(PolyString orig) Normalize a PolyString value.norm(PolyStringType orig) Normalize a PolyStringType value.Normalize a string value.parseAdditionalName(Object fullName) parseDateTime(String format, String stringDate) parseFamilyName(Object fullName) parseGivenName(Object fullName) parseHonorificPrefix(Object fullName) parseHonorificSuffix(Object fullName) parseNickName(Object fullName) static StringvoidsetExtensionPropertyValues(@NotNull Containerable parent, @NotNull String propertyName, Object... values) voidsetExtensionPropertyValues(@NotNull Containerable parent, @NotNull QName propertyName, Object... values) Sets the real values of a given extension property (of an object, assignment, or similar structure).voidsetExtensionRealValues(PrismContainerValue<?> containerValue, Map<String, Object> map) Deprecated.voidsetTaskWorkerThreads(@NotNull TaskType task, Integer value) Sets "worker threads" distribution parameter for the root task activity.booleanstartsWith(PolyString polyString, String value) Checks whether the given normalized string begins with the specified value.booleanstartsWith(String string, String value) Checks whether the given normalized string begins with the specified value by first normalizing it.Converts whatever it gets to a string.<T> TtoSingle(Collection<T> values) static StringRemove whitespaces at the beginning and at the end of the string.static StringConvert string to upper case.
- 
Field Details- 
NAME_SEPARATOR- See Also:
 
- 
LOGGER
- 
LONG_AGOSpecial value that is too far in the past. It can be returned from time-based expressions to make sure that the expression is always executed.
 
- 
- 
Constructor Details- 
BasicExpressionFunctions
 
- 
- 
Method Details- 
lcConvert string to lower case.
- 
ucConvert string to upper case.
- 
contains
- 
containsIgnoreCase
- 
trimRemove whitespaces at the beginning and at the end of the string.
- 
concatNameConcatenates the arguments to create a name. Each argument is stringified, trimmed and the result is concatenated by spaces.
- 
startsWithChecks whether the given normalized string begins with the specified value by first normalizing it.- Parameters:
- string- the string
- value- the value
- Returns:
- true/false
 
- 
startsWithChecks whether the given normalized string begins with the specified value.- Parameters:
- polyString- the string
- value- the value
- Returns:
- true/false
 
- 
endsWithChecks whether the given normalized string ends with the specified value by first normalizing it.- Parameters:
- string- the string
- value- the value
- Returns:
- true/false
 
- 
endsWithChecks whether the given normalized string ends with the specified value- Parameters:
- polyString- the string
- value- the value
- Returns:
- true/false
 
- 
normNormalize a string value. It follows the default normalization algorithm used for PolyString values.- Parameters:
- orig- original value to normalize
- Returns:
- normalized value
 
- 
normNormalize a PolyString value.- Parameters:
- orig- original value to normalize
- Returns:
- normalized value
 
- 
normNormalize a PolyStringType value.- Parameters:
- orig- original value to normalize
- Returns:
- normalized value
 
- 
toAscii
- 
stringifyConverts whatever it gets to a string. But it does it in a sensitive way. E.g. it tries to detect collections and returns the first element (if there is only one). Never returns null. Returns empty string instead.
- 
getOids
- 
getOids
- 
getOids
- 
isEmpty
- 
getPrismContext
- 
getExtensionPropertyValues@NotNull public <T> @NotNull Collection<T> getExtensionPropertyValues(Containerable containerable, String namespace, @NotNull @NotNull String localPart) Returns real values of an extension property (of an object, assignment, or similar structure). Do not modify the returned collection.
- 
getExtensionPropertyValues@NotNull public <T> @NotNull Collection<T> getExtensionPropertyValues(Containerable object, @NotNull groovy.namespace.QName propertyQname) 
- 
getExtensionPropertyValues@NotNull public <T> @NotNull Collection<T> getExtensionPropertyValues(Containerable object, @NotNull QName propertyQname) 
- 
getExtensionPropertyValue@Nullable public <T> T getExtensionPropertyValue(Containerable containerable, @NotNull QName propertyQname) throws SchemaException Returns the real value of an extension property (of an object, assignment, or similar structure), ornullif no value exists. Throws aSchemaExceptionif the property has multiple values.- Throws:
- SchemaException
 
- 
getExtensionPropertyValue@Nullable public <T> T getExtensionPropertyValue(Containerable containerable, @NotNull @NotNull String localPart) throws SchemaException - Throws:
- SchemaException
- See Also:
 
- 
getExtensionPropertyValue@Nullable public <T> T getExtensionPropertyValue(Containerable containerable, String namespace, @NotNull @NotNull String localPart) throws SchemaException - Throws:
- SchemaException
- See Also:
 
- 
getExtensionPropertyValue@Nullable public <T> T getExtensionPropertyValue(Containerable containerable, @NotNull groovy.namespace.QName propertyQname) throws SchemaException - Throws:
- SchemaException
- See Also:
 
- 
getExtensionReferenceValue@Nullable public @Nullable Referencable getExtensionReferenceValue(Containerable containerable, @NotNull QName itemQName) throws SchemaException Returns the value of an extension reference item (of an object, assignment, or similar structure), ornullif no value exists. Throws aSchemaExceptionif the item has multiple values.- Throws:
- SchemaException
 
- 
getExtensionReferenceValue@Nullable public @Nullable Referencable getExtensionReferenceValue(Containerable containerable, String namespace, @NotNull @NotNull String localPart) throws SchemaException - Throws:
- SchemaException
- See Also:
 
- 
setExtensionPropertyValuespublic void setExtensionPropertyValues(@NotNull @NotNull Containerable parent, @NotNull @NotNull QName propertyName, Object... values) throws SchemaException Sets the real values of a given extension property (of an object, assignment, or similar structure). Removes any existing values.- Throws:
- SchemaException
 
- 
setExtensionPropertyValuespublic void setExtensionPropertyValues(@NotNull @NotNull Containerable parent, @NotNull @NotNull String propertyName, Object... values) throws SchemaException - Throws:
- SchemaException
- See Also:
 
- 
setExtensionRealValues@Deprecated public void setExtensionRealValues(PrismContainerValue<?> containerValue, Map<String, Object> map) throws SchemaExceptionDeprecated.- Throws:
- SchemaException
 
- 
getPropertyValue- Throws:
- SchemaException
 
- 
getPropertyValues
- 
getPropertyValue- Throws:
- SchemaException
 
- 
getPropertyValues
- 
getPropertyValue- Throws:
- SchemaException
 
- 
getPropertyValue- Throws:
- SchemaException
 
- 
getPropertyValues
- 
getPropertyValues
- 
getAttributeValuespublic <T> Collection<T> getAttributeValues(ShadowType shadow, String attributeNamespace, String attributeLocalPart) 
- 
getAttributeValues
- 
getAttributeValuespublic <T> Collection<T> getAttributeValues(ShadowType shadow, groovy.namespace.QName attributeQname) 
- 
getAttributeValues
- 
getAttributeValuepublic <T> T getAttributeValue(ShadowType shadow, String attributeNamespace, String attributeLocalPart) throws SchemaException - Throws:
- SchemaException
 
- 
getAttributeValueThe namespace of the attribute is assumed to be "ri:"- Throws:
- SchemaException
 
- 
getAttributeValuepublic <T> T getAttributeValue(ShadowType shadow, groovy.namespace.QName attributeQname) throws SchemaException - Throws:
- SchemaException
 
- 
getAttributeValue- Throws:
- SchemaException
 
- 
getAttributeStringValuespublic Collection<String> getAttributeStringValues(ShadowType shadow, String attributeNamespace, String attributeLocalPart) 
- 
getAttributeStringValuespublic Collection<String> getAttributeStringValues(ShadowType shadow, groovy.namespace.QName attributeQname) 
- 
getAttributeStringValues
- 
getMetadataValues@Experimental @NotNull public @NotNull Collection<?> getMetadataValues(PrismValue value, Object... pathSegments) Generic method to extract all metadata values pointed-to by given item path (specified as segments). Note: does not support multivalued containers withing the path (e.g. collecting transformation/source/name, where transformation/source is a multivalued container).
- 
getMetadataValues@Experimental @NotNull public @NotNull Collection<?> getMetadataValues(PrismValue value, String path) 
- 
getMetadataExtensionValues@Experimental @NotNull public @NotNull Collection<?> getMetadataExtensionValues(PrismValue value, String itemLocalPart) Simplified version of getMetadataValue aimed at fetching single-segment extension paths.
- 
getIdentifierValue- Throws:
- SchemaException
 
- 
getSecondaryIdentifierValue- Throws:
- SchemaException
 
- 
determineLdapSingleAttributeValuepublic String determineLdapSingleAttributeValue(Collection<String> dns, String attributeName, PrismProperty attribute) throws NamingException - Throws:
- NamingException
 
- 
getResourceIcfConfigurationPropertyValue
- 
getResourceIcfConfigurationPropertyValuepublic <T> T getResourceIcfConfigurationPropertyValue(ResourceType resource, String propertyLocalPart) 
- 
determineLdapSingleAttributeValuepublic String determineLdapSingleAttributeValue(Collection<String> dns, String attributeName, Collection<String> values) throws NamingException - Throws:
- NamingException
 
- 
determineLdapSingleAttributeValuepublic String determineLdapSingleAttributeValue(String dn, String attributeName, Collection<?> values) throws NamingException - Throws:
- NamingException
 
- 
toSingle- Throws:
- SchemaException
 
- 
readFile- Throws:
- IOException
 
- 
formatDateTime
- 
formatDateTime
- 
parseDateTime- Throws:
- ParseException
 
- 
currentDateTime
- 
fromNow
- 
addDuration
- 
addDuration
- 
addMillis
- 
roundDownToMidnight
- 
roundUpToEndOfDay
- 
longAgo
- 
parseGivenName
- 
parseFamilyName
- 
parseAdditionalName
- 
parseNickName
- 
parseHonorificPrefix
- 
parseHonorificSuffix
- 
decrypt
- 
encrypt
- 
composeDnCreates a valid LDAP distinguished name from the wide range of components. The method can be invoked in many ways, e.g.:composeDn("cn","foo","o","bar") composeDn("cn","foo",new Rdn("o","bar")) composeDn(new Rdn("cn","foo"),"ou","baz",new Rdn("o","bar")) composeDn(new Rdn("cn","foo"),"ou","baz","o","bar") composeDn(new Rdn("cn","foo"),new LdapName("ou=baz,o=bar")) composeDn("cn","foo",new LdapName("ou=baz,o=bar")) Note: the DN is not normalized. The case of the attribute names and white spaces are preserved. - Throws:
- InvalidNameException
 
- 
composeDnWithSuffixCreates a valid LDAP distinguished name from the wide range of components assuming that the last component is a suffix. The method can be invoked in many ways, e.g.:composeDn("cn","foo","o=bar") composeDn(new Rdn("cn","foo"),"ou=baz,o=bar") composeDn(new Rdn("cn","foo"),new LdapName("ou=baz,o=bar")) composeDn("cn","foo",new LdapName("ou=baz,o=bar")) The last element is a complete suffix represented either as String or LdapName. Note: the DN is not normalized. The case of the attribute names and white spaces are preserved. - Throws:
- InvalidNameException
 
- 
hashLdapPasswordpublic String hashLdapPassword(ProtectedStringType protectedString, String alg) throws NoSuchAlgorithmException, EncryptionException Hashes cleartext password in an (unofficial) LDAP password format. Supported algorithms: SSHA, SHA and MD5.
- 
hashLdapPasswordHashes cleartext password in an (unofficial) LDAP password format. Supported algorithms: SSHA, SHA and MD5.- Throws:
- NoSuchAlgorithmException
 
- 
hashLdapPasswordHashes cleartext password in an (unofficial) LDAP password format. Supported algorithms: SSHA, SHA and MD5.- Throws:
- NoSuchAlgorithmException
 
- 
debugDump
- 
debugDump
- 
setTaskWorkerThreadsSets "worker threads" distribution parameter for the root task activity.
 
-