wt.org
Class StandardOrganizationServicesManager

java.lang.Object
  extended by wt.services.StandardManager
      extended by wt.org.StandardOrganizationServicesManager
All Implemented Interfaces:
Serializable, NetFactor, OrganizationServicesManager, wt.services.Manager

public class StandardOrganizationServicesManager
extends StandardManager
implements OrganizationServicesManager, Serializable

Standard implementation of the Organization Services Manager interface. Supports also a cache of WTPrincipal objects.

Use the newStandardOrganizationServicesManager static factory method(s), not the StandardOrganizationServicesManager constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Method Summary
 boolean addMember(WTGroup group, WTPrincipal principal)
          Adds a principal to a group.
 WTPrincipal[] addMembers(WTGroup group, WTPrincipal[] principals)
          Adds principals to a group.
 WTPrincipal createPrincipal(WTPrincipal principal)
          This API persists the principal object in the database.
 WTGroup delete(WTGroup group)
          The API is used to delete a group from the database and its corresponding entry in LDAP.
 WTUser delete(WTUser user)
          The API is used to delete a user object from the database and its corresponding entry in LDAP.
 WTPrincipal disablePrincipal(WTPrincipal principal)
          This API is used to disable a principal in the database.
 WTPrincipal enablePrincipal(WTPrincipal principal)
          This API is used to enable a previously disabled principal.
 Enumeration findLikeActiveAndDisabledUsers(Class principalClass, String criteria, DirectoryContextProvider[] contexts)
          This API returns a resultset containing all the active and disabled users.
 Enumeration findLikeDisabledUsers(String criteria)
          Provides a result set of all disabled users that match the search criteria provided as a parameter.
 Enumeration findLikeGroups(String pattern, DirectoryContextProvider context)
          This method will search the given directory context for groups whose name matches the name pattern provided.
 Enumeration findLikeOrganizations(String attributeName, String pattern, DirectoryContextProvider context)
          This API returns all the organizations matching the name provided as a pattern.
 Enumeration findLikeOrganizations(String attributeName, String pattern, DirectoryContextProvider context, boolean querySubtree)
          This API returns all the organizations matching the name provided as a pattern.
 Enumeration findLikeOrganizations(String attributeName, String pattern, DirectoryContextProvider context, boolean querySubtree, boolean applyAccessFilter)
          This API returns all the organizations matching the name provided as a pattern.
 Enumeration findLikeUsers(String attributeName, String pattern, DirectoryContextProvider context)
          This API returns all the users matching the name provided as a pattern.
 WTUser getAuthenticatedUser(String auth_name)
          

Supported API: true
 String[] getDirectoryServiceNames()
          

Supported API: true
 WTGroup getGroup(String name, DirectoryContextProvider context)
          This method will search for groups whose name attribute matches the given name in the given directory context.
 Enumeration getGroups(String name, DirectoryContextProvider context)
          

Supported API: true
 WTOrganization getOrganization(String name, DirectoryContextProvider context)
          

Supported API: true
 WTOrganization getOrganization(WTPrincipal principal)
          Returns the organization with which a principal is associated.
 Enumeration getOrganizations(String name, DirectoryContextProvider context)
          

Supported API: true
 WTPrincipal getPrincipal(ObjectIdentifier reference)
          Gets the user or group for the specified principal reference.
 WTPrincipal getPrincipal(String name, Class type, DirectoryContextProvider context)
          This method will search for a principal with the given name in the given organization.
 Enumeration getPrincipal(String name, DirectoryContextProvider context)
          This method will search for principals with the given name in the given organization.
 WTPrincipal getPrincipalByDN(String dn)
          Returns the principal identified by a specific directory distinguished name, or null if no such principal exists.
 WTPrincipalReference getPrincipalReference(String name, Class type, DirectoryContextProvider context)
          This method will search for a principal with the given name in the given organization, and return its reference.
 Enumeration getPrincipalReference(String name, DirectoryContextProvider context)
          This method will search for principals with the given name in the given organization, and references to them will be returned.
 WTUser getUser(String name, DirectoryContextProvider context)
          

