org.oscelot.webct.dao
Class UserService

java.lang.Object
  extended byorg.oscelot.webct.dao.UserService

public class UserService
extends java.lang.Object

The UserService is a singleton utility that allows user data to be retrieved from within the Vista authentication module framework given a user Id and the learning context Id (typically the section Id). A user value object (UserVO) is returned.

This service also returns a list of all the users (UserVOs) for a given learning context Id.

Based on com.webct.platform.sdkext.authmoduledata.UserService

Version:
2.5 (31-Oct-11)
Author:
Stephen P Vickers

Method Summary
 java.util.Map getChildMembers(java.lang.Long lcId)
          Get all members of the given learning context Id
static UserService getInstance()
          Returns an instance of this service
 java.util.List getLearningContexts(java.lang.String userId, int typeLevel)
          Deprecated. This method has been deprecated because it is fundamentally flawed; the userId parameter is not sufficient to uniquely identify a user when multiple institutions exist. Use the UserVO.getLearningContexts(int) method instead.
 java.util.List getMembers(java.lang.Long lcId)
          Get all members of the given learning context Id.
 UserVO getUser(java.lang.String userId, java.lang.Long currentLCId)
          Retrieve a User definition for the user identified by userId in the given learning context ID.
 java.lang.String getUserId(java.lang.Long personId)
          Retrieve the User Id for the user identified by person Id.
 java.lang.String getUserId(java.lang.String sourceName, java.lang.String sourceId)
          Retrieve the User Id for the user identified by person Id.
 java.lang.Long getUserRoleId(java.lang.String role)
          Get the Id of a user role
 java.util.List getUserRoles(java.lang.String userId, java.lang.Long lcId)
          Deprecated. This method is duplicated by the UserVO.getUserRoles() method so, given the deprecation of the UserRole class, this method has been deprecated and replaced by UserVO.getRoles().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UserService getInstance()
Returns an instance of this service

Returns:
UserService

getUser

public UserVO getUser(java.lang.String userId,
                      java.lang.Long currentLCId)
               throws VistaDataException
Retrieve a User definition for the user identified by userId in the given learning context ID. This ID is typically that of a section.

Parameters:
userId - user Id
currentLCId - current learning context Id (typically the section lcId)
Returns:
UserVO - the user value object
Throws:
VistaDataException

getUserId

public java.lang.String getUserId(java.lang.Long personId)
                           throws VistaDataException
Retrieve the User Id for the user identified by person Id.

Parameters:
personId - person Id
Returns:
String - the user Id
Throws:
VistaDataException

getUserId

public java.lang.String getUserId(java.lang.String sourceName,
                                  java.lang.String sourceId)
                           throws VistaDataException
Retrieve the User Id for the user identified by person Id.

Returns:
String - the user Id
Throws:
VistaDataException

getMembers

public java.util.List getMembers(java.lang.Long lcId)
                          throws VistaDataException
Get all members of the given learning context Id.

Note that this method will not return institutional user accounts for domain or server level learning contexts. Use the UserVO.getRoles(Boolean) to find all the roles held by an institutional user account.

Parameters:
lcId - the learning context Id
Returns:
List - user value objects representing all users in LC
Throws:
VistaDataException

getChildMembers

public java.util.Map getChildMembers(java.lang.Long lcId)
                              throws VistaDataException
Get all members of the given learning context Id

Parameters:
lcId - the learning context Id
Returns:
Map - user value objects representing all users enrolled in the learning context with an associated ID of the learning context in which they are enrolled (which may be a child section in a cross-listed set) (Map<UserVO, Long>)
Throws:
VistaDataException

getLearningContexts

public java.util.List getLearningContexts(java.lang.String userId,
                                          int typeLevel)
                                   throws VistaDataException
Deprecated. This method has been deprecated because it is fundamentally flawed; the userId parameter is not sufficient to uniquely identify a user when multiple institutions exist. Use the UserVO.getLearningContexts(int) method instead.

Parameters:
userId - the user id
typeLevel - the learning context type level
Returns:
List - list of LearningContextVOs
Throws:
VistaDataException

getUserRoles

public java.util.List getUserRoles(java.lang.String userId,
                                   java.lang.Long lcId)
                            throws VistaDataException
Deprecated. This method is duplicated by the UserVO.getUserRoles() method so, given the deprecation of the UserRole class, this method has been deprecated and replaced by UserVO.getRoles().

Parameters:
userId - the user Id
lcId - the learning context Id
Returns:
List - List of UserRole elements
Throws:
VistaDataException

getUserRoleId

public java.lang.Long getUserRoleId(java.lang.String role)
Get the Id of a user role

Parameters:
role - the role name
Returns:
Long - the Id for the user role (or null if the role is not recognised)