public class UserManagerResolver extends Object implements ObjectResolver
ObjectResolver allows to manage integrity for fields containing group or user references.
 References should have a prefix. NuxeoPrincipal.PREFIX for users, NuxeoGroup.PREFIX for groups.
If only user or group are configured, the prefix is not needed but still supported. If noth user and group are configured, reference without prefix are resolved as user first.
To use it, put the following code in your schema XSD :
 
 <!-- user or group resolver -->
 <xs:simpleType name="userOrGroupReference">
   <xs:restriction base="xs:string" ref:resolver="userManagerResolver" />
 </xs:simpleType>
 <!-- user resolver -->
 <xs:simpleType name="userReference">
   <xs:restriction base="xs:string" ref:resolver="userManagerResolver" ref:type="user" />
 </xs:simpleType>
 <!-- group resolver -->
 <xs:simpleType name="groupReference">
   <xs:restriction base="xs:string" ref:resolver="userManagerResolver" ref:type="group" />
 </xs:simpleType>
 
 ObjectResolver.Helper| Modifier and Type | Field and Description | 
|---|---|
| static String | FILTER_GROUP | 
| static String | FILTER_USER | 
| static String | INPUT_PARAM_FILTER | 
| static String | NAME | 
| static String | PARAM_INCLUDE_GROUPS | 
| static String | PARAM_INCLUDE_USERS | 
| Constructor and Description | 
|---|
| UserManagerResolver() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | configure(Map<String,String> parameters)Configure this resolver. | 
| <T> T | fetch(Class<T> type,
     Object value)Provides the entity referenced by a value, return the entity as expected type. | 
| Object | fetch(Object value)Provides the entity referenced by a value. | 
| String | getConstraintErrorMessage(Object invalidValue,
                         Locale locale)Provides an error message to display when some invalid value does not match existing entity. | 
| List<Class<?>> | getManagedClasses()Returns the resolved object types. | 
| String | getName()Provides this resolver name. | 
| Map<String,Serializable> | getParameters()Provides this resolver parameters. | 
| Serializable | getReference(Object entity)Generates a reference to an entity. | 
| UserManager | getUserManager() | 
| boolean | isIncludingGroups() | 
| boolean | isIncludingUsers() | 
| boolean | validate(Object value)Validates some value references an existing entity. | 
public static final String INPUT_PARAM_FILTER
public static final String FILTER_GROUP
public static final String FILTER_USER
public static final String NAME
public static final String PARAM_INCLUDE_USERS
public static final String PARAM_INCLUDE_GROUPS
public UserManagerResolver()
public UserManager getUserManager()
public List<Class<?>> getManagedClasses()
ObjectResolvergetManagedClasses in interface ObjectResolverpublic void configure(Map<String,String> parameters) throws IllegalStateException
ObjectResolverconfigure in interface ObjectResolverparameters - A map of parameter whose keys are parameter names and map value are corresponding values.IllegalStateException - If this resolver is already configured.public String getName() throws IllegalStateException
ObjectResolvergetName in interface ObjectResolverIllegalStateExceptionpublic Map<String,Serializable> getParameters() throws IllegalStateException
ObjectResolvergetParameters in interface ObjectResolverIllegalStateExceptionpublic boolean validate(Object value) throws IllegalStateException
ObjectResolvervalidate in interface ObjectResolvervalue - The reference.IllegalStateException - If this resolver has not been configured.public Object fetch(Object value) throws IllegalStateException
ObjectResolverfetch in interface ObjectResolvervalue - The reference.IllegalStateException - If this resolver has not been configured.public <T> T fetch(Class<T> type, Object value) throws IllegalStateException
ObjectResolverfetch in interface ObjectResolvervalue - The reference.IllegalStateException - If this resolver has not been configured.public Serializable getReference(Object entity) throws IllegalStateException
ObjectResolvergetReference in interface ObjectResolverentity - The entity.IllegalStateException - If this resolver has not been configured.public String getConstraintErrorMessage(Object invalidValue, Locale locale) throws IllegalStateException
ObjectResolvergetConstraintErrorMessage in interface ObjectResolverinvalidValue - The invalid value that don't match any entity.locale - The language in which the message should be generated.IllegalStateExceptionpublic boolean isIncludingUsers() throws IllegalStateException
IllegalStateExceptionpublic boolean isIncludingGroups() throws IllegalStateException
IllegalStateExceptionCopyright © 2015 Nuxeo SA. All rights reserved.