Class Keyword

All Implemented Interfaces:
CatalogItem<Keyword>, Serializable, Comparable
Direct Known Subclasses:
GeneratedClassificationKeyword

public class Keyword extends GeneratedKeyword implements CatalogItem<Keyword>
A keyword can be used to allow convenient searches on catalog elements. Keywords are be bound to the catalog elements Categoryand Product
See Also:
  • Constructor Details

    • Keyword

      public Keyword()
  • 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 GenericItem
      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
    • 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.
    • getIDAttributeQualifier

      public String getIDAttributeQualifier()
      Description copied from interface: CatalogItem
      Must provide the attribute qualifier of the attribute holding the unique id of this item.
      Specified by:
      getIDAttributeQualifier in interface CatalogItem<Keyword>
    • getCatalogVersionAttributeQualifier

      public String getCatalogVersionAttributeQualifier()
      Description copied from interface: CatalogItem
      Must provide the attribute qualifier of the attribute holding the catalog version which this item belongs to.
      Specified by:
      getCatalogVersionAttributeQualifier in interface CatalogItem<Keyword>
    • getCounterpartItem

      public Keyword getCounterpartItem(CatalogVersion targetVersion)
      Description copied from interface: CatalogItem
      Optionally finds potential copies of this item within a synchronization target version. This applies to catalog items which have not been synchronized before but nevertheless already exist in both version and must be matched to avoid duplicates.

      Hint: Usually this can be easily implemented by searching for a item with he same id within the target version.

      Specified by:
      getCounterpartItem in interface CatalogItem<Keyword>
    • getCatalogItemID

      public String getCatalogItemID()
      Description copied from interface: CatalogItem
      Returns the unique id of this item. This id is unique within its enclosing catalog version only - other catalog versions may own items with the same id ( usually copies of this one ).
      Specified by:
      getCatalogItemID in interface CatalogItem<Keyword>
    • setCatalogVersion

      public void setCatalogVersion(SessionContext ctx, CatalogVersion catalogVersion)
      Assigns the Keyword to a new CatalogVersion. The read-only attribute catalog is automatically updated!
      Overrides:
      setCatalogVersion in class GeneratedKeyword
      Parameters:
      ctx - the SessionContext which will be used.
      catalogVersion - the new CatalogVersion.
    • getProductsCount

      public long getProductsCount(SessionContext ctx)
      Overrides:
      getProductsCount in class GeneratedKeyword
      Parameters:
      ctx - the session context to define localization
      Returns:
      the amount of products described by this keyword. note that the product set is localized.
    • getCategoriesCount

      public long getCategoriesCount(SessionContext ctx)
      Overrides:
      getCategoriesCount in class GeneratedKeyword
      Parameters:
      ctx - the session context to define localization
      Returns:
      the amount of categories described by this keyword. note that the category set is localized.