ca.bc.gov.webade
Class WebADEDatabaseApplication

java.lang.Object
  extended byca.bc.gov.webade.WebADEDatabaseApplication
All Implemented Interfaces:
Application, ApplicationMBean, java.io.Serializable

public final class WebADEDatabaseApplication
extends java.lang.Object
implements Application, java.io.Serializable

This class encapsulates the information about a single Web application.

It does the following:

Application objects control the allocation of external resources (eg connections). They should be defined with Application scope in servlets, so that the resources can be shared by all sessions.

See Also:
Serialized Form

Field Summary
static java.lang.String WEBADE_MBEAN_DOMAIN
          The WebADE MBean domain for JMX.
 
Method Summary
 void dispose()
          closes all connection caches gracefully.
 java.util.List findGroups(GroupSearchObject searchObject)
          Finds the set of Group objects that match the provided group search attributes.
 java.util.List findOrganizations(OrganizationSearchObject searchObject)
          Finds the set of Organization objects that match the provided search criteria.
 java.util.List findUsers(UserSearchObject searchObject)
          Finds the set of User objects that match the provided search criteria.
 WebADEUserInfo[] findWebADEUsers(UserSearchObject searchObject)
          Finds the set of WebADEUserInfo objects that match the provided search criteria.
 User getAnonymousUser()
          Get the singleton anonymous User object.
 java.lang.String getApplicationCode()
          Get the code (acronym) for the application.
 java.lang.String getApplicationEnvironment()
          Get the deployment environment this application is deployed in.
 ApplicationManager getApplicationManager()
          Returns the application manager singleton, or null, if not configured.
 Preferences getApplicationPreferences()
          Returns the set of application preferences.
 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)
          gets a Connection for the given role.
 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)
          gets a Connection for the given action.
 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)
          Gets a Connection for the given action.
 java.sql.Connection getConnectionByPriviledgedAction(Action action)
          Gets a Connection for the given priviledged action.
 java.sql.Connection getConnectionByPriviledgedAction(java.lang.String actionName)
          Gets a Connection for the given priviledged action.
 ElectronicAgreement getElectronicAgreement(java.lang.String agreementName)
          Returns the target agreement, based on the given agreement name.
 Preferences getGlobalPreferences()
          Returns the global preferences for WebADE.
 Group getGroupByGUID(java.lang.String guid)
          Loads the target group from the datastore, or returns null if the group is not found.
 java.util.List getGroupSearchMetadata()
          Returns a List of GroupSearchObject metadata objects for all configured directories for this application.
 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 getUserByEUserId(long euserId)
          Deprecated.  
 User getUserByGUID(java.lang.String guid)
          Loads the target user from the datastore, or returns null if the user is not found.
 User getUserByUserId(java.lang.String userId)
          Loads the target user from the datastore, or returns null if the user is not found.
 Organization getUserDefaultOrganization(User user)
          Gets the user's default organization.
 Organization getUserDefaultOrganization(UserCredentials userCredentials)
          Gets the user's default organization.
 UserInfoService getUserInfoService()
          Returns the UserInfoService object for this application.
 Preferences getUserPreferences(User targetUser)
          Returns the set of user preferences for this user and this application.
 Preferences getUserPreferences(UserCredentials targetUserCredentials)
          Returns the set of user preferences for this user and this application.
 User[] getUsersByOrganization(Organization organization)
          Loads all users from the datastore that are members of roles via an authorization associated with the given organization.
 User[] getUsersByRole(Role role)
          Loads all users from the datastore that are members of the given role.
 User[] getUsersByRoleAndOrganization(Role role, Organization organization)
          Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.
 java.util.List getUserSearchMetadata()
          Returns a List of UserSearchObject metadata objects for all configured directories for this application.
 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.
 WebADEPreferences getWebADEPreferences()
          Returns the WebADE preferences for the application.
 WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials)
          Loads the target user's personal information from the datastore, or returns null if the user is not found.
 WebADEUserInfo getWebADEUserInfo(UserCredentials userCredentials, boolean ignoreSessionCache)
          Loads the target user's personal information from the datastore, or returns null if the user is not found.
 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)
          Returns a flag indicating whether the user has previously agreed to the given agreement.
 boolean isAnonymousUser(User user)
          Tests if the given user is the anonymous user for this application.
 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)
          Checks to see if the user is a member of the group identified by the given GUID.
 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)
          Checks to see if the user is a member of the groups identified by the given array of GUID values.
 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)
          Sets the user's "accepted" flag on the given agreement to the given flag value.
 void setUserDefaultOrganization(UserCredentials userCredentials, Organization organization)
          Sets the user's default organization to the given organization.
 void setUserDefaultOrganization(User user, Organization organization)
          Sets the user's default organization to the given organization.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEBADE_MBEAN_DOMAIN

