Class ActionBase

    • Field Detail

      • entryTransformSetVariablesMap

        protected Map<String,​String> entryTransformSetVariablesMap
        The map for transform variable bindings for the action
      • log

        protected ILogChannel log
        The log channel interface object, used for logging
      • containerObjectId

        protected String containerObjectId
        The container object id
      • parentWorkflowMeta

        protected WorkflowMeta parentWorkflowMeta
    • Constructor Detail

      • ActionBase

        protected ActionBase()
        Instantiates a new action base object.
      • ActionBase

        protected ActionBase​(String name,
                             String description)
        Instantiates a new action base object with the given name and description.
        Parameters:
        name - the name of the action
        description - the description of the action
      • ActionBase

        protected ActionBase​(String name,
                             String description,
                             String pluginId)
        Parameters:
        name - the name of the action
        description - the description of the action
        pluginId - the pluginId of the action
      • ActionBase

        protected ActionBase​(ActionBase b)
        Copy constructor variant
        Parameters:
        b - The action base to copy
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Checks if the Action object is equal to the specified object
        Overrides:
        equals in class Object
        Returns:
        true if the two objects are equal, false otherwise
        See Also:
        Object.equals(Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • clear

        public void clear()
        Clears all variable values
        Specified by:
        clear in interface IAction
      • getTypeDesc

        public String getTypeDesc()
        Gets the plug-in type description
        Returns:
        the plug-in type description
      • setName

        public void setName​(String name)
        Sets the name of the action
        Specified by:
        setName in interface IAction
        Parameters:
        name - the new name
      • setDescription

        public void setDescription​(String description)
        Sets the description for the action.
        Specified by:
        setDescription in interface IAction
        Parameters:
        description - the new description
      • getTypeId

        public String getTypeId()
        Description copied from interface: IResourceHolder
        Gets the high-level type of resource holder.
        Specified by:
        getTypeId in interface IResourceHolder
        Returns:
        JOBENTRY, TRANSFORM, etc.
      • setChanged

        public void setChanged()
        Sets that the action has changed (i.e. a call to setChanged(true))
        Specified by:
        setChanged in interface IAction
        See Also:
        setChanged(boolean)
      • setChanged

        public void setChanged​(boolean ch)
        Sets whether the action has changed
        Specified by:
        setChanged in interface IAction
        Parameters:
        ch - true if the action has changed, false otherwise
      • hasChanged

        public boolean hasChanged()
        Checks whether the action has changed
        Specified by:
        hasChanged in interface IAction
        Returns:
        true if the action has changed, false otherwise
      • isStart

        public boolean isStart()
        Checks if the action has started
        Specified by:
        isStart in interface IAction
        Returns:
        true if the action has started, false otherwise
      • isWorkflow

        public boolean isWorkflow()
        Checks if the action executes a workflow
        Specified by:
        isWorkflow in interface IAction
        Returns:
        true if the action executes a workflow, false otherwise
      • isPipeline

        public boolean isPipeline()
        Checks if this action executes a pipeline
        Specified by:
        isPipeline in interface IAction
        Returns:
        true if this action executes a pipeline, false otherwise
      • getXml

        public String getXml()
        This method is called by Hop whenever a action needs to serialize its settings to XML. It is called when saving a workflow in HopGui. The method returns an XML string, containing the serialized settings. The string contains a series of XML tags, typically one tag per setting. The helper class org.apache.hop.core.xml.XmlHandler is typically used to construct the XML string.
        Specified by:
        getXml in interface IAction
        Returns:
        the xml representation of the action
      • loadXml

        public void loadXml​(Node node)
                     throws HopXmlException
        This method is called by Hop whenever a action needs to read its settings from XML. The XML node containing the action's settings is passed in as an argument. Again, the helper class org.apache.hop.core.xml.XmlHandler is typically used to conveniently read the settings from the XML node.
        Parameters:
        node - the top-level XML node
        Throws:
        HopXmlException - if any errors occur during the loading of the XML
      • loadXml

        public void loadXml​(Node entryNode,
                            IHopMetadataProvider metadataProvider,
                            IVariables variables)
                     throws HopXmlException
        Description copied from interface: IAction
        This method is called by Apache Hop whenever a action needs to read its settings from XML. The XML node containing the action's settings is passed in as an argument. Again, the helper class org.apache.hop.core.xml.XmlHandler is typically used to conveniently read the settings from the XML node.
        Specified by:
        loadXml in interface IAction
        Parameters:
        entryNode - the top-level XML node
        metadataProvider - The metadataProvider to optionally load from.
        Throws:
        HopXmlException - if any errors occur during the loading of the XML
      • clone

        public Object clone()
        This method is called when a action is duplicated in HopGui. It needs to return a deep copy of this action object. It is essential that the implementing class creates proper deep copies if the action configuration is stored in modifiable objects, such as lists or custom helper objects.
        Specified by:
        clone in interface IAction
        Overrides:
        clone in class Object
        Returns:
        a clone of the object
      • toString

        public String toString()
        Returns a string representation of the object. For ActionBase, this method returns the name
        Overrides:
        toString in class Object
        See Also:
        Object.toString()
      • resetErrorsBeforeExecution

        public boolean resetErrorsBeforeExecution()
        Checks whether a reset of the number of errors is required before execution.
        Specified by:
        resetErrorsBeforeExecution in interface IAction
        Returns:
        true if a reset of the number of errors is required before execution, false otherwise
      • isEvaluation

        public boolean isEvaluation()
        This method must return true if the action supports the true/false outgoing hops. For ActionBase, this method always returns false
        Specified by:
        isEvaluation in interface IAction
        Returns:
        false
      • isUnconditional

        public boolean isUnconditional()
        This method must return true if the action supports the unconditional outgoing hop. For ActionBase, this method always returns true
        Specified by:
        isUnconditional in interface IAction
        Returns:
        true
      • getSqlStatements

        public List<SqlStatement> getSqlStatements​(IHopMetadataProvider metadataProvider,
                                                   IVariables variables)
                                            throws HopException
        Gets the SQL statements needed by this action to execute successfully, given a set of variables. For ActionBase, this method returns an empty list.
        Specified by:
        getSqlStatements in interface IAction
        Parameters:
        variables - a variable variables object containing variable bindings
        metadataProvider - the MetaStore to use
        Returns:
        an empty list
        Throws:
        HopException - if any errors occur during the generation of SQL statements
      • getRealFilename

        public String getRealFilename()
        Gets the real filename of the action, by substituting any environment variables present in the filename. For ActionBase, this method always returns null
        Specified by:
        getRealFilename in interface IAction
        Returns:
        null
      • getUsedDatabaseConnections

        public DatabaseMeta[] getUsedDatabaseConnections()
        Gets all the database connections that are used by the action. For ActionBase, this method returns an empty (non-null) array
        Returns:
        an empty (non-null) array
      • resolve

        public String resolve​(String aString)
        Substitutes any variable values into the given string, and returns the resolved string
        Specified by:
        resolve in interface IVariables
        Returns:
        the string with any environment variables resolved and substituted
        See Also:
        IVariables.resolve(String)
      • getVariable

        public String getVariable​(String variableName,
                                  String defaultValue)
        Gets the value of the specified variable, or returns a default value if no such variable exists
        Specified by:
        getVariable in interface IVariables
        Returns:
        the value of the specified variable, or returns a default value if no such variable exists
        See Also:
        IVariables.getVariable(String, String)
      • getVariable

        public String getVariable​(String variableName)
        Gets the value of the specified variable, or returns a default value if no such variable exists
        Specified by:
        getVariable in interface IVariables
        Returns:
        the value of the specified variable, or returns a default value if no such variable exists
        See Also:
        IVariables.getVariable(String)
      • getVariableBoolean

        public boolean getVariableBoolean​(String variableName,
                                          boolean defaultValue)
        Returns a boolean representation of the specified variable after performing any necessary substitution. Truth values include case-insensitive versions of "Y", "YES", "TRUE" or "1".
        Specified by:
        getVariableBoolean in interface IVariables
        Parameters:
        variableName - the name of the variable to interrogate
        Returns:
        a boolean representation of the specified variable after performing any necessary substitution
        See Also:
        IVariables.getVariableBoolean(String, boolean)
      • setVariables

        public void setVariables​(Map<String,​String> map)
        Injects variables using the given Map. The behavior should be that the properties object will be stored and at the time the IVariables is initialized (or upon calling this method if the variables is already initialized). After injecting the link of the properties object should be removed.
        Specified by:
        setVariables in interface IVariables
        See Also:
        IVariables.setVariables(Map)
      • check

        public void check​(List<ICheckResult> remarks,
                          WorkflowMeta workflowMeta,
                          IVariables variables,
                          IHopMetadataProvider metadataProvider)
        Allows Action objects to check themselves for consistency
        Specified by:
        check in interface IAction
        Parameters:
        remarks - List of CheckResult objects indicating consistency status
        workflowMeta - the metadata object for the action
        variables - the variable variables to resolve string expressions with variables with
        metadataProvider - the MetaStore to load common elements from
      • exportResources

        public String exportResources​(IVariables variables,
                                      Map<String,​ResourceDefinition> definitions,
                                      IResourceNaming namingInterface,
                                      IHopMetadataProvider metadataProvider)
                               throws HopException
        Exports the object to a flat-file system, adding content with filename keys to a set of definitions. The supplied resource naming interface allows the object to name appropriately without worrying about those parts of the implementation specific details.
        Specified by:
        exportResources in interface IAction
        Parameters:
        variables - The variable variables to resolve (environment) variables with.
        definitions - The map containing the filenames and content
        namingInterface - The resource naming interface allows the object to be named appropriately
        metadataProvider - the metadataProvider to load external metadata from
        Returns:
        The filename for this object. (also contained in the definitions map)
        Throws:
        HopException - in case something goes wrong during the export
      • setPluginId

        public void setPluginId​(String pluginId)
        Sets the plugin id.
        Specified by:
        setPluginId in interface IAction
        Parameters:
        pluginId - the new plugin id
      • getDialogClassName

        public String getDialogClassName()
        You can use this to point to an alternate class for the Dialog. By default we return null. This means we simply add Dialog to the Action plugin class name.
        Specified by:
        getDialogClassName in interface IAction
        Returns:
        full class name of the action dialog class (null by default)
      • getVariables

        protected IVariables getVariables()
        Gets the variable bindings for the action.
        Returns:
        the variable bindings for the action.
      • isBasic

        public boolean isBasic()
        Checks if the logging level is basic.
        Returns:
        true if the logging level is basic, false otherwise
      • isDetailed

        public boolean isDetailed()
        Checks if the logging level is detailed.
        Returns:
        true if the logging level is detailed, false otherwise
      • isDebug

        public boolean isDebug()
        Checks if the logging level is debug.
        Returns:
        true if the logging level is debug, false otherwise
      • isRowlevel

        public boolean isRowlevel()
        Checks if the logging level is rowlevel.
        Returns:
        true if the logging level is rowlevel, false otherwise
      • logMinimal

        public void logMinimal​(String message)
        Logs the specified string at the minimal level.
        Parameters:
        message - the message
      • logMinimal

        public void logMinimal​(String message,
                               Object... arguments)
        Logs the specified string and arguments at the minimal level.
        Parameters:
        message - the message
        arguments - the arguments
      • logBasic

        public void logBasic​(String message)
        Logs the specified string at the basic level.
        Parameters:
        message - the message
      • logBasic

        public void logBasic​(String message,
                             Object... arguments)
        Logs the specified string and arguments at the basic level.
        Parameters:
        message - the message
        arguments - the arguments
      • logDetailed

        public void logDetailed​(String message)
        Logs the specified string at the detailed level.
        Parameters:
        message - the message
      • logDetailed

        public void logDetailed​(String message,
                                Object... arguments)
        Logs the specified string and arguments at the detailed level.
        Parameters:
        message - the message
        arguments - the arguments
      • logDebug

        public void logDebug​(String message)
        Logs the specified string at the debug level.
        Parameters:
        message - the message
      • logDebug

        public void logDebug​(String message,
                             Object... arguments)
        Logs the specified string and arguments at the debug level.
        Parameters:
        message - the message
        arguments - the arguments
      • logRowlevel

        public void logRowlevel​(String message)
        Logs the specified string at the row level.
        Parameters:
        message - the message
      • logRowlevel

        public void logRowlevel​(String message,
                                Object... arguments)
        Logs the specified string and arguments at the row level.
        Parameters:
        message - the message
        arguments - the arguments
      • logError

        public void logError​(String message)
        Logs the specified string at the error level.
        Parameters:
        message - the message
      • logError

        public void logError​(String message,
                             Throwable e)
        Logs the specified string and Throwable object at the error level.
        Parameters:
        message - the message
        e - the e
      • logError

        public void logError​(String message,
                             Object... arguments)
        Logs the specified string and arguments at the error level.
        Parameters:
        message - the message
        arguments - the arguments
      • setLogLevel

        public void setLogLevel​(LogLevel logLevel)
        Sets the logging level for the action
        Parameters:
        logLevel - the new log level
      • getContainerId

        public String getContainerId()
        Gets the container object id
        Specified by:
        getContainerId in interface ILoggingObject
        Returns:
        the container object id
      • setContainerObjectId

        public void setContainerObjectId​(String containerObjectId)
        Sets the container object id
        Parameters:
        containerObjectId - the container object id to set
      • getRegistrationDate

        public Date getRegistrationDate()
        Returns the registration date for the action. For ActionBase, this method always returns null
        Specified by:
        getRegistrationDate in interface ILoggingObject
        Returns:
        null
      • getReferencedObjectDescriptions

        public String[] getReferencedObjectDescriptions()
        Specified by:
        getReferencedObjectDescriptions in interface IAction
        Returns:
        The objects referenced in the transform, like a a pipeline, a workflow, a mapper, a reducer, a combiner, ...
      • isReferencedObjectEnabled

        public boolean[] isReferencedObjectEnabled()
        Specified by:
        isReferencedObjectEnabled in interface IAction
        Returns:
        true for each referenced object that is enabled or has a valid reference definition.
      • loadReferencedObject

        public IHasFilename loadReferencedObject​(int index,
                                                 IHopMetadataProvider metadataProvider,
                                                 IVariables variables)
                                          throws HopException
        Load the referenced object
        Specified by:
        loadReferencedObject in interface IAction
        Parameters:
        index - the referenced object index to load (in case there are multiple references)
        metadataProvider - the metadataProvider to load from
        variables - the variable variables to use
        Returns:
        the referenced object once loaded
        Throws:
        HopException
      • setMetadataProvider

        public void setMetadataProvider​(IHopMetadataProvider metadataProvider)
        Description copied from interface: IAction
        Sets the MetaStore
        Specified by:
        setMetadataProvider in interface IAction
        Parameters:
        metadataProvider - The new MetaStore to use
      • getParentWorkflowMeta

        public WorkflowMeta getParentWorkflowMeta()
        Description copied from interface: IAction
        Return Gets the parent workflowMeta. This default method will throw an exception if a action attempts to call the getter when not implemented.
        Specified by:
        getParentWorkflowMeta in interface IAction
        Returns:
        The parent workflowMeta at save and during execution.
      • setParentWorkflowMeta

        public void setParentWorkflowMeta​(WorkflowMeta parentWorkflowMeta)
        At save and run time, the system will attempt to set the workflowMeta so that it can be accessed by the actions if necessary.
        Specified by:
        setParentWorkflowMeta in interface IAction
        Parameters:
        parentWorkflowMeta - the WorkflowMeta to which this IAction belongs
      • getEntryTransformSetVariablesMap

        protected Map<String,​String> getEntryTransformSetVariablesMap()
        Gets a Map of variables set in EntryTransformSetVariables
        Returns:
        a map of variable names and values
      • setEntryTransformSetVariable

        public void setEntryTransformSetVariable​(String variableName,
                                                 String variableValue)
        Sets the value of the specified EntryTransformSetVariable
      • getEntryTransformSetVariable

        public String getEntryTransformSetVariable​(String variableName)
        Gets the value of the specified EntryTransformSetVariable