psdi.mbo

Class Translate

  • java.lang.Object
    • psdi.mbo.Translate
  • All Implemented Interfaces:
    MaximoCache


    public class Translate
    extends java.lang.Object
    implements MaximoCache
    Handles conversion of strings that have been localized and need to be refered to internally by the original value, and vica versa.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected java.util.HashMap lists
      Hash table containing all value lists that have been referred to so far.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Translate()
      Standard Constructor, does nothing.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      java.lang.String[] getExternalValues(java.lang.String listName, java.lang.String internalValue, MboRemote mbo)
      Convert the specified value in the list to an array of external possible values.
      java.lang.String[] getExternalValues(java.lang.String listName, java.lang.String internalValue, java.lang.String siteId, java.lang.String orgId)
      Convert the specified value in the list to an array of external possible values.
      java.lang.String getName()
      Returns the name of the cache object.
      java.lang.String[] getSiteOrg(MboRemote mbo) 
      java.util.Vector getValuesVector(java.lang.String listName, java.lang.String siteId, java.lang.String orgId) 
      void init()
      Initialize the object.
      void reload()
      Reload everything by clearing the lists...
      void reload(java.lang.String key)
      Reload the domain cache for domain name identified by key.
      void remove(java.lang.String listName)
      Remove a valuelist from the hashtable.
      java.lang.String toExternalDefaultValue(java.lang.String listName, java.lang.String value)
      Deprecated. 
      please use the ones which take the mbo or site org id as parameters.
      java.lang.String toExternalDefaultValue(java.lang.String listName, java.lang.String value, MboRemote mbo)
      Return the value that has been marked as the default external value for the specified list name and internal value.
      java.lang.String toExternalDefaultValue(java.lang.String listName, java.lang.String value, java.lang.String siteId, java.lang.String orgId)
      Return the value that has been marked as the default external value for the specified list name and internal value.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String value)
      Convert the specified value in the list to an external list of possible values.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String[] value)
      Convert the specified set of values in the list to an external list of possible values.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String[] value, MboRemote mbo)
      Convert the specified set of values in the list to an external list of possible values.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String[] value, java.lang.String siteId, java.lang.String orgId)
      Convert the specified set of values in the list to an external list of possible values.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String value, MboRemote mbo)
      Convert the specified value in the list to an external list of possible values.
      java.lang.String toExternalList(java.lang.String listName, java.lang.String value, java.lang.String siteId, java.lang.String orgId)
      Convert the specified value in the list to an external list of possible values.
      java.lang.String toInternalString(java.lang.String listName, java.lang.String value)
      Convert a specified value in the list to an internal MAXIMO value.
      java.lang.String toInternalString(java.lang.String listName, java.lang.String value, MboRemote mbo)
      Convert a specified value in the list to an internal MAXIMO value.
      java.lang.String toInternalString(java.lang.String listName, java.lang.String value, java.lang.String siteId, java.lang.String orgId)
      Convert a specified value in the list to an internal MAXIMO value.
      java.lang.String toInternalStringNoException(java.lang.String listName, java.lang.String value, MboRemote mbo)
      Convert a specified value in the list to an internal MAXIMO value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lists

        protected java.util.HashMap lists
        Hash table containing all value lists that have been referred to so far. This is held for performance reasons. The hash table contains Vectors of String[2] or another hashmap of String[2] if there are org or site specific values. In this case, the key to this secondary hashmap is DomainInfo.getKey(). String [0] = Internal value, String [1] = external value.
    • Constructor Detail

      • Translate

        public Translate()
        Standard Constructor, does nothing.
    • Method Detail

      • init

        public void init()
        Initialize the object.
        Specified by:
        init in interface MaximoCache
      • toInternalString

        public java.lang.String toInternalString(java.lang.String listName,
                                                 java.lang.String value)
                                          throws MXException
        Convert a specified value in the list to an internal MAXIMO value. String returned is a single value. The value parameter IS case sensitive, listname is not.

        For example:

        if (getTranslator().toInternalString("POSTATUS", poStatus).equalsIgnoreCase("CAN"))
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The external value (valuelist.value). This is case sensitive.
        Returns:
        The internal value (valuelist.maxvalue)
        Throws:
        MXException
      • toInternalString

        public java.lang.String toInternalString(java.lang.String listName,
                                                 java.lang.String value,
                                                 MboRemote mbo)
                                          throws MXException
        Convert a specified value in the list to an internal MAXIMO value. String returned is a single value. The value parameter IS case sensitive, listname is not. Framework will use the siteid of the passed in MBO if it is site level, or the orgid of the MBO if it is org level to find out the actual values for the specified domain, and use those values for translation. If the siteid and orgid of the MBO is null, all the value records will be considered.

        For example:

        if (getTranslator().toInternalString("POSTATUS", poStatus).equalsIgnoreCase("CAN"))
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The external value (valuelist.value). This is case sensitive.
        the - MBO that the translation values are used for or the MBO which the site and org is same with the MBO that the translation is used for.
        Returns:
        The internal value (valuelist.maxvalue)
        Throws:
        MXException
      • toInternalStringNoException

        public java.lang.String toInternalStringNoException(java.lang.String listName,
                                                            java.lang.String value,
                                                            MboRemote mbo)
        Convert a specified value in the list to an internal MAXIMO value. String returned is a single value. The value parameter IS case sensitive, listname is not. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered. Exception will be thrown if the external value doesn't exist. If the external value doesn't exist in the domain, null will be returned.

        For example:

        if (getTranslator().toInternalString("POSTATUS", poStatus).equalsIgnoreCase("CAN"))
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The external value (valuelist.value). This is case sensitive.
        siteId - The site that the translation should consider if there are specific values for this site.
        Mbo - object whose provide the relavent site id and orgid
        Returns:
        The internal value (valuelist.maxvalue). If the external value doesn't exist in the domain, null will be returned.
      • toInternalString

        public java.lang.String toInternalString(java.lang.String listName,
                                                 java.lang.String value,
                                                 java.lang.String siteId,
                                                 java.lang.String orgId)
                                          throws MXException
        Convert a specified value in the list to an internal MAXIMO value. String returned is a single value. The value parameter IS case sensitive, listname is not. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered. Exception will be thrown if the external value doesn't exist.

        For example:

        if (getTranslator().toInternalString("POSTATUS", poStatus).equalsIgnoreCase("CAN"))
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The external value (valuelist.value). This is case sensitive.
        siteId - The site that the translation should consider if there are specific values for this site.
        orgId - The orgnization that the translation should consider if there are specific values for this organization.
        Returns:
        The internal value (valuelist.maxvalue). Exception will be thrown if the external value doesn't exist in the domain.
        Throws:
        MXException
      • getValuesVector

        public java.util.Vector getValuesVector(java.lang.String listName,
                                                java.lang.String siteId,
                                                java.lang.String orgId)
                                         throws MXException
        Throws:
        MXException
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String value)
                                        throws MXException
        Convert the specified value in the list to an external list of possible values. List returned may be a comma separated list or a a single value. Returns null if the list name, or internal value does not exist.

        For example:

        String apprSyn = getTranslator().toExternalList("PRSTATUS","APPR");
        String whereClause = "status in (" + apprSyn +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        Returns:
        The external synonym value(s) (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'SYN1','SYN2'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String[])
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String value,
                                               MboRemote mbo)
                                        throws MXException
        Convert the specified value in the list to an external list of possible values. List returned may be a comma separated list or a a single value. Returns null if the list name, or internal value does not exist. Framework will use the siteid of the passed in MBO if it is site level, or the orgid of the MBO if it is org level to find out the actual values for the specified domain, and use those values for translation. If the siteid and orgid of the MBO is null, all the value records will be considered.

        For example:

        String apprSyn = getTranslator().toExternalList("PRSTATUS","APPR");
        String whereClause = "status in (" + apprSyn +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        the - MBO that the translation values are used for or the MBO which the site and org is same with the MBO that the translation is used for.
        Returns:
        The external synonym value(s) (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'SYN1','SYN2'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String[])
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String value,
                                               java.lang.String siteId,
                                               java.lang.String orgId)
                                        throws MXException
        Convert the specified value in the list to an external list of possible values. List returned may be a comma separated list or a a single value. Returns null if the list name, or internal value does not exist. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered.

        For example:

        String apprSyn = getTranslator().toExternalList("PRSTATUS","APPR");
        String whereClause = "status in (" + apprSyn +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        siteId - The site that the translation should consider if there are specific values for this site.
        orgId - The orgnization that the translation should consider if there are specific values for this organization.
        Returns:
        The external synonym value(s) (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'SYN1','SYN2'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String[])
      • getExternalValues

        public java.lang.String[] getExternalValues(java.lang.String listName,
                                                    java.lang.String internalValue,
                                                    java.lang.String siteId,
                                                    java.lang.String orgId)
                                             throws MXException
        Convert the specified value in the list to an array of external possible values. Returns null if the list name, or internal value does not exist. Framework will use the siteid of the passed in MBO if it is site level, or the orgid of the MBO if it is org level to find out the actual values for the specified domain, and use those values for translation. If the siteid and orgid of the MBO is null, all the value records will be considered.

        For example:

        String[] apprSyn = getTranslator().getExternalValues("PRSTATUS","APPR");
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        internalValue - The internal value (valuelist.maxvalue). This is case sensitive.
        mbo - The Mbo remote object whose siteid and orgid is used to consider what values to be returned as if the valuelist's value is going to be applied to one of the attribute of this mbo.
        Returns:
        An string array of synonym value(s) (valuelist.value). Each element is one synonym value. The string is not surrounded by single quotes.
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String[])
      • getExternalValues

        public java.lang.String[] getExternalValues(java.lang.String listName,
                                                    java.lang.String internalValue,
                                                    MboRemote mbo)
                                             throws MXException
        Convert the specified value in the list to an array of external possible values. Returns null if the list name, or internal value does not exist. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered.

        For example:

        String[] apprSyn = getTranslator().getExternalValues("PRSTATUS","APPR");
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        internalValue - The internal value (valuelist.maxvalue). This is case sensitive.
        siteId - The site that the translation should consider if there are specific values for this site.
        orgId - The orgnization that the translation should consider if there are specific values for this organization.
        Returns:
        An string array of synonym value(s) (valuelist.value). Each element is one synonym value. The string is not surrounded by single quotes.
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String[])
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String[] value)
                                        throws MXException
        Convert the specified set of values in the list to an external list of possible values. List returned may be a comma separated list, a single value. Returns empty string if the list name, or all internal values does not exist. Framework will use the siteid of the passed in MBO if it is site level, or the orgid of the MBO if it is org level to find out the actual values for the specified domain, and use those values for translation. If the siteid and orgid of the MBO is null, all the value records will be considered.

        For example:

        String[] poStatuses = {"APPR", "PRINT"};
        String poStatus = getTranslator().toExternalList("POSTATUS", poStatuses);
        String whereClause = "status in (" + poStatus +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - An array of internal values (valuelist.maxvalue). This is case sensitive.
        Returns:
        The external synonym values (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'RPPA','TNIRP'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String)
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String[] value,
                                               MboRemote mbo)
                                        throws MXException
        Convert the specified set of values in the list to an external list of possible values. List returned may be a comma separated list, a single value. Returns empty string if the list name, or all internal values does not exist.

        For example:

        String[] poStatuses = {"APPR", "PRINT"};
        String poStatus = getTranslator().toExternalList("POSTATUS", poStatuses);
        String whereClause = "status in (" + poStatus +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - An array of internal values (valuelist.maxvalue). This is case sensitive.
        the - MBO that the translation values are used for or the MBO which the site and org is same with the MBO that the translation is used for.
        Returns:
        The external synonym values (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'RPPA','TNIRP'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String)
      • toExternalList

        public java.lang.String toExternalList(java.lang.String listName,
                                               java.lang.String[] value,
                                               java.lang.String siteId,
                                               java.lang.String orgId)
                                        throws MXException
        Convert the specified set of values in the list to an external list of possible values. List returned may be a comma separated list, a single value. Returns empty string if the list name, or all internal values does not exist. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered.

        For example:

        String[] poStatuses = {"APPR", "PRINT"};
        String poStatus = getTranslator().toExternalList("POSTATUS", poStatuses);
        String whereClause = "status in (" + poStatus +")";
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - An array of internal values (valuelist.maxvalue). This is case sensitive.
        siteId - The site that the translation should consider if there are specific values for this site.
        orgId - The orgnization that the translation should consider if there are specific values for this organization.
        Returns:
        The external synonym values (valuelist.value), surrounded with single quotes. If there is more than one synonym, they are delimited by commas. For example:
        'RPPA','TNIRP'
        Throws:
        MXException
        See Also:
        Translate.toExternalList(String, String)
      • toExternalDefaultValue

        public java.lang.String toExternalDefaultValue(java.lang.String listName,
                                                       java.lang.String value)
                                                throws MXException
        Deprecated. please use the ones which take the mbo or site org id as parameters.
        Return the value that has been marked as the default external value for the specified list name and internal value. This will return a single value as a string or NULL if the list does not exist, the value does not exist, or there is no default.

        For example:

        setValue("type", getTranslator().toExternalDefaultValue("MRTYPE","STANDARD"), NOACCESSCHECK|NOVALIDATION_AND_NOACTION);
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        Returns:
        The external default value (valuelist.value where defaults = :yes). This is NOT surrounded with quotes. For example:
        RPPA
        Throws:
        MXException
      • toExternalDefaultValue

        public java.lang.String toExternalDefaultValue(java.lang.String listName,
                                                       java.lang.String value,
                                                       MboRemote mbo)
                                                throws MXException
        Return the value that has been marked as the default external value for the specified list name and internal value. This will return a single value as a string or NULL if the list does not exist, the value does not exist, or there is no default. Framework will use the siteid of the passed in MBO if it is site level, or the orgid of the MBO if it is org level to find out the actual values for the specified domain, and use those values for translation. If the siteid and orgid of the MBO is null, all the value records will be considered.

        For example:

        setValue("type", getTranslator().toExternalDefaultValue("MRTYPE","STANDARD"), NOACCESSCHECK|NOVALIDATION_AND_NOACTION);
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        the - MBO that the translation values are used for or the MBO which the site and org is same with the MBO that the translation is used for.
        Returns:
        The external default value (valuelist.value where defaults = :yes). This is NOT surrounded with quotes. For example:
        RPPA
        Throws:
        MXException
      • toExternalDefaultValue

        public java.lang.String toExternalDefaultValue(java.lang.String listName,
                                                       java.lang.String value,
                                                       java.lang.String siteId,
                                                       java.lang.String orgId)
                                                throws MXException
        Return the value that has been marked as the default external value for the specified list name and internal value. This will return a single value as a string or NULL if the list does not exist, the value does not exist, or there is no default. Framework will use the passed in siteid and orgid to find out the actual domain values for the specified domain, and use those values for translation. If both strings are null, all the value records will be considered.

        For example:

        setValue("type", getTranslator().toExternalDefaultValue("MRTYPE","STANDARD"), NOACCESSCHECK|NOVALIDATION_AND_NOACTION);
        Parameters:
        listName - The valuelist name (valuelist.listname). This is not case sensitive.
        value - The internal value (valuelist.maxvalue). This is case sensitive.
        Returns:
        The external default value (valuelist.value where defaults = :yes). This is NOT surrounded with quotes. For example:
        RPPA
        Throws:
        MXException
      • remove

        public void remove(java.lang.String listName)
        Remove a valuelist from the hashtable. Called from MXValue save for any kind of update to the valuelist table. If a listname is removed from our hashtable and it's later needed, the appropriate method in Translate will reload the listname into the hashtable.
        Parameters:
        listName - The name of the valuelist.
      • getName

        public java.lang.String getName()
        Description copied from interface: MaximoCache
        Returns the name of the cache object. Should be unique within the app server. This name is used to uniquely identify the cache object among all cached object for both accessing the cache object as well as refreshing the cache object. Ex. MaximoDD returns "MAXIMODD"
        Specified by:
        getName in interface MaximoCache
        Returns:
      • reload

        public void reload(java.lang.String key)
                    throws MXException
        Reload the domain cache for domain name identified by key.
        Specified by:
        reload in interface MaximoCache
        Throws:
        MXException