ca.bc.gov.webade
Interface Application

All Superinterfaces:
ApplicationMBean
All Known Implementing Classes:
WebADEDatabaseApplication

public interface Application
extends ApplicationMBean

Author:
jross

Method Summary
 java.util.List findGroups(GroupSearchObject searchObject)
          Deprecated. All group search functionality in no longer supported.
 java.util.List findOrganizations(OrganizationSearchObject searchObject)
          Finds the set of Organization objects that match the provided search criteria.
 java.util.List findUsers(UserSearchObject searchObject)
          Deprecated. Use UserInfoService.findUsers(ca.bc.gov.webade.user.search.UserSearchQuery) instead.
 WebADEUserInfo[] findWebADEUsers(UserSearchObject searchObject)
          Deprecated. Use UserInfoService.findUsers(ca.bc.gov.webade.user.search.UserSearchQuery) instead.
 User getAnonymousUser()
          Deprecated. No replacement API for this method. To obtain the set of permissions granted to all users (authenticated and unauthenticated), see getPublicWebADEPermissions().
 java.lang.String getApplicationCode()
          Get the code (acronym) for the application.
 java.lang.String getApplicationEnvironment()
          Get the deployment environment this application is deployed in.
 Preferences getApplicationPreferences()
          Deprecated. Use getWebADEApplicationPreferences() instead.
 UserCredentials[] getAuthorizedUsers(Organization organization)
          Loads all users from the datastore that are members of roles via an authorization associated with the given organization.
 UserCredentials[] getAuthorizedUsers(Organization organization, boolean ignoreIndeterminateAuthorizationsErrors)
          Loads all users from the datastore that are members of roles via an authorization associated with the given organization.
 UserCredentials[] getAuthorizedUsers(Role role)
          Loads all users from the datastore that are members of the given role.
 UserCredentials[] getAuthorizedUsers(Role role, boolean ignoreIndeterminateAuthorizationsErrors)
          Loads all users from the datastore that are members of the given role.
 UserCredentials[] getAuthorizedUsers(Role role, Organization organization)
          Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.
 UserCredentials[] getAuthorizedUsers(Role role, Organization organization, boolean ignoreIndeterminateAuthorizationsErrors)
          Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.
 java.sql.Connection getConnection(User user, Role role)
          Deprecated. Use getConnection(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Role) instead.
 java.sql.Connection getConnection(WebADEUserPermissions userAuthorizations, Role role)
          gets a Connection for the given role.
 java.sql.Connection getConnectionByAction(User user, java.lang.String actionName)
          Deprecated. Use getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Action) instead.
 java.sql.Connection getConnectionByAction(WebADEUserPermissions userAuthorizations, Action action)
          Gets a Connection for the given action.
 java.sql.Connection getConnectionByAction(WebADEUserPermissions userAuthorizations, java.lang.String actionName)
          Deprecated. Use getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Action) instead.
 java.sql.Connection getConnectionByPriviledgedAction(Action action)
          Gets a Connection for the given priviledged action.
 java.sql.Connection getConnectionByPriviledgedAction(java.lang.String actionName)
          Deprecated. Use getConnectionByPriviledgedAction(ca.bc.gov.webade.Action) instead.
 ElectronicAgreement getElectronicAgreement(java.lang.String agreementName)
          Returns the target agreement, based on the given agreement name.
 Preferences getGlobalPreferences()
          Deprecated. Use getWebADEGlobalPreferences() instead.
 Group getGroupByGUID(java.lang.String guid)
          Deprecated. All group search functionality in no longer supported.
 java.util.List getGroupSearchMetadata()
          Deprecated. All group search functionality in no longer supported.
 Organization getOrganizationById(long organizationId)
          Returns the organization with the given organization id.
 OrganizationSearchObject getOrganizationSearchMetadata()
          Returns the OrganizationSearchObject metadata object that allows the searching of ministry organizations.
 WebADEUserPermissions getPublicWebADEPermissions()
          Returns the public unauthenticated permissions from the datastore.
 AppRoles getRoles()
          get the roles used by this application.
 User getUserByGUID(java.lang.String guid)
          Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) and UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.
 User getUserByUserId(java.lang.String userId)
          Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) and UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.
 Organization getUserDefaultOrganization(User user)
          Deprecated. Use getUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials) instead.
 Organization getUserDefaultOrganization(UserCredentials userCredentials)
          Gets the user's default organization.
 UserInfoService getUserInfoService()
          Returns the UserInfoService object for this application.
 Preferences getUserPreferences(User targetUser)
          Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) instead.
 Preferences getUserPreferences(UserCredentials targetUserCredentials)
          Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) instead.
 User[] getUsersByOrganization(Organization organization)
          Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Organization) instead.
 User[] getUsersByRole(Role role)
          Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Role) instead.
 User[] getUsersByRoleAndOrganization(Role role, Organization organization)
          Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization) instead.
 java.util.List getUserSearchMetadata()
          Deprecated. Use UserInfoService.createUserSearchQuery(ca.bc.gov.webade.user.UserTypeCode) instead, passing in the target user type code to search on.
 WebADEPreferences getWebADEApplicationPreferences()
          Returns the set of WebADE application preferences.
 WebADEExtension getWebADEExtension(java.lang.Class classObject)
          Retrieves the registered extension singleton from the list of extensions which is an instance of the provided class object.
 WebADEExtension getWebADEExtension(java.lang.String className)
          Retrieves the registered extension singleton from the list of extensions whose fully qualified class name is the one provided.
 WebADEPreferences getWebADEGlobalPreferences()
          Returns the global preferences for WebADE.
 WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials)
          Deprecated. Use UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.
 WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials, boolean ignoreSessionCache)
          Deprecated. Use UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials, boolean) instead.
 WebADEUserPermissions getWebADEUserPermissions(UserCredentials userCredentials)
          Loads the target user's permissions from the datastore, or returns null if the user is not found.
 WebADEUserPermissions getWebADEUserPermissions(UserCredentials userCredentials, boolean ignoreSessionCache)
          Loads the target user's permissions from the datastore, or returns null if the user is not found.
 WebADEPreferences getWebADEUserPreferences(UserCredentials targetUserCredentials)
          Returns the set of user preferences for this user and this application.
 boolean hasIndeterminateAuthorizations(Organization organization)
          Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given organization.
 boolean hasIndeterminateAuthorizations(Role role)
          Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given role.
 boolean hasIndeterminateAuthorizations(Role role, Organization organization)
          Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given role and organization.
 boolean hasUserAcceptedAgreement(UserCredentials userCredentials, java.lang.String agreementName)
          Returns a flag indicating whether the user has previously agreed to the given agreement.
 boolean hasUserAcceptedAgreement(User user, java.lang.String agreementName)
          Deprecated. Use hasUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String) instead.
 boolean isAnonymousUser(User user)
          Deprecated. See WebADECurrentUserPermissions.isUserAuthenticated()
 boolean isDisabled()
          Tests if the application is currently disabled.
 boolean isUserInGroup(UserCredentials userCredentials, GUID groupGuid)
          Checks to see if the user is a member of the group identified by the given GUID.
 boolean isUserInGroup(User user, java.lang.String groupGuid)
          Deprecated. Use isUserInGroup(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID) instead.
 GUID[] isUserInGroups(UserCredentials userCredentials, GUID[] groupGuids)
          Checks to see if the user is a member of the groups identified by the given array of GUID values.
 java.lang.String[] isUserInGroups(User user, java.lang.String[] groupGuids)
          Deprecated. Use isUserInGroups(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID[]) instead.
 void registerWebADEExtension(WebADEExtension extension)
          Registers a new WebADE Extension with the Application object.
 WebADEPreferences saveWebADEUserPreferences(UserCredentials targetUserCredentials, WebADEPreferences preferences)
          Saves the given user preferences for this user and this application.
 void setDisabled(boolean disable)
          Sets the disabled status of this application in the current execution environment.
 void setUserAcceptedAgreement(UserCredentials userCredentials, java.lang.String agreementName, boolean agreeFlag)
          Sets the user's "accepted" flag on the given agreement to the given flag value.
 void setUserAcceptedAgreement(User user, java.lang.String agreementName, boolean agreeFlag)
          Deprecated. Use setUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String, boolean) instead.
 void setUserDefaultOrganization(UserCredentials userCredentials, Organization organization)
          Sets the user's default organization to the given organization.
 void setUserDefaultOrganization(User user, Organization organization)
          Deprecated. Use setUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.Organization) instead.
 void shutdown()
          Notifies the application singleton to shutdown, stopping monitoring threads and closing dependant resources.
 void unregisterWebADEExtension(WebADEExtension extension)
          Unregisters a WebADE Extension from the Application object.
 

