wt.prefs.delegates
Class ContainerDelegate

java.lang.Object
  extended bywt.prefs.delegates.PreferenceDelegate
      extended bywt.prefs.delegates.ContainerDelegate

public final class ContainerDelegate
extends PreferenceDelegate

This class is a generic delegate for container level preferences. The ruleset for this delegate is that any member of the Container or its ancestor containers' Administrators will have the authority to administer and edit preferences at this level in the preference Heirarchy. This delegate gets the divisions for given container and its ancestor containers. If no container is available, exchange container would be considered to get divisions, and for getDivisionsAsAdministrator. The order of delegates are defined in the delegates.properties file under the property wt.prefs.delegates.DelegateOrder which defines the heirarchy of delegates from top to bottom. See wt.prefs.delegates.PreferenceDelegate for more details on this property.

When using this delegate in the Preference Heirarchy, the wt.prefs.delegates.DelegateOrder property entry for this delegate should appear as $CONTAINER.

Supported API: false

See Also:
PreferenceDelegate, DefaultSystemDelegate, WindchillEnterpriseDelegate, UserDelegate, PrefsUtil, WTPreferences, Preferences

Field Summary
private static boolean VERBOSE
           
 
Fields inherited from class wt.prefs.delegates.PreferenceDelegate
DELEGATE_FILE, DELEGATE_ORDER, DELEGATE_PREFERENCE_NODE
 
Constructor Summary
ContainerDelegate()
           
 
Method Summary
 ArrayList getDivisions(WTContainerRef aContainer, WTUser user)
          This method will return the heirarchial divisions for the named user that this delegate is responsible for.
 ArrayList getDivisions(WTUser user)
          This method will return the heirarchial divisions for the named user that this delegate is responsible for.
 ArrayList getDivisionsAsAdministrator(WTContainerRef aContainer, WTUser user)
          This method will return the divisions which the user has administrative privileges for.
 ArrayList getDivisionsAsAdministrator(WTUser user)
          This method will return the divisions which the user has administrative privileges for.
 String getLocalizedName(String division, Locale aLocale)
          This method will return the name of this division for display purposes.
 boolean isAdministrator(String division, WTUser user)
          Will determine if the user is an adminstarator of a container's division.
 boolean isAdministrator(WTContainerRef container, WTUser user)
          Will determine if the user is an adminstarator of the container.
 
Methods inherited from class wt.prefs.delegates.PreferenceDelegate
isAdministrator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

private static boolean VERBOSE
Constructor Detail

ContainerDelegate

public ContainerDelegate()
Method Detail

getLocalizedName

public String getLocalizedName(String division,
                               Locale aLocale)
This method will return the name of this division for display purposes.

Supported API: false

Specified by:
getLocalizedName in class PreferenceDelegate
Parameters:
division - the division
aLocale - ignored.
Returns:
String The name of container designated by the division string.

isAdministrator

public boolean isAdministrator(String division,
                               WTUser user)
Will determine if the user is an adminstarator of a container's division.

Supported API: false

Specified by:
isAdministrator in class PreferenceDelegate
Parameters:
division - The division to apply the privileges to
user - The user of determine administrative privileges for.
Returns:
boolean true if the user matches the current context's session user and user is an administrator of the container.

isAdministrator

public boolean isAdministrator(WTContainerRef container,
                               WTUser user)
Will determine if the user is an adminstarator of the container.

Supported API: false

Parameters:
container - The division to apply the privileges to
user - The user of determine administrative privileges for.
Returns:
boolean true if the user matches the current context's session user and user is an administrator for the container.

getDivisionsAsAdministrator

public ArrayList getDivisionsAsAdministrator(WTUser user)
This method will return the divisions which the user has administrative privileges for. This method will return an arraylist containing divisions corresponding to the given container and its ancestors for which the user is an administrator. Returns empty if user is not an administrator of any container in the container's hierarchy.

Supported API: false

Specified by:
getDivisionsAsAdministrator in class PreferenceDelegate
Parameters:
user - The user to check authentication on.
Returns:
ArrayList Division corresponding to the Exchange Container if user has Administrative rights, else empty ArrayList.

getDivisionsAsAdministrator

public ArrayList getDivisionsAsAdministrator(WTContainerRef aContainer,
                                             WTUser user)
This method will return the divisions which the user has administrative privileges for. This method will return an arraylist containing divisions corresponding to the given container and its ancestors for which the user is an administrator. Returns empty if user is not an administrator of any container in the container's hierarchy.

Supported API: false

Overrides:
getDivisionsAsAdministrator in class PreferenceDelegate
Parameters:
aContainer - The base container to get divisions as administrator
user - The user to check authentication on.
Returns:
ArrayList Divisions corresponding to the given container and its ancestors the user has Administrative rights, or empty in other cases.

getDivisions

public ArrayList getDivisions(WTUser user)
This method will return the heirarchial divisions for the named user that this delegate is responsible for. This delegate will return the divisions for the exchange container.

Supported API: false

Specified by:
getDivisions in class PreferenceDelegate
Parameters:
user - ignored.
Returns:
ArrayList Divisions corresponding to exchange container.

getDivisions

public ArrayList getDivisions(WTContainerRef aContainer,
                              WTUser user)
This method will return the heirarchial divisions for the named user that this delegate is responsible for.

Supported API: false

Overrides:
getDivisions in class PreferenceDelegate
Parameters:
aContainer - the container based on which divisions are created.
user - ignored.
Returns:
ArrayList Divisions corresponding to the given container and its ancestors.