Class AppianTypeCache

java.lang.Object
com.appiancorp.suiteapi.process.AppianTypeCache
All Implemented Interfaces:
JSONable, JSONCacheable, XMLable, Serializable

public class AppianTypeCache extends Object implements JSONCacheable, XMLable, Serializable
Holds the ids and display names of Appian-typed objects such as users and groups. Generally, a cache is created for an entity such as an ActivityClass or a ProcessModel, and when that entity is loaded, the primary keys of all of the Appian-typed objects in the entity's object graph are added to the cache using addAppianType(java.lang.Integer, java.lang.Long). After the primary keys have been added, one can call populate(com.appiancorp.services.ServiceContext) to fetch the display names. Once the cache has been populated,display names can be retrieved through the getDisplayName(java.lang.Long, java.lang.Integer) and getDisplayNames(java.lang.Long[], java.lang.Integer) methods.
See Also:
  • Field Details

    • AT_USERS

      public static final Integer AT_USERS
      Appian type constant for users
    • AT_GROUPS

      public static final Integer AT_GROUPS
      Appian type constant for groups
    • AT_FOLDERS

      public static final Integer AT_FOLDERS
      Appian type constant for folders
    • AT_DOCS

      public static final Integer AT_DOCS
      Appian type constant for documents
    • AT_PAGES

      public static final Integer AT_PAGES
      Appian type constant for pages
    • AT_FORUMS

      public static final Integer AT_FORUMS
      Appian type constant for forums
    • AT_THREADS

      public static final Integer AT_THREADS
      Appian type constant for threads
    • AT_MESSAGES

      public static final Integer AT_MESSAGES
      Appian type constant for messages
    • AT_KCS

      public static final Integer AT_KCS
      Appian type constant for knowledge centers
    • AT_CONTENT

      public static final Integer AT_CONTENT
      Appian type constant for content
    • AT_CONTENT_CONSTANT

      public static final Integer AT_CONTENT_CONSTANT
      Appian type constant for content
    • AT_EMAIL_ADDRESSES

      public static final Integer AT_EMAIL_ADDRESSES
      Appian type constant for email addresses
    • AT_PROCESS_MODELS

      public static final Integer AT_PROCESS_MODELS
      Appian type constant for process models
    • AT_PROCESSES

      public static final Integer AT_PROCESSES
      Appian type constant for processes
    • AT_COMMUNITIES

      public static final Integer AT_COMMUNITIES
      Appian type constant for communities
    • AT_EVENTS

      public static final Integer AT_EVENTS
    • AT_PROCESSMODEL_FOLDER

      public static final Integer AT_PROCESSMODEL_FOLDER
      Appian type constant for process model folders
  • Constructor Details

    • AppianTypeCache

      public AppianTypeCache()
  • Method Details

    • getHiddenAttributes

      public HashSet getHiddenAttributes()
      Description copied from interface: JSONable
      Returns the set of attributes (properties) that should not be included in the JSON representation of the object.
      Specified by:
      getHiddenAttributes in interface JSONable
      Returns:
      the set of hidden attributes
    • toXML

      public String toXML()
      Description copied from interface: XMLable
      Generates an XML representation of this object (including all child objects). A typical implementation is to create a new StringBuilder and call toXML( StringBuilder ) on it.
      Specified by:
      toXML in interface XMLable
      Returns:
      The XML representation of this object.
    • toXML

      public void toXML(StringBuilder buffer_)
      Description copied from interface: XMLable
      Appends an XML representation of this object (including all child objects) to the given buffer. Override for performance.
      Specified by:
      toXML in interface XMLable
      Parameters:
      buffer_ - The buffer on which to append the XML representation.
    • getInvalidReferences

      public boolean getInvalidReferences()
      Adds multiple instances of the given Appian type to the table of Appian-typed objects.
      Parameters:
      type_ - one of the AT_XXX constants
      ids_ - an array of integer primary keys of Appian objects
    • addAppianTypes

      public void addAppianTypes(Integer type_, Long[] ids_)
    • setDisplayName

      public void setDisplayName(Integer type_, Long id_, String display_)
    • setDisplayName

      public void setDisplayName(Integer type_, String id_, String display_)
    • addAppianType

      public void addAppianType(Integer type_, Long id_)
      Adds the primary key of the given Appian type to the table of Appian-typed objects.
      Parameters:
      type_ - one of the AT_XXX constants
      id_ - an integer primary key of an Appian object
    • addAppianTypes

      public void addAppianTypes(Integer type_, String[] ids_)
      Adds String primary keys to the cache for the given type.
      Parameters:
      type_ - one of the AT_XXX constants
      ids_ - array of String primary keys
    • addAppianType

      public void addAppianType(Integer type_, String id_)
      Adds a String primary key of the given Appian type to the table of Appian-typed objects.
      Parameters:
      type_ - one of the AT_XXX constants
      id_ - a String primary key of an Appian object
    • addAppianTypeOrTypes

      public void addAppianTypeOrTypes(int type_, boolean isMultiple_, Object value_)
    • getPopulatedTypes

      public Integer[] getPopulatedTypes()
      Retrieves the keys for the Appian types for which this cache has entries. If any calls to the addAppianType or addAppianTypes methods have been made with a key, the returned array will contain that key.
    • populate

      public com.appiancorp.process.design.validation.Errors populate(ServiceContext sc)
      Uses the given user to populate the display names.
    • populate

      public com.appiancorp.process.design.validation.Errors populate(ServiceContext sc, boolean includeCurrentUser_)
    • getAtcTypeForTypedVariableType

      public static Integer getAtcTypeForTypedVariableType(int type_)
      Utility method to retrieve the cache key for the given TypedVariable type.
      Parameters:
      type_ - one of the constants from TypedVariable
      Returns:
      the cache key for the given type. Arrays have the same key as their corresponding scalars.
      Throws:
      IllegalArgumentException - if type_is not a valid type.
      See Also:
    • getAllDisplayNames

      public String[] getAllDisplayNames(Locale l_)
    • getDisplayName

      public String getDisplayName(Long id_, Integer type_)
      Fetches the display name for the integer primary key of the given type.
      Parameters:
      id_ - an integer primary key
      type_ - one of the AT_XXX constants indicating an Appian type
      Returns:
      the display name for the Appian type object of the given type and with the given id, or null if no scuh object exists (or the display name has not been retrieved).
    • getDisplayNames

      public String[] getDisplayNames(Long[] ids_, Integer type_)
      Fetches the display names for the integer primary keys of the given type. Display names will be in the same order as the primary keys, and null will correspond to any primary key for which there is no display name in the cache.
      Parameters:
      ids_ - an array of integer primary keys
      type_ - one of the AT_XXX constants indicating an Appian type
    • getDisplayName

      public String getDisplayName(String id_, Integer type_)
      Fetches the display name for the string primary key of the given type.
      Parameters:
      id_ - a String primary key
      type_ - one of the AT_XXX constants indicating an Appian type
      Returns:
      the display name for the Appian type object of the given type and with the given id, or null if no scuh object exists (or the display name has not been retrieved).
    • getDisplayNames

      public String[] getDisplayNames(String[] ids_, Integer type_)
      Fetches the display names for the string primary keys of the given type. Display names will be in the same order as the primary keys, and null will correspond to any primary key for which there is no display name in the cache.
      Parameters:
      ids_ - an array of String primary keys
      type_ - one of the AT_XXX constants indicating an Appian type
    • getDisplayName

      public String getDisplayName(LocalObject lo_, Integer type_)
    • getDisplayNames

      public String[] getDisplayNames(LocalObject[] los_, Integer type_)
    • getDisplayNames

      public String[] getDisplayNames(Object id_, Integer type_)
    • getDisplayNames

      public String[] getDisplayNames(Object id_, Integer type_, boolean isMultiple)
    • getMap

      public Map getMap(Integer key_)
      Retreives the map of ids to display names for the given key.
      Parameters:
      key_ - one of the AT_XXX constants
      Returns:
      the corresponding map, never null
    • getFullMap

      public Map getFullMap()