Method Detail

getUserInfoService

public UserInfoService getUserInfoService()
Returns the UserInfoService object for this application. This singleton centralizes all user info related API calls. The reason this was done was to separate them from the rest of the WebADE API, in an attempt to reduce the clutter of the monolithic Application interface.

Returns:
The UserInfoService singleton for this application.

getApplicationPreferences

public Preferences getApplicationPreferences()
Deprecated. Use getWebADEApplicationPreferences() instead.

Returns the set of application preferences.

Returns:
Returns the applicationPreferences.

getWebADEApplicationPreferences

public WebADEPreferences getWebADEApplicationPreferences()
                                                  throws WebADEException
Returns the set of WebADE application preferences.

Returns:
Returns the applicationPreferences.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the WebADE application preferences.

getUserPreferences

public Preferences getUserPreferences(UserCredentials targetUserCredentials)
                               throws WebADEException
Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) instead.

Returns the set of user preferences for this user and this application.

Parameters:
targetUserCredentials - The user's identifying credentials.
Returns:
Returns the user's preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.

getWebADEUserPreferences

public WebADEPreferences getWebADEUserPreferences(UserCredentials targetUserCredentials)
                                           throws WebADEException
Returns the set of user preferences for this user and this application.

Parameters:
targetUserCredentials - The user's identifying credentials.
Returns:
Returns the user's preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.