Supported API: true
 Enumeration getUsers(String name, DirectoryContextProvider context)
          

Supported API: true
 boolean isMember(WTGroup group, WTPrincipal principal)
          

Supported API: true
 boolean isMember(WTPrincipalReference group, WTPrincipal principal)
          

Supported API: true
 Enumeration members(WTGroup group)
          

Supported API: true
 Enumeration members(WTGroup group, boolean flatten)
          

Supported API: true
 WTPrincipal move(WTPrincipal principal, DirectoryContextProvider newContext)
          

Supported API: true
 DirectoryContextProvider newDirectoryContextProvider(DirectoryContextProvider baseContext, String[] searchScopes)
          

Supported API: true
 DirectoryContextProvider newDirectoryContextProvider(String[] services, String[] searchScopes)
          

Supported API: true
 Enumeration parentGroups(WTPrincipal principal)
          

Supported API: true
 Enumeration queryPrincipals(Class principalClass, String criteria, DirectoryContextProvider context)
          

Supported API: true
 Enumeration queryPrincipals(Class principalClass, String criteria, DirectoryContextProvider[] contexts)
          

Supported API: true
 boolean removeMember(WTGroup group, WTPrincipal principal)
          Removes a principal from a group.
 boolean removeMember(WTGroup group, WTPrincipal principal, boolean bValidate)
          Removes a principal from a group.
 boolean removeMembers(WTGroup group, WTPrincipal[] principals)
          Removes principals from a group.
 boolean removeMembers(WTGroup group, WTPrincipal[] principals, boolean bValidate)
          Removes principals from a group.
 WTPrincipal rename(WTPrincipal principal, String newName)
          

