Class GroovyTrigger

  • All Implemented Interfaces:
    Trigger

    @Component
    public class GroovyTrigger
    extends java.lang.Object
    implements Trigger

    A trigger which activates only when the current query contains all the words given as triggers.

    The query may contain other words without affecting the trigger, and the order of the words within the query is not considered important.

    • Constructor Summary

      Constructors 
      Constructor Description
      GroovyTrigger()  
      GroovyTrigger​(java.lang.String classFile, java.util.Map<java.lang.String,​java.lang.Object> properties)
      Convenience constructor to create a new GroovyTrigger with a script and properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean activatesOn​(SearchTransaction searchTransaction)
      Check the given searchTransaction to see if the trigger activates on this request.
      protected boolean canEqual​(java.lang.Object other)  
      void configure​(Configurer configurer)
      Configure this trigger (expected to autowire in any dependencies)
      boolean equals​(java.lang.Object o)  
      java.lang.String getClassFile()
      File specifying the Groovy class which implements the desired action.
      java.util.Map<java.lang.String,​java.lang.Object> getProperties()
      Any properties associated with the action (passed to the performAction and runsInPhase methods).
      GroovyTriggerInterface getTriggerImplementation()
      Returns the GroovyTriggerInterface implementation for this trigger.
      int hashCode()  
      void setClassFile​(java.lang.String classFile)
      File specifying the Groovy class which implements the desired action.
      void setProperties​(java.util.Map<java.lang.String,​java.lang.Object> properties)
      Any properties associated with the action (passed to the performAction and runsInPhase methods).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • classFile

        private java.lang.String classFile
        File specifying the Groovy class which implements the desired action. This class is expected to implement the GroovyTriggerInterface interface.
      • properties

        private java.util.Map<java.lang.String,​java.lang.Object> properties
        Any properties associated with the action (passed to the performAction and runsInPhase methods).
      • cachedTriggerImplementationLastModified

        private long cachedTriggerImplementationLastModified
    • Constructor Detail

      • GroovyTrigger

        public GroovyTrigger​(java.lang.String classFile,
                             java.util.Map<java.lang.String,​java.lang.Object> properties)
        Convenience constructor to create a new GroovyTrigger with a script and properties.
      • GroovyTrigger

        public GroovyTrigger()
    • Method Detail

      • getTriggerImplementation

        public GroovyTriggerInterface getTriggerImplementation()
        Returns the GroovyTriggerInterface implementation for this trigger. The returned implementation is cached, however the original file has a modification timestamp check performed on every request (and the implementation refreshed if the file is changed).
      • activatesOn

        public boolean activatesOn​(SearchTransaction searchTransaction)
        Check the given searchTransaction to see if the trigger activates on this request.
        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
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

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

        public java.lang.String getClassFile()
        File specifying the Groovy class which implements the desired action. This class is expected to implement the GroovyTriggerInterface interface.
      • setClassFile

        public void setClassFile​(java.lang.String classFile)
        File specifying the Groovy class which implements the desired action. This class is expected to implement the GroovyTriggerInterface interface.
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties()
        Any properties associated with the action (passed to the performAction and runsInPhase methods).
      • setProperties

        public void setProperties​(java.util.Map<java.lang.String,​java.lang.Object> properties)
        Any properties associated with the action (passed to the performAction and runsInPhase methods).