Class EntityUtil
java.lang.Object
ch.tocco.nice2.persist.security.api.EntityUtil
Static methods for common entity operations to avoid copy/paste coding.
-
Method Summary
Modifier and TypeMethodDescriptiongetCorrespondenceLanguages
(Context context) Returns a map containing all correspondence languages.static boolean
static boolean
Checks if the principal has all (matchAll: true) or just one of the given roles (matchAll: false)static <V> List
<V> map
(EntityList entities, Function<Entity, V> fun) static boolean
principalExists
(Context context, String userName, boolean caseless)
-
Method Details
-
principalExists
public static boolean principalExists(Context context, String userName, boolean caseless) throws PersistException - Parameters:
caseless
- If true then an existing user in any spelling (upper/lower case) will return true. This may be desired to not accidently create multiple users with the same username in different case.- Throws:
PersistException
-
getCorrespondenceLanguages
public static Map<String,String> getCorrespondenceLanguages(Context context) throws PersistException Returns a map containing all correspondence languages.- Returns:
- a map containing all correspondence languages.
- Throws:
PersistException
- if an error occurs.
-
hasRoles
Checks if the principal has all (matchAll: true) or just one of the given roles (matchAll: false)- Parameters:
roles
- pass a Set if you do not get data from another point (i.e. you are creating it).
-
hasRole
-
map
- Throws:
PersistException
-