Class CountryNameTrigger

  • All Implemented Interfaces:
    Trigger, HasNoBeans

    public final class CountryNameTrigger
    extends java.lang.Object
    implements Trigger, HasNoBeans

    A trigger which activates only when the current request originates from a country whose name exists in the targetCountries list.

    The detection of the originating country requires geolocation to be active (otherwise this trigger will never activate).

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Set<java.lang.String> targetCountries
      The list of country names (case sensitive) for which this trigger should activate.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean activatesOn​(SearchTransaction searchTransaction)
      Check whether the given searchTransaction originates from a country listed in targetCountries.
      void configure​(Configurer configurer)
      Configure this trigger (expected to autowire in any dependencies)
      boolean equals​(java.lang.Object o)  
      java.util.Set<java.lang.String> getTargetCountries()
      The list of country names (case sensitive) for which this trigger should activate.
      int hashCode()  
      void setTargetCountries​(java.util.Set<java.lang.String> targetCountries)
      The list of country names (case sensitive) for which this trigger should activate.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • targetCountries

        private java.util.Set<java.lang.String> targetCountries
        The list of country names (case sensitive) for which this trigger should activate.
    • Constructor Detail

      • CountryNameTrigger

        public CountryNameTrigger​(java.util.Set<java.lang.String> targetCountries)
      • CountryNameTrigger

        public CountryNameTrigger()
    • Method Detail

      • activatesOn

        public boolean activatesOn​(SearchTransaction searchTransaction)
        Check whether the given searchTransaction originates from a country listed in targetCountries. If it does, return true, otherwise false.
        Specified by:
        activatesOn in interface Trigger
        Parameters:
        searchTransaction - Current search transaction
        Returns:
        true if this trigger should activate on the given searchTransaction, and false otherwise.
      • configure

        public void configure​(Configurer configurer)
        Configure this trigger (expected to autowire in any dependencies)
        Specified by:
        configure in interface Trigger
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getTargetCountries

        public java.util.Set<java.lang.String> getTargetCountries()
        The list of country names (case sensitive) for which this trigger should activate.
      • setTargetCountries

        public void setTargetCountries​(java.util.Set<java.lang.String> targetCountries)
        The list of country names (case sensitive) for which this trigger should activate.