com.ibm.commerce.tools.catalog.util

Class CategoryHelper

  • java.lang.Object
    • com.ibm.commerce.tools.catalog.util.CategoryHelper


  • public class CategoryHelper
    extends java.lang.Object
    CategoryHelper creates, updates, and deletes categories.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CategoryHelper() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addCategory(CommandContext cmdContext)
      Adds a category.
      void deleteCategory(java.lang.Long nCatalogId, java.lang.Long nCatgroupId, CommandContext cmdContext)
      Deletes a category.
      boolean getAllowDuplicatedName()
      Get the allow duplicate name flag.
      java.lang.Long getCatalogId()
      Get the catalog ID.
      java.lang.Long getCatgroupId()
      Get the catalog group ID.
      java.lang.Long getCatgroupIdParent()
      Get the parent catalog group ID.
      CommandContext getCommandContext()
      Get the command context.
      java.lang.String getKeyword() 
      void reset()
      Resets all instance variables to null.
      void setAllowDuplicatedName(boolean aboolAllowDuplicatedName)
      Set the allow duplicate name.
      void setCatalogId(java.lang.Long anCatalogId)
      Set the catalog ID.
      void setCatgroupId(java.lang.Long anCatgroupId)
      Set the catalog group ID.
      void setCatgroupIdParent(java.lang.Long anCatgroupIdParent)
      Set the parent catalog group ID.
      void setDescLanguage(java.lang.Integer anDescLanguage)
      Set the language id of the catalog group description.
      void setDisplay(java.lang.String astrDisplay)
      Set the display for the catalog group description.
      void setField1(java.lang.String astrField1)
      Set the field1 of the catalog group.
      void setField2(java.lang.String astrField2)
      Set the field2 of the catalog group.
      void setForContract(boolean bContract)
      Setter to indicate if the category is to be used in a contract.
      void setFullimage(java.lang.String astrFullimage)
      Set the path of the full image of catalog group description.
      void setIdentifier(java.lang.String astrIdentifier)
      Set the identifier of the catalog group.
      void setKeyword(java.lang.String istrKeyword)
      Set the keyword of the catalog group description.
      void setLongdescription(java.lang.String astrLongdescription)
      Set the long description of the catalog group description.
      void setMarkfordelete(java.lang.Integer anMarkfordelete)
      Set the markfordelete of the catalog group.
      void setName(java.lang.String astrName)
      Set the language dependent name of catalog group description.
      void setPublished(java.lang.Integer anPublished)
      Set the published flag of catalog group description.
      void setSequence(java.lang.Double adSequence)
      Sets the sequence.
      void setShortdescription(java.lang.String astrShortdescription)
      Set the short description of catalog group description.
      void setThumbnail(java.lang.String astrThumbnail)
      Set the path to the thumbnail image of the catalog group description.
      void setUpdateParentCategory(boolean bUpdate)
      Set the 'UpdateParentCategory' flag.
      void updateCategory(CommandContext cmdContext)
      Update a category.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CategoryHelper

        public CategoryHelper()
    • Method Detail

      • addCategory

        public void addCategory(CommandContext cmdContext)
                         throws ECException,
                                javax.ejb.RemoveException,
                                CatalogToolException
        Adds a category. The controller command CatalogGroupAddCmd is used to create the category. Before calling this method, uses the appropriate setters on CategoryHelper, including field1, field2, identifier, mark for delete, display, full image path, description language, long description, name, published flag, short description, thumbnail path, keyword, catalog ID, catalog group parent ID, and sequence number. so that CatalogGroupAddCmd executes without exceptions.
        Parameters:
        cmdContext - The CommandContext.
        Throws:
        ECException - If CatalogGroupAddCmd fails.
        javax.ejb.RemoveException - In the execution of the method, a RemoveException occurs.
        CatalogToolException - If we don't allow duplicate name and a duplicate name is detected.
      • deleteCategory

        public void deleteCategory(java.lang.Long nCatalogId,
                                   java.lang.Long nCatgroupId,
                                   CommandContext cmdContext)
                            throws ECException,
                                   javax.ejb.RemoveException,
                                   CatalogToolException
        Deletes a category. The CatalogGroupDeleteCmd will be called to deleted the category. To be successful, the setCatGroupId method should be called before this method. Product sets associated to the catalog and the category will also be removed.
        Parameters:
        nCatalogId - The catalog ID.
        nCatgroupId - The catalog group ID.
        cmdContext - The CommandContext.
        Throws:
        ECException - If CatalogGroupDeleteCmd fails.
        javax.ejb.RemoveException - In the execution of the method, a RemoveException occurs.
        CatalogToolException - if the "to be deleted" catalog group has catalog groups or catalog entries.
      • getCatalogId

        public java.lang.Long getCatalogId()
        Get the catalog ID.
      • getCatgroupId

        public java.lang.Long getCatgroupId()
        Get the catalog group ID.
      • getCatgroupIdParent

        public java.lang.Long getCatgroupIdParent()
        Get the parent catalog group ID.
      • getCommandContext

        public CommandContext getCommandContext()
        Get the command context.
      • getAllowDuplicatedName

        public boolean getAllowDuplicatedName()
        Get the allow duplicate name flag. The default is true.
        Returns:
        true if duplicate names are allowed, otherwise false.
      • reset

        public void reset()
        Resets all instance variables to null.
      • setAllowDuplicatedName

        public void setAllowDuplicatedName(boolean aboolAllowDuplicatedName)
        Set the allow duplicate name.
        Parameters:
        aboolAllowDuplicatedName - true to allow duplicate catalog group name, false otherwise.
      • setCatalogId

        public void setCatalogId(java.lang.Long anCatalogId)
        Set the catalog ID.
        Parameters:
        anCatalogId - The catalog ID.
      • setCatgroupId

        public void setCatgroupId(java.lang.Long anCatgroupId)
        Set the catalog group ID.
        Parameters:
        anCatgroupId - The catalog group ID.
      • setCatgroupIdParent

        public void setCatgroupIdParent(java.lang.Long anCatgroupIdParent)
        Set the parent catalog group ID.
        Parameters:
        anCatgroupIdParent - the parent catalog group ID.
      • setDescLanguage

        public void setDescLanguage(java.lang.Integer anDescLanguage)
                             throws ECException
        Set the language id of the catalog group description.
        Parameters:
        anDescLanguage - The language id of the catalog group description.
        Throws:
        ECException - If the CommandContext cannot return a language ID.
      • setDisplay

        public void setDisplay(java.lang.String astrDisplay)
        Set the display for the catalog group description.
        Parameters:
        astrDisplay - The display for the catalog group description.
      • setField1

        public void setField1(java.lang.String astrField1)
        Set the field1 of the catalog group.
        Parameters:
        astrField1 - The field1 of the catalog group.
      • setField2

        public void setField2(java.lang.String astrField2)
        Set the field2 of the catalog group.
        Parameters:
        astrField2 - The field2 of the catalog group.
      • setForContract

        public void setForContract(boolean bContract)
        Setter to indicate if the category is to be used in a contract. The default value is set to false.
        Parameters:
        bContract - true if the category is to be used in a contract; false otherwise.
      • setFullimage

        public void setFullimage(java.lang.String astrFullimage)
        Set the path of the full image of catalog group description.
        Parameters:
        astrFullimage - The path of the full image of catalog group description.
      • setIdentifier

        public void setIdentifier(java.lang.String astrIdentifier)
        Set the identifier of the catalog group.
        Parameters:
        astrIdentifier - The identifier of the catalog group.
      • setLongdescription

        public void setLongdescription(java.lang.String astrLongdescription)
        Set the long description of the catalog group description.
        Parameters:
        astrLongdescription - The long description of the catalog group description.
      • setMarkfordelete

        public void setMarkfordelete(java.lang.Integer anMarkfordelete)
        Set the markfordelete of the catalog group.
        Parameters:
        anMarkfordelete - The markfordelete of the catalog group.
      • setName

        public void setName(java.lang.String astrName)
        Set the language dependent name of catalog group description.
        Parameters:
        astrName - The language dependent name of catalog group description.
      • setPublished

        public void setPublished(java.lang.Integer anPublished)
        Set the published flag of catalog group description.
        Parameters:
        anPublished - 0 indicates "no"; otherwise 1 indicates "yes".
      • setSequence

        public void setSequence(java.lang.Double adSequence)
        Sets the sequence. The adSequence attribute below maps to the sequence field in one of the following tables: CATTOGRP, CATGRPREL. The table that is used depends on whether the category is a top category (CATTOGRP) or a sub-category (CATGRPREL). The logic that stores the sequence value determines which of these tables is appropriate to hold the relationship. Note that there is an inconsistent usage of the sequence field between the two tables. CATTOGRP specifies the sequence field to be nullable, while CATGRPREL uses a default of 0.0. Using a numeric sequence number rather than leaving the sequence empty is recommended and will ensure that there are no inconsistencies.
        Parameters:
        adSequence - The sequence number.
      • setShortdescription

        public void setShortdescription(java.lang.String astrShortdescription)
        Set the short description of catalog group description.
        Parameters:
        astrShortdescription - The short description of catalog group description.
      • setThumbnail

        public void setThumbnail(java.lang.String astrThumbnail)
        Set the path to the thumbnail image of the catalog group description.
        Parameters:
        astrThumbnail - The path to the thumbnail image of the catalog group description.
      • setUpdateParentCategory

        public void setUpdateParentCategory(boolean bUpdate)
        Set the 'UpdateParentCategory' flag. The default is false.
        Parameters:
        bUpdate - true to update the parent category; otherwise false.
      • updateCategory

        public void updateCategory(CommandContext cmdContext)
                            throws ECException,
                                   javax.ejb.RemoveException,
                                   CatalogToolException
        Update a category. The controller command CatalogGroupUpdateCmd is used to update the category. Before calling this method, uses the appropriate setters on CategoryHelper
        Parameters:
        cmdContext - The CommandContext.
        Throws:
        ECException - If the CatalogGroupUpdateCmd fails.
        javax.ejb.RemoveException - In the execution of the method, a RemoveException occurs.
        CatalogToolException - If we try to create an invalid paretn-child categories relationship (like a cycle)
      • getKeyword

        public java.lang.String getKeyword()
        Returns:
        Returns the keyword of the catalog group description.
      • setKeyword

        public void setKeyword(java.lang.String istrKeyword)
        Set the keyword of the catalog group description.
        Parameters:
        istrKeyword - The keyword of the catalog group description..