Interface CatalogTypeService

All Known Implementing Classes:
DefaultCatalogTypeService

public interface CatalogTypeService
Provides methods for using the catalog type system.
  • Method Details

    • isCatalogVersionAwareType

      boolean isCatalogVersionAwareType(String typeCode)
      Returns true if the given typeCode string represents a type that is catalog version aware.
      Parameters:
      typeCode - the typeCode of ComposedType
      Returns:
      false if the typeCode is not a catalog item type.
      Throws:
      IllegalArgumentException - if the typeCode is null.
      UnknownIdentifierException - if the typeCode does not correspond to a valid type.
    • getCatalogVersionContainerAttribute

      String getCatalogVersionContainerAttribute(String typeCode)
      Returns for the given typeCode the qualifier of the CatalogVersion attribute. This method will try to examine the given type for attribute where the CatalogVersion is stored and return it's qualifier.
      Parameters:
      typeCode - the typeCode of the target ComposedTypeModel
      Returns:
      the catalog version attribute qualifier
      Throws:
      IllegalArgumentException - if
      • the typeCode is null OR
      • corresponding type has no catalog version container attribute
      AmbiguousIdentifierException - - when more than one composed type for given typeCode is found.
      UnknownIdentifierException - - when no composed type for given typeCode is found.
    • getCatalogVersionUniqueKeyAttribute

      Set<String> getCatalogVersionUniqueKeyAttribute(String typeCode)
      Returns a set of attribute qualifiers by which an instance with the given typeCode can be identified as unique within any catalog version.
      Parameters:
      typeCode - the ComposedType's code
      Returns:
      an empty set if the given typeCode has no such attributes
      Throws:
      IllegalArgumentException - if the typeCode is null.
    • getCatalogVersionAwareModel

      ItemModel getCatalogVersionAwareModel(CatalogVersionModel version, String typeCode, Map<String,Object> uniqueKeyValues) throws CatalogAwareObjectResolvingException
      Returns for the given CatalogVersionModel, the typeCode and the map with the unique catalog key attributes and their values an ItemModel (or a given subtype).

      Please refer to getCatalogVersionUniqueKeyAttribute(String) to see how a set of the unique catalog key attributes for a given type can be recognized.

      If the version is not persisted or one of the uniqueKeyValues members is a non-persisted model, the method will throw CatalogAwareObjectResolvingException;

      Parameters:
      version - the CatalogVersionModel
      typeCode - String typeCode of the ComposedTypeModel
      uniqueKeyValues - a map with ALL unique catalog key attribute and their values to be searched for. Any non-unique catalog key attribute in the given map will be ignored.
      Returns:
      an ItemModel or a subtype of ItemModel which matches the given parameters OR null if any item model in the uniqueKeyValues map was not persisted yet.
      Throws:
      IllegalArgumentException - if:
      • the version is null
      • the typeCode is null
      • the uniqueKeyValues is null
      • the typeCode is not a catalog item type
      • if uniqueKeyValues map does not contain all unique attributes for the given catalog item type
      IllegalStateException - if:
      • the given typeCode has no unique catalog attributes defined
      • if a unique catalog key attribute is not searchable
      UnknownIdentifierException - if:
      • the given typeCode does not correspond to a system type
      AmbiguousIdentifierException - if:
      • the given typeCode corresponds to more than one system type
      CatalogAwareObjectResolvingException - if version in not persisted OR one of the unique parameters is a model and is not persisted.
    • getAllCatalogVersionAwareTypes

      Collection<ComposedTypeModel> getAllCatalogVersionAwareTypes(boolean supertypesOnly)
      Returns all composed types which are catalog version aware (or catalog contained).
      The method has two modes of operation:
      • If the supertypesOnly argument is false : all the types with ComposedTypeModel.CATALOGITEMTYPE equal TRUE will be returned.
      • If the supertypesOnly argument is true : the method will return all ComposedTypeModels which fulfill the following:
        • ComposedTypeModel.CATALOGITEMTYPE flag equal TRUE
        • super type is not catalog version aware OR super type is catalog version aware but it's unique attributes are different than unique attributes of the given type
      Parameters:
      supertypesOnly - if set to true only root types will be returned.
      Returns:
      collection of ComposedTypeModels which have ComposedTypeModel.CATALOGITEMTYPE equal TRUE.
    • isCatalogVersionAwareType

      boolean isCatalogVersionAwareType(ComposedTypeModel type)
      Checks if the given type is catalog version aware (catalog contained type).
      Parameters:
      type - target ComposedTypeModel
      Returns:
      boolean value
      Throws:
      IllegalArgumentException - if type is null.
    • isCatalogVersionAwareModel

      boolean isCatalogVersionAwareModel(ItemModel model)
      Checks if the given model is catalogVersion aware (catalog contained type).
      Parameters:
      model - the target item model
      Returns:
      boolean value
      Throws:
      IllegalArgumentException - if model is null.
    • getCatalogVersionForCatalogVersionAwareModel

      CatalogVersionModel getCatalogVersionForCatalogVersionAwareModel(ItemModel model)
      Retrieves the owning catalog version for a catalog version contained item model.
      Parameters:
      model - the target item model
      Throws:
      IllegalArgumentException - if model is null
      IllegalStateException - if
      • catalog version attribute was of unexpected type, or
      • the model given is not catalog version aware
      See Also:
    • getCatalogVersionOverview

      CatalogVersionOverview getCatalogVersionOverview(CatalogVersionModel catalogVersion)
      Collects all catalog version aware types, where at least one item exists, which belongs to given catalog version. Some statistics, like the amount of items per type are collected as well.
      Parameters:
      catalogVersion - the catalog version
      Returns:
      CatalogVersionOverview object