public static final java.lang.String WEBADE_MBEAN_DOMAIN
The WebADE MBean domain for JMX.

See Also:
Constant Field Values
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.

Specified by:
getUserInfoService in interface Application
Returns:
The UserInfoService singleton for this application.

getApplicationPreferences

public Preferences getApplicationPreferences()
Deprecated.  

Description copied from interface: Application
Returns the set of application preferences.

Specified by:
getApplicationPreferences in interface Application
Returns:
Returns the applicationPreferences.
See Also:
Application.getApplicationPreferences()

getWebADEApplicationPreferences

public WebADEPreferences getWebADEApplicationPreferences()
                                                  throws WebADEException
Description copied from interface: Application
Returns the set of WebADE application preferences.

Specified by:
getWebADEApplicationPreferences in interface Application
Returns:
Returns the applicationPreferences.
Throws:
WebADEException - Thrown when an error occurs while trying to retrieve the WebADE application preferences.
See Also:
Application.getWebADEApplicationPreferences()

getGlobalPreferences

public Preferences getGlobalPreferences()
                                 throws WebADEException
Deprecated.  

Description copied from interface: Application
Returns the global preferences for WebADE.

Specified by:
getGlobalPreferences in interface Application
Returns:
Returns the WebADE global preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.
See Also:
Application.getGlobalPreferences()

getWebADEGlobalPreferences

public WebADEPreferences getWebADEGlobalPreferences()
                                             throws WebADEException
Description copied from interface: Application
Returns the global preferences for WebADE.

Specified by:
getWebADEGlobalPreferences in interface Application
Returns:
Returns the WebADE global preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.
See Also:
Application.getWebADEGlobalPreferences()

getApplicationCode

public java.lang.String getApplicationCode()
Description copied from interface: Application
Get the code (acronym) for the application.

Specified by:
getApplicationCode in interface Application
Returns:
the code
See Also:
Application.getApplicationCode()

getApplicationEnvironment

public java.lang.String getApplicationEnvironment()
Description copied from interface: Application
Get the deployment environment this application is deployed in.

Specified by:
getApplicationEnvironment in interface Application
Returns:
The application environment code.
See Also:
Application.getApplicationEnvironment()

getRoles

public AppRoles getRoles()
Description copied from interface: Application
get the roles used by this application.

Specified by:
getRoles in interface Application
Returns:
a list of the application roles
See Also:
Application.getRoles()

getPublicWebADEPermissions

public WebADEUserPermissions getPublicWebADEPermissions()
                                                 throws WebADEException
Description copied from interface: Application
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.

Specified by:
getPublicWebADEPermissions in interface Application
Returns:
A WebADEUserPermissions object for the public unauthenticated user.
Throws:
WebADEException
See Also:
Application.getPublicWebADEPermissions()

getWebADEUserPermissions

public WebADEUserPermissions getWebADEUserPermissions(UserCredentials userCredentials)
                                               throws WebADEException
Description copied from interface: Application
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.

Specified by:
getWebADEUserPermissions in interface Application
Parameters:
userCredentials - The user's identifying credentials.
Returns:
A WebADEUserPermissions object for the target user.
Throws:
WebADEException
See Also:
Application.getWebADEUserPermissions(ca.bc.gov.webade.user.UserCredentials)

getWebADEUserPermissions

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

Specified by:
getWebADEUserPermissions in interface Application
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
See Also:
Application.getWebADEUserPermissions(ca.bc.gov.webade.user.UserCredentials, boolean)

getWebADEUserInfo

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

Description copied from interface: Application
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.

Specified by:
getWebADEUserInfo in interface Application
Parameters:
userCredentials - The user's identifying credentials.
Returns:
A WebADEUserInfo object for the target user.
Throws:
WebADEException
See Also:
Application.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials)

