Class CatalogVersion

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
GeneratedClassificationSystemVersion

public class CatalogVersion extends GeneratedCatalogVersion
A CatalogVersion represents one specified version of a Catalog. A CatalogVersion is always part of a Catalog which can be accessed through GeneratedCatalogVersion.getCatalog().
See Also:
  • Field Details

  • Constructor Details

    • CatalogVersion

      public CatalogVersion()
  • Method Details

    • createItem

      protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
      Description copied from class: Item
      Has to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) during ComposedType.newInstance(Map).

      In case this method uses any of the attribute values during creation it is required to override Item.getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
      Sn example:

      
       public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
       ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
       man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
       // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
       SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
       super.getNonInitialAttributes( ctx, allAttributes );
       // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
      
       
      Overrides:
      createItem in class GeneratedCatalogVersion
      Parameters:
      ctx - the current session context which this item is created within
      type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
      Returns:
      the new item instance
      Throws:
      JaloBusinessException - indicates an error during creation - any changes will be rollbacked
    • remove

      public void remove(SessionContext ctx) throws ConsistencyCheckException
      Removing a category version is denied if
      • it's the active catalog version,
      • it still owns categories,
      • it still owns product or
      • it still owns keywords.
      Overrides:
      remove in class Item
      Parameters:
      ctx - A SessionContext object
      Throws:
      ConsistencyCheckException - if this item could not be removed for some reason
    • setCatalog

      @Deprecated(since="ages", forRemoval=false) protected void setCatalog(SessionContext ctx, Catalog param)
      Deprecated.
      since ages - Handled by Catalog-CatalogVersion relation modifiers (init=true, write=false).
      Description copied from class: GeneratedCatalogVersion
      Generated method - Setter of the CatalogVersion.catalog attribute.
      Overrides:
      setCatalog in class GeneratedCatalogVersion
      param - the catalog
    • checkRemovable

      protected void checkRemovable(SessionContext ctx) throws ConsistencyCheckException
      Description copied from class: Item
      Checks whether or not this it may be removed or not. Called before the actual removal process.
      Overrides:
      checkRemovable in class Item
      Throws:
      ConsistencyCheckException - to indicate that the item cannot be removed
    • isRemovable

      protected boolean isRemovable(SessionContext ctx, boolean throwException) throws ConsistencyCheckException
      Throws:
      ConsistencyCheckException
    • setActive

      @Deprecated(since="ages", forRemoval=false) public void setActive(SessionContext ctx, Boolean param)
      Deprecated.
      since ages - Use CatalogVersionModel.setActive(Boolean). CatalogVersionPrepareInterceptor will handle the corresponding logic.
      Superclass method overridden to make sure only one catalog version may be active within one catalog.
      Overrides:
      setActive in class GeneratedCatalogVersion
      param - the active - active flag
    • setActiveInternal

      protected void setActiveInternal(SessionContext ctx, Boolean param)
      Used by Catalog.setActiveCatalogVersion(SessionContext, CatalogVersion)to make sure the version is having the correct active flag when the catalog changes its active version.

      For internal use only!

    • hasAgreement

      @Deprecated(since="ages", forRemoval=false) public boolean hasAgreement(String id)
      Deprecated.
      since ages - Check CatalogVersionModel.getAgreements() instead
      Returns true if there exists an Agreementwith the specified id for this CatalogVersion, otherwise false is returned.
      Parameters:
      id - the id of the searched Agreement
      Returns:
      true if there exists an Agreementwith the specified id for this CatalogVersion, otherwise false is returned.
    • isImportedLanguage

      @Deprecated(since="ages", forRemoval=false) public boolean isImportedLanguage(String isoCode)
      Deprecated.
      since ages - Check if languagesCatalogVersionModel.getLanguages() contain the target language instead.
      If null is passed as isoCode, false is returned, otherwise true is returned, if the language with the submitted isocode is already imported for this CatalogVersion.
      Parameters:
      isoCode - the isocode of the language, for which it should be tested, if it is already imported.
      Returns:
      If null is passed as isoCode, false is returned, otherwise true is returned, if the language with the submitted isocode is already imported for this CatalogVersion
    • addLanguage

      public void addLanguage(Language language)
      Adds the specified Languageto the Collectionof imported languages.
      Parameters:
      language - the new language
    • getAllKeywords

      public Collection<Keyword> getAllKeywords()
      Returns a Collectionof all Keywords, which are assigned to this CatalogVersion.
      Returns:
      a Collectionof all Keywords, which are assigned to this CatalogVersion
    • getAllKeywords

      public Collection<Keyword> getAllKeywords(int start, int count)
      Returns a range of all Keywords, which are assigned to this CatalogVersion.
      Parameters:
      start - start index of range
      count - number of elements in the range
      Returns:
      a Collectionof all Keywords, which are assigned to this CatalogVersion
    • getAllKeywordCount

      public int getAllKeywordCount()
      Returns the number of Keywords which are assigned to this CatalogVersion.
      Returns:
      the number of Keywords which are assigned to this CatalogVersion
    • getAllKeywordCount

      public int getAllKeywordCount(SessionContext ctx)
      Returns the number of Keywords which are assigned to this CatalogVersion.
      Returns:
      the number of Keywords which are assigned to this CatalogVersion
    • getKeywords

      public Collection getKeywords(String keyword)
      Returns a Collectionof all Keywords with the specified keyword value GeneratedKeyword.getKeyword() which are assigned to this CatalogVersion.
      Parameters:
      keyword - the keyword value
      Returns:
      a Collectionof all Keywords with the specified keyword value GeneratedKeyword.getKeyword() which are assigned to this CatalogVersion
    • getAllProducts

      public Collection<Product> getAllProducts()
      Returns a Collectionof all Products, which are part of this CatalogVersion.
      Returns:
      a Collectionof all Products, which are part of this CatalogVersion
    • getAllProducts

      public Collection<Product> getAllProducts(int start, int count)
      Returns a range of all Products, which are assigned to this CatalogVersion.
      Parameters:
      start - start index of range
      count - number of elements in the range
      Returns:
      a Collectionof all Products, which are assigned to this CatalogVersion
    • getAllVisibleProducts

      public Collection getAllVisibleProducts(int start, int count)
      Returns all products which are visible to the current session user within this catalog version in a specified range.
      Parameters:
      start - the range start
      count - the range count
    • getAllProductCount

      public int getAllProductCount()
      Returns the number of Products which are assigned to this CatalogVersion.
      Returns:
      the number of Products which are assigned to this CatalogVersion
    • getAllProductCount

      public int getAllProductCount(SessionContext ctx)
      Returns the number of Products which are assigned to this CatalogVersion.
      Parameters:
      ctx - the SessionContext
      Returns:
      the number of Products which are assigned to this CatalogVersion
    • getAllVisibleProductCount

      public int getAllVisibleProductCount()
      Returns the number of Products which are visible for the current session user within this catalog version.
    • getProducts

      @Deprecated(since="ages", forRemoval=false) public Collection<Product> getProducts(String code)
      Deprecated.
      since ages - Code should be unique within catalogVersion. Use ProductService.getProduct(CatalogVersionModel, String) instead.
      Returns a Collectionof all Products, which are part of this CatalogVersion and whose code ( GeneratedProduct.getCode()) matches the specified code.
      Parameters:
      code - the code
      Returns:
      a Collectionof all Products, which are part of this CatalogVersion and whose code ( GeneratedProduct.getCode()) matches the specified code
    • getProducts

      @Deprecated(since="ages", forRemoval=false) public Collection<Product> getProducts(SessionContext ctx, String code)
      Deprecated.
      since ages - Code should be unique within catalogVersion. Use ProductService.getProduct(CatalogVersionModel, String) instead.
      Returns a Collectionof all Products, which are part of this CatalogVersion and whose code ( GeneratedProduct.getCode()) matches the specified code.
      Parameters:
      ctx - the SessionContext
      code - the code
      Returns:
      a Collectionof all Products, which are part of this CatalogVersion and whose code ( GeneratedProduct.getCode()) matches the specified code
    • getProduct

      @Deprecated(since="ages", forRemoval=false) public Product getProduct(String code)
      Deprecated.
      since ages - Use ProductService.getProduct(CatalogVersionModel, String) instead.
      Returns the Product with the specified code which is assigned to this CatalogVersion or null if no Product exists with this code. !Caution! This method should only be used if the product codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getProducts(SessionContext, String) .
      Parameters:
      code - the product code
      Returns:
      the Productwith the specified code which is assigned to this CatalogVersion or null if no Product exists with this code.
    • getProduct

      @Deprecated(since="ages", forRemoval=false) public Product getProduct(SessionContext ctx, String code)
      Deprecated.
      since ages - Use ProductService.getProduct(CatalogVersionModel, String) instead.
      Returns the Productwith the specified code which is assigned to this CatalogVersion or null if no Product exists with this code. !Caution! This method should only be used if the product codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getProducts(SessionContext, String) .
      Parameters:
      ctx - the SessionContext
      code - the product code
      Returns:
      the Productwith the specified code which is assigned to this CatalogVersion or null if no Product exists with this code.
    • getRootCategories

      public List<Category> getRootCategories(SessionContext ctx)
      Returns a Collectionof all root categories of this CatalogVersion.
      Parameters:
      ctx - the SessionContext
      Returns:
      a Collectionof all root categories of this CatalogVersion.
    • getRootCategories

      public List<Category> getRootCategories()
    • getRootCategoriesCount

      public int getRootCategoriesCount()
      Returns:
      the amount of root categories owned by this version
    • getRootCategoriesCount

      public int getRootCategoriesCount(SessionContext ctx)
      Parameters:
      ctx - the SessionContext
      Returns:
      the amount of root categories owned by this version
    • getCategories

      public Collection<Category> getCategories(String code)
      Returns a Collectionof all Categorys with the specified code, which belong to this CatalogVersion. The hierarchy of the CatalogCategory s will not be considered!
      Parameters:
      code - the code of the Category
      Returns:
      a Collectionof all Categorys with the specified code, which belong to this CatalogVersion
    • getCategories

      public Collection<Category> getCategories(SessionContext ctx, String code)
      Returns a Collectionof all Categorys with the specified code, which belong to this CatalogVersion. The hierarchy of the CatalogCategory s will not be considered!
      Parameters:
      ctx - the SessionContext
      code - the code of the Category
      Returns:
      a Collectionof all Categorys with the specified code, which belong to this CatalogVersion
    • getCategory

      public Category getCategory(String code)
      Returns the Categorywith the specified code which is assigned to this CatalogVersion or null if no CatalogCategory exists with this code. !Caution! This method should only be used if the category codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getCategories(SessionContext, String).
      Parameters:
      code - the category code
      Returns:
      the Categorywith the specified code which is assigned to this CatalogVersion or null if no CatalogCategory exists with this code.
    • getCategory

      public Category getCategory(SessionContext ctx, String code)
      Returns the Categorywith the specified code which is assigned to this CatalogVersion or null if no CatalogCategory exists with this code. !Caution! This method should only be used if the category codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getCategories(SessionContext, String).
      Parameters:
      ctx - the SessionContext
      code - the category code
      Returns:
      the Categorywith the specified code which is assigned to this CatalogVersion or null if no CatalogCategory exists with this code.
    • setRootCategories

      public void setRootCategories(SessionContext ctx, List<Category> categories) throws JaloInvalidParameterException
      Changes this catalog version's root categories. All previous root categories which are missing in the new category set are removed.
      Parameters:
      ctx - the SessionContext
      categories - the new root categories of this catalog version
      Throws:
      JaloInvalidParameterException - if at least one category is no root category, does not belong to this catalog version or a previous category could not be removed
    • setRootCategories

      public void setRootCategories(List<Category> value)
    • ownsCategories

      protected boolean ownsCategories(CatalogManager catalogManager, Collection categories)
    • owns

      protected boolean owns(Category cat)
    • owns

      protected boolean owns(CatalogManager catalogManager, Category cat)
    • getAllCategories

      public Collection<Category> getAllCategories()
      Returns all categories of this CatalogVersion as a Collectionignoring the category structure.
      Returns:
      all categories of this CatalogVersion as a Collectionignoring the category structure
    • getAllCategories

      public Collection<Category> getAllCategories(int start, int count)
      Returns a range of all categories of this CatalogVersion as a Collectionignoring the category structure.
      Parameters:
      start - start index of range
      count - number of elements in the range
      Returns:
      a range of all categories of this CatalogVersion as a Collectionignoring the category structure
    • getAllVisibleCategories

      public Collection getAllVisibleCategories(int start, int count)
      Returns all categories which are visible to the current session user within this catalog version in a specified range.
      Parameters:
      start - the range start
      count - the range count
    • getAllCategoryCount

      public int getAllCategoryCount()
      Returns the number of Categorys which are assigned to this CatalogCategory.
      Returns:
      the number of Categorys which are assigned to this CatalogCategory
    • getAllCategoryCount

      public int getAllCategoryCount(SessionContext ctx)
      Returns the number of Categorys which are assigned to this CatalogCategory.
      Parameters:
      ctx - the SessionContext
      Returns:
      the number of Categorys which are assigned to this CatalogCategory
    • getAllVisibleCategoryCount

      public int getAllVisibleCategoryCount()
      Returns the amount of all categories which are visible for the current session user within this catalog version.
    • getMedias

      @Deprecated(since="ages", forRemoval=false) public Collection<Media> getMedias(String code)
      Deprecated.
      since ages - Use MediaService.getMedia(CatalogVersionModel, String) instead.
      Returns a Collectionof all Medias with the specified code which are assigned to this CatalogVersion.
      Parameters:
      code - the code of the media
      Returns:
      a Collectionof all Medias with the specified code which are assigned to this CatalogVersion.
    • getMedias

      @Deprecated(since="ages", forRemoval=false) public Collection<Media> getMedias(SessionContext ctx, String code)
      Deprecated.
      since ages - Use MediaService.getMedia(CatalogVersionModel, String) instead.
      Returns a Collectionof all Medias with the specified code which are assigned to this CatalogVersion.
      Parameters:
      ctx - the SessionContext
      code - the code of the media
      Returns:
      a Collectionof all Medias with the specified code which are assigned to this CatalogVersion.
    • getMedia

      @Deprecated(since="ages", forRemoval=false) public Media getMedia(String code)
      Deprecated.
      since ages - Use MediaService.getMedia(CatalogVersionModel, String) instead.
      Returns the Mediawith the specified code which is assigned to this CatalogVersion or null if no Media with this code exists. !Caution! This method should only be used if the media codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getMedias(SessionContext, String).
      Parameters:
      code - the product code
      Returns:
      the Mediawith the specified code which is assigned to this CatalogVersion or null if no Media with this code exists.
    • getMedia

      @Deprecated(since="ages", forRemoval=false) public Media getMedia(SessionContext ctx, String code)
      Deprecated.
      since ages - Use MediaService.getMedia(CatalogVersionModel, String) instead.
      Returns the Mediawith the specified code which is assigned to this CatalogVersion or null if no Media with this code exists. !Caution! This method should only be used if the media codes are unique within the CatalogVersion, because this method simply returns the first element of the Collection returned by the method getMedias(SessionContext, String).
      Parameters:
      ctx - the SessionContext
      code - the product code
      Returns:
      the Mediawith the specified code which is assigned to this CatalogVersion or null if no Media with this code exists.
    • getAllMedias

      public Collection<Media> getAllMedias()
      Returns a Collectionof all Medias which are assigned to this CatalogVersion.
      Returns:
      a Collectionof all Medias with the specified code which are assigned to this CatalogVersion.
    • getAllMedias

      public Collection<Media> getAllMedias(int start, int count)
      Returns a range of all medias of this CatalogVersion as a Collection.
      Parameters:
      start - start index of range
      count - number of elements in the range
      Returns:
      a range of all medias of this CatalogVersion as a Collection
    • getAllMediaCount

      public int getAllMediaCount()
      Returns the number of Medias which are assigned to this CatalogCategory.
      Returns:
      the number of Medias which are assigned to this CatalogCategory
    • getCatalogVersionItems

      public SearchResult getCatalogVersionItems(Class itemclass, int start, int count)
    • getCatalogVersionItems

      public SearchResult getCatalogVersionItems(SessionContext ctx, Class itemclass, int start, int count)
    • getSameProducts

      @Deprecated(since="ages", forRemoval=false) public Collection getSameProducts(Product product)
      Deprecated.
      since ages - Products should have unique codes within catalog versions.
    • getSameProducts

      @Deprecated(since="ages", forRemoval=false) public Collection getSameProducts(SessionContext ctx, Product product)
      Deprecated.
      since ages - Products should have unique codes within catalog versions.
    • getSameCategories

      @Deprecated(since="ages", forRemoval=false) public Collection getSameCategories(Category category)
      Deprecated.
      since ages - Categories should have unique codes within catalog versions.
    • getSameCategories

      @Deprecated(since="ages", forRemoval=false) public Collection getSameCategories(SessionContext ctx, Category category)
      Deprecated.
      since ages - Categories should have unique codes within catalog versions.
    • getSameKeywords

      public Collection getSameKeywords(Keyword keyword)
    • getSameMedias

      public Collection getSameMedias(Media media)
    • toString

      public String toString()
      Description copied from class: Item
      Returns the String representation of this item. This is by default the representation of the primary key of this item.
      Overrides:
      toString in class Item
      Returns:
      the String representation of this item.
      See Also:
    • getSyncJobs

      protected List getSyncJobs(boolean asSource)
    • getSyncJobs

      protected List getSyncJobs(SessionContext ctx, boolean asSource)
    • hasSynchronizations

      public boolean hasSynchronizations()
    • getDuplicateCatalogItemIDs

      public Set getDuplicateCatalogItemIDs(SessionContext ctx, String itemTypeCode, String versionAttr, String idAttribute) throws JaloItemNotFoundException
      Located duplicate catalog item ids. The method uses the item type, a id attribute and the catalog version attribute which binds it to this catalog version.
      Parameters:
      ctx - the SessionContext
      itemTypeCode -
      versionAttr -
      idAttribute -
      Returns:
      a Set with duplicated catalog item IDs
      Throws:
      JaloItemNotFoundException
    • getDuplicatedCatalogItemsCount

      public long getDuplicatedCatalogItemsCount(SessionContext ctx, ComposedType type)
      Counts the duplicated items for the given CatalogVersion and ComposedType.
      Parameters:
      ctx - the SessionContext
      type - the ComposedType to look for duplicates
      Returns:
      0 if in the CatalogVersion for the given ComposedType no items exists which share the same unique identifier values
      Since:
      3.1-u7
    • setReadPrincipals

      public void setReadPrincipals(SessionContext ctx, List<Principal> param)
      Description copied from class: GeneratedCatalogVersion
      Generated method - Setter of the CatalogVersion.readPrincipals attribute.
      Overrides:
      setReadPrincipals in class GeneratedCatalogVersion
      param - the readPrincipals
    • setWritePrincipals

      public void setWritePrincipals(SessionContext ctx, List<Principal> param)
      Description copied from class: GeneratedCatalogVersion
      Generated method - Setter of the CatalogVersion.writePrincipals attribute.
      Overrides:
      setWritePrincipals in class GeneratedCatalogVersion
      param - the writePrincipals
    • setLanguages

      public void setLanguages(SessionContext ctx, Collection value)
      Description copied from class: GeneratedCatalogVersion
      Generated method - Setter of the CatalogVersion.languages attribute.
      Overrides:
      setLanguages in class GeneratedCatalogVersion
      value - the languages - languages
      See Also:
    • getDuplicateKeywords

      @Deprecated(since="ages", forRemoval=false) public Set getDuplicateKeywords(SessionContext ctx)
      Deprecated.
      since ages - usegetDuplicatedCatalogItemsCount(SessionContext, ComposedType) with the ComposedType 'Keyword' for checking/counting for duplicated entries.
    • getDuplicateMediaIDs

      @Deprecated(since="ages", forRemoval=false) public Set getDuplicateMediaIDs(SessionContext ctx)
      Deprecated.
      since ages - usegetDuplicatedCatalogItemsCount(SessionContext, ComposedType) with the ComposedType 'Media' for checking/counting for duplicated entries.
    • getDuplicateCategoryIDs

      @Deprecated(since="ages", forRemoval=false) public Set getDuplicateCategoryIDs(SessionContext ctx)
      Deprecated.
      since ages - usegetDuplicatedCatalogItemsCount(SessionContext, ComposedType) with the ComposedType 'Category' for checking/counting for duplicated entries.
    • getDuplicateProductIDs

      @Deprecated(since="ages", forRemoval=false) public Set getDuplicateProductIDs(SessionContext ctx)
      Deprecated.
      since ages - usegetDuplicatedCatalogItemsCount(SessionContext, ComposedType) with the ComposedType 'Product' for checking/counting for duplicated entries.