Class AssociationDisplayAssistant

java.lang.Object
wt.facade.persistedcollection.AssociationDisplayAssistant
All Implemented Interfaces:
Serializable

public class AssociationDisplayAssistant extends Object implements Serializable
Processing class used to obtain localized display values for the association keys stored in the member graph data when soft filtering is used. Instances of this class are designed to be used for the duration of processing a graph of data. When processing a graph, an instance can be initialized with a desired locale and custom resource bundle, and the getDisplayValue method can be used to obtain localized display values for the association key as stored during collection post-processing.

Example:

   AssociationDisplayAssistant displayAssistant = new AssociationDisplayAssistant(locale, "com.myCompany.myBundle");
      String displayValue = displayAssistant.getDisplayName(thisRelationKey);



Supported API: true

Extendable: true

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    AssociationDisplayAssistant(Locale theLocale, String sCustomBundleName)
    Constructor taking locale and custom resource bundle name.
  • Method Summary

    Modifier and Type
    Method
    Description
    static final String
    buildRelationKey(int iCollectedAsKey)
    Given a 'collected as key' value from collector results, this method returns the relation key to be stored in the filter graph.
    static final String
    buildRelationKey(int iCollectedAsKey, ObjectReference refLink)
    Give a 'collected as key' value from collector results and a reference to a link OID, this method returns the relation key to be stored in the filter graph.
    final String
    Get the resource bundle name used for localizing relationship roles.
    protected final ResourceBundle
    Get the resource bundle used for localizing relationship roles.
    getDisplayValue(String sAssociationKey)
    For an association key passed in as stored in the filter graph, this method returns the display value found from the custom resource bundle, for the locale initialized on the instance.
    protected String
    getDisplayValueFromRawEntryValue(String sBundleEntry, String sRawEntryValue)
    Given the passed in bundle entry key and actual bundle entry value, this method processes the value and either returns it 'as is' if it localized text, or resolves the value if it points to another bundle entry or the model value to use instead.
    protected static final String
    getLinkName(String sLinkOID)
    Given an association key from filter graph which is expected to be a standard link association, this method returns the link class name portion of the oid.
    final Locale
    Get locale used for localizing strings.
    protected final String
    getModelValue(String sBundleEntry)
    Given a bundle value that specifies to use the value from the model, this method obtains the localized value from the model for the link class specified as the bundle entry.
    protected final String
    getOtherBundleValue(String sRawEntryValue)
    For a bundle entry that specifies to use the value from another bundle entry, this value obtains the localized value from the bundle and returns it.
    protected static final boolean
    Returns whether this entry is a bundle entry specifying to use the value from another bundle.
    protected static final boolean
    isUseModelEntry(String sRawEntryValue)
    Returns whether this entry is a bundle entry specifying to use the display value from the model resource bundle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AssociationDisplayAssistant

      public AssociationDisplayAssistant(Locale theLocale, String sCustomBundleName)
      Constructor taking locale and custom resource bundle name. The instance will return all localized values for the passed in locale, using the custom resource bundle as specified.



      Supported API: true

      Parameters:
      theLocale - Locale of display values.
      sCustomBundleName - Name of custom resource bundle ("wt.facade.persistedcollection.relationResource" used if null).
  • Method Details

    • getLocale

      public final Locale getLocale()
      Get locale used for localizing strings.

      Supported API: true
      Returns:
      Locale object (guaranteed non-null).
    • getCustomBundleName

      public final String getCustomBundleName()
      Get the resource bundle name used for localizing relationship roles.

      Supported API: true
      Returns:
      String identifier of resource bundle, may be null (e.g., "wt.facade.persistedcollection.relationResource").
    • getCustomResourceBundle

      protected final ResourceBundle getCustomResourceBundle()
      Get the resource bundle used for localizing relationship roles.

      Supported API: true
      Returns:
      Custom resource bundle.
    • getLinkName

      protected static final String getLinkName(String sLinkOID)
      Given an association key from filter graph which is expected to be a standard link association, this method returns the link class name portion of the oid.



      Supported API: true

      Parameters:
      sAssociationKey - association key as stored in filter graph
      Returns:
      link class name portion of the link oid
    • getDisplayValue

      public String getDisplayValue(String sAssociationKey)
      For an association key passed in as stored in the filter graph, this method returns the display value found from the custom resource bundle, for the locale initialized on the instance. If a display value cannot be found in the custom bundle, the association key is passed back as is.



      Supported API: true

      Parameters:
      sAssociationKey - association key
      Returns:
      localized value to use for the association key as found from custom bundle, or the association key as is if not found
    • getDisplayValueFromRawEntryValue

      protected String getDisplayValueFromRawEntryValue(String sBundleEntry, String sRawEntryValue)
      Given the passed in bundle entry key and actual bundle entry value, this method processes the value and either returns it 'as is' if it localized text, or resolves the value if it points to another bundle entry or the model value to use instead. If the entry value does specify to grab from another bundle or the model, and in either case a value cannot be obtained, this method will log an error and return null.



      Supported API: true

      Parameters:
      sBundleEntry - name of entry in custom resource bundle
      sRawEntryValue - raw value of the custom bundle entry
      Returns:
      the processed value of the entry (which may come from a model or other bundle lookup)
    • getModelValue

      protected final String getModelValue(String sBundleEntry)
      Given a bundle value that specifies to use the value from the model, this method obtains the localized value from the model for the link class specified as the bundle entry.



      Supported API: true

      Parameters:
      sBundleEntry - custom bundle entry, which should be a link class name
      Returns:
      localized display value of the class from model, as returned by getDisplayName(Locale) from its ClassInfo instance; null is returned if this cannot be obtained
    • isUseModelEntry

      protected static final boolean isUseModelEntry(String sRawEntryValue)
      Returns whether this entry is a bundle entry specifying to use the display value from the model resource bundle.



      Supported API: true

      Parameters:
      sRawEntryValue - raw value of the bundle entry
      Returns:
      true if it specifies to use the model value; false if not
    • getOtherBundleValue

      protected final String getOtherBundleValue(String sRawEntryValue)
      For a bundle entry that specifies to use the value from another bundle entry, this value obtains the localized value from the bundle and returns it.



      Supported API: true

      Parameters:
      sRawEntryValue - bundle entry specifying to use the value from another bundle entry
      Returns:
      value from the other bundle; null is returned if the bundle value cannot be obtained
    • isUseAnotherBundleEntry

      protected static final boolean isUseAnotherBundleEntry(String sRawEntryValue)
      Returns whether this entry is a bundle entry specifying to use the value from another bundle.



      Supported API: true

      Parameters:
      sRawEntryValue - raw value of the bundle entry
      Returns:
      true if it specifies to use another bundle entry; false if not
    • buildRelationKey

      public static final String buildRelationKey(int iCollectedAsKey)
      Given a 'collected as key' value from collector results, this method returns the relation key to be stored in the filter graph.



      Supported API: true

      Parameters:
      iCollectedAsKey - collected as key value from collector results
      Returns:
      relation key as to be stored in filter graph
    • buildRelationKey

      public static final String buildRelationKey(int iCollectedAsKey, ObjectReference refLink)
      Give a 'collected as key' value from collector results and a reference to a link OID, this method returns the relation key to be stored in the filter graph. The link OID may be null if none available.



      Supported API: true

      Parameters:
      iCollectedAsKey - collected as key value from collector results
      refLink - reference to link object; may be null
      Returns:
      relation key as to be stored in filter graph