Supported API: true
 WTPrincipal repairPrincipal(String oldName, String newDn, String oldEnteredDn)
          This method tries and repairs the principal given the "oldName" (name that is currently in the database and possibly will continue to be -- ie.
 WTPrincipal updatePrincipal(WTPrincipal principal)
          

Supported API: true
 
Methods inherited from class wt.services.StandardManager
getManagerService, getManagerStatus, getName, getStartupType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPrincipal

public WTPrincipal getPrincipal(ObjectIdentifier reference)
                         throws WTException
Gets the user or group for the specified principal reference.

Supported API: true

Specified by:
getPrincipal in interface OrganizationServicesManager
Parameters:
reference -
Returns:
WTPrincipal
Throws:
WTException

getPrincipal

public Enumeration getPrincipal(String name,
                                DirectoryContextProvider context)
                         throws WTException
This method will search for principals with the given name in the given organization.

Supported API: true

Specified by:
getPrincipal in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
Enumeration
Throws:
WTException

getPrincipal

public WTPrincipal getPrincipal(String name,
                                Class type,
                                DirectoryContextProvider context)
                         throws WTException
This method will search for a principal with the given name in the given organization. If more than one principal is found, an exception is thrown.

Supported API: true

Specified by:
getPrincipal in interface OrganizationServicesManager
Parameters:
name -
type -
context -
Returns:
WTPrincipal
Throws:
WTException

getPrincipalByDN

public WTPrincipal getPrincipalByDN(String dn)
                             throws WTException
Returns the principal identified by a specific directory distinguished name, or null if no such principal exists.

Supported API: true

Specified by:
getPrincipalByDN in interface OrganizationServicesManager
Parameters:
dn -
Returns:
WTPrincipal
Throws:
WTException

getPrincipalReference

public Enumeration getPrincipalReference(String name,
                                         DirectoryContextProvider context)
                                  throws WTException
This method will search for principals with the given name in the given organization, and references to them will be returned.

Supported API: true

Specified by:
getPrincipalReference in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
Enumeration
Throws:
WTException

getPrincipalReference

public WTPrincipalReference getPrincipalReference(String name,
                                                  Class type,
                                                  DirectoryContextProvider context)
                                           throws WTException
This method will search for a principal with the given name in the given organization, and return its reference. If more than one principal is found, an exception is thrown.

Supported API: true

Specified by:
getPrincipalReference in interface OrganizationServicesManager
Parameters:
name -
type -
context -
Returns:
WTPrincipalReference
Throws:
WTException

queryPrincipals

public Enumeration queryPrincipals(Class principalClass,
                                   String criteria,
                                   DirectoryContextProvider context)
                            throws WTException


Supported API: true

Specified by:
queryPrincipals in interface OrganizationServicesManager
Parameters:
principalClass -
criteria -
context -
Returns:
Enumeration
Throws:
WTException

queryPrincipals

public Enumeration queryPrincipals(Class principalClass,
                                   String criteria,
                                   DirectoryContextProvider[] contexts)
                            throws WTException


Supported API: true

Specified by:
queryPrincipals in interface OrganizationServicesManager
Parameters:
principalClass -
criteria -
contexts -
Returns:
Enumeration
Throws:
WTException

createPrincipal

public WTPrincipal createPrincipal(WTPrincipal principal)
                            throws WTException
This API persists the principal object in the database. In addition it also creates a corresponding entry in LDAP if necessary.

Supported API: true

Specified by:
createPrincipal in interface OrganizationServicesManager
Parameters:
principal -
Returns:
WTPrincipal
Throws:
WTException

disablePrincipal

public WTPrincipal disablePrincipal(WTPrincipal principal)
                             throws WTException
This API is used to disable a principal in the database. When a principal is deleted, it is not completely removed from the database. Instead it is disabled in the database. The process of disabling the principal object is by renaming the principal in the database to its object identifier and setting the disabled bit.

Supported API: true

Specified by:
disablePrincipal in interface OrganizationServicesManager
Parameters:
principal -
Returns:
WTPrincipal
Throws:
WTException

enablePrincipal

public WTPrincipal enablePrincipal(WTPrincipal principal)
                            throws WTException
This API is used to enable a previously disabled principal. The API renames the principal in the database from the current object identifier name to the actual name of the principal that needs to be displayed on the UI. In addition it also resets the disabled bit in the database. NOTE: This API does not recreate a previously deleted entry in LDAP corresponding to this principal. The API should only be used to enable the database entry for the principal after verifying that a corresponding entry for the principal exists in LDAP. Once the principal is enabled, the Principal Administrator maintenance page should be used to reconnect the principal to the corresponding LDAP node.

Supported API: true

Specified by:
enablePrincipal in interface OrganizationServicesManager
Parameters:
principal -
Returns:
WTPrincipal
Throws:
WTException

updatePrincipal

public WTPrincipal updatePrincipal(WTPrincipal principal)
                            throws WTException


Supported API: true

Specified by:
updatePrincipal in interface OrganizationServicesManager
Parameters:
principal -
Returns:
WTPrincipal
Throws:
WTException

rename

public WTPrincipal rename(WTPrincipal principal,
                          String newName)
                   throws WTException


Supported API: true

Specified by:
rename in interface OrganizationServicesManager
Parameters:
principal -
newName -
Returns:
WTPrincipal
Throws:
WTException

move

public WTPrincipal move(WTPrincipal principal,
                        DirectoryContextProvider newContext)
                 throws WTException


Supported API: true

Specified by:
move in interface OrganizationServicesManager
Parameters:
principal -
newContext -
Returns:
WTPrincipal
Throws:
WTException

getAuthenticatedUser

public WTUser getAuthenticatedUser(String auth_name)
                            throws WTException


Supported API: true

Specified by:
getAuthenticatedUser in interface OrganizationServicesManager
Parameters:
auth_name -
Returns:
WTUser
Throws:
WTException

getUser

public WTUser getUser(String name,
                      DirectoryContextProvider context)
               throws WTException


Supported API: true

Specified by:
getUser in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
WTUser
Throws:
WTException

getUsers

public Enumeration getUsers(String name,
                            DirectoryContextProvider context)
                     throws WTException


Supported API: true

Specified by:
getUsers in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
Enumeration
Throws:
WTException

findLikeUsers

public Enumeration findLikeUsers(String attributeName,
                                 String pattern,
                                 DirectoryContextProvider context)
                          throws WTException
This API returns all the users matching the name provided as a pattern. For this API the attribute name would typically be "name". The pattern would be the user name that is being searched for. The pattern would also accept a wild card search. Org services package documentation has a detailed description on how to create a DirectoryContexttProvider that needs to be passed into this API.

Supported API: true

Specified by:
findLikeUsers in interface OrganizationServicesManager
Parameters:
attributeName -
pattern -
context -
Returns:
Enumeration
Throws:
WTException

delete

public WTUser delete(WTUser user)
              throws WTException
The API is used to delete a user object from the database and its corresponding entry in LDAP. Users are not completely deleted from the database. Instead when a user object is deleted, the correspodning user name in the database is renamed to the format of the user's object identifier and the disabled bit is set.

Supported API: true

Specified by:
delete in interface OrganizationServicesManager
Parameters:
user -
Returns:
WTUser
Throws:
WTException

getGroup

public WTGroup getGroup(String name,
                        DirectoryContextProvider context)
                 throws WTException
This method will search for groups whose name attribute matches the given name in the given directory context.

Supported API: true

Specified by:
getGroup in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
WTGroup
Throws:
WTException

getGroups

public Enumeration getGroups(String name,
                             DirectoryContextProvider context)
                      throws WTException


Supported API: true

Specified by:
getGroups in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
Enumeration
Throws:
WTException

findLikeGroups

public Enumeration findLikeGroups(String pattern,
                                  DirectoryContextProvider context)
                           throws WTException
This method will search the given directory context for groups whose name matches the name pattern provided. The "pattern" parameter could be something like "name=group1" or "name=g*.

Supported API: true

Specified by:
findLikeGroups in interface OrganizationServicesManager
Parameters:
pattern -
context -
Returns:
Enumeration
Throws:
WTException

delete

public WTGroup delete(WTGroup group)
               throws WTException
The API is used to delete a group from the database and its corresponding entry in LDAP. Groups are not completely deleted from the database. Instead when a group is deleted, the corresponding group name in the database is renamed to the format of the groups's object identifier and the disabled bit is set..

Supported API: true

Specified by:
delete in interface OrganizationServicesManager
Parameters:
group -
Returns:
WTGroup
Throws:
WTException

addMember

public boolean addMember(WTGroup group,
                         WTPrincipal principal)
                  throws WTException,
                         UserNotFoundException
Adds a principal to a group. Returns 'true' if principal was successfully added to the group, 'false' otherwise.

Supported API: true

Specified by:
addMember in interface OrganizationServicesManager
Parameters:
group -
principal -
Returns:
boolean
Throws:
WTException
UserNotFoundException

addMembers

public WTPrincipal[] addMembers(WTGroup group,
                                WTPrincipal[] principals)
                         throws WTException
Adds principals to a group. Returns an array containing principals that were newly added as members of the group..

Supported API: true

Specified by:
addMembers in interface OrganizationServicesManager
Parameters:
group -
principals -
Returns:
WTPrincipal[]
Throws:
WTException

removeMember

public boolean removeMember(WTGroup group,
                            WTPrincipal principal)
                     throws WTException,
                            UserNotFoundException
Removes a principal from a group. Returns true if principal belonged to the group, false otherwise.

Supported API: true

Specified by:
removeMember in interface OrganizationServicesManager
Parameters:
group -
principal -
Returns:
boolean
Throws:
WTException
UserNotFoundException

isMember

public boolean isMember(WTGroup group,
                        WTPrincipal principal)
                 throws WTException


Supported API: true

Specified by:
isMember in interface OrganizationServicesManager
Parameters:
group -
principal -
Returns:
boolean
Throws:
WTException

isMember

public boolean isMember(WTPrincipalReference group,
                        WTPrincipal principal)
                 throws WTException


Supported API: true

Specified by:
isMember in interface OrganizationServicesManager
Parameters:
group -
principal -
Returns:
boolean
Throws:
WTException

members

public Enumeration members(WTGroup group)
                    throws WTException


Supported API: true

Specified by:
members in interface OrganizationServicesManager
Parameters:
group -
Returns:
Enumeration
Throws:
WTException

members

public Enumeration members(WTGroup group,
                           boolean flatten)
                    throws WTException


Supported API: true

Specified by:
members in interface OrganizationServicesManager
Parameters:
group -
flatten -
Returns:
Enumeration
Throws:
WTException

parentGroups

public Enumeration parentGroups(WTPrincipal principal)
                         throws WTException


Supported API: true

Specified by:
parentGroups in interface OrganizationServicesManager
Parameters:
principal -
Returns:
Enumeration
Throws:
WTException

getOrganization

public WTOrganization getOrganization(WTPrincipal principal)
                               throws WTException
Returns the organization with which a principal is associated.

Supported API: true

Specified by:
getOrganization in interface OrganizationServicesManager
Parameters:
principal -
Returns:
WTOrganization
Throws:
WTException

getOrganization

public WTOrganization getOrganization(String name,
                                      DirectoryContextProvider context)
                               throws WTException


Supported API: true

Specified by:
getOrganization in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
WTOrganization
Throws:
WTException

getOrganizations

public Enumeration getOrganizations(String name,
                                    DirectoryContextProvider context)
                             throws WTException


Supported API: true

Specified by:
getOrganizations in interface OrganizationServicesManager
Parameters:
name -
context -
Returns:
Enumeration
Throws:
WTException

findLikeOrganizations

public Enumeration findLikeOrganizations(String attributeName,
                                         String pattern,
                                         DirectoryContextProvider context)
                                  throws WTException
This API returns all the organizations matching the name provided as a pattern. For this API the attribute name would typically be "name". The pattern would be the organization name that is being searched for. The pattern would also accept a wild card search.

Supported API: true

Specified by:
findLikeOrganizations in interface OrganizationServicesManager
Parameters:
attributeName -
pattern -
context -
Returns:
Enumeration
Throws:
WTException

findLikeOrganizations

public Enumeration findLikeOrganizations(String attributeName,
                                         String pattern,
                                         DirectoryContextProvider context,
                                         boolean querySubtree)
                                  throws WTException
This API returns all the organizations matching the name provided as a pattern. For this API the attribute name would typically be "name". The pattern would be the organization name that is being searched for. The pattern also accepts a wild card search. Typically organizations are stored directly in the default search base i.e. within a one level search scope of the base where organizations are searched. On some occasions, there could be a new search base that may be created as a sub node of the default search base, to hold all the organizations. In this case a subtree search scope is necessary to retrieve the organizations. So if the parameter querySubTree is set to true, it seaches with the search scope of subtree, else it searches with a default search scope of one-level.

Supported API: true

Specified by:
findLikeOrganizations in interface OrganizationServicesManager
Parameters:
attributeName -
pattern -
context -
querySubtree -
Returns:
Enumeration
Throws:
WTException

findLikeOrganizations

public Enumeration findLikeOrganizations(String attributeName,
                                         String pattern,
                                         DirectoryContextProvider context,
                                         boolean querySubtree,
                                         boolean applyAccessFilter)
                                  throws WTException
This API returns all the organizations matching the name provided as a pattern. For this API the attribute name would typically be "name". The pattern would be the organization name that is being searched for. The pattern also accepts a wild card search. Typically organizations are stored directly in the default search base i.e. within a one level search scope of the base where organizations are searched. On some occasions, there could be a new search base that may be created as a sub node of the default search base, to hold all the organizations. In this case a subtree search scope is necessary to retrieve the organizations. So if the parameter querySubTree is set to true, it seaches with the search scope of subtree, else it searches with a default search scope of one-level. If the boolean value applyAccessFilter is set to true, then the only organizations that the user has access to would be returned, else all organizations that match the search criteria would be returned.

Supported API: true

Specified by:
findLikeOrganizations in interface OrganizationServicesManager
Parameters:
attributeName -
pattern -
context -
querySubtree -
applyAccessFilter -
Returns:
Enumeration
Throws:
WTException

getDirectoryServiceNames

public String[] getDirectoryServiceNames()
                                  throws WTException


Supported API: true

Specified by:
getDirectoryServiceNames in interface OrganizationServicesManager
Returns:
String []
Throws:
WTException

repairPrincipal

public WTPrincipal repairPrincipal(String oldName,
                                   String newDn,
                                   String oldEnteredDn)
                            throws WTException
This method tries and repairs the principal given the "oldName" (name that is currently in the database and possibly will continue to be -- ie. only the UFID has changed) and the new DN (Distinguished name in the DIrectory).

Supported API: true

Specified by:
repairPrincipal in interface OrganizationServicesManager
Parameters:
oldName -
newDn -
oldEnteredDn -
Returns:
WTPrincipal
Throws:
WTException

newDirectoryContextProvider

public DirectoryContextProvider newDirectoryContextProvider(DirectoryContextProvider baseContext,
                                                            String[] searchScopes)
                                                     throws WTException


Supported API: true

Specified by:
newDirectoryContextProvider in interface OrganizationServicesManager
Parameters:
baseContext -
searchScopes -
Returns:
DirectoryContextProvider
Throws:
WTException

newDirectoryContextProvider

public DirectoryContextProvider newDirectoryContextProvider(String[] services,
                                                            String[] searchScopes)
                                                     throws WTException


Supported API: true

Specified by:
newDirectoryContextProvider in interface OrganizationServicesManager
Parameters:
services -
searchScopes -
Returns:
DirectoryContextProvider
Throws:
WTException

removeMembers

public boolean removeMembers(WTGroup group,
                             WTPrincipal[] principals)
                      throws WTException,
                             UserNotFoundException
Removes principals from a group. Returns true if principals belonged to the group, false otherwise.

Supported API: true

Specified by:
removeMembers in interface OrganizationServicesManager
Parameters:
group -
principals -
Returns:
boolean
Throws:
WTException
UserNotFoundException

findLikeActiveAndDisabledUsers

public Enumeration findLikeActiveAndDisabledUsers(Class principalClass,
                                                  String criteria,
                                                  DirectoryContextProvider[] contexts)
                                           throws WTException
This API returns a resultset containing all the active and disabled users. The "criteria" parameter could be something like "name=user1" or email="user1@email.com". Org services package documentation has a detailed description on how to create a DirectoryContexttProvider that needs to be passed into this API.

Supported API: true

Specified by:
findLikeActiveAndDisabledUsers in interface OrganizationServicesManager
Parameters:
principalClass -
criteria -
contexts -
Returns:
Enumeration
Throws:
WTException

findLikeDisabledUsers

public Enumeration findLikeDisabledUsers(String criteria)
                                  throws WTException
Provides a result set of all disabled users that match the search criteria provided as a parameter. The search crteira should be along the lines "name = user1" or "name = u*" or "name=*"

Supported API: true

Specified by:
findLikeDisabledUsers in interface OrganizationServicesManager
Parameters:
criteria -
Returns:
Enumeration
Throws:
WTException

removeMember

public boolean removeMember(WTGroup group,
                            WTPrincipal principal,
                            boolean bValidate)
                     throws WTException,
                            UserNotFoundException
Removes a principal from a group. Returns true if principal belonged to the group, false otherwise.

Supported API: true

Specified by:
removeMember in interface OrganizationServicesManager
Parameters:
group -
principal -
bValidate -
Returns:
boolean
Throws:
WTException
UserNotFoundException

removeMembers

public boolean removeMembers(WTGroup group,
                             WTPrincipal[] principals,
                             boolean bValidate)
                      throws WTException,
                             UserNotFoundException
Removes principals from a group. Returns true if principals belonged to the group, false otherwise.

Supported API: true

Specified by:
removeMembers in interface OrganizationServicesManager
Parameters:
group -
principals -
bValidate -
Returns:
boolean
Throws:
WTException
UserNotFoundException