getWebADEUserInfo

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

Description copied from interface: Application
Loads the target user's personal information from the datastore, or returns null if the user is not found.

Specified by:
getWebADEUserInfo in interface Application
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
See Also:
Application.getWebADEUserInfo(ca.bc.gov.webade.user.UserCredentials, boolean)

getUserSearchMetadata

public java.util.List getUserSearchMetadata()
Deprecated. Use UserInfoService.createUserSearchQuery(ca.bc.gov.webade.user.UserTypeCode)

Description copied from interface: Application
Returns a List of UserSearchObject metadata objects for all configured directories for this application.

Specified by:
getUserSearchMetadata in interface Application
Returns:
A List of UserSearchObject objects.
See Also:
Application.getUserSearchMetadata()

findWebADEUsers

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

Description copied from interface: Application
Finds the set of WebADEUserInfo objects that match the provided search criteria.

Specified by:
findWebADEUsers in interface Application
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.
See Also:
Application.findWebADEUsers(ca.bc.gov.webade.UserSearchObject)

getUserDefaultOrganization

public Organization getUserDefaultOrganization(UserCredentials userCredentials)
                                        throws WebADEException
Description copied from interface: Application
Gets the user's default organization.

Specified by:
getUserDefaultOrganization in interface Application
Parameters:
userCredentials - The target user's credentials.
Returns:
The selected organization.
Throws:
WebADEException - Thrown if an error occurs while getting the default organization.
See Also:
Application.getUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials)

getUserPreferences

public Preferences getUserPreferences(UserCredentials targetUserCredentials)
                               throws WebADEException
Deprecated.  

Description copied from interface: Application
Returns the set of user preferences for this user and this application.

Specified by:
getUserPreferences in interface Application
Parameters:
targetUserCredentials - The user's identifying credentials.
Returns:
Returns the user's preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.
See Also:
Application.getUserPreferences(ca.bc.gov.webade.user.UserCredentials)

getWebADEUserPreferences

public WebADEPreferences getWebADEUserPreferences(UserCredentials targetUserCredentials)
                                           throws WebADEException
Description copied from interface: Application
Returns the set of user preferences for this user and this application.

Specified by:
getWebADEUserPreferences in interface Application
Parameters:
targetUserCredentials - The user's identifying credentials.
Returns:
Returns the user's preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.
See Also:
Application.getWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials)

saveWebADEUserPreferences

public WebADEPreferences saveWebADEUserPreferences(UserCredentials targetUserCredentials,
                                                   WebADEPreferences preferences)
                                            throws WebADEException
Description copied from interface: Application
Saves the given user preferences for this user and this application.

Specified by:
saveWebADEUserPreferences in interface 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.
See Also:
Application.saveWebADEUserPreferences(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.preferences.WebADEPreferences)

hasUserAcceptedAgreement

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

Specified by:
hasUserAcceptedAgreement in interface Application
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.
See Also:
Application.hasUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String)

isUserInGroup

public boolean isUserInGroup(UserCredentials userCredentials,
                             GUID groupGuid)
                      throws WebADEException
Description copied from interface: Application
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.

Specified by:
isUserInGroup in interface Application
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.
See Also:
Application.isUserInGroup(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID)

isUserInGroups

public GUID[] isUserInGroups(UserCredentials userCredentials,
                             GUID[] groupGuids)
                      throws WebADEException
Description copied from interface: Application
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.

Specified by:
isUserInGroups in interface Application
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.
See Also:
Application.isUserInGroups(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.user.GUID[])

setUserAcceptedAgreement

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

Specified by:
setUserAcceptedAgreement in interface Application
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.
See Also:
Application.setUserAcceptedAgreement(ca.bc.gov.webade.user.UserCredentials, java.lang.String, boolean)

setUserDefaultOrganization

public void setUserDefaultOrganization(UserCredentials userCredentials,
                                       Organization organization)
                                throws WebADEException
Description copied from interface: Application
Sets the user's default organization to the given organization.

Specified by:
setUserDefaultOrganization in interface Application
Parameters:
userCredentials - The target user's credentials.
organization - The selected organization.
Throws:
WebADEException - Thrown if an error occurs while setting the default organization.
See Also:
Application.setUserDefaultOrganization(ca.bc.gov.webade.user.UserCredentials, ca.bc.gov.webade.Organization)

