Package org.pentaho.di.trans.step
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
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:
- Acquisition of a
LogChannelInterfacefor consistent logging - Template handling in
stepAction(String, TransMeta, java.util.Map)including:- Delegation to
handleStepAction(String, TransMeta, java.util.Map) - Automatic population of standard response status fields defined in the interface
- Error trapping and failure status assignment
- Delegation to
- Utility to evaluate failure state via
isFailedResponse(org.json.simple.JSONObject)
handleStepAction(String, TransMeta, java.util.Map).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected final org.pentaho.di.core.logging.LogChannelInterfacestatic final Stringstatic final StringFields inherited from interface org.pentaho.di.trans.step.StepHelperInterface
ACTION_STATUS, FAILURE_METHOD_NOT_FOUND_RESPONSE, FAILURE_RESPONSE, STATUS, SUCCESS_RESPONSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetReferencePath(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.protected abstract org.json.simple.JSONObjectAbstract method to be implemented by subclasses for handling step-specific actions.booleanisFailedResponse(org.json.simple.JSONObject response) Utility method to check if a response indicates a failure.org.json.simple.JSONObjectTemplate method for executing a step action method.protected org.json.simple.JSONObjectvalidateAndPutReferenceStatus(TransMeta transMeta, org.json.simple.JSONObject response, StepWithMappingMeta stepWithMappingMeta) Validates the reference path of a StepWithMappingMeta instance and updates the response JSON object
-
Field Details
-
log
protected final org.pentaho.di.core.logging.LogChannelInterface log -
IS_TRANS_REFERENCE
- See Also:
-
IS_VALID_REFERENCE
- See Also:
-
REFERENCE_PATH
- See Also:
-
SEPARATOR
- See Also:
-
-
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:
stepActionin interfaceStepHelperInterface- 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).
-