saveWebADEUserPreferences

public WebADEPreferences saveWebADEUserPreferences(UserCredentials targetUserCredentials,
                                                   WebADEPreferences preferences)
                                            throws WebADEException
Saves the given user preferences for this user and this application.

Parameters:
targetUserCredentials - The user's identifying credentials.
preferences - The user's User preferences.
Returns:
The saved user's preferences object.
Throws:
WebADEException - Thrown when a WebADE error occurs.

getGlobalPreferences

public Preferences getGlobalPreferences()
                                 throws WebADEException
Deprecated. Use getWebADEGlobalPreferences() instead.

Returns the global preferences for WebADE.

Returns:
Returns the WebADE global preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.

getWebADEGlobalPreferences

public WebADEPreferences getWebADEGlobalPreferences()
                                             throws WebADEException
Returns the global preferences for WebADE.

Returns:
Returns the WebADE global preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.

getApplicationCode

public java.lang.String getApplicationCode()
Get the code (acronym) for the application.

Specified by:
getApplicationCode in interface ApplicationMBean
Returns:
the code

getApplicationEnvironment

public java.lang.String getApplicationEnvironment()
Get the deployment environment this application is deployed in.

Returns:
The application environment code.

getRoles

public AppRoles getRoles()
get the roles used by this application.

Returns:
a list of the application roles

getPublicWebADEPermissions

public WebADEUserPermissions getPublicWebADEPermissions()
                                                 throws WebADEException
Returns the public unauthenticated permissions from the datastore. If no user can be identified with the request, this method will be userd to return a set of public authorizations.

Returns:
A WebADEUserPermissions object for the public unauthenticated user.
Throws:
WebADEException

getWebADEUserPermissions

public WebADEUserPermissions getWebADEUserPermissions(UserCredentials userCredentials)
                                               throws WebADEException
Loads the target user's permissions from the datastore, or returns null if the user is not found. Will return the session user's cached permissions object, if the given credentials match the current user's credentials.

Parameters:
userCredentials - The user's identifying credentials.
Returns:
A WebADEUserPermissions object for the target user.
Throws:
WebADEException

getWebADEUserPermissions

public WebADEUserPermissions getWebADEUserPermissions(UserCredentials userCredentials,
                                                      boolean ignoreSessionCache)
                                               throws WebADEException