getElectronicAgreement

public ElectronicAgreement getElectronicAgreement(java.lang.String agreementName)
                                           throws WebADEException
Description copied from interface: Application
Returns the target agreement, based on the given agreement name.

Specified by:
getElectronicAgreement in interface Application
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.
See Also:
Application.getElectronicAgreement(java.lang.String)

getOrganizationById

public Organization getOrganizationById(long organizationId)
                                 throws WebADEException
Description copied from interface: Application
Returns the organization with the given organization id.

Specified by:
getOrganizationById in interface Application
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.
See Also:
Application.getOrganizationById(long)

getOrganizationSearchMetadata

public OrganizationSearchObject getOrganizationSearchMetadata()
Description copied from interface: Application
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.

Specified by:
getOrganizationSearchMetadata in interface Application
Returns:
A properly configured OrganizationSearchObject object.
See Also:
Application.getOrganizationSearchMetadata()

findOrganizations

public java.util.List findOrganizations(OrganizationSearchObject searchObject)
                                 throws WebADEException
Description copied from interface: Application
Finds the set of Organization objects that match the provided search criteria.

Specified by:
findOrganizations in interface Application
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.
See Also:
Application.findOrganizations(ca.bc.gov.webade.OrganizationSearchObject)

registerWebADEExtension

public void registerWebADEExtension(WebADEExtension extension)
                             throws WebADEExtensionException
Description copied from interface: Application
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.

Specified by:
registerWebADEExtension in interface Application
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
See Also:
Application.registerWebADEExtension(ca.bc.gov.webade.WebADEExtension)

unregisterWebADEExtension

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

Specified by:
unregisterWebADEExtension in interface Application
Parameters:
extension - A singleton extension object to remove from the application's extension list.
See Also:
Application.unregisterWebADEExtension(ca.bc.gov.webade.WebADEExtension)

getWebADEExtension

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

Specified by:
getWebADEExtension in interface Application
Parameters:
className - The fully qualified class name(including package)
Returns:
The registered extension singleton, or null if not found.
See Also:
Application.getWebADEExtension(java.lang.String)

getWebADEExtension

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

Specified by:
getWebADEExtension in interface Application
Parameters:
classObject - The class of the extension singleton
Returns:
The registered extension singleton, or null if not found.
See Also:
Application.getWebADEExtension(java.lang.Class)

isDisabled

public boolean isDisabled()
                   throws WebADEException
Description copied from interface: Application
Tests if the application is currently disabled. The disabled status

Specified by:
isDisabled in interface Application
Returns:
true if the application is currently disabled
Throws:
WebADEException - Thrown if an error occurs while determining if the application has been disabled.
See Also:
Application.isDisabled()

setDisabled

public void setDisabled(boolean disable)
                 throws WebADEException
Description copied from interface: Application
Sets the disabled status of this application in the current execution environment.

Specified by:
setDisabled in interface Application
Parameters:
disable - Flag indicating whether to disable the application.
Throws:
WebADEException
See Also:
Application.setDisabled(boolean)

getConnection

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

Specified by:
getConnection in interface Application
Parameters:
userAuthorizations - The target user's authorizations.
role - the role to get the Connection for
Returns:
A connection from the pool.
Throws:
java.sql.SQLException - Thrown if an error occurs.
WebADEException - Thrown if an error occurs.
See Also:
Application.getConnection(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Role)

getConnectionByAction

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

Specified by:
getConnectionByAction in interface Application
Parameters:
userAuthorizations - The target user's authorizations.
action - The action to get the Connection for.
Returns:
connection a connection
Throws:
java.sql.SQLException - Thrown if an error occurs.
WebADEException - Thrown if an error occurs.
See Also:
Application.getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, ca.bc.gov.webade.Action)

getConnectionByAction

public java.sql.Connection getConnectionByAction(WebADEUserPermissions userAuthorizations,
                                                 java.lang.String actionName)
                                          throws WebADEException,
                                                 java.sql.SQLException
Deprecated.  

Description copied from interface: Application
Gets a Connection for the given action. Checks to see whether has role access to the action.

