Interface StandardizerActionRunner

All Superinterfaces:
Cloneable
All Known Implementing Classes:
BasicStandardizerRunner

@PublicApi public interface StandardizerActionRunner extends Cloneable
The descendant of StandardizerActionRunner interface has to provide the functionality to run StandardizerConfiguration instances automatically on the given molecule.
As standardizer configuration may contain actions in groups, using setTargetGroup(String) and setTargetGroups(String...) methods, the target groups, containing the actions to be executed can be defined.
By default, in case of the provided configuration containing error(s) the runner throws IllegalArgumentException. Configuration errors can be ignored using the method setIgnoreConfigurationErrors(boolean) with true as parameter. In this case the faulty actions are not executed, error message or exception should not occur!
If errors of configuration needs to be checked, use the getConfiguration() method to get the configuration, and check the validity of the configuration by using the function StandardizerConfiguration.isValid().
Standardization can be executed by standardize() and standardizeAndWait() method. The method standardize() executes the standardization in a background thread. The state of the standardization can be gathered using isRunning() method. Using standardizeAndWait() method the thread is blocked until the standardization finishes.
The applied standardizer actions can be collected using getAppliedActions(), and the changes applied on the molecule can be collected using getChanges() method.
Logs are generated to a System.Logger, that can be collected by using StandardizerLogger.getLogger() method.
Note, that setMolecule(Molecule) method must be called prior standardization.
Since:
5.11
  • Method Details

    • setConfigurationReader

      void setConfigurationReader(StandardizerConfigurationReader reader)
      Sets a new configuration for the runner.
      Parameters:
      reader - is the StandardizerConfigurationReader instance which provides the current configuration
    • standardize

      void standardize() throws IllegalArgumentException
      Invoke a background thread which will run all standardizer actions on the given molecule
      Throws:
      IllegalArgumentException - if the configuration or the molecule contains errors
    • standardizeAndWait

      List<Changes> standardizeAndWait() throws IllegalArgumentException
      Executes all standardizer actions contained by the pre-set configuration on the given molecule and returns the list of applied changes. For each action of the configuration there is a change object (or null) in the list.
      Returns:
      the list of changes applied on the molecule
      Throws:
      IllegalArgumentException - if the configuration or the molecule contains errors
    • cancel

      void cancel()
      Stops the background thread
    • isRunning

      boolean isRunning()
      This function identifies the state of the standardizer thread
      Returns:
      true if the background thread runs false otherwise
    • getCurrent

      int getCurrent()
      Gets the current progress percent
      Returns:
      the current progress percent
    • getCurrentActionName

      String getCurrentActionName()
      Gets which StandardizerAction instance run currently
      Returns:
      which StandardizerAction instance run currently
    • getProgessLength

      int getProgessLength()
      Gets the length of the standardization process
      Returns:
      the length of the standardization process
    • getChanges

      List<Changes> getChanges()
      Gets the list of changes applied on the molecule. For each action of the configuration there is a change object (or null) in the list.
      Returns:
      the list of changes applied on the molecule
    • setMolecule

      void setMolecule(Molecule molecule)
      Sets the molecule to be standardized by the standardizer actions
      Parameters:
      molecule - a Molecule instance to be standardized
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener changeListener)
      Adds a PropertyChangeListener that will receive all the PropertyChangeEvent fired by this class
      Parameters:
      changeListener - a PropertyChangeListener instance
    • addPropertyChangeListener

      void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Adds a PropertyChangeListener that will receive the PropertyChangeEvent fired when the property with the given name is changed
      Parameters:
      propertyName - the name of the property to be listened
      listener - a PropertyChangeListener instance
    • getConfiguration

      StandardizerConfiguration getConfiguration()
      Gets the configuration of the runner
      Returns:
      the configuration of the runner
    • setConfiguration

      void setConfiguration(StandardizerConfiguration configuration)
      Sets the configuration of the runner
      Parameters:
      configuration - the configuration to be set to the runner
    • getAppliedActions

      List<StandardizerAction> getAppliedActions()
      Gets the list of actions applied in the configuration at the last execution
      Returns:
      the list of applied actions at the last execution
    • setTargetGroup

      void setTargetGroup(String groupName)
      Sets the target group of standardizer action of the runner
      Parameters:
      groupName - the name of the group of standardizer actions
    • setTargetGroups

      void setTargetGroups(String... groupNames)
      Sets the target groups of standardizer action of the runner
      Parameters:
      groupNames - the names of the groups of standardizer actions
    • setLicenseEnvironment

      void setLicenseEnvironment(String env)
      Sets the license environment of the runner
      Parameters:
      env - the license environment of the runner
    • setIgnoreConfigurationErrors

      void setIgnoreConfigurationErrors(boolean ignore)
      Sets whether configuration errors should be ignored
      Parameters:
      ignore - whether configuration errors should be ignored