Interface TypeService

All Superinterfaces:
ContextSensitiveSingletonService, com.appiancorp.type.DataTypeProvider, com.appiancorp.type.ExtendedDataTypeProvider, Service

public interface TypeService extends ContextSensitiveSingletonService, com.appiancorp.type.ExtendedDataTypeProvider
  • Field Details

    • DEACTIVATE_SUCCESS

      static final Integer DEACTIVATE_SUCCESS
      Result code indicating that deactivation of a type was successful.
    • DEACTIVATE_INVALID

      static final Integer DEACTIVATE_INVALID
      Result code indicating that deactivation of a type could not occur because the type does not exist.
    • DEACTIVATE_NOT_ALLOWED

      static final Integer DEACTIVATE_NOT_ALLOWED
      Result code indicating that deactivation of a type was not allowed. System types cannot be deactivated.
    • DEACTIVATE_ALREADY_DEACTIVATED

      static final Integer DEACTIVATE_ALREADY_DEACTIVATED
      Result code indicating that a type could not be deactivated because it is already deactivated.
    • LISTS_NO_FILTERING

      static final int LISTS_NO_FILTERING
      Do not do any filtering of lists.
      See Also:
    • LISTS_FILTER_NON_EXPLICIT

      static final int LISTS_FILTER_NON_EXPLICIT
      Filter all lists except explicitly created lists (ie. lists created via 'xsd:list' in XSD).
      See Also:
    • LISTS_FILTER_ALL

      static final int LISTS_FILTER_ALL
      Filter all lists. No lists will be returned.
      See Also:
    • getType$UPDATES

      static final boolean getType$UPDATES
      See Also:
    • getTypeSafe$UPDATES

      static final boolean getTypeSafe$UPDATES
      See Also:
    • getTypes$UPDATES

      static final boolean getTypes$UPDATES
      See Also:
    • getDatatypeProperties$UPDATES

      static final boolean getDatatypeProperties$UPDATES
      See Also:
    • getInstanceProperties$UPDATES

      static final boolean getInstanceProperties$UPDATES
      See Also:
    • getTypesByNamespace$UPDATES

      static final boolean getTypesByNamespace$UPDATES
      See Also:
    • getTypesPaging$UPDATES

      static final boolean getTypesPaging$UPDATES
      See Also:
    • getTypesByParentPaging$UPDATES

      static final boolean getTypesByParentPaging$UPDATES
      See Also:
    • getTypesFilteredPaging$UPDATES

      static final boolean getTypesFilteredPaging$UPDATES
      See Also:
    • getTypesByParentFilteredPaging$UPDATES

      static final boolean getTypesByParentFilteredPaging$UPDATES
      See Also:
    • getSystemTypes$UPDATES

      static final boolean getSystemTypes$UPDATES
      See Also:
    • getSystemTypesByParent$UPDATES

      static final boolean getSystemTypesByParent$UPDATES
      See Also:
    • setVisibilityForType$UPDATES

      static final boolean setVisibilityForType$UPDATES
      See Also:
    • setVisibilityForTypes$UPDATES

      static final boolean setVisibilityForTypes$UPDATES
      See Also:
    • suggest$UPDATES

      static final boolean suggest$UPDATES
      See Also:
    • getInstancePropertyTypesRecursive$UPDATES

      static final boolean getInstancePropertyTypesRecursive$UPDATES
      See Also:
    • getReferencedTypes$UPDATES

      static final boolean getReferencedTypes$UPDATES
      See Also:
    • getTypeByQualifiedName$UPDATES

      static final boolean getTypeByQualifiedName$UPDATES
      See Also:
    • getTypeByQualifiedNames$UPDATES

      static final boolean getTypeByQualifiedNames$UPDATES
      See Also:
    • cast$UPDATES

      static final boolean cast$UPDATES
      See Also:
    • select$UPDATES

      static final boolean select$UPDATES
      See Also:
    • update$UPDATES

      static final boolean update$UPDATES
      See Also:
    • delete$UPDATES

      static final boolean delete$UPDATES
      See Also:
    • insert$UPDATES

      static final boolean insert$UPDATES
      See Also:
    • deactivateTypes$UPDATES

      static final boolean deactivateTypes$UPDATES
      See Also:
    • getTypeByExternalTypeId$UPDATES

      static final boolean getTypeByExternalTypeId$UPDATES
      See Also:
    • getWSDLTypes$UPDATES

      static final boolean getWSDLTypes$UPDATES
      See Also:
    • getDirectlyReferencedTypes$UPDATES

      static final boolean getDirectlyReferencedTypes$UPDATES
      See Also:
  • Method Details

    • getType

      Datatype getType(Long typeId) throws InvalidTypeException
      Get Datatype from server. The Datatype is immutable (save for explicitly declared mutable properties), so it may be cached safely in Java for efficiency.
      Specified by:
      getType in interface com.appiancorp.type.DataTypeProvider
      Specified by:
      getType in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      typeId -
      Returns:
      the datatype
      Throws:
      InvalidTypeException - if there is no type with that id.
    • getTypeSafe

      @Deprecated Datatype getTypeSafe(Long typeId)
      Deprecated.
      use getType(Long) instead.
      Get Datatype from server. The Datatype is immutable (save for explicitly declared mutable properties), so it may be cached safely in Java for efficiency. Use this instead of getType(Long) when the typeId has been validated
      Specified by:
      getTypeSafe in interface com.appiancorp.type.DataTypeProvider
      Specified by:
      getTypeSafe in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      typeId -
      Returns:
      the datatype
      Throws:
      IllegalArgumentException - if there is no type with that id.
    • getTypes

      Datatype[] getTypes(Long[] typeIds_) throws InvalidTypeException
      Get datatypes from the server. The Datatype objects are immutable (save for explicitly declared mutable properties), so they may be cached safely in Java for efficiency.
      Specified by:
      getTypes in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      typeIds_ -
      Returns:
      the datatypes
      Throws:
      InvalidTypeException - if any of the types do not exist
    • getDatatypeProperties

      DatatypeProperties getDatatypeProperties(Long typeId) throws InvalidTypeException
      Get DatatypeProperties from server.
      Specified by:
      getDatatypeProperties in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      typeId -
      Returns:
      the datatype
      Throws:
      InvalidTypeException - if there is no type with that id.
    • getInstanceProperties

      NamedTypedValue[] getInstanceProperties(Long typeId) throws InvalidTypeException
      Gets the instance properties for the given type
      Parameters:
      typeId - a type id
      Returns:
      an array of instance properties
      Throws:
      InvalidTypeException - if the type does not exist
    • getTypesByNamespace

      Datatype[] getTypesByNamespace(String namespace)
      Retrieves an array of datatypes with the given namespace.
      Parameters:
      namespace - the namespace in which the datatype resides
      Returns:
      an array of datatypes
    • getTypesByNamespace

      @Deprecated Datatype[] getTypesByNamespace(String namespace, TypedValue parent)
      Deprecated.
      Retrieves an array of datatypes with the given namespace and parent.
      Parameters:
      namespace - the namespace in which the datatype resides
      parent - the parent of the datatype, or null for all datatypes
      Returns:
      an array of datatypes
    • getTypesPaging

      ResultPage getTypesPaging(int startIndex, int batchSize, Integer sortProperty, Integer sortOrder)
      Retrieves all the datatypes.
      Parameters:
      startIndex - The index into the collection of total results at which to start. Negative numbers are treated as zeros.
      batchSize - The number of results to return. Use Constants.COUNT_ALL to return the entire collection, but this is STRONGLY discouraged.
      sortProperty - The property by which the results will be sorted. This is one of the SORT_BY_XXX constants located in Datatype
      sortOrder - the order in which to sort the results. This is either Constants.SORT_ORDER_ASCENDING or Constants.SORT_ORDER_DESCENDING
      Returns:
      A ResultPage containing Datatype objects.
    • getTypesByParentPaging

      @Deprecated ResultPage getTypesByParentPaging(TypedValue parent, int startIndex, int batchSize, Integer sortProperty, Integer sortOrder)
      Retrieves datatypes under a given parent.
      Parameters:
      parent - The parent of the datatype, or null for all datatypes.
      startIndex - The index into the collection of total results at which to start. Negative numbers are treated as zeros.
      batchSize - The number of results to return. Use Constants.COUNT_ALL to return the entire collection, but this is STRONGLY discouraged.
      sortProperty - The property by which the results will be sorted. This is one of the SORT_BY_XXX constants located in Datatype
      sortOrder - the order in which to sort the results. This is either Constants.SORT_ORDER_ASCENDING or Constants.SORT_ORDER_DESCENDING
      Returns:
      A ResultPage containing Datatype objects.
    • getTypesFilteredPaging

      ResultPage getTypesFilteredPaging(int excludeFlags, int listsFilteringMode, int startIndex, int batchSize, Integer sortProperty, Integer sortOrder)
      Retrieves all the datatypes allowing custom filtering. If 0 is passed in for excludeFlags and LISTS_NO_FILTERING is passed in for listsFilteringMode, the data returned is exactly the same as when calling getTypesPaging(int, int, java.lang.Integer, java.lang.Integer). Specifying other values for excludeFlags and listsFilteringMode allows doing additional filtering on the data; for example, to retrieve all types that are not hidden and not lists, call: getTypesFilteredPaging(Datatype.FLAG_HIDDEN, true, ...)
      Parameters:
      excludeFlags - A mask (such as Datatype.FLAG_SYSTEM | Datatype.FLAG_HIDDEN) allowing datatypes with particular flags to be filtered out. Pass in 0 to not do any flag-based filtering.
      listsFilteringMode - One of the LISTS_XXX constants of this interface
      startIndex - The index into the collection of total results at which to start. Negative numbers are treated as zeros.
      batchSize - The number of results to return. Use Constants.COUNT_ALL to return the entire collection, but this is STRONGLY discouraged.
      sortProperty - The property by which the results will be sorted. This is one of the SORT_BY_XXX constants located in Datatype
      sortOrder - the order in which to sort the results. This is either Constants.SORT_ORDER_ASCENDING or Constants.SORT_ORDER_DESCENDING
      Returns:
      A ResultPage containing Datatype objects.
    • getTypesFilteredPaging

      ResultPage getTypesFilteredPaging(int excludeFlags, int listsFilteringMode, Long[] foundationTypes, int startIndex, int batchSize, Integer sortProperty, Integer sortOrder)
      Retrieves all the datatypes allowing custom filtering. Specifying values for excludeFlags and listsFilteringMode allows doing filtering on the data; for example, to retrieve all types that are not hidden and not lists, call: getTypesFilteredPaging(Datatype.FLAG_HIDDEN, true, ...)

      In addition, a list of datatypes can be provided in order to constrain the resulting list of types to those that have a foundation contained in the given list.

      Parameters:
      excludeFlags - A mask (such as Datatype.FLAG_SYSTEM | Datatype.FLAG_HIDDEN) allowing datatypes with particular flags to be filtered out. Pass in 0 to not do any flag-based filtering.
      listsFilteringMode - One of the LISTS_XXX constants of this interface
      foundationTypes - The list of types returned will all satisfy the constraint that their foundation types will be listed in this array.
      startIndex - The index into the collection of total results at which to start. Negative numbers are treated as zeros.
      batchSize - The number of results to return. Use Constants.COUNT_ALL to return the entire collection, but this is STRONGLY discouraged.
      sortProperty - The property by which the results will be sorted. This is one of the SORT_BY_XXX constants located in Datatype
      sortOrder - the order in which to sort the results. This is either Constants.SORT_ORDER_ASCENDING or Constants.SORT_ORDER_DESCENDING
      Returns:
      A ResultPage containing Datatype objects.
    • getTypesByParentFilteredPaging

      @Deprecated ResultPage getTypesByParentFilteredPaging(TypedValue parent, int excludeFlags, int listsFilteringMode, int startIndex, int batchSize, Integer sortProperty, Integer sortOrder)
      Retrieves datatypes under a given parent allowing custom filtering. If 0 is passed in for excludeFlags and LISTS_NO_FILTERING is passed in for listsFilteringMode, the data returned is exactly the same as when calling getTypesByParentPaging(com.appiancorp.suiteapi.type.TypedValue, int, int, java.lang.Integer, java.lang.Integer). Specifying other values for excludeFlags and listsFilteringMode allows doing additional filtering on the data; for example, to retrieve all types that are not hidden and not lists, call: getTypesByParentFilteredPaging(null, Datatype.FLAG_HIDDEN, true, ...)
      Parameters:
      parent - The parent of the datatype, or null for all datatypes.
      excludeFlags - A mask (such as Datatype.FLAG_SYSTEM | Datatype.FLAG_HIDDEN) allowing datatypes with particular flags to be filtered out. Pass in 0 to not do any flag-based filtering.
      listsFilteringMode - One of the LISTS_XXX constants of this interface
      startIndex - The index into the collection of total results at which to start. Negative numbers are treated as zeros.
      batchSize - The number of results to return. Use Constants.COUNT_ALL to return the entire collection, but this is STRONGLY discouraged.
      sortProperty - The property by which the results will be sorted. This is one of the SORT_BY_XXX constants located in Datatype
      sortOrder - the order in which to sort the results. This is either Constants.SORT_ORDER_ASCENDING or Constants.SORT_ORDER_DESCENDING
      Returns:
      A ResultPage containing Datatype objects.
    • getSystemTypes

      Datatype[] getSystemTypes()
      Retrieves all system datatypes.
      Returns:
      a list of datatypes
    • getSystemTypesByParent

      @Deprecated Datatype[] getSystemTypesByParent(TypedValue parent)
      Deprecated.
      Retrieves all system datatypes under the given parent.
      Parameters:
      parent - The parent of the datatype, or null for all datatypes
      Returns:
      a list of datatypes
    • setVisibilityForType

      void setVisibilityForType(Long typeId_, boolean visible_) throws InvalidTypeException
      Sets the visibility for a type. If the visible_ parameter is true, then the type will be made visible (the DataTypeProperties.FLAG_HIDDEN flag will be removed) and if the type is temporary, then it will be made permanent (the DataTypeProperties.FLAG_TEMPORARY flag will be removed). If the visible_ parameter is false, the type will be made hidden. This method is not safe for clustered appservers due to Datatype caching; another communication mechanism must be used to communicate this information to the other clustered appservers' Datatype caches.
      Parameters:
      typeIds_ - the types to modify
      visible_ - whether or not to make the types visible
      Throws:
      InvalidTypeException - if any of the types do not exist
    • setVisibilityForTypes

      void setVisibilityForTypes(Long[] typeIds_, boolean visible_) throws InvalidTypeException
      Sets the visibility for an array of types. If the visible_ parameter is true, then all types will be made visible (the DataTypeProperties.FLAG_HIDDEN flag will be removed) and any temporary types will be made permanent (the DataTypeProperties.FLAG_TEMPORARY flag will be removed). If the visible_ parameter is false, all types will be made hidden. This method is not safe for clustered appservers due to Datatype caching; another communication mechanism must be used to communicate this information to the other clustered appservers' Datatype caches.
      Parameters:
      typeIds_ - the types to modify
      visible_ - whether or not to make the types visible
      Throws:
      InvalidTypeException - if any of the types do not exist
    • suggest

      String suggest(String query_, int maxItems_, SuggestParam[] params_, Boolean groupResults_)
      Queries for content and returns a JSON formatted string to be used by autocomplete.
      Parameters:
      query_ - query
      maxItems_ - max number of items to return
      params_ - list of information on what is being suggested and what format the results should be in. valid types are rules.
      groupResults_ - if specifying more than one SuggestParam, would you like to group the results by type, or mixed together and sorted? Default is true. If grouped, order of types matches the order of the suggestParams passed in.
      Returns:
      a JSON formatted string
    • suggest

      String suggest(String query_, int maxItems_, SuggestParam[] params_, Boolean groupResults_, Long[] allowList)
      Queries for content and returns a JSON formatted string to be used by autocomplete.
      Parameters:
      query_ - query
      maxItems_ - max number of items to return
      params_ - list of information on what is being suggested and what format the results should be in. valid types are rules.
      groupResults_ - if specifying more than one SuggestParam, would you like to group the results by type, or mixed together and sorted? Default is true. If grouped, order of types matches the order of the suggestParams passed in.
      allowList - list of IDs that will be automatically added to returned results, filtered by query. Ignored if null or empty.
      Returns:
      a JSON formatted string
    • getInstancePropertyTypesRecursive

      Set<Long> getInstancePropertyTypesRecursive(Long typeId_) throws InvalidTypeException
      Returns a Set containing all type ids (as java.lang.Long objects) referenced by the given type. The referenced types include the types of its instance properties, as well as their instance properties, and so on.
      Parameters:
      typeId_ - The type for which we want all referenced types
      Returns:
      the referenced types
      Throws:
      InvalidTypeException
    • getReferencedTypes

      List<Datatype> getReferencedTypes(Long typeId_) throws InvalidTypeException
      Returns a list containing the given datatype and all datatypes referenced by it. The referenced types include all types referenced in one of the following ways: (1) instance properties, (2) list item type, (3) base type of a derived type. Referenced types recursively include all types referenced by the references of the given type. However, the returned list does not contain any duplicate entries.
      Parameters:
      typeId_ - the target datatype id
      Returns:
      a List of Datatype objects
      Throws:
      InvalidTypeException
    • getReferencedTypes

      List<Datatype> getReferencedTypes(Long[] typeIds_) throws InvalidTypeException
      Returns a list containing the given datatypes and all datatypes referenced by them. The referenced types include all types referenced in one of the following ways:
      1. instance properties
      2. list item type
      3. list type
      4. base type of a derived type
      . Referenced types recursively include all types referenced by the references of the given types. However, the returned list does not contain any duplicate entries.
      Parameters:
      typeId_ - the target datatype ids
      Returns:
      a List of Datatype objects
      Throws:
      InvalidTypeException
    • getTypeByQualifiedName

      Datatype getTypeByQualifiedName(QName qName_)
      Gets the current version of a type, given a QName.
      Specified by:
      getTypeByQualifiedName in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      qName_ - The QName that identifies the type. The namespaceURI and localPart must be set. Prefix is ignored.
      Returns:
      the current version of the datatype, or null if there is no type corresponding to the parameters
    • getTypeByQualifiedName

      @Deprecated Datatype getTypeByQualifiedName(QName qName_, TypedValue parent_)
      Gets the current version of a type, given a QName and parent.
      Parameters:
      qName_ - The QName that identifies the type. The namespaceURI and localPart must be set. Prefix is ignored.
      parent - the parent of the datatype, or null for all datatypes
      Returns:
      the current version of the datatype, or null if there is no type corresponding to the parameters
    • getTypeByQualifiedNames

      Datatype[] getTypeByQualifiedNames(QName[] qName_)
      Gets the current version of a list of types, given a list of QName.
      Specified by:
      getTypeByQualifiedNames in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      qName_ - The QName list that identifies the types. For each element the namespaceURI and localPart must be set. Prefix is ignored.
      Returns:
      the current version of the list of datatypes, or null if there is no type corresponding to the parameters
    • getTypeByQualifiedNames

      @Deprecated Datatype[] getTypeByQualifiedNames(QName[] qName_, TypedValue parent_)
      Gets the current version of a list of types, given a list of QName.
      Parameters:
      qName_ - The QName that identifies the type. The namespaceURI and localPart must be set. Prefix is ignored.
      parent - the parent of the datatypes, or null for all datatypes
      Returns:
      the current version of the list of datatypes, or null if there is no type corresponding to the parameters
    • cast

      TypedValue cast(Long toTypeId, TypedValue value)
      Cast a TypedValue to another type, if possible, returning the new TypedValue.
      Parameters:
      toTypeId -
      value -
      Returns:
      Throws:
      ClassCastException - if the cast is invalid
    • select

      TypedValue select(TypedValue data, TypedValue[] indices)
      Select an item of data from a TypedValue by indices.
      Parameters:
      data - Data from which the value is selected.
      indices - Typically, indices will be either integer (based at 1) for lists, list of integer (based at 1) for lists, or string for records. Each successive index digs deeper into records.
      Returns:
      TypedValue of selected data.
    • update

      TypedValue update(TypedValue data, TypedValue[] indices, TypedValue assignValue)
      Update a value at indices from data.
      Parameters:
      data - Data from which the value is selected.
      indices - Typically, indices will be either integer (based at 1) for lists, list of integer (based at 1) for lists, or string for records. Each successive index digs deeper into records.
      assignValue -
      Returns:
    • delete

      TypedValue delete(TypedValue data, TypedValue[] indices)
      Delete a value at indices from data.
      Parameters:
      data - Data from which the value is deleted.
      indices - Typically, indices will be either integer (based at 1) for lists, list of integer (based at 1) for lists, or string for records. Each successive index digs deeper into records.
      Returns:
    • insert

      TypedValue insert(TypedValue data, TypedValue[] indices, TypedValue insertValue)
      Insert a value at indices into data.
      Parameters:
      data - Data into which the value is selected.
      indices - Typically, indices will be either integer (based at 1) for lists, list of integer (based at 1) for lists, or string for records. The insertion point is before the index. Each successive index digs deeper into records.
      insertValue -
      Returns:
    • deactivateTypes

      ResultList deactivateTypes(Long[] typeIds) throws PrivilegeException
      Deactivates each of the specified types, if possible. System types cannot be deactivated. The following actions are taken for each type that can be deactivated. The flag DataTypeProperties.FLAG_DEACTIVATED is added for the type. The type's qualified name (returned by DatatypeProperties.getQualifiedName()) will have its local part modified to "[OriginalLocalPart]^n" where 'n' is the next number in the sequence of deleted types with the same qualified name. If the local part is blank, no change will be made. If not blank, the type's name (returned by DatatypeProperties.getName()) will be modified to "[OriginalTypeName]^n" where 'n' is the same value as that appended to the local part of the qualified name. Except for invalid and system types passed in, the list type of each specified type will be deactivated as well.
      Parameters:
      typeIds - the types to deactivate
      Returns:
      a ResultList. ResultList.getResultCodes() will return the result codes corresponding to the type ids passed in, followed by the codes corresponding to automatic deactivations (ie. lists). The DEACTIVATE_XXX constants of this interface make up the possible result codes. Result.getResults() will return a Datatype[] of the same length as the result codes. The value at each index will be either the up-to-date Datatype or null for invalid type ids.
      Throws:
      PrivilegeException - if the user does not have sufficient privileges to deactivate types. Only system administrators can deactivate types.
    • getTypeByExternalTypeId

      Datatype getTypeByExternalTypeId(String externalTypeId)
      Gets the datatype corresponding to an external type id.
      Specified by:
      getTypeByExternalTypeId in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      externalTypeId - the external type id that identifies the type. It cannot be null.
      Returns:
      the type corresponding to the parameters, or null if there is no such type
    • getWSDLTypes

      Long[] getWSDLTypes()
      Gets WSDL type ids and their dependents.
      Returns:
      a list of type ids of WSDL types and their dependents
    • getTypeByExternalTypeId

      @Deprecated Datatype getTypeByExternalTypeId(String externalTypeId, TypedValue parent)
      Gets the datatype corresponding to an external type id and parent.
      Parameters:
      externalTypeId - the external type id that identifies the type. It cannot be null.
      parent - the parent of the datatype, or null for all datatypes
      Returns:
      the type corresponding to the parameters, or null if there is no such type
    • getDirectlyReferencedTypes

      List<Datatype> getDirectlyReferencedTypes(Long... typeIds)
      Returns a list containing all datatypes directly referenced by the given datatypes. The referenced types include all types referenced in one of the following ways:
      1. instance properties
      2. list item type
      3. list type
      4. base type of a derived type
      5. union types
      Specified by:
      getDirectlyReferencedTypes in interface com.appiancorp.type.ExtendedDataTypeProvider
      Parameters:
      typeIds - target datatypes
      Returns:
      list of datatype objects