Class BaseStepHelper

java.lang.Object
org.pentaho.di.trans.step.BaseStepHelper
All Implemented Interfaces:
StepHelperInterface
Direct Known Subclasses:
CalculatorHelper, CsvInputHelper, DatabaseLookupHelper, DenormaliserStepHelper, FormulaHelper, GetFilesRowCountHelper, GroupByHelper, InsertUpdateHelper, JobExecutorHelper, MappingHelper, MergeJoinHelper, MergeRowsHelper, RandomValueStepHelper, SelectValuesHelper, SimpleMappingHelper, SingleThreaderHelper, StreamLookupStepHelper, SystemDataStepHelper, TableInputHelper, TableOutputHelper, TextFileInputHelper, TextFileOutputHelper, TransExecutorHelper, UpdateHelper

public abstract class BaseStepHelper extends Object implements StepHelperInterface
Base implementation of StepHelperInterface providing shared infrastructure for executing UI-triggered "step actions" and other common methods.

Step actions are step-specific, non-runtime operations initiated from a step dialog (e.g. fetching external metadata, validating configuration, testing connections). They do not participate in transformation execution.

This class centralizes:

Subclasses implement only the step-specific logic in handleStepAction(String, TransMeta, java.util.Map).

See Also:
  • Field Details

  • Constructor Details

    • BaseStepHelper

      protected BaseStepHelper()
  • Method Details

    • stepAction

      public org.json.simple.JSONObject stepAction(String method, TransMeta transMeta, Map<String,String> queryParams)
      Template method for executing a step action method. Handles response status and error logging. Subclasses should implement the `handleStepAction` method to provide step-specific logic.
      Specified by:
      stepAction in interface StepHelperInterface
      Parameters:
      method - The name of the method to execute.
      transMeta - The transformation metadata associated with the step.
      queryParams - A map of query parameters for the action.
      Returns:
      A JSON object containing the action status and any additional response data.
    • handleStepAction

      protected abstract org.json.simple.JSONObject handleStepAction(String method, TransMeta transMeta, Map<String,String> queryParams)
      Abstract method to be implemented by subclasses for handling step-specific actions.
      Parameters:
      method - The name of the method to execute.
      transMeta - The transformation metadata associated with the step.
      queryParams - A map of query parameters for the action.
      Returns:
      A JSON object containing the action status and any additional response data.
    • isFailedResponse

      public boolean isFailedResponse(org.json.simple.JSONObject response)
      Utility method to check if a response indicates a failure.
      Parameters:
      response - The JSON object containing the response data.
      Returns:
      True if the response indicates a failure, false otherwise.
    • getReferencePath

      protected String getReferencePath(TransMeta transMeta, String directoryPath, String objectName, org.pentaho.di.core.ObjectLocationSpecificationMethod specificationMethod, String fileName)
      Constructs the reference path for a transformation based on the provided directory path and name.
      Parameters:
      transMeta - The transformation metadata containing the step.
      directoryPath - The directory path where the transformation or job is located.
      objectName - The name of the transformation or job.
      specificationMethod - The specification method used (e.g. REPOSITORY_BY_NAME, FILENAME).
      fileName - The filename of the transformation or job (used if the specification method is FILENAME).
      Returns:
      The constructed reference path, or an empty string if neither directoryPath nor objectName is provided.
    • validateAndPutReferenceStatus

      protected org.json.simple.JSONObject validateAndPutReferenceStatus(TransMeta transMeta, org.json.simple.JSONObject response, StepWithMappingMeta stepWithMappingMeta)
      Validates the reference path of a StepWithMappingMeta instance and updates the response JSON object
      Parameters:
      transMeta - The transformation metadata containing the step.
      stepWithMappingMeta - The StepWithMappingMeta instance containing the directory path and transformation name.
      Returns:
      A JSON object containing: - "referencePath": The full path to the referenced transformation, with environment variables substituted. - "isValidReference": A boolean indicating whether the referenced transformation is valid. - "isTransReference": A boolean indicating whether the reference is a transformation (always true for StepWithMapping).