Specified by:
getConnectionByAction in interface Application
Parameters:
userAuthorizations - The target user's authorizations.
actionName - the actionname to get the Connection for
Returns:
connection a connection
Throws:
java.sql.SQLException - Thrown if an error occurs.
WebADEException - Thrown if an error occurs.
See Also:
Application.getConnectionByAction(ca.bc.gov.webade.user.WebADEUserPermissions, java.lang.String)

getConnectionByPriviledgedAction

public java.sql.Connection getConnectionByPriviledgedAction(Action action)
                                                     throws WebADEException,
                                                            java.sql.SQLException
Description copied from interface: Application
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.

Specified by:
getConnectionByPriviledgedAction in interface Application
Parameters:
action - The action to get the Connection for.
Returns:
connection a connection
Throws:
java.sql.SQLException - Thrown if an error occurs.
WebADEException - Thrown if an error occurs, or if the action is not marked as priviledged.
See Also:
Application.getConnectionByPriviledgedAction(ca.bc.gov.webade.Action)

getConnectionByPriviledgedAction

public java.sql.Connection getConnectionByPriviledgedAction(java.lang.String actionName)
                                                     throws WebADEException,
                                                            java.sql.SQLException
Deprecated.  

Description copied from interface: Application
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.

Specified by:
getConnectionByPriviledgedAction in interface Application
Parameters:
actionName - the action name to get the Connection for
Returns:
connection a connection
Throws:
java.sql.SQLException - Thrown if an error occurs.
WebADEException - Thrown if an error occurs, or if the action is not marked as priviledged.
See Also:
Application.getConnectionByPriviledgedAction(java.lang.String)

getApplicationManager

public ApplicationManager getApplicationManager()
Returns the application manager singleton, or null, if not configured.

Returns:
A manager instance.

hasIndeterminateAuthorizations

public boolean hasIndeterminateAuthorizations(Role role)
                                       throws WebADEException
Description copied from interface: Application
Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given role.

Specified by:
hasIndeterminateAuthorizations in interface Application
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.
See Also:
Application.hasIndeterminateAuthorizations(ca.bc.gov.webade.Role)

hasIndeterminateAuthorizations

public boolean hasIndeterminateAuthorizations(Organization organization)
                                       throws WebADEException
Description copied from interface: Application
Checks to see if a call to getUsersByRole() will throw a IndeterminateAuthorizationsException for the given organization.

Specified by:
hasIndeterminateAuthorizations in interface Application
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.
See Also:
Application.hasIndeterminateAuthorizations(ca.bc.gov.webade.Organization)

hasIndeterminateAuthorizations

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

Specified by:
hasIndeterminateAuthorizations in interface Application
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.
See Also:
Application.hasIndeterminateAuthorizations(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
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.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Role)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
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:
WebADEException - Throws a base WebADEException if an error occurs while performing this query.
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Role, boolean)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
Parameters:
organization - The organization to load users for.
Returns:
An array of member UserCredentials objects.
Throws:
WebADEException - Throws a base WebADEException if an error occurs while performing this query.
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Organization)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
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.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Organization, boolean)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
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:
WebADEException - Throws a base WebADEException if an error occurs while performing this query.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization)

getAuthorizedUsers

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

Specified by:
getAuthorizedUsers in interface Application
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:
WebADEException - Throws a base WebADEException if an error occurs while performing this query.
IndeterminateAuthorizationsException - Throws IndeterminateAuthorizationsException if the list of users cannot be completely loaded.
See Also:
Application.getAuthorizedUsers(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization, boolean)

shutdown

public void shutdown()
              throws java.lang.SecurityException
Description copied from interface: Application
Notifies the application singleton to shutdown, stopping monitoring threads and closing dependant resources.

Specified by:
shutdown in interface Application
Throws:
java.lang.SecurityException - If the caller is not an instance of an authorized class, a SecurityException is thrown.
See Also:
Application.shutdown()

dispose

public void dispose()
closes all connection caches gracefully.


getUserByEUserId

public User getUserByEUserId(long euserId)
                      throws WebADEException
Deprecated.  

Returns the User identified by the given database key EUserId. This method should not be used for most situations, as the EUserId value is sequence-generated and is not consistant across databases. This method should only be used for systems that use the database EUSerId primary key to link to other database tables.

