com.silverpeas.profile.web
Class UserProfileResource

java.lang.Object
  extended by com.silverpeas.web.RESTWebService
      extended by com.silverpeas.profile.web.UserProfileResource

@Service
@RequestScoped
@Authenticated
public class UserProfileResource
extends RESTWebService

A REST-based Web service that acts on the user profiles in Silverpeas. Each provided method is a way to access a representation of one or several user profile. This representation is vehiculed as a Web entity in the HTTP requests and responses. The users that are published depend on some parameters whose the domain isolation and the profile of the user behind the requesting. The domain isolation defines the visibility of a user or a group of users in a given domain to the others domains in Silverpeas.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.silverpeas.web.RESTWebService
RESTWebService.WebProcess<RETURN_VALUE>, RESTWebService.WebTreatment<RETURN_VALUE>
 
Field Summary
static String QUERY_ALL_GROUPS
          Specific identifier of a user group meaning all the user groups in Silverpeas.
static String RESPONSE_HEADER_USERSIZE
          The HTTP header parameter that provides the real size of the user profiles that match a query.
 
Fields inherited from class com.silverpeas.web.RESTWebService
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE
 
Constructor Summary
UserProfileResource()
          Creates a new instance of UserProfileResource
 
Method Summary
 UserProfileEntity checkUserToken()
           
 javax.ws.rs.core.Response getApplicationUsers(String instanceId, String groupId, String roles, String resource, String name, String page, Set<UserState> userStatesToExclude)
          Gets the profiles of the users that have access to the specified Silverpeas component instance and that matches the specified optional query parameters.
 String getComponentId()
          Gets the identifier of the component instance to which the requested resource belongs to.
 UserProfileEntity getUser(String userId, boolean extended)
          Gets the profile on the user that is identified by the unique identifier refered by the URI.
 javax.ws.rs.core.Response getUserContacts(String userId, String instanceId, String roles, String resource, String name, String page, String domain, Set<UserState> userStatesToExclude)
          Gets the profile on the user that is identified by the unique identifier refered by the URI.
 javax.ws.rs.core.Response getUsers(Set<String> userIds, String groupId, String name, String page, String domain, Set<UserAccessLevel> accessLevels, Set<UserState> userStatesToExclude)
          Gets the users defined in Silverpeas and that matches the specified optional query parameters.
protected static URI identifiedBy(URI uri)
           
protected static URI locatedAt(URI uri)
           
 
Methods inherited from class com.silverpeas.web.RESTWebService
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESPONSE_HEADER_USERSIZE

public static final String RESPONSE_HEADER_USERSIZE
The HTTP header parameter that provides the real size of the user profiles that match a query. This parameter is useful for clients that use the pagination to filter the count of user profiles to sent back.

See Also:
Constant Field Values

QUERY_ALL_GROUPS

public static final String QUERY_ALL_GROUPS
Specific identifier of a user group meaning all the user groups in Silverpeas. In that case, only the users part of a user group will be fetched.

See Also:
Constant Field Values
Constructor Detail

UserProfileResource

public UserProfileResource()
Creates a new instance of UserProfileResource

Method Detail

checkUserToken

public UserProfileEntity checkUserToken()
Returns:
The user entity corresponding to the token specified in the URI.

getUsers

public javax.ws.rs.core.Response getUsers(Set<String> userIds,
                                          String groupId,
                                          String name,
                                          String page,
                                          String domain,
                                          Set<UserAccessLevel> accessLevels,
                                          Set<UserState> userStatesToExclude)
Gets the users defined in Silverpeas and that matches the specified optional query parameters. If no query parameters are set, then all the users in Silverpeas are sent back. The users to sent back can be filtered by a pattern their name has to satisfy, by the group they must belong to, and by some pagination parameters. In the response is indicated as an HTTP header (named X-Silverpeas-UserSize) the real size of the users that matches the query. This is usefull for clients that use the pagination to filter the count of the answered users.

