Package ca.uhn.fhir.batch2.model
Class JobDefinition.Builder<PT extends ca.uhn.fhir.model.api.IModelJson,NIT extends ca.uhn.fhir.model.api.IModelJson>
java.lang.Object
ca.uhn.fhir.batch2.model.JobDefinition.Builder<PT,NIT>
- Enclosing class:
- JobDefinition<PT extends ca.uhn.fhir.model.api.IModelJson>
public static class JobDefinition.Builder<PT extends ca.uhn.fhir.model.api.IModelJson,NIT extends ca.uhn.fhir.model.api.IModelJson>
extends Object
-
Method Summary
Modifier and TypeMethodDescription<OT extends ca.uhn.fhir.model.api.IModelJson>
JobDefinition.Builder<PT,OT> addFinalReducerStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IReductionStepWorker<PT, NIT, OT> theStepWorker) <OT extends ca.uhn.fhir.model.api.IModelJson>
JobDefinition.Builder<PT,OT> addFirstStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IJobStepWorker<PT, VoidModel, OT> theStepWorker) Adds a processing step for this job.<OT extends ca.uhn.fhir.model.api.IModelJson>
JobDefinition.Builder<PT,OT> addIntermediateStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IJobStepWorker<PT, NIT, OT> theStepWorker) Adds a processing step for this job.addLastStep(String theStepId, String theStepDescription, IJobStepWorker<PT, NIT, VoidModel> theStepWorker) Adds a processing step for this job.build()completionHandler(IJobCompletionHandler<PT> theCompletionHandler) Supplies an optional callback that will be invoked when the job is completeerrorHandler(IJobCompletionHandler<PT> theErrorHandler) Supplies an optional callback that will be invoked if the job failsIf this is set, the framework will wait for all work chunks to be processed for an individual step before moving on to beginning processing on the next step.setJobDefinitionId(String theJobDefinitionId) setJobDefinitionVersion(int theJobDefinitionVersion) setJobDescription(String theJobDescription) <NPT extends ca.uhn.fhir.model.api.IModelJson>
JobDefinition.Builder<NPT,NIT> setParametersType(Class<NPT> theJobParametersType) Sets the datatype for the parameters used by this job.setParametersValidator(IJobParametersValidator<PT> theParametersValidator) Supplies a programmatic job parameters validator.
-
Method Details
-
setJobDefinitionId
- Parameters:
theJobDefinitionId- A unique identifier for the job definition (i.e. for the "kind" of job)
-
setJobDefinitionVersion
- Parameters:
theJobDefinitionVersion- A unique identifier for the version of the job definition. Higher means newer but numbers have no other meaning. Must be greater than 0.
-
addFirstStep
public <OT extends ca.uhn.fhir.model.api.IModelJson> JobDefinition.Builder<PT,OT> addFirstStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IJobStepWorker<PT, VoidModel, OT> theStepWorker) Adds a processing step for this job.- Parameters:
theStepId- A unique identifier for this step. This only needs to be unique within the scope of the individual job definition (i.e. diuplicates are fine for different jobs, or even different versions of the same job)theStepDescription- A description of this steptheStepWorker- The worker that will actually perform this step
-
addIntermediateStep
public <OT extends ca.uhn.fhir.model.api.IModelJson> JobDefinition.Builder<PT,OT> addIntermediateStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IJobStepWorker<PT, NIT, OT> theStepWorker) Adds a processing step for this job.- Parameters:
theStepId- A unique identifier for this step. This only needs to be unique within the scope of the individual job definition (i.e. duplicates are fine for different jobs, or even different versions of the same job)theStepDescription- A description of this steptheStepWorker- The worker that will actually perform this step
-
addLastStep
public JobDefinition.Builder<PT,VoidModel> addLastStep(String theStepId, String theStepDescription, IJobStepWorker<PT, NIT, VoidModel> theStepWorker) Adds a processing step for this job.- Parameters:
theStepId- A unique identifier for this step. This only needs to be unique within the scope of the individual job definition (i.e. diuplicates are fine for different jobs, or even different versions of the same job)theStepDescription- A description of this steptheStepWorker- The worker that will actually perform this step
-
addFinalReducerStep
public <OT extends ca.uhn.fhir.model.api.IModelJson> JobDefinition.Builder<PT,OT> addFinalReducerStep(String theStepId, String theStepDescription, Class<OT> theOutputType, IReductionStepWorker<PT, NIT, OT> theStepWorker) -
build
-
setJobDescription
-
setParametersType
public <NPT extends ca.uhn.fhir.model.api.IModelJson> JobDefinition.Builder<NPT,NIT> setParametersType(@Nonnull Class<NPT> theJobParametersType) Sets the datatype for the parameters used by this job. This model is aIModelJsonJSON serializable object.Validation: Fields should be annotated with any appropriate
jakarta.validation(JSR 380) annotations (e.g.MinorPattern). In addition, if there are validation rules that are too complex to express using JSR 380, you can also specify a programmatic validator usingsetParametersValidator(IJobParametersValidator).Any fields that contain sensitive data (e.g. passwords) that should not be provided back to the end user must be marked with
PasswordFieldas well.- See Also:
-
PasswordFieldjakarta.validation.constraintssetParametersValidator(IJobParametersValidator)
-
setParametersValidator
public JobDefinition.Builder<PT,NIT> setParametersValidator(@Nonnull IJobParametersValidator<PT> theParametersValidator) Supplies a programmatic job parameters validator. Note that as much as possible, JSR 380 annotations should be used for validation. This method is provided only to satisfy rules that are too complex to be expressed using JSR 380.- Parameters:
theParametersValidator- The validator (must not be null. Do not call this method at all if you do not want a parameters validator).
-
gatedExecution
If this is set, the framework will wait for all work chunks to be processed for an individual step before moving on to beginning processing on the next step. Otherwise, processing on subsequent steps may begin as soon as any data has been produced.This is useful in a few cases:
- If there are potential constraint issues, e.g. data being written by the third step depends on all data from the second step already being written
- If multiple steps require expensive database queries, it may reduce the chances of timeouts to ensure that they are run discretely.
Setting this mode means the job may take longer, since it will rely on a polling mechanism to determine that one step is complete before beginning any processing for the next step.
-
completionHandler
public JobDefinition.Builder<PT,NIT> completionHandler(IJobCompletionHandler<PT> theCompletionHandler) Supplies an optional callback that will be invoked when the job is complete -
errorHandler
Supplies an optional callback that will be invoked if the job fails
-