Class CaseInsensitiveRequestKeys

  • All Implemented Interfaces:
    RequestKeys
    Direct Known Subclasses:
    StringRequestKeys

    public abstract class CaseInsensitiveRequestKeys
    extends GenericRequestKeys
    The CaseInsensitiveRequestKeys abstract class makes available the architecture required for being able to handle request keys as case insensitive. If one key is recorded as "abc" with value "1" and another with key as "ABC" and value "2", both values will be accessible via the same key (that can be requested as "abc", "ABC", "aBC", etc).
    Any child of this class should call the getKeyToSearch(java.lang.String) and updateKeyMapping(java.lang.String) whenever requests with keys are directly called. These methods take care of mapping the user-given key to the one actually used for storing the values.
    Since:
    MicroStrategy Web 7.5.0
    • Constructor Detail

      • CaseInsensitiveRequestKeys

        public CaseInsensitiveRequestKeys()
        Class constructor.
    • Method Detail

      • getValue

        public java.lang.String getValue​(java.lang.String keyName)
        Returns from this collection a comma separated string of all the values mapped by the specified keyName.
        Specified by:
        getValue in interface RequestKeys
        Overrides:
        getValue in class GenericRequestKeys
        Parameters:
        keyName - a key in this collection
        Returns:
        all the values mapped to the keyName, separated by the character comma; null if the key does not exist.
      • getValue

        public java.lang.String getValue​(java.lang.String keyName,
                                         int valueIndex)
        Returns the value at the specified position mapped by the specified keyName.
        Specified by:
        getValue in interface RequestKeys
        Overrides:
        getValue in class GenericRequestKeys
        Parameters:
        keyName - a key in this collection
        valueIndex - the index of a value mapped to the key specified
        Returns:
        the value at the specified position mapped by the specified key; null if the key does not exist.
      • getValueCount

        public int getValueCount​(java.lang.String keyName)
        Returns from this collection the number of values mapped with the keyName.
        Specified by:
        getValueCount in interface RequestKeys
        Overrides:
        getValueCount in class GenericRequestKeys
        Parameters:
        keyName - a key to a value collection
        Returns:
        the count of values to which the specified key is mapped in this collection; 0 if the key is not found.
      • getKeyListByPrefix

        public java.util.Enumeration getKeyListByPrefix​(java.lang.String prefix)
        Returns an enumeration over all the keys with the specified prefix.
        Returns all the keys if the specified prefix is null or empty.
        Returns an empty list if no key is found.
        Specified by:
        getKeyListByPrefix in interface RequestKeys
        Overrides:
        getKeyListByPrefix in class GenericRequestKeys
        Parameters:
        prefix - the prefix of keys.
        Returns:
        an enumeration over all the keys that have the specified prefix.
      • getKeyToSearch

        protected java.lang.String getKeyToSearch​(java.lang.String originalKey)
        Get which key to search, for supporting case insensitive scenarios.
        Parameters:
        originalKey - the original key requested by the user
        Returns:
        a String value with the key with the correct casing that should be used for accessing the stored request values.
      • updateKeyMapping

        protected void updateKeyMapping​(java.lang.String originalKey)
        Keep the key mapping list updated by calling this method with the key name requested by the user. If the key has already been mapped calling this method has no effect (it should still be done for security).
        Parameters:
        originalKey - String with the key used for storing or retrieving values.