Package wt.prefs

Class PreferenceHelper

java.lang.Object
wt.prefs.PreferenceHelper

@Deprecated public class PreferenceHelper extends Object
Deprecated.
The PreferenceHelper class may be used by both the client and server for obtaining utlity and helper methods for the Preferences Framework. This includes the creation of Edit and Search Context Masks, and translating contexts.

The methods of this class ( createEditMask() and createContextMask() ) replace those found in the PrefsUtil class.

This class is safe to provide to the client and will be able to communicate with a Windchill Method Server over RMI if client side communication is required.

To assist in the usage of the Preferences Framework, the helper creation context methods will return context masks in the form as defined below. It is important to ensure any code utilizes the correct context in order to be 'well-formed' in a multi-level preference heirarchy.

Context Mask Format

The form of the context mask will be in a String Array using the following order: (order from 1 (top) to bottom in the Preference Heirarchy )

    Division Policy.1
    Division Policy.2
    ...
    Division Policy.n
    User
    Division.n
    ...
    Division.2
    Division.1
    System Defaults



Supported API: true

See Also:
  • Method Details

    • getDisplayNameFromContext

      public static String getDisplayNameFromContext(String aContext, Locale aLocale) throws WTException
      Deprecated.
      This method will access the delegate for the given context and return the localized string the represents that context within the delegate.

      NOTE: If the context is a WTPreferences.DIVISION_CONTEXT or WTPreferences.DIVISION_POLICY_CONTEXT, the Macro constant will be stripped before being sent to the delegate. Both a fully defined context (one that has a WTPreferences.DIVISION_CONTEXT) or a delegate context (just the name of the division) are valid parameters.

      Supported API: true

      Parameters:
      aLocale - The locale of the current browser
      aContext - The context name or Division to localize.
      Returns:
      String The display name or empty is no name was found.
      Throws:
      WTException
    • getDivisionsAsAdministrator

      public static String[] getDivisionsAsAdministrator(WTUser user)
      Deprecated.
      This method will return the divisions that the named user can administer from the list of all the delegates in the current heirarchy.

      Supported API: true
      Parameters:
      user - The user which wants administration rights.
      Returns:
      String[] The array of Divisions which are administerable.
    • getDivisionsAsAdministrator

      public static String[] getDivisionsAsAdministrator(WTContainerRef aContainer, WTUser user)
      Deprecated.
      This method will return the divisions that the named user can administer from the list of all the delegates in the current heirarchy. For container delegate, the named container aContainer and its ancestors will be checked for administrative rights of the user.

      Supported API: true
      Parameters:
      aContainer - The container to check adminitrative rights (for container delegate)
      user - The user which wants administration rights.
      Returns:
      String[] The array of Divisions which are administerable.
    • getDivisionsAsAdministrator

      public static String[] getDivisionsAsAdministrator(WTContainerRef aContainer)
      Deprecated.
      This method will return the divisions that the session's user can administer from the list of all the delegates in the current heirarchy. For container delegate, the named container aContainer and its ancestors will be checked for administrative rights of the user.

      Supported API: true
      Parameters:
      aContainer - The container to check adminitrative rights for the current session's user (for container delegate)
      Returns:
      String[] The array of Divisions which are administerable.
    • getDivisionsAsAdministrator

      public static String[] getDivisionsAsAdministrator()
      Deprecated.
      This method will return the divisions that the user can administer from the current sesssion context. The user is obtained from the Session on the MethodServer via the SessionHelper.

      Supported API: true
      Returns:
      String[] Array of Divisions which are administerable.
    • getDivisionsAsAdministrator

      public static String[] getDivisionsAsAdministrator(String aContainer)
      Deprecated.
      This method will return the divisions that the session's user can administer from the list of all the delegates in the current heirarchy. For container delegate, the named container aContainer and its ancestors will be checked for administrative rights of the user.

      Supported API: true
      Parameters:
      aContainer - Reference String of the container to check adminitrative rightsfor the current session's user (for container delegate)
      Returns:
      String[] The array of Divisions which are administerable.
    • createEditMask

      public static final String createEditMask()
      Deprecated.
      This method will attempt to create the Edit Mask for the current user. With this context, a call to

        WTPreferences.setEditContext( createEditMask( ) );

      Will edit a preference at the user level upon a

        WTPreferences.put( aKey, aPreference );



      Supported API: true

      Returns:
      String The correct Edit Mask
    • createEditMask

      public static String createEditMask(String division, boolean policy)
      Deprecated.
      This method will attempt to create the Edit Mask for the current user at a given division node in the Heirarchy. If the user can not administrate preferences at that division (ie. edit the value) then this method will return a null String. If the user is a valid user to edit at this level, then the correct context will be returned. With this context, a call to

        WTPreferences.setEditContext( createEditMask( division, policy ) );

      Will edit a preference at this level upon a

        WTPreferences.put( aKey, aPreference );



      Supported API: true

      Parameters:
      division - The division node in the heirarchy that is to be edited.
      policy - Whether the Editmask is a policy (WTPreferences.DIVISION_POLICY_CONTEXT)
      Returns:
      String The correct Edit Mask or null if the user can not edit the value at this division node.
    • createEditMask

      public static String createEditMask(String division, WTUser aUser, boolean policy)
      Deprecated.
      This method will attempt to create the Edit Mask for a given user at a given division node in the Heirarchy. If the user can not administrate preferences at that division (ie. edit the value) then this method will return a null String. If the user is a valid user to edit at this level, then the correct context will be returned. With this context, a call to

        WTPreferences.setEditContext( createEditMask( division, aUseri, policy ) );

      Will edit a preference at this level upon a

        WTPreferences.put( aKey, aPreference );



      Supported API: true

      Parameters:
      division - The division node in the heirarchy that is to be edited.
      aUser - The user requesting editing permissions.
      policy - Whether the Editmask is a policy (WTPreferences.DIVISION_POLICY_CONTEXT)
      Returns:
      String The correct Edit Mask or null if the user can not edit the value at this division node.
    • createEditMask

      public static String createEditMask(WTContainerRef aContainer, WTUser aUser, boolean policy)
      Deprecated.
      This method will attempt to create the Edit Mask for a given user at the given container node in the Heirarchy. If the user can not administrate preferences at that container (ie. edit the value) then this method will return a null String. If the user is a valid user to edit at this level, then the correct context will be returned. * With this context, a call to

        WTPreferences.setEditContext( createEditMask( aContainer, aUser, policy ) );

      Will edit a preference at this level upon a

        WTPreferences.put( aKey, aPreference );



      Supported API: true

      Parameters:
      aContainer - The container in the heirarchy that is to be edited.
      aUser - The user requesting editing permissions.
      policy - Whether the Editmask is a policy (WTPreferences.CONTAINER_POLICY_CONTEXT)
      Returns:
      String The correct Edit Mask or null if the user can not edit the value at this container.
    • createContextMask

      public static String[] createContextMask(String division)
      Deprecated.
      This method will create a Context Mask for the current logged in user. The mask that is created with the named division being taken in precedence over the normal ordering of the context mask. For example, if the normal order was:

        { Policy.1, Policy2, User, Division.1....}

      and Division.1 was passed in as the division parameter then the new order would be

        { Policy.1, Policy.2, Division.1, User, .... }

      Please see Context Mask Format for details on the proper format of the context mask.

      Supported API: true

      Parameters:
      division - The division to take higher priority
      Returns:
      String[] array of contexts in the order above.
    • createContextMask

      public static String[] createContextMask(String aContainer, String division)
      Deprecated.
      This method will create a Context Mask for the current logged in user. The mask that is created with the named division being taken in precedence over the normal ordering of the context mask. For example, if the normal order was:

        { Policy.1, Policy2, User, Division.1....}

      and Division.1 was passed in as the division parameter then the new order would be

        { Policy.1, Policy.2, Division.1, User, .... }

      Please see Context Mask Format for details on the proper format of the context mask.

      Supported API: true

      Parameters:
      aContainer - The container string to create the hierarchy for
      division - The division to take higher priority
      Returns:
      String[] array of contexts in the order above.
    • createContextMask

      public static String[] createContextMask(String aDivision, WTUser aUser)
      Deprecated.
      This method will create a Context Mask for the named user. The mask that is created, if a fully expanded context mask (except for the WTPreferences.USER_CONTEXT which is expanded during Preferences calls). The mask will have a proper heirarchy list for a given user.

      The mask that is created with the named division being taken in precedence over the normal ordering of the context mask. For example, if the normal order was:

        { Policy.1, Policy2, User, Division.1....}

      and Division.1 was passed in as the division parameter then the new order would be

        { Policy.1, Policy.2, Division.1, User, .... }

      Please see Context Mask Format for details on the proper format of the context mask.

      Supported API: true

      Parameters:
      aDivision - The division to create the Context Mask with.
      aUser - The user to create the mask for.
      Returns:
      String[] array of contexts in the order above.
    • createContextMask

      public static String[] createContextMask(WTContainerRef aContainer, String aDivision, WTUser aUser)
      Deprecated.
      This method will create a Context Mask for the named user. The mask that is created, if a fully expanded context mask (except for the WTPreferences.USER_CONTEXT which is expanded during Preferences calls). The mask will have a proper heirarchy list for a given user.

      The mask that is created with the named division being taken in precedence over the normal ordering of the context mask. For example, if the normal order was:

        { Policy.1, Policy.2, User, Division.1....}

      and Division.1 was passed in as the container parameter then the new order would be

        { Policy.1, Policy.2, Division.1, User, .... }

      Please see Context Mask Format for details on the proper format of the context mask.

      Supported API: true

      Parameters:
      aContainer - The container to create the context mask with, for container delegate.
      aDivision - The preferred division to create the Context Mask with.
      aUser - The user to create the mask for.
      Returns:
      String[] array of contexts in the order above.
    • createContextMask

      public static String[] createContextMask()
      Deprecated.
      This method will create a Context Mask for the current logged in user. The mask that is created, if a fully expanded context mask (except for the WTPreferences.USER_CONTEXT which is expanded during Preferences calls). The mask will have a proper heirarchy list for a given user. The user is taken from the current session context managed on the Method Server.

      Please see Context Mask Format for details on the proper format of the context mask.



      Supported API: true

      Returns:
      String[] array of contexts in the order above.
      See Also: