Class CatalogVersion

    • Constructor Detail

      • CatalogVersion

        public CatalogVersion()
    • Method Detail

      • 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
        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
      • setActive

        @Deprecated
        public void setActive​(SessionContext ctx,
                              java.lang.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
      • hasAgreement

        @Deprecated
        public boolean hasAgreement​(java.lang.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
        public boolean isImportedLanguage​(java.lang.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 java.util.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 java.util.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 java.util.Collection getKeywords​(java.lang.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 java.util.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 java.util.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 java.util.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
        public java.util.Collection<Product> getProducts​(java.lang.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
        public java.util.Collection<Product> getProducts​(SessionContext ctx,
                                                         java.lang.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
        public Product getProduct​(java.lang.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
        public Product getProduct​(SessionContext ctx,
                                  java.lang.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 java.util.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 java.util.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 java.util.Collection<Category> getCategories​(java.lang.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 java.util.Collection<Category> getCategories​(SessionContext ctx,
                                                            java.lang.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​(java.lang.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,
                                    java.lang.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,
                                      java.util.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​(java.util.List<Category> value)
      • ownsCategories

        protected boolean ownsCategories​(CatalogManager catalogManager,
                                         java.util.Collection categories)
      • owns

        protected boolean owns​(Category cat)
      • getAllCategories

        public java.util.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 java.util.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 java.util.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
        public java.util.Collection<Media> getMedias​(java.lang.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
        public java.util.Collection<Media> getMedias​(SessionContext ctx,
                                                     java.lang.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
        public Media getMedia​(java.lang.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
        public Media getMedia​(SessionContext ctx,
                              java.lang.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 java.util.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 java.util.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​(java.lang.Class itemclass,
                                                   int start,
                                                   int count)
      • getCatalogVersionItems

        public SearchResult getCatalogVersionItems​(SessionContext ctx,
                                                   java.lang.Class itemclass,
                                                   int start,
                                                   int count)
      • getSameProducts

        @Deprecated
        public java.util.Collection getSameProducts​(Product product)
        Deprecated.
        since ages - Products should have unique codes within catalog versions.
      • getSameProducts

        @Deprecated
        public java.util.Collection getSameProducts​(SessionContext ctx,
                                                    Product product)
        Deprecated.
        since ages - Products should have unique codes within catalog versions.
      • getSameCategories

        @Deprecated
        public java.util.Collection getSameCategories​(Category category)
        Deprecated.
        since ages - Categories should have unique codes within catalog versions.
      • getSameCategories

        @Deprecated
        public java.util.Collection getSameCategories​(SessionContext ctx,
                                                      Category category)
        Deprecated.
        since ages - Categories should have unique codes within catalog versions.
      • getSameKeywords

        public java.util.Collection getSameKeywords​(Keyword keyword)
      • getSameMedias

        public java.util.Collection getSameMedias​(Media media)
      • toString

        public java.lang.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:
        Object.toString()
      • getSyncJobs

        protected java.util.List getSyncJobs​(boolean asSource)
      • getSyncJobs

        protected java.util.List getSyncJobs​(SessionContext ctx,
                                             boolean asSource)
      • hasSynchronizations

        public boolean hasSynchronizations()
      • getDuplicateCatalogItemIDs

        public java.util.Set getDuplicateCatalogItemIDs​(SessionContext ctx,
                                                        java.lang.String itemTypeCode,
                                                        java.lang.String versionAttr,
                                                        java.lang.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