wt.help
Class HelpLinkHelper

java.lang.Object
  extended bywt.help.HelpLinkHelper

public class HelpLinkHelper
extends Object

This class is used in conjunction with the URLFactory to generate HREF links for help files within the Windchill System. There are two methods provided for generating help files.

The first follows the pattern of the ServletHelpers where a resource is provided and URLFactory generates the HREF from this. An example of this might be



This resource name is taken from the help_XX path downward, where XX is the help locale (such as en or fr).

The second method involves a lookup from the services.properties file for a action and context. An example of this might be


This would utilize the resource referenced in services.properties to create a HREF for the correct language locale for the specific object with the action of CREATE. See the methods below for details on implementation.

If a null URLFactory is passed to the HelpLinkHelper methods a new URLFactory for the current default Method Server will be instantiated and used. All HREFs will be fully qualified by default in this case.

Helpfiles are unique that the localized resources are contained in localized directories, not localized filenames. As well, some locales do not map to an equivalent directory. For example, en_US and en_GB both map to en. As such, specific processing of the locale is required. This is performed by the determineHelpLocale(Locale) method as detailed below, which uses the property wt.help.locales in wt.properties to determine the valid locale from the supported locales. This method supports locale backoff, such that a locale like en_US backs off to en.

Supported API: true

Extendable: false

See Also:
URLFactory, WTServiceProviderFromProperties

Field Summary
private static String DEFAULT_EXTENSION
          static for the default extension
private static String DEFAULT_LOCALE
          static for the default locale
private static String DEFAULT_SERVICE_NAME
          static for the default service name
static String HELP_HOME
          static for the help home directory
static String HELP_KEY
          static for the help key path
static String HELP_PATH
          static for the help path name
private  String ivHelp_Home
           
private  String ivHelp_Key
           
private  String ivHelp_Path
           
private static Vector locales
          static list of locales
private static HelpLinkHelper localHelper
           
private static ApplicationContextServices provider
          The service provider
 
Constructor Summary
HelpLinkHelper()
           
HelpLinkHelper(String path, String home)
          This constructor will create a new help link helper set to the desired path and home.
 
Method Summary
static String createHelpHREF(URLFactory factory, Object context, String action, Locale locale)
          This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale.
static String createHelpHREF(URLFactory factory, Object context, String action, Locale locale, HashMap props)
          This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale.
static String createHelpHREF(URLFactory factory, Object context, String action, Locale locale, HashMap props, HelpLinkHelper helper)
          This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale.
static String createHelpHREF(URLFactory factory, Object context, String action, Locale locale, HelpLinkHelper helper)
          This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale.
static String createHelpHREF(URLFactory factory, String resource, Locale locale)
          This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale.
static String createHelpHREF(URLFactory factory, String resource, Locale locale, HashMap props)
          This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale.
static String createHelpHREF(URLFactory factory, String resource, Locale locale, HashMap props, HelpLinkHelper helper)
          This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale.
static String createHelpHREF(URLFactory factory, String resource, Locale locale, HelpLinkHelper helper)
          This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale.
static String createHelpHREF(URLFactory factory, String service_name, Object context, String action, Locale locale)
          This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale.
static String createHelpHREF(URLFactory factory, String service_name, Object context, String action, Locale locale, HashMap props)
          This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale.
static String createHelpHREF(URLFactory factory, String service_name, Object context, String action, Locale locale, HashMap props, HelpLinkHelper helper)
          This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale.
static String createHelpHREF(URLFactory factory, String service_name, Object context, String action, Locale locale, HelpLinkHelper helper)
          This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale.
static String determineHelpLocale(Locale locale)
          This method will take the input locale and utilizing the property wt.help.locales from wt.properties will determine the optimal locale for the help pages.
static void setHelpHome(String home)
          This method will set the help home to be used when generating the help resource paths.
static void setHelpPath(String path)
          This method will set the help path to be used when generating the help resource paths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELP_HOME

public static final String HELP_HOME
static for the help home directory

See Also:
Constant Field Values

HELP_PATH

public static final String HELP_PATH
static for the help path name

See Also:
Constant Field Values

HELP_KEY

public static final String HELP_KEY
static for the help key path

See Also:
Constant Field Values

DEFAULT_SERVICE_NAME

private static String DEFAULT_SERVICE_NAME
static for the default service name


DEFAULT_EXTENSION

private static String DEFAULT_EXTENSION
static for the default extension


DEFAULT_LOCALE

private static String DEFAULT_LOCALE
static for the default locale


locales

private static Vector locales
static list of locales


provider

private static ApplicationContextServices provider
The service provider


ivHelp_Home

private String ivHelp_Home

ivHelp_Path

private String ivHelp_Path

ivHelp_Key

private String ivHelp_Key

localHelper

private static HelpLinkHelper localHelper
Constructor Detail

HelpLinkHelper

public HelpLinkHelper()

HelpLinkHelper

public HelpLinkHelper(String path,
                      String home)
This constructor will create a new help link helper set to the desired path and home.

Parameters:
path - The Path for the help (typically "help")
home - The home of the help files ("wt/helpfiles" in foundation)
Method Detail

setHelpPath

public static void setHelpPath(String path)
This method will set the help path to be used when generating the help resource paths. The default is help. This will get translated to a localized name such as help_en at runtime. NOTE: This can be clobbered by multiple threads and is not thread safe!

Supported API: false


setHelpHome

public static void setHelpHome(String home)
This method will set the help home to be used when generating the help resource paths. The default is wt/helpfiles NOTE: This can be clobbered by multiple threads and is not thread safe!

Supported API: false

Parameters:
home - The help home path

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String service_name,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HashMap props)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
service_name - The name of the service which contains help link
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
props - Optional Hashmap of properties (null valid)
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String service_name,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HashMap props,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
service_name - The name of the service which contains help link
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
props - Optional Hashmap of properties (null valid)
helper - The Helper to use to generate the link (allowing for externalized helpers)
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String service_name,
                                    Object context,
                                    String action,
                                    Locale locale)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
service_name - The name of the service which contains help link
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String service_name,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated service_name, context and action for the given locale. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
service_name - The name of the service which contains help link
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
helper - The helper to use to generate the link
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HashMap props)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale. The service name will be DEFAULT_SERVICE_NAME which is defined to be wt.templateutil.processor.HelpHTMLTemplate by default. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
props - Optional Hashmap of properties (null valid)
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HashMap props,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale. The service name will be DEFAULT_SERVICE_NAME which is defined to be wt.templateutil.processor.HelpHTMLTemplate by default. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
props - Optional Hashmap of properties (null valid)
helper - The helper to use for link generation
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    Object context,
                                    String action,
                                    Locale locale)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale. The service name will be DEFAULT_SERVICE_NAME which is defined to be wt.templateutil.processor.HelpHTMLTemplate by default. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    Object context,
                                    String action,
                                    Locale locale,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a Help HREF using the services.properties entry defined by the designated context and action for the given locale. The service name will be DEFAULT_SERVICE_NAME which is defined to be wt.templateutil.processor.HelpHTMLTemplate by default. If this service is not found, an attempt to obtain the filename for the context of 'Object' and 'DEFAULT_HELP_PAGE' action will be made. if this fails, an exception will be thrown.

Supported API: true

Parameters:
factory - The URLFactory to use to instantiate the link.
context - The context object to apply the help link to
action - The action to apply to the context for the help
locale - The locale of the client
helper - The helper to use for help link generation
Returns:
The HREF generated for the correct locale for the desired help context from the services.properties.
Throws:
Exception - If the service is not found.

determineHelpLocale

public static String determineHelpLocale(Locale locale)
This method will take the input locale and utilizing the property wt.help.locales from wt.properties will determine the optimal locale for the help pages.

Supported API: true

Parameters:
locale - The browser/client locale
Returns:
the matching locale or null if no match

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String resource,
                                    Locale locale,
                                    HashMap props)
                             throws Exception
This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale. For example, to obtain the correct HREF for the resource "wt/helpfiles/help_XX/online/vc/MyHelp.html" the resource should be "online/vc/MyHelp.html". If URLFactory mapping is being used to remap a component the entire resource name should be remapped (for example: "wt/helpfiles/help_en/online/vc/MyHelp.html").

Supported API: true

Parameters:
factory - The URLFactory to use to generate the link
resource - The desired help resource
locale - The locale of the client
props - The properties for the HREF.
Returns:
the HREF to the help resource.
Throws:
Exception

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String resource,
                                    Locale locale,
                                    HashMap props,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale. For example, to obtain the correct HREF for the resource "wt/helpfiles/help_XX/online/vc/MyHelp.html" the resource should be "online/vc/MyHelp.html". If URLFactory mapping is being used to remap a component the entire resource name should be remapped (for example: "wt/helpfiles/help_en/online/vc/MyHelp.html").

Supported API: true

Parameters:
factory - The URLFactory to use to generate the link
resource - The desired help resource
locale - The locale of the client
props - The properties for the HREF.
helper - The helper to use to generate the HREF
Returns:
the HREF to the help resource.
Throws:
Exception

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String resource,
                                    Locale locale)
                             throws Exception
This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale. For example, to obtain the correct HREF for the resource "wt/helpfiles/help_XX/online/vc/MyHelp.html" the resource should be "online/vc/MyHelp.html". If URLFactory mapping is being used to remap a component the entire resource name should be remapped (for example: "wt/helpfiles/help_en/online/vc/MyHelp.html").

Supported API: true

Parameters:
factory - The URLFactory to use to generate the link
resource - The desired help resource
locale - The locale of the client
Returns:
the HREF to the help resource.
Throws:
Exception

createHelpHREF

public static String createHelpHREF(URLFactory factory,
                                    String resource,
                                    Locale locale,
                                    HelpLinkHelper helper)
                             throws Exception
This method will generate a HREF for the help resource referenced post the /help_XX path for the desired locale. For example, to obtain the correct HREF for the resource "wt/helpfiles/help_XX/online/vc/MyHelp.html" the resource should be "online/vc/MyHelp.html". If URLFactory mapping is being used to remap a component the entire resource name should be remapped (for example: "wt/helpfiles/help_en/online/vc/MyHelp.html").

Supported API: true

Parameters:
factory - The URLFactory to use to generate the link
resource - The desired help resource
locale - The locale of the client
helper - The helper to use to build the href
Returns:
the HREF to the help resource.
Throws:
Exception