Loads the target user's permissions from the datastore, or returns null if the user is not found.

Parameters:
userCredentials - The user's identifying credentials.
ignoreSessionCache - A flag indicating whether to ignore the session user permissions object, should it match the given user credentials.
Returns:
A WebADEUserPermissions object for the target user.
Throws:
WebADEException

getWebADEUserInfo

public WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials)
                                 throws WebADEException
Deprecated. Use UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.

Loads the target user's personal information from the datastore, or returns null if the user is not found. Will return the session user's cached info object, if the given credentials match the current user's credentials.

Parameters:
userCredentials - The user's identifying credentials.
Returns:
A WebADEUserInfo object for the target user.
Throws:
WebADEException

getWebADEUserInfo

public WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials,
                                        boolean ignoreSessionCache)
                                 throws WebADEException
Deprecated. Use UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials, boolean) instead.

Loads the target user's personal information from the datastore, or returns null if the user is not found.

Parameters:
userCredentials - The user's identifying credentials.
ignoreSessionCache - A flag indicating whether to ignore the session user info object, should it match the given user credentials.
Returns:
A WebADEUserInfo object for the target user.
Throws:
WebADEException

isUserInGroup

public boolean isUserInGroup(UserCredentials userCredentials,
                             GUID groupGuid)
                      throws WebADEException
Checks to see if the user is a member of the group identified by the given GUID. This method will also traverse the group's member groups recursively until it has either found the user or exhausted the set of member groups.

Parameters:
userCredentials - The target user's credentials.
groupGuid - The unique GUID of the target group.
Returns:
True if the user was found as a member, otherwise false.
Throws:
WebADEException - Thrown if the group is not found or an error occurs while processing the request.

isUserInGroups

public GUID[] isUserInGroups(UserCredentials userCredentials,
                             GUID[] groupGuids)
                      throws WebADEException
Checks to see if the user is a member of the groups identified by the given array of GUID values. This method will also traverse the groups' member groups recursively until it has either found the user or exhausted the set of member groups.

Parameters:
userCredentials - The target user's credentials.
groupGuids - The unique GUID values of the target groups.
Returns:
The array of all GUID values for groups in the set that the user is a member of (Returns a size-0 array if the user is not a member of any of the given groups).
Throws:
WebADEException - Thrown if ant of the groups are not found or an error occurs while processing the request.

getUserSearchMetadata

public java.util.List getUserSearchMetadata()
Deprecated. Use UserInfoService.createUserSearchQuery(ca.bc.gov.webade.user.UserTypeCode) instead, passing in the target user type code to search on.

Returns a List of UserSearchObject metadata objects for all configured directories for this application.

Returns:
A List of UserSearchObject objects.

findWebADEUsers

public WebADEUserInfo[] findWebADEUsers(UserSearchObject searchObject)
                                 throws WebADEException
Deprecated. Use UserInfoService.findUsers(ca.bc.gov.webade.user.search.UserSearchQuery) instead.

Finds the set of WebADEUserInfo objects that match the provided search criteria.

Parameters:
searchObject - The search object.
Returns:
A List of WebADEUserInfo objects.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

getElectronicAgreement

public ElectronicAgreement getElectronicAgreement(java.lang.String agreementName)
                                           throws WebADEException
Returns the target agreement, based on the given agreement name.

Parameters:
agreementName - The name of the target agreement.
Returns:
The target ElectronicAgreement.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

hasUserAcceptedAgreement

public boolean hasUserAcceptedAgreement(UserCredentials userCredentials,
                                        java.lang.String agreementName)
                                 throws WebADEException
Returns a flag indicating whether the user has previously agreed to the given agreement.

Parameters:
userCredentials - The target user's credentials.
agreementName - The unique name of the target agreement.
Returns:
The set of application role names authorized to that user.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

setUserAcceptedAgreement

public void setUserAcceptedAgreement(UserCredentials userCredentials,
                                     java.lang.String agreementName,
                                     boolean agreeFlag)
                              throws WebADEException
Sets the user's "accepted" flag on the given agreement to the given flag value.

Parameters:
userCredentials - The target user's credentials.
agreementName - The unique name of the target agreement.
agreeFlag - A flag indicating whether the user accepts or refuses the given agreement.
Throws:
WebADEException - Thrown when an error occurs while trying to save the flag to the datastore.

getOrganizationById

public Organization getOrganizationById(long organizationId)
                                 throws WebADEException
Returns the organization with the given organization id.

Parameters:
organizationId - The unique organization id.
Returns:
A ministry-specific organization.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

getOrganizationSearchMetadata

public OrganizationSearchObject getOrganizationSearchMetadata()
Returns the OrganizationSearchObject metadata object that allows the searching of ministry organizations. This object may need to be cast to the appropriate ministry-specific object to gain access to ministry-specific search fields.

Returns:
A properly configured OrganizationSearchObject object.

findOrganizations

public java.util.List findOrganizations(OrganizationSearchObject searchObject)
                                 throws WebADEException
Finds the set of Organization objects that match the provided search criteria.

Parameters:
searchObject - The search object.
Returns:
A List of Organization objects.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

registerWebADEExtension

public void registerWebADEExtension(WebADEExtension extension)
                             throws WebADEExtensionException
Registers a new WebADE Extension with the Application object. When an extension is registered with the application singleton, it is provided references to the application singleton and the WebADE database proxy.

Parameters:
extension - A singleton extension object to initialize and store in the application object
Throws:
WebADEExtensionException - Thrown if the extension object is null or an instance of the class has already been registered

unregisterWebADEExtension

public void unregisterWebADEExtension(WebADEExtension extension)
Unregisters a WebADE Extension from the Application object.

Parameters:
extension - A singleton extension object to remove from the application's extension list.

getWebADEExtension

public WebADEExtension getWebADEExtension(java.lang.String className)
Retrieves the registered extension singleton from the list of extensions whose fully qualified class name is the one provided.

Parameters:
className - The fully qualified class name(including package)
Returns:
The registered extension singleton, or null if not found.

getWebADEExtension

public WebADEExtension getWebADEExtension(java.lang.Class classObject)
Retrieves the registered extension singleton from the list of extensions which is an instance of the provided class object.

Parameters:
classObject - The class of the extension singleton
Returns:
The registered extension singleton, or null if not found.

isDisabled

public boolean isDisabled()
                   throws WebADEException
Tests if the application is currently disabled. The disabled status

Returns:
true if the application is currently disabled
Throws:
WebADEException - Thrown if an error occurs while determining if the application has been disabled.

setDisabled

public void setDisabled(boolean disable)
                 throws WebADEException
Sets the disabled status of this application in the current execution environment.

Parameters:
disable - Flag indicating whether to disable the application.
Throws:
WebADEException

getUserDefaultOrganization

public Organization getUserDefaultOrganization(UserCredentials userCredentials)
                                        throws WebADEException
Gets the user's default organization.

Parameters:
userCredentials - The target user's credentials.
Returns:
The selected organization.
Throws:
WebADEException - Thrown if an error occurs while getting the default organization.

setUserDefaultOrganization

public void setUserDefaultOrganization(UserCredentials userCredentials,
                                       Organization organization)
                                throws WebADEException
Sets the user's default organization to the given organization.

Parameters:
userCredentials - The target user's credentials.
organization - The selected organization.
Throws:
WebADEException - Thrown if an error occurs while setting the default organization.

getConnection

public java.sql.Connection getConnection(WebADEUserPermissions userAuthorizations,
                                         Role role)
                                  throws WebADEException,
                                         java.sql.SQLException
gets a Connection for the given role. Checks to see whether the user is in the specified role.

Parameters:
userAuthorizations - The target user's authorizations.
role - the role to get the Connection for
Returns:
A connection from the pool.
Throws:
WebADEException - Thrown if an error occurs.
java.sql.SQLException - Thrown if an error occurs.

getConnectionByAction

public java.sql.Connection getConnectionByAction(WebADEUserPermissions userAuthorizations,
                                                 Action action)
                                          throws WebADEException,
                                                 java.sql.SQLException
Gets a Connection for the given action. Checks to see whether has role access to the action.

Parameters:
userAuthorizations - The target user's authorizations.
action - The action to get the Connection for.
Returns:
connection a connection
Throws:
WebADEException - Thrown if an error occurs.
java.sql.SQLException - Thrown if an error occurs.

getConnectionByAction

public java.sql.Connection getConnectionByAction(WebADEUserPermissions userAuthorizations,
                                                 java.lang.String actionName)
                                          throws WebADEException,
                                                 java.sql.SQLException
Deprecated. Use getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Action) instead.

Gets a Connection for the given action. Checks to see whether has role access to the action.

Parameters:
userAuthorizations - The target user's authorizations.
actionName - the actionname to get the Connection for
Returns:
connection a connection
Throws:
WebADEException - Thrown if an error occurs.
java.sql.SQLException - Thrown if an error occurs.

getConnectionByPriviledgedAction

public java.sql.Connection getConnectionByPriviledgedAction(Action action)
                                                     throws WebADEException,
                                                            java.sql.SQLException
Gets a Connection for the given priviledged action. Checks to see if the action has been defined as priviledged in the WebADE datastore. Only priviledged actions can return connections without requiring a user to authorize against. See the WebADE documentation for more information about priviledged actions.

Parameters:
action - The action to get the Connection for.
Returns:
connection a connection
Throws:
WebADEException - Thrown if an error occurs, or if the action is not marked as priviledged.
java.sql.SQLException - Thrown if an error occurs.

getConnectionByPriviledgedAction

public java.sql.Connection getConnectionByPriviledgedAction(java.lang.String actionName)
                                                     throws WebADEException,
                                                            java.sql.SQLException
Deprecated. Use getConnectionByPriviledgedAction(ca.bc.gov.webade.Action) instead.

Gets a Connection for the given priviledged action. Checks to see if the action has been defined as priviledged in the WebADE datastore. Only priviledged actions can return connections without requiring a user to authorize against. See the WebADE documentation for more information about priviledged actions.

Parameters:
actionName - the action name to get the Connection for
Returns:
connection a connection
Throws:
WebADEException - Thrown if an error occurs, or if the action is not marked as priviledged.
java.sql.SQLException - Thrown if an error occurs.

hasIndeterminateAuthorizations

public boolean hasIndeterminateAuthorizations(Role role)
                                       throws WebADEException
Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given role.

Parameters:
role - The WebADE role in this application.
Returns:
True if there are authorizations that cannot be fully evaluated, when looking for users in this role.
Throws:
WebADEException - Thrown if an error occurs while performing this query.

hasIndeterminateAuthorizations

public boolean hasIndeterminateAuthorizations(Organization organization)
                                       throws WebADEException
Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given organization.

Parameters:
organization - The organization to load users of this application for.
Returns:
True if there are authorizations that cannot be fully evaluated, when looking for users in this role.
Throws:
WebADEException - Thrown if an error occurs while performing this query.

hasIndeterminateAuthorizations

public boolean hasIndeterminateAuthorizations(Role role,
                                              Organization organization)
                                       throws WebADEException
Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given role and organization.

Parameters:
role - The WebADE role in this application.
organization - The organization to load users of this application for.
Returns:
True if there are authorizations that cannot be fully evaluated, when looking for users in this role.
Throws:
WebADEException - Thrown if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Role role)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members of the given role.

Parameters:
role - The role to load users for.
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Role role,
                                            boolean ignoreIndeterminateAuthorizationsErrors)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members of the given role.

Parameters:
role - The role to load users for.
ignoreIndeterminateAuthorizationsErrors - If set to true, prevents the IndeterminateAuthorizationsException from being thrown, if it occurs.
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Organization organization)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members of roles via an authorization associated with the given organization.

Parameters:
organization - The organization to load users for.
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Organization organization,
                                            boolean ignoreIndeterminateAuthorizationsErrors)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members of roles via an authorization associated with the given organization.

Parameters:
organization - The organization to load users for.
ignoreIndeterminateAuthorizationsErrors - If set to true, prevents the IndeterminateAuthorizationsException from being thrown, if it occurs.
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Role role,
                                            Organization organization)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.

Parameters:
role - The role to load users for (optional).
organization - The organization to load users for (optional).
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

getAuthorizedUsers