Parameters:
euserId - The unique database key of the record in the EUser database table.
Returns:
The loaded User object.
Throws:
WebADEException - Thrown if an error occurs while retrieving the user record.

getUserPreferences

public Preferences getUserPreferences(User targetUser)
                               throws WebADEException
Deprecated.  

Description copied from interface: Application
Returns the set of user preferences for this user and this application.

Specified by:
getUserPreferences in interface Application
Parameters:
targetUser - The user to retrieve the preferences for.
Returns:
Returns the user preferences.
Throws:
WebADEException - Thrown when a WebADE error occurs.
See Also:
Application.getUserPreferences(ca.bc.gov.webade.User)

getAnonymousUser

public User getAnonymousUser()
                      throws WebADEException
Deprecated.  

Description copied from interface: Application
Get the singleton anonymous User object.

Specified by:
getAnonymousUser in interface Application
Returns:
The singleton anonymous User object.
Throws:
WebADEException
See Also:
Application.getAnonymousUser()

isAnonymousUser

public boolean isAnonymousUser(User user)
                        throws WebADEException
Deprecated.  

Description copied from interface: Application
Tests if the given user is the anonymous user for this application.

Specified by:
isAnonymousUser in interface Application
Parameters:
user - The user to compare to the anonymous user.
Returns:
True if a match is found.
Throws:
WebADEException
See Also:
Application.isAnonymousUser(ca.bc.gov.webade.User)

getUserByGUID

public User getUserByGUID(java.lang.String guid)
                   throws WebADEException
Deprecated.  

Description copied from interface: Application
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.

Specified by:
getUserByGUID in interface Application
Parameters:
guid - The guid of the user to load.
Returns:
A User object for the target user.
Throws:
WebADEException
See Also:
Application.getUserByGUID(java.lang.String)

getUserByUserId

public User getUserByUserId(java.lang.String userId)
                     throws WebADEException
Deprecated.  

Description copied from interface: Application
Loads the target user from the datastore, or returns null if the user is not found.

Specified by:
getUserByUserId in interface Application
Parameters:
userId - The userId of the user, including domain, to load.
Returns:
A User object for the target user.
Throws:
WebADEException
See Also:
Application.getUserByUserId(java.lang.String)

getUsersByRole

public User[] getUsersByRole(Role role)
                      throws WebADEException
Deprecated.  

Description copied from interface: Application
Loads all users from the datastore that are members of the given role.

Specified by:
getUsersByRole in interface Application
Parameters:
role - The role to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException
See Also:
Application.getUsersByRole(ca.bc.gov.webade.Role)

getUsersByOrganization

public User[] getUsersByOrganization(Organization organization)
                              throws WebADEException
Deprecated.  

Description copied from interface: Application
Loads all users from the datastore that are members of roles via an authorization associated with the given organization.

Specified by:
getUsersByOrganization in interface Application
Parameters:
organization - The organization to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException
See Also:
Application.getUsersByOrganization(ca.bc.gov.webade.Organization)

getUsersByRoleAndOrganization

public User[] getUsersByRoleAndOrganization(Role role,
                                            Organization organization)
                                     throws WebADEException
Deprecated.  

Description copied from interface: Application
Loads all users from the datastore that are members the given roles via an authorization associated with the given organization.

Specified by:
getUsersByRoleAndOrganization in interface Application
Parameters:
role - The role to load users for.
organization - The organization to load users for.
Returns:
An array of member User objects.
Throws:
WebADEException
See Also:
Application.getUsersByRoleAndOrganization(ca.bc.gov.webade.Role, ca.bc.gov.webade.Organization)

isUserInGroup

public boolean isUserInGroup(User user,
                             java.lang.String groupGuid)
                      throws WebADEException
Deprecated.  

Description copied from interface: Application
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.

Specified by:
isUserInGroup in interface Application
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.
See Also:
Application.isUserInGroup(ca.bc.gov.webade.User, java.lang.String)

isUserInGroups

public java.lang.String[] isUserInGroups(User user,
                                         java.lang.String[] groupGuids)
                                  throws WebADEException
Deprecated.  

Description copied from interface: Application
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.

Specified by:
isUserInGroups in interface Application
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.
See Also:
Application.isUserInGroups(ca.bc.gov.webade.User, java.lang.String[])

