Class GroovyAction

  • All Implemented Interfaces:
    Action

    @Component
    public class GroovyAction
    extends java.lang.Object
    implements Action
    Perform an action which is specified by an external Groovy class.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.funnelback.publicui.search.model.curator.config.Action

        Action.Phase
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canEqual​(java.lang.Object other)  
      void configure​(Configurer configurer)
      Configure this action (expected to autowire in any dependencies)
      boolean equals​(java.lang.Object o)  
      private GroovyActionInterface getActionImplementation()
      Returns the GroovyTriggerInterface implementation for this trigger.
      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).
      int hashCode()  
      void performAction​(SearchTransaction searchTransaction, Action.Phase phase)
      Performs the desired action (by calling performAction on an instance of the specified Groovy class).
      boolean runsInPhase​(Action.Phase phase)
      Checks whether the desired action should be run in the given phase (by calling runsInPhase on an instance of the specified Groovy class).
      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 GroovyActionInterface 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).
      • cachedActionImplementationLastModified

        private long cachedActionImplementationLastModified
    • Constructor Detail

      • GroovyAction

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

        public GroovyAction()
    • Method Detail

      • getActionImplementation

        private GroovyActionInterface getActionImplementation()
        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).
      • performAction

        public void performAction​(SearchTransaction searchTransaction,
                                  Action.Phase phase)
        Performs the desired action (by calling performAction on an instance of the specified Groovy class).
        Specified by:
        performAction in interface Action
        Parameters:
        searchTransaction - Current search transaction
        phase - The phase being processed (Some actions may wish to behave differently depending on the current phase of processing).
      • runsInPhase

        public boolean runsInPhase​(Action.Phase phase)
        Checks whether the desired action should be run in the given phase (by calling runsInPhase on an instance of the specified Groovy class).
        Specified by:
        runsInPhase in interface Action
        Parameters:
        phase - The phase being processed (Some actions may wish to behave differently depending on the current phase of processing).
        Returns:
        true if this action should be run in the given phase, otherwise return false.
      • configure

        public void configure​(Configurer configurer)
        Configure this action (expected to autowire in any dependencies)
        Specified by:
        configure in interface Action
      • 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 GroovyActionInterface 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 GroovyActionInterface 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).