public UserCredentials[] getAuthorizedUsers(Role role,
                                            Organization organization,
                                            boolean ignoreIndeterminateAuthorizationsErrors)
                                     throws IndeterminateAuthorizationsException,
                                            WebADEException
Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.

Parameters:
role - The role to load users for (optional).
organization - The organization to load users for (optional).
ignoreIndeterminateAuthorizationsErrors - If set to true, prevents the IndeterminateAuthorizationsException from being thrown, if it occurs.
Returns:
An array of member UserCredentials objects.
Throws:
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
WebADEException - Throws a base WebADEException if an error occurs while performing this query.

shutdown

public void shutdown()
              throws java.lang.SecurityException
Notifies the application singleton to shutdown, stopping monitoring threads and closing dependant resources.

Throws:
java.lang.SecurityException - If the caller is not an instance of an authorized class, a SecurityException is thrown.

getUserPreferences

public Preferences getUserPreferences(User targetUser)
                               throws WebADEException
Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) instead.

Returns the set of user preferences for this user and this application.

Parameters:
targetUser - The user to retrieve the preferences for.
Returns:
Returns the user preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.

getAnonymousUser

public User getAnonymousUser()
                      throws WebADEException
Deprecated. No replacement API for this method. To obtain the set of permissions granted to all users (authenticated and unauthenticated), see getPublicWebADEPermissions().

Get the singleton anonymous User object.

Returns:
The singleton anonymous User object.
Throws:
WebADEException

isAnonymousUser

public boolean isAnonymousUser(User user)
                        throws WebADEException
Deprecated. See WebADECurrentUserPermissions.isUserAuthenticated()

Tests if the given user is the anonymous user for this application.

Parameters:
user - The user to compare to the anonymous user.
Returns:
True if a match is found.
Throws:
WebADEException

getUserByGUID

public User getUserByGUID(java.lang.String guid)
                   throws WebADEException
Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) and UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.

Loads the target user from the datastore, or returns null if the user is not found. Deprecated and replaced with searchForUserByGUID method to indicate to the developer that this call is less efficient than the application's getUser() methods.

Parameters:
guid - The guid of the user to load.
Returns:
A User object for the target user.
Throws:
WebADEException

getUserByUserId

public User getUserByUserId(java.lang.String userId)
                     throws WebADEException
Deprecated. Use getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials) and UserInfoService.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials) instead.

Loads the target user from the datastore, or returns null if the user is not found.

Parameters:
userId - The userId of the user, including domain, to load.
Returns:
A User object for the target user.
Throws:
WebADEException

getUsersByRole

public User[] getUsersByRole(Role role)
                      throws WebADEException
Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Role) instead.

Loads all users from the datastore that are members of the given role.

Parameters:
role - The role to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException

getUsersByOrganization

public User[] getUsersByOrganization(Organization organization)
                              throws WebADEException
Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Organization) instead.

Loads all users from the datastore that are members of roles via an authorization associated with the given organization.

Parameters:
organization - The organization to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException

getUsersByRoleAndOrganization

public User[] getUsersByRoleAndOrganization(Role role,
                                            Organization organization)
                                     throws WebADEException
Deprecated. Use getAuthorizedUsers(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization) instead.

Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.

Parameters:
role - The role to load users for.
organization - The organization to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException

isUserInGroup

public boolean isUserInGroup(User user,
                             java.lang.String groupGuid)
                      throws WebADEException
Deprecated. Use isUserInGroup(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID) instead.

Checks to see if the user is a member of the group identified by the given GUID. This method will also traverse the group's member groups recursively until it has either found the user or exhausted the set of member groups.

Parameters:
user - The target user object.
groupGuid - The unique GUID of the target group.
Returns:
True if the user was found as a member, otherwise false.
Throws:
WebADEException - Thrown if the group is not found or an error occurs while processing the request.

isUserInGroups

public java.lang.String[] isUserInGroups(User user,
                                         java.lang.String[] groupGuids)
                                  throws WebADEException
Deprecated. Use isUserInGroups(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID[]) instead.

Checks to see if the user is a member of the groups identified by the given array of GUID values. This method will also traverse the groups' member groups recursively until it has either found the user or exhausted the set of member groups.

