Package com.boomi.connector.util
Class BaseOperation
- java.lang.Object
-
- com.boomi.connector.util.ContextualOperation
-
- com.boomi.connector.util.BaseOperation
-
- All Implemented Interfaces:
Operation
- Direct Known Subclasses:
BaseDeleteOperation
,BaseGetOperation
,BaseQueryOperation
,BaseUpdateOperation
public abstract class BaseOperation extends ContextualOperation implements Operation
Utility base class for implementing anOperation
. Stores the OperationContext for later access during the operation execution.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseOperation(OperationContext context)
protected
BaseOperation(BaseConnection<OperationContext> conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(OperationRequest request, OperationResponse response)
Executes an operation with the given request, passing results to the given response.-
Methods inherited from class com.boomi.connector.util.ContextualOperation
getConnection, getContext
-
-
-
-
Constructor Detail
-
BaseOperation
protected BaseOperation(OperationContext context)
-
BaseOperation
protected BaseOperation(BaseConnection<OperationContext> conn)
-
-
Method Detail
-
execute
public void execute(OperationRequest request, OperationResponse response)
Description copied from interface:Operation
Executes an operation with the given request, passing results to the given response.Any
TrackedData
received as part of a request should eventually be passed into the response. Any data not passed along will be marked as "failed" by the atom (thus, any thrown exceptions will cause all outstanding data to be marked as "failed"). There are 4 scenarios for input/output relationships, each of which can be handled conveniently via theResponseUtil
utility:- Single Input(TrackedData) -> Single Output(Payload) - the common scenario where each input results in
a single output. Each input TrackedData will be passed to the response with the relevant output using
OperationResponse.addResult(com.boomi.connector.api.TrackedData, com.boomi.connector.api.OperationStatus, java.lang.String, java.lang.String, com.boomi.connector.api.Payload)
. - Multiple Inputs(TrackedData) -> Single Output(Payload) - this scenario generally results from
operations which take batches of input and return a single result status. Since multiple inputs are responsible
for the single output, they should all be passed together to the response with the relevant output using
OperationResponse.addCombinedResult(java.lang.Iterable<? extends com.boomi.connector.api.TrackedData>, com.boomi.connector.api.OperationStatus, java.lang.String, java.lang.String, com.boomi.connector.api.Payload)
. - Single Input(TrackedData) -> Multiple Outputs(Payload) - this scenario generally results from query
type operations where a single query returns many results. Since the same input is responsible for many outputs,
the outputs should be passed to the response as a "partial" result using
OperationResponse.addPartialResult(com.boomi.connector.api.TrackedData, com.boomi.connector.api.OperationStatus, java.lang.String, java.lang.String, com.boomi.connector.api.Payload)
until all results have been processed, at which point the input should be passed to the response as "finished" usingOperationResponse.finishPartialResult(com.boomi.connector.api.TrackedData)
. - Single/Multiple Inputs(TrackedData) -> No Output(Payload) - this scenario may result from operations
which return no response, such as a GET request with an id for which no object exists. Each input TrackedData
should be passed to the response using
OperationResponse.addEmptyResult(com.boomi.connector.api.TrackedData, com.boomi.connector.api.OperationStatus, java.lang.String, java.lang.String)
.
- Specified by:
execute
in interfaceOperation
- Parameters:
request
- the current request for this operation. this object should be downcast to the request type for the relevant operation, one ofGetRequest
,DeleteRequest
,QueryRequest
orUpdateRequest
(for CREATE,UPDATE, and UPSERT operations).response
- object which should be updated with the results of this operation (see comments above).
- Single Input(TrackedData) -> Single Output(Payload) - the common scenario where each input results in
a single output. Each input TrackedData will be passed to the response with the relevant output using
-
-