|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.prefs.PreferenceHelper
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.
Division Policy.1
Division Policy.2
...
Division Policy.n
User
Division.n
...
Division.2
Division.1
System Defaults
Supported API: true
WTPreferences
,
PreferenceDelegate
,
UserDelegate
Field Summary | |
private static boolean |
DEBUG
|
private static RemoteMethodServer |
server
Static method server instance used for the client |
Constructor Summary | |
PreferenceHelper()
|
Method Summary | |
static String[] |
createContextMask()
This method will create a Context Mask for the current logged in user. |
static String[] |
createContextMask(String division)
This method will create a Context Mask for the current logged in user. |
static String[] |
createContextMask(String aContainer,
String division)
This method will create a Context Mask for the current logged in user. |
static String[] |
createContextMask(String aDivision,
WTUser aUser)
This method will create a Context Mask for the named user. |
static String[] |
createContextMask(WTContainerRef aContainer,
String aDivision,
WTUser aUser)
This method will create a Context Mask for the named user. |
static String |
createEditMask()
This method will attempt to create the Edit Mask for the current user. |
static String |
createEditMask(String division,
boolean policy)
This method will attempt to create the Edit Mask for the current user at a given division node in the Heirarchy. |
static String |
createEditMask(String division,
WTUser aUser,
boolean policy)
This method will attempt to create the Edit Mask for a given user at a given division node in the Heirarchy. |
static String |
createEditMask(WTContainerRef aContainer,
WTUser aUser,
boolean policy)
This method will attempt to create the Edit Mask for a given user at the given container node in the Heirarchy. |
static String |
createFullyQualifiedPreferenceName(String aNode,
String aKey)
This method will create a full path name attribute from a Parent, Node and Key much like the Database view. |
static String |
createFullyQualifiedPreferenceName(String aParent,
String aNode,
String aKey)
This method will create a full path name attribute from a Parent, Node and Key much like the Database view. |
static String |
getDisplayNameFromContext(String aContext,
Locale aLocale)
This method will access the delegate for the given context and return the localized string the represents that context within the delegate. |
static String[] |
getDivisionsAsAdministrator()
This method will return the divisions that the user can administer from the current sesssion context. |
static String[] |
getDivisionsAsAdministrator(String aContainer)
This method will return the divisions that the session's user can administer from the list of all the delegates in the current heirarchy. |
static String[] |
getDivisionsAsAdministrator(WTContainerRef aContainer)
This method will return the divisions that the session's user can administer from the list of all the delegates in the current heirarchy. |
static String[] |
getDivisionsAsAdministrator(WTContainerRef aContainer,
WTUser user)
This method will return the divisions that the named user can administer from the list of all the delegates in the current heirarchy. |
static String[] |
getDivisionsAsAdministrator(WTUser user)
This method will return the divisions that the named user can administer from the list of all the delegates in the current heirarchy. |
static HashMap |
getNodeValues(Preferences pref)
This method will return a hashmap of key/value pairs for the given Preferences node. |
static long |
getTimeOutInterval()
Supported API: false |
protected static String |
joinContextUser(String context,
String user)
|
private static void |
main(String[] args)
|
static void |
setTimeOutInterval(long time)
This method will set the timeout interval for the delegate list in Method Server. |
static String |
splitContext(String aContext)
Supported API: false |
protected static String |
transformContext(String context)
Performs transformations on context Transforms WTPreferences.USER_CONTEXT to WTPreferences.USER_CONTEXT + identity Supported API: false |
protected static String[] |
transformContext(String[] context)
Performs transformations on context array Transforms WTPreferences.USER_CONTEXT to WTPreferences.USER_CONTEXT + identity Supported API: false |
protected static String |
transformContext(String context,
String user)
Performs transformations on context Transforms WTPreferences.USER_CONTEXT to WTPreferences.USER_CONTEXT + identity Supported API: false |
static String |
untransformContext(String aContext)
This method will take a qualified context such as WTPreferences.USER_CONTEXT or
WTPreferences.DIVISION_CONTEXT:Some Division
and return the String representation fo the context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static RemoteMethodServer server
private static boolean DEBUG
Constructor Detail |
public PreferenceHelper()
Method Detail |
public static String getDisplayNameFromContext(String aContext, Locale aLocale) throws WTException
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
aLocale
- The locale of the current browseraContext
- The context name or Division to localize.
WTException
public static long getTimeOutInterval()
public static void setTimeOutInterval(long time)
time
- The time in milliseconds for the timeout to be set too.public static String[] getDivisionsAsAdministrator(WTUser user)
user
- The user which wants administration rights.
public static String[] getDivisionsAsAdministrator(WTContainerRef aContainer, WTUser user)
aContainer
- The container to check adminitrative rights
(for container delegate)user
- The user which wants administration rights.
public static String[] getDivisionsAsAdministrator(WTContainerRef aContainer)
aContainer
- The container to check adminitrative rights
for the current session's user
(for container delegate)
public static String[] getDivisionsAsAdministrator()
public static String[] getDivisionsAsAdministrator(String aContainer)
aContainer
- Reference String of the container to check
adminitrative rightsfor the current session's user
(for container delegate)
public static final String createEditMask()
WTPreferences.setEditContext( createEditMask( ) );
Will edit a preference at the user level upon a
WTPreferences.put( aKey, aPreference );
Supported API: true
public static String createEditMask(String division, boolean policy)
WTPreferences.setEditContext( createEditMask( division, policy ) );
Will edit a preference at this level upon a
WTPreferences.put( aKey, aPreference );
Supported API: true
division
- The division node in the heirarchy that is to be edited.policy
- Whether the Editmask is a policy
(WTPreferences.DIVISION_POLICY_CONTEXT)
public static String createEditMask(String division, WTUser aUser, boolean policy)
WTPreferences.setEditContext( createEditMask( division, aUseri, policy ) );
Will edit a preference at this level upon a
WTPreferences.put( aKey, aPreference );
Supported API: true
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)
public static String createEditMask(WTContainerRef aContainer, WTUser aUser, boolean policy)
WTPreferences.setEditContext( createEditMask( aContainer, aUser, policy ) );
Will edit a preference at this level upon a
WTPreferences.put( aKey, aPreference );
Supported API: true
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)
public static String[] createContextMask(String division)
{ 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
division
- The division to take higher priority
public static String[] createContextMask(String aContainer, String division)
{ 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
aContainer
- The container string to create the hierarchy fordivision
- The division to take higher priority
public static String[] createContextMask(String aDivision, WTUser aUser)
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
@param aUser The user to create the mask for.
aDivision
- The division to create the Context Mask with.
public static String[] createContextMask(WTContainerRef aContainer, String aDivision, WTUser aUser)
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
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.
public static String[] createContextMask()
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
PreferenceHelper
protected static String transformContext(String context)
context
- The context to convert
protected static String transformContext(String context, String user)
context
- The context to convertuser
- The string user to append
protected static String joinContextUser(String context, String user)
protected static String[] transformContext(String[] context)
context
- An array of contexts to convert.
public static final String untransformContext(String aContext)
WTPreferences.USER_CONTEXT
or
WTPreferences.DIVISION_CONTEXT:Some Division
and return the String representation fo the context. For
example, stripping either a WTPreferences.USER_CONTEXT
or WTPreferences.DEFAULT_CONTEXT
will return that
constant context, however stripping a WTPreferences.DIVISION_CONTEXT
or WTPreferences.DIVISION_POLICY_CONTEXT
will result in
just the name portion of the context (in the above example "Some
Division").
aContext
- The fully macro-defined context.
public static HashMap getNodeValues(Preferences pref)
Note: The contextMask should be set first using the
PrefsUtil.createContextMask( )
method to ensure that the
Preference node will be searched using the proper context.
Supported API: false
pref
- The preference node.
public static final String splitContext(String aContext)
public static final String createFullyQualifiedPreferenceName(String aNode, String aKey)
aNode
- The preference nodeaKey
- The preference key
public static String createFullyQualifiedPreferenceName(String aParent, String aNode, String aKey)
aParent
- The parent preferenceaNode
- The preference nodeaKey
- The preference key
private static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |