com.ibm.commerce.giftregistry.beans

Class GiftRegistrySearchDataBeanBase

  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, java.io.Serializable
    Direct Known Subclasses:
    GiftRegistrySearchDataBean


    public class GiftRegistrySearchDataBeanBase
    extends SmartDataBeanImpl
    implements SmartDataBean, InputDataBean
    Populates a list with gift registries found in the database according to at least the following parameters:
    • userId
    • firstName
    • lastName
    • email1
    • eventMonth
    • eventYear
    • eventDay
    • state
    • country
    • externalId
    • eventType_id

    Variables that can be set include:
    • startIndex
    • maxResultsPerPage

    This bean generates a prepareStatement to perform a search for gift registries. A valid storeId must be found in the context.

    When the above parameters are set, the caller should call getRegistries() to conduct a search and retrieve a list of GiftRegistryDataBeans, or call findGiftRegistries() to get a list of GiftRegistryId found.

    If setFindSimilarMatches is set to false, an exact search will be conducted on the firstName and lastName fields only.

    If setFindSimilarMatches is set to true, a LIKE search will be conducted on the firstName and lastName fields. If supported by the database, a SOUNDEX search will also be run on the firstName and lastName fields.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASSNAME
      The Classname.
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      CommandContext getCommandContext()
      Gets the command context set within this bean.
      java.lang.String getCountry()
      Gets the country being searched on if set.
      int getCurrentPageNumber()
      Returns the current page number in the result set (based on page size -- if page size is zero or null, this function returns 1)
      java.lang.String getEmail1()
      Gets an email address being searched on if set.
      int getEndIndex()
      Returns the end index for the result set on the page.
      java.lang.String getEventDay()
      Gets the event day being searched on if set.
      java.lang.String getEventMonth()
      Gets the event month being searched on if set.
      java.lang.String getEventTypeId()
      Gets the ID of the gift registry's event type
      java.lang.String getEventYear()
      Gets the event year being searched on if set.
      java.lang.String getExternalId()
      Gets the gift registry externalId being searched on if set.
      boolean getFindSimilarMatches()
      Gets similar search result value.
      java.lang.String getFirstName()
      Gets the first name being searched on if set.
      int[] getGuestOption()
      Gets the guestOption of a gift registry to search for.
      java.lang.String getLastName()
      Gets the last name being searched on if set.
      java.lang.String getMaxResultsPerPage()
      Gets the maximum results to display per page.
      int getNumberOfResultsOnPage()
      Returns the number of results that are available on this particular page.
      GiftRegistryDataBean[] getRegistries()
      Returns matches for the specified search criteria
      TypedProperty getRequestProperties()
      Returns the request properties of the data bean.
      int getResultCount()
      Returns the total number of results that were found matching the query specified.
      java.lang.String getSortBy()
      An integer index into the following list of sortable criteria supported in this bean.
      java.lang.String getSortByFieldName()
      Gets the sortBy field name
      java.lang.String getSortByTableName()
      Gets the Sort By table name
      java.lang.String getSortByType()
      Gets the registrant type used for the sorting.
      java.lang.String getStartIndex()
      Gets the index of the first search result returned
      java.lang.String getState()
      Gets the state to be searched on if set
      int[] getStatus()
      Gets the status of a gift registry to search for.
      java.lang.String getStoreId()
      Gets the storeId to run the search against
      int getTotalPages()
      Returns the number of pages that are in this result count.
      int[] getType()
      Gets the type of a gift registry to search for.
      java.lang.String getUserId()
      Gets the userId being searched on if set.
      boolean isFindSimilarMatches()
      Returns true if this bean is set to search for similar results.
      boolean isNextPageExists()
      Determines whether a next page of data exists
      boolean isPreviousPageExists()
      Determines whether a previous page of data exists
      void populate()
      Populates the data bean
      void setCommandContext(CommandContext commandContext)
      Sets the command context.
      void setCountry(java.lang.String string)
      Sets the country to be searched on if set
      void setEmail1(java.lang.String string)
      Sets an e-mail address to be searched on
      void setEventDay(java.lang.String string)
      Sets the country to be searched on if set
      void setEventMonth(java.lang.String string)
      Sets the event month to be searched on if set
      void setEventTypeId(java.lang.String id)
      Sets the ID of the event type that is associated with the gift registry
      void setEventYear(java.lang.String string)
      Sets the event year to be searched on if set
      void setExternalId(java.lang.String string)
      Sets the gift registry externalId to be searched on
      void setFindSimilarMatches(boolean bSimilarMatches)
      Sets this bean to search for similar search results.
      void setFirstName(java.lang.String string)
      Sets the first name to be searched on if set
      void setGuestOption(int[] integer)
      Sets the guestOption of a gift registry to search for.
      void setLastName(java.lang.String string)
      Sets the last name to be searched on if set
      void setMaxResultsPerPage(java.lang.String string)
      Sets the maximum results to display per page.
      void setRequestProperties(TypedProperty param)
      Sets the requestProperties associated with the data bean.
      void setResetSearchBean()
      Resets this bean.
      void setSortBy(java.lang.String string)
      Sets an integer index into the following list of sortable criteria supported in this bean.
      void setSortByFieldName(java.lang.String aSortByFieldName)
      Set the sortBy field name.
      void setSortByTableName(java.lang.String aSortByTableName)
      Sets the Sort By table name.
      void setSortByType(java.lang.String aSortByRegistrantType)
      Sets the registrant type used for the sorting.
      void setStartIndex(java.lang.String string)
      Sets the index of the first search result to return.
      void setState(java.lang.String string)
      Sets the state to be searched on if set
      void setStatus(int[] integer)
      Sets the status of a gift registry to search for.
      void setStoreId(java.lang.String string)
      Sets the storeId to run the search against
      void setType(int[] integer)
      Sets the type of a gift registry to search for.
      void setUserId(java.lang.String string)
      Sets the userId to be searched on
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The Classname.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GiftRegistrySearchDataBeanBase

        public GiftRegistrySearchDataBeanBase()
        Default constructor
    • Method Detail

      • setRequestProperties

        public void setRequestProperties(TypedProperty param)
                                  throws java.lang.Exception
        Sets the requestProperties associated with the data bean. If requestProperties is null when the activate method is invoked on the DataBeanManager, the manager uses the properties in the request.
        Specified by:
        setRequestProperties in interface InputDataBean
        Overrides:
        setRequestProperties in class InputDataBeanImpl
        Parameters:
        requestProperties - the set of properties passed to the JSP page that invokes this data bean,
        Throws:
        java.lang.Exception - if there is a problem when setting the request properties. This particular method should not throw any exception because it just stores the request properties.
      • getRegistries

        public GiftRegistryDataBean[] getRegistries()
        Returns matches for the specified search criteria
        Returns:
        GiftRegistryDataBean[]
      • setResetSearchBean

        public void setResetSearchBean()
        Resets this bean. If a search is run once, it will not be run again unless this method is called. This will force the getRegistries() and findGiftRegistries() methods to go back to the database and gather new results.
      • getResultCount

        public int getResultCount()
        Returns the total number of results that were found matching the query specified. This value is set after calling findGiftRegistries() or getRegistries().
        Returns:
        the counter value of the result set
      • getTotalPages

        public int getTotalPages()
        Returns the number of pages that are in this result count. getResultCount() / getMaxResultsPerPage()
        Returns:
        totalNumberOfPages
      • getCurrentPageNumber

        public int getCurrentPageNumber()
        Returns the current page number in the result set (based on page size -- if page size is zero or null, this function returns 1)
        Returns:
        the current page number in the result set
      • getEndIndex

        public int getEndIndex()
        Returns the end index for the result set on the page. The end index identifies the last element result of any page from total number of elements in result set.
        Returns:
        the end index
      • isPreviousPageExists

        public boolean isPreviousPageExists()
        Determines whether a previous page of data exists
        Returns:
        true if there is a previous page, false otherwise
      • isNextPageExists

        public boolean isNextPageExists()
        Determines whether a next page of data exists
        Returns:
        true if there is a next page, false otherwise
      • getCountry

        public java.lang.String getCountry()
        Gets the country being searched on if set.
        Returns:
        country
      • setCountry

        public void setCountry(java.lang.String string)
        Sets the country to be searched on if set
        Parameters:
        country -
      • getEventDay

        public java.lang.String getEventDay()
        Gets the event day being searched on if set.
        Returns:
        event day
      • setEventDay

        public void setEventDay(java.lang.String string)
        Sets the country to be searched on if set
        Parameters:
        string -
      • getEventMonth

        public java.lang.String getEventMonth()
        Gets the event month being searched on if set.
        Returns:
        event month
      • setEventMonth

        public void setEventMonth(java.lang.String string)
        Sets the event month to be searched on if set
        Parameters:
        eventMonth -
      • getEventYear

        public java.lang.String getEventYear()
        Gets the event year being searched on if set.
        Returns:
        event year
      • setEventYear

        public void setEventYear(java.lang.String string)
        Sets the event year to be searched on if set
        Parameters:
        eventYear -
      • getFirstName

        public java.lang.String getFirstName()
        Gets the first name being searched on if set.
        Returns:
        firstName
      • setFirstName

        public void setFirstName(java.lang.String string)
        Sets the first name to be searched on if set
        Parameters:
        firstName -
      • getLastName

        public java.lang.String getLastName()
        Gets the last name being searched on if set.
        Returns:
        lastName
      • setLastName

        public void setLastName(java.lang.String string)
        Sets the last name to be searched on if set
        Parameters:
        lastName -
      • getState

        public java.lang.String getState()
        Gets the state to be searched on if set
        Returns:
        state
      • setState

        public void setState(java.lang.String string)
        Sets the state to be searched on if set
        Parameters:
        state -
      • getUserId

        public java.lang.String getUserId()
        Gets the userId being searched on if set.
        Returns:
        userId
      • setUserId

        public void setUserId(java.lang.String string)
        Sets the userId to be searched on
        Parameters:
        userId -
      • setEventTypeId

        public void setEventTypeId(java.lang.String id)
        Sets the ID of the event type that is associated with the gift registry
        Parameters:
        id - the ID of the event type
      • getEventTypeId

        public java.lang.String getEventTypeId()
        Gets the ID of the gift registry's event type
        Returns:
        the ID of the event type
      • getExternalId

        public java.lang.String getExternalId()
        Gets the gift registry externalId being searched on if set.
        Returns:
        externalId
      • setExternalId

        public void setExternalId(java.lang.String string)
        Sets the gift registry externalId to be searched on
        Parameters:
        externalId -
      • getEmail1

        public java.lang.String getEmail1()
        Gets an email address being searched on if set.
        Returns:
        email1
      • setEmail1

        public void setEmail1(java.lang.String string)
        Sets an e-mail address to be searched on
        Parameters:
        email1 -
      • getMaxResultsPerPage

        public java.lang.String getMaxResultsPerPage()
        Gets the maximum results to display per page. Default is 20.
        Returns:
        the max number of results per page
      • setMaxResultsPerPage

        public void setMaxResultsPerPage(java.lang.String string)
        Sets the maximum results to display per page. Default is 20. Search results returned begin at startIndex and end at index startIndex + maxResultsPerPage
        Parameters:
        maxResultsPerPage -
      • getStartIndex

        public java.lang.String getStartIndex()
        Gets the index of the first search result returned
        Returns:
        startIndex
      • setStartIndex

        public void setStartIndex(java.lang.String string)
        Sets the index of the first search result to return. Search results returned begin at startIndex and end at index startIndex plus maxResultsPerPage
        Parameters:
        string -
      • getStoreId

        public java.lang.String getStoreId()
        Gets the storeId to run the search against
        Returns:
        storeId
      • setStoreId

        public void setStoreId(java.lang.String string)
        Sets the storeId to run the search against
        Parameters:
        storeId -
      • getSortBy

        public java.lang.String getSortBy()
        An integer index into the following list of sortable criteria supported in this bean. 0: GRADDR.LASTNAME, 1: GRADDR.FIRSTNAME, 2: GRADDR.STATE, 3: GRADDR.COUNTRY, 4: GRGFTREG.EVENTDATE 5: GRADDR.CITY 6: GREVNTTYPE.EVENTTYPENAME 7: GRETDESC.DESCRIPTION
        Returns:
        sortBy
      • setSortBy

        public void setSortBy(java.lang.String string)
        Sets an integer index into the following list of sortable criteria supported in this bean. 0: GRADDR.LASTNAME, 1: GRADDR.FIRSTNAME, 2: GRADDR.STATE, 3: GRADDR.COUNTRY, 4: GRGFTREG.EVENTDATE 5: GRADDR.CITY 6: GREVNTTYPE.EVENTTYPENAME 7: GRETDESC.DESCRIPTION
        Parameters:
        sortBy -
      • getStatus

        public int[] getStatus()
        Gets the status of a gift registry to search for. Searching can be done on several states. See the gift registry database description of the status's to know what to search.
        Returns:
        status
      • setStatus

        public void setStatus(int[] integer)
        Sets the status of a gift registry to search for. Searching can be done on several states. See the gift registry database description of the status's to know what to search. This parameter should be set by extending this bean. Should not be set in a JSP page to protect from users searching for resources they do not have access to.
        Parameters:
        status -
      • getType

        public int[] getType()
        Gets the type of a gift registry to search for. Searching can be done on several types. See the gift registry database description of the type's to know what to search.
        Returns:
        type
      • setType

        public void setType(int[] integer)
        Sets the type of a gift registry to search for. Searching can be done on several types. See the gift registry database description of the type's to know what to search. This parameter should be set by extending this bean. Should not be set in a JSP file to protect from users searching for resources they do not have access to.
        Parameters:
        type -
      • getGuestOption

        public int[] getGuestOption()
        Gets the guestOption of a gift registry to search for. Searching can be done on several guestOptions. See the gift registry database description of the guest option to know what to search.
        Returns:
        guestOption
      • setGuestOption

        public void setGuestOption(int[] integer)
        Sets the guestOption of a gift registry to search for. Searching can be done on several guestOptions. See the gift registry database description of the guest option to know what to search. This parameter should be set by extending this bean. Should not be set in a JSP file to protect from users searching for resources they do not have access to.
        Parameters:
        guestOption -
      • isFindSimilarMatches

        public boolean isFindSimilarMatches()
        Returns true if this bean is set to search for similar results. False if set to false or not specified
        Returns:
        boolean
      • setFindSimilarMatches

        public void setFindSimilarMatches(boolean bSimilarMatches)
        Sets this bean to search for similar search results. true means to search for similar results. false means to search only for exact results.
        Parameters:
        bSimilarMatches -
      • getFindSimilarMatches

        public boolean getFindSimilarMatches()
        Gets similar search result value. true means to search for similar results. false means to search only for exact results.
        Returns:
        boolean
      • getNumberOfResultsOnPage

        public int getNumberOfResultsOnPage()
        Returns the number of results that are available on this particular page.
        Returns:
        number of result pages
      • getSortByType

        public java.lang.String getSortByType()
        Gets the registrant type used for the sorting.
        Returns:
        registrant type: R for registrant and C for co-registrant
      • setSortByType

        public void setSortByType(java.lang.String aSortByRegistrantType)
        Sets the registrant type used for the sorting. This is used when sorting for any fields in GRADDR table. The default is set to R, if nothing is specified.
        Parameters:
        registrant - type: R for registrant and C for co-registrant
      • getSortByTableName

        public java.lang.String getSortByTableName()
        Gets the Sort By table name
        Returns:
        the Sort By table name
      • setSortByTableName

        public void setSortByTableName(java.lang.String aSortByTableName)
        Sets the Sort By table name. Besides the pre-defined sort by fields, user can specify to use other table field to sort. Please ensures the field is in the tables supported by GiftRegistrySearchDataBeanBase. If this is specified, it will override the setSortBy(String string).
        Parameters:
        the - Sort By table name.
      • getSortByFieldName

        public java.lang.String getSortByFieldName()
        Gets the sortBy field name
        Returns:
        the sortBy field name
      • setSortByFieldName

        public void setSortByFieldName(java.lang.String aSortByFieldName)
        Set the sortBy field name. Besides the pre-defined sort by fields, user can specify to use other field to sort as long as the field is in the tables supported by GiftRegistrySearchDataBeanBase. If this is specified, it will override the setSortBy(String string).
        Parameters:
        the - sortBy field name.