Parameters:
user - The target user object.
groupGuids - The unique GUID values of the target groups.
Returns:
The array of all GUID values for groups in the set that the user is a member of (Returns a size-0 array if the user is not a member of any of the given groups).
Throws:
WebADEException - Thrown if ant of the groups are not found or an error occurs while processing the request.

findUsers

public java.util.List findUsers(UserSearchObject searchObject)
                         throws WebADEException
Deprecated. Use UserInfoService.findUsers(ca.bc.gov.webade.user.search.UserSearchQuery) instead.

Finds the set of User objects that match the provided search criteria.

Parameters:
searchObject - The search object.
Returns:
A List of User objects.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

getGroupByGUID

public Group getGroupByGUID(java.lang.String guid)
                     throws WebADEException
Deprecated. All group search functionality in no longer supported.

Loads the target group from the datastore, or returns null if the group is not found.

Parameters:
guid - The guid of the group to load.
Returns:
A Group object for the target group.
Throws:
WebADEException

getGroupSearchMetadata

public java.util.List getGroupSearchMetadata()
Deprecated. All group search functionality in no longer supported.

Returns a List of GroupSearchObject metadata objects for all configured directories for this application.

Returns:
A List of GroupSearchObject objects.

findGroups

public java.util.List findGroups(GroupSearchObject searchObject)
                          throws WebADEException
Deprecated. All group search functionality in no longer supported.

Finds the set of Group objects that match the provided group search attributes.

Parameters:
searchObject - The search object.
Returns:
A List of Group objects.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

hasUserAcceptedAgreement

public boolean hasUserAcceptedAgreement(User user,
                                        java.lang.String agreementName)
                                 throws WebADEException
Deprecated. Use hasUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String) instead.

Returns a flag indicating whether the user has previously agreed to the given agreement.

Parameters:
user - The user.
agreementName - The unique name of the target agreement.
Returns:
The set of application role names authorized to that user.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the information from the datastore.

setUserAcceptedAgreement

public void setUserAcceptedAgreement(User user,
                                     java.lang.String agreementName,
                                     boolean agreeFlag)
                              throws WebADEException
Deprecated. Use setUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String, boolean) instead.

Sets the user's "accepted" flag on the given agreement to the given flag value.

Parameters:
user - The user.
agreementName - The unique name of the target agreement.
agreeFlag - A flag indicating whether the user accepts or refuses the given agreement.
Throws:
WebADEException - Thrown when an error occurs while trying to save the flag to the datastore.

getUserDefaultOrganization

public Organization getUserDefaultOrganization(User user)
                                        throws WebADEException
Deprecated. Use getUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials) instead.

Gets the user's default organization.

Parameters:
user - The target user.
Returns:
The selected organization.
Throws:
WebADEException - Thrown if an error occurs while getting the default organization.

setUserDefaultOrganization

public void setUserDefaultOrganization(User user,
                                       Organization organization)
                                throws WebADEException
Deprecated. Use setUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.Organization) instead.

Sets the user's default organization to the given organization.

Parameters:
user - The target user.
organization - The selected organization.
Throws:
WebADEException - Thrown if an error occurs while setting the default organization.

getConnection

public java.sql.Connection getConnection(User user,
                                         Role role)
                                  throws WebADEException,
                                         java.sql.SQLException
Deprecated. Use getConnection(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Role) instead.

gets a Connection for the given role. Checks to see whether the user is in the specified role.

Parameters:
user - the user the connection is being obtained for
role - the role to get the Connection for
Returns:
A connection from the pool.
Throws:
WebADEException - Thrown if an error occurs.
java.sql.SQLException - Thrown if an error occurs.

getConnectionByAction

public java.sql.Connection getConnectionByAction(User user,
                                                 java.lang.String actionName)
                                          throws WebADEException,
                                                 java.sql.SQLException
Deprecated. Use getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Action) instead.

gets a Connection for the given action. Checks to see whether has role access to the action.

Parameters:
user - the user the connection is being obtained for
actionName - the actionname to get the Connection for
Returns:
connection a connection
Throws:
WebADEException - Thrown if an error occurs.
java.sql.SQLException - Thrown if an error occurs.