findUsers

public java.util.List findUsers(UserSearchObject searchObject)
                         throws WebADEException
Deprecated.  

Description copied from interface: Application
Finds the set of User objects that match the provided search criteria.

Specified by:
findUsers in interface Application
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.
See Also:
Application.findUsers(ca.bc.gov.webade.UserSearchObject)

getGroupByGUID

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

Description copied from interface: Application
Loads the target group from the datastore, or returns null if the group is not found.

Specified by:
getGroupByGUID in interface Application
Parameters:
guid - The guid of the group to load.
Returns:
A Group object for the target group.
Throws:
WebADEException
See Also:
Application.getGroupByGUID(java.lang.String)

getGroupSearchMetadata

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

Description copied from interface: Application
Returns a List of GroupSearchObject metadata objects for all configured directories for this application.

Specified by:
getGroupSearchMetadata in interface Application
Returns:
A List of GroupSearchObject objects.
See Also:
Application.getGroupSearchMetadata()

findGroups

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

Description copied from interface: Application
Finds the set of Group objects that match the provided group search attributes.

Specified by:
findGroups in interface Application
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.
See Also:
Application.findGroups(ca.bc.gov.webade.GroupSearchObject)

hasUserAcceptedAgreement

public boolean hasUserAcceptedAgreement(User user,
                                        java.lang.String agreementName)
                                 throws WebADEException
Deprecated.  

Description copied from interface: Application
Returns a flag indicating whether the user has previously agreed to the given agreement.

Specified by:
hasUserAcceptedAgreement in interface Application
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.
See Also:
Application.hasUserAcceptedAgreement(ca.bc.gov.webade.User, java.lang.String)

setUserAcceptedAgreement

public void setUserAcceptedAgreement(User user,
                                     java.lang.String agreementName,
                                     boolean agreeFlag)
                              throws WebADEException
Deprecated.  

Description copied from interface: Application
Sets the user's "accepted" flag on the given agreement to the given flag value.

Specified by:
setUserAcceptedAgreement in interface Application
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.
See Also:
Application.setUserAcceptedAgreement(ca.bc.gov.webade.User, java.lang.String, boolean)

getUserDefaultOrganization

public Organization getUserDefaultOrganization(User user)
                                        throws WebADEException
Deprecated.  

Description copied from interface: Application
Gets the user's default organization.

Specified by:
getUserDefaultOrganization in interface Application
Parameters:
user - The target user.
Returns:
The selected organization.
Throws:
WebADEException - Thrown if an error occurs while getting the default organization.
See Also:
Application.getUserDefaultOrganization(ca.bc.gov.webade.User)

setUserDefaultOrganization

public void setUserDefaultOrganization(User user,
                                       Organization organization)
                                throws WebADEException
Deprecated.  

Description copied from interface: Application
Sets the user's default organization to the given organization.

Specified by:
setUserDefaultOrganization in interface Application
Parameters:
user - The target user.
organization - The selected organization.
Throws:
WebADEException - Thrown if an error occurs while setting the default organization.
See Also:
Application.setUserDefaultOrganization(ca.bc.gov.webade.User, ca.bc.gov.webade.Organization)

getConnection

public java.sql.Connection getConnection(User user,
                                         Role role)
                                  throws WebADEException,
                                         java.sql.SQLException
Deprecated.  

Description copied from interface: Application
gets a Connection for the given role. Checks to see whether the user is in the specified role.

Specified by:
getConnection in interface Application
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.
See Also:
Application.getConnection(ca.bc.gov.webade.User, ca.bc.gov.webade.Role)

getConnectionByAction

public java.sql.Connection getConnectionByAction(User user,
                                                 java.lang.String actionName)
                                          throws WebADEException,
                                                 java.sql.SQLException
Deprecated.  

Description copied from interface: Application
gets a Connection for the given action. Checks to see whether has role access to the action.

Specified by:
getConnectionByAction in interface Application
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.
See Also:
Application.getConnectionByAction(ca.bc.gov.webade.User, java.lang.String)

getWebADEPreferences

public WebADEPreferences getWebADEPreferences()
                                       throws WebADEException
Returns the WebADE preferences for the application.

Returns:
A WebADEPreferences instance.
Throws:
WebADEException