Parameters:
userIds - requested user identifiers
groupId - the unique identifier of the group the users must belong to. The particular identifier "all" means all user groups.
name - a pattern the name of the users has to satisfy. The wildcard * means anything string of characters.
page - the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of users to sent back: those between ((page number - 1) * item count in the page) and ((page number - 1) * item count in the page + item count in the page).
domain - the unique identifier of the domain the users have to be related.
accessLevels - filters the users by the access level in Silverpeas.
userStatesToExclude - the user states that users taken into account must not be in.
Returns:
the JSON serialization of the array with the user profiles that matches the query.

getUser

public UserProfileEntity getUser(String userId,
                                 boolean extended)
Gets the profile on the user that is identified by the unique identifier refered by the URI. The unique identifier in the URI accepts also the specific term me to refers the current user of the session within which the request is received.

Parameters:
userId - the unique identifier of the user.
extended - more user details (full details).
Returns:
the profile of the user in a JSON representation.

getApplicationUsers

public javax.ws.rs.core.Response getApplicationUsers(String instanceId,
                                                     String groupId,
                                                     String roles,
                                                     String resource,
                                                     String name,
                                                     String page,
                                                     Set<UserState> userStatesToExclude)
Gets the profiles of the users that have access to the specified Silverpeas component instance and that matches the specified optional query parameters. If no query parameters are set, then all the users with the rights to access the component instance are sent back. The users to sent back can be filtered by a pattern their name has to satisfy, by the group they must belong to, and by some pagination parameters. In the response is indicated as an HTTP header (named X-Silverpeas-UserSize) the real size of the users that matches the query. This is usefull for clients that use the pagination to filter the count of the answered users.

Parameters:
instanceId - the unique identifier of the component instance the users should have access to.
groupId - the unique identifier of the group the users must belong to. The particular identifier "all" means all user groups.
roles - the name of the roles the users must play either for the component instance or for a given resource of the component instance.
resource - the unique identifier of the resource in the component instance the users to get must have enough rights to access. This query filter is coupled with the roles one. If it is not set, by default the resource refered is the whole component instance. As for component instance identifier, a resource one is defined by its type followed by its identifier.
name - a pattern the name of the users has to satisfy. The wildcard * means anything string of characters.
page - the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of users to sent back: those between ((page number - 1) * item count in the page) and ((page number - 1) * item count in the page + item count in the page).
userStatesToExclude - the user states that users taken into account must not be in.
Returns:
the JSON serialization of the array with the user profiles that can access the Silverpeas component and that matches the query.

getUserContacts

public javax.ws.rs.core.Response getUserContacts(String userId,
                                                 String instanceId,
                                                 String roles,
                                                 String resource,
                                                 String name,
                                                 String page,
                                                 String domain,
                                                 Set<UserState> userStatesToExclude)
Gets the profile on the user that is identified by the unique identifier refered by the URI. The unique identifier in the URI accepts also the specific term me to refers the current user of the session within which the request is received.

Parameters:
userId - the unique identifier of the user or me to refers the current user at the origin of the request.
instanceId - the unique identifier of the component instance the users should have access to.
roles - the name of the roles the users must play either for the component instance or for a given resource of the component instance.
resource - the unique identifier of the resource in the component instance the users to get must have enough rights to access. This query filter is coupled with the roles one. If it is not set, by default the resource refered is the whole component instance. As for component instance identifier, a resource one is defined by its type followed by its identifier.
name - a pattern the name of the users has to satisfy. The wildcard * means anything string of characters.
page - the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of users to sent back: those between ((page number - 1) * item count in the page) and ((page number - 1) * item count in the page + item count in the page).
domain - the unique identifier of the domain the users have to be related.
userStatesToExclude - the user states that users taken into account must not be in.
Returns:
the profile of the user in a JSON representation.

getComponentId

public String getComponentId()
Description copied from class: RESTWebService
Gets the identifier of the component instance to which the requested resource belongs to.

Specified by:
getComponentId in class RESTWebService
Returns:
the identifier of the Silverpeas component instance.

locatedAt

protected static URI locatedAt(URI uri)

identifiedBy

protected static URI identifiedBy(URI uri)


Copyright © 2016 Silverpeas. All Rights Reserved.