Class DefaultAnnotationProcessor
java.lang.Object
com.inductiveautomation.historian.gateway.api.query.processor.DefaultAnnotationProcessor
- All Implemented Interfaces:
AnnotationPointProcessor
,ComplexPointProcessor<AnnotationPoint,
,AnnotationQueryKey> QueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType>
Default implementation of the
AnnotationPointProcessor
interface.
This class processes annotation points and manages their associated quality codes. It provides methods for retrieving legacy annotations and results of the processing.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAnnotationProcessor
(List<AnnotationQueryKey> queryKeys, String queryId) Constructs a newDefaultAnnotationProcessor
. -
Method Summary
Modifier and TypeMethodDescriptionConverts the processed annotation points to legacy annotation objects.Retrieves the results of the annotation processing.void
Called when all processing is complete.void
onError
(QualityCode error) Handles a terminal error condition with a quality code.void
Handles a terminal error condition with an exception.boolean
Initializes the processor with context information before processing begins.void
onKeyFailure
(AnnotationQueryKey queryKey, QualityCode failureCode) Handles a failure specific to a query key.boolean
onPointAvailable
(AnnotationQueryKey queryKey, AnnotationPoint point) Processes a single temporal point.
-
Constructor Details
-
DefaultAnnotationProcessor
Constructs a newDefaultAnnotationProcessor
.Initializes the quality codes for the provided annotation query keys and sets up the logger.
- Parameters:
queryKeys
- A list of annotation query keys to initialize with a default quality code.queryId
- A unique identifier for the logger context.
-
-
Method Details
-
getAsLegacyAnnotations
Converts the processed annotation points to legacy annotation objects.- Returns:
- A list of legacy
Annotation
objects.
-
getResults
Retrieves the results of the annotation processing.If the result quality is good, returns the processed annotation points. Otherwise, returns an error result.
- Returns:
- A
Results
object containing the annotation points or an error.
-
onInitialize
Description copied from interface:QueriedPointProcessor
Initializes the processor with context information before processing begins. This method is called once before any points are processed.- Specified by:
onInitialize
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType> - Parameters:
context
- The processing context containing initialization properties.- Returns:
- True if initialization was successful and processing should continue, false to stop.
-
onPointAvailable
Description copied from interface:QueriedPointProcessor
Processes a single temporal point. Called repeatedly for each point in the result set.- Specified by:
onPointAvailable
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType> - Parameters:
queryKey
- The query key associated with the point.point
- The temporal point to process.- Returns:
- True to continue processing additional points, false to stop.
-
onKeyFailure
Description copied from interface:QueriedPointProcessor
Handles a failure specific to a query key. Processing continues for other query keys after this is called. This method can be called prior toQueriedPointProcessor.onInitialize(ProcessingContext)
as needed.- Specified by:
onKeyFailure
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType> - Parameters:
queryKey
- The query key that failed.failureCode
- The quality code indicating the reason for failure.
-
onError
Description copied from interface:QueriedPointProcessor
Handles a terminal error condition with a quality code. Processing stops after this method is called.- Specified by:
onError
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType> - Parameters:
error
- The quality code representing the error condition.
-
onError
Description copied from interface:QueriedPointProcessor
Handles a terminal error condition with an exception. Processing stops after this method is called.- Specified by:
onError
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType> - Parameters:
error
- The exception that caused the error.
-
onComplete
public void onComplete()Description copied from interface:QueriedPointProcessor
Called when all processing is complete. This method is called exactly once after all points have been processed or processing has been stopped.- Specified by:
onComplete
in interfaceQueriedPointProcessor<AnnotationPoint,
AnnotationQueryKey, ComplexPointType>
-