Class HistorianRpcAdapterHelper
java.lang.Object
com.inductiveautomation.historian.common.rpc.adapters.util.HistorianRpcAdapterHelper
Utility class for converting between common Historian Java objects and their Protocol Buffers representations.
This class provides methods to serialize and deserialize various objects, such as
ComplexPointProto.AnnotationPointPB
, ComplexPointProto.MetadataPointPB
, BasicQualifiedValueProto.BasicQualifiedValuePB
, and QualityCodeProto.QualityCodePB
.
It also handles type-specific conversions and ensures compatibility with Protocol Buffers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnnotationPoint
fromAnnotationPB
(ComplexPointProto.AnnotationPointPB annotationPB) Converts a Protocol Buffers representation of anAnnotationPoint
into anAnnotationPoint
object.static ComplexPoint<?>
fromComplexPB
(ComplexPointProto.ComplexPointPB complexPB) Converts a Protocol Buffers representation of aComplexPoint
into aComplexPoint
object.static MetadataPoint
fromMetadataPointPB
(ComplexPointProto.MetadataPointPB metadataPB) Converts a Protocol Buffers representation of aMetadataPoint
into aMetadataPoint
object.static Instant
fromProtoMilliToInstant
(long epochMilli) Converts a millisecond epoch value into anInstant
.static TimeRange
fromTimeRangePB
(TimeRangeProto.TimeRangePB timeRangePB) Converts aTimeRangeProto.TimeRangePB
Protocol Buffers object into aTimeRange
.static AggregatedQueryKey
Converts a Protocol Buffers representation of anAggregatedQueryKey
back into anAggregatedQueryKey
object.Converts anAggregatedQueryKey
object into its Protocol Buffers representation.static AnnotationQueryKey
Converts a Protocol Buffers representation of anAnnotationQueryKey
back into anAnnotationQueryKey
object.Converts anAnnotationQueryKey
object into its Protocol Buffers representation.Converts anAnnotationPoint
object into its Protocol Buffers representation.static BasicQualifiedValue
Converts aBasicQualifiedValueProto.BasicQualifiedValuePB
Protocol Buffers object into aBasicQualifiedValue
.Converts aQualifiedValue
object into itsBasicQualifiedValueProto.BasicQualifiedValuePB
Protocol Buffers representation.toComplexPointPB
(ComplexPoint<?> cp) Converts aComplexPoint
object into its Protocol Buffers representation.toGenericObjectPB
(Object value) Converts a Java object into itsGenericObjectProto.GenericObjectPB
Protocol Buffers representation.static Object
Converts aGenericObjectProto.GenericObjectPB
Protocol Buffers object into a Java object.static MetadataQueryKey
Converts a Protocol Buffers representation of aMetadataQueryKey
back into aMetadataQueryKey
object.Converts aMetadataQueryKey
object into its Protocol Buffers representation.Converts aMetadataPoint
object into its Protocol Buffers representation.toPropertiesMap
(PropertySet data) Converts aPropertySet
into a map of property names andGenericObjectProto.GenericObjectPB
values.static PropertySet
toPropertySet
(Map<String, GenericObjectProto.GenericObjectPB> propertiesMap) Converts a map of property names andGenericObjectProto.GenericObjectPB
values into aPropertySet
.Converts aQualifiedPath
object into itsQualifiedPathProto.QualifiedPathPB
Protocol Buffers representation.static QualityCode
Converts aQualityCodeProto.QualityCodePB
Protocol Buffers object into aQualityCode
.Converts aQualityCode
object into itsQualityCodeProto.QualityCodePB
Protocol Buffers representation.static TimeRangeProto.TimeRangePB
toTimeRangePB
(TimeRange timeRange) Converts aTimeRange
object into its Protocol Buffers representation.static TimeWindow
toTimeWindow
(TimeWindowProto.TimeWindowPB windowPB) Converts aTimeWindowProto.TimeWindowPB
Protocol Buffers object into aTimeWindow
.static TimeWindowProto.TimeWindowPB
toTimeWindowPB
(TimeWindow window) Converts aTimeWindow
object into its Protocol Buffers representation.
-
Method Details
-
toGenericObjectPB
public static GenericObjectProto.GenericObjectPB toGenericObjectPB(@Nullable Object value) throws ProtoSerializationException Converts a Java object into itsGenericObjectProto.GenericObjectPB
Protocol Buffers representation.- Parameters:
value
- The Java object to convert. Can benull
.- Returns:
- A
GenericObjectProto.GenericObjectPB
representing the given object. - Throws:
ProtoSerializationException
- If the object's data type is unsupported.
-
toJavaObject
public static Object toJavaObject(GenericObjectProto.GenericObjectPB objectPB) throws ProtoSerializationException Converts aGenericObjectProto.GenericObjectPB
Protocol Buffers object into a Java object.- Parameters:
objectPB
- TheGenericObjectProto.GenericObjectPB
to convert.- Returns:
- The corresponding Java object, or
null
if the data type is invalid. - Throws:
ProtoSerializationException
- If the data type is unsupported.
-
toQualifiedPathPB
Converts aQualifiedPath
object into itsQualifiedPathProto.QualifiedPathPB
Protocol Buffers representation.- Parameters:
path
- TheQualifiedPath
to convert.- Returns:
- A
QualifiedPathProto.QualifiedPathPB
representing the givenQualifiedPath
.
-
toBasicQualifiedValuePB
public static BasicQualifiedValueProto.BasicQualifiedValuePB toBasicQualifiedValuePB(QualifiedValue value) Converts aQualifiedValue
object into itsBasicQualifiedValueProto.BasicQualifiedValuePB
Protocol Buffers representation.- Parameters:
value
- TheQualifiedValue
to convert.- Returns:
- A
BasicQualifiedValueProto.BasicQualifiedValuePB
representing the givenQualifiedValue
.
-
toQualityCodePB
Converts aQualityCode
object into itsQualityCodeProto.QualityCodePB
Protocol Buffers representation.- Parameters:
qc
- TheQualityCode
to convert.- Returns:
- A
QualityCodeProto.QualityCodePB
representing the givenQualityCode
.
-
toBasicQualifiedValue
public static BasicQualifiedValue toBasicQualifiedValue(BasicQualifiedValueProto.BasicQualifiedValuePB valuePB) throws ProtoSerializationException Converts aBasicQualifiedValueProto.BasicQualifiedValuePB
Protocol Buffers object into aBasicQualifiedValue
.- Parameters:
valuePB
- TheBasicQualifiedValueProto.BasicQualifiedValuePB
to convert.- Returns:
- A
BasicQualifiedValue
created from the given Protocol Buffers object. - Throws:
ProtoSerializationException
- If an error occurs during the conversion process.
-
toQualityCode
Converts aQualityCodeProto.QualityCodePB
Protocol Buffers object into aQualityCode
.- Parameters:
qcPB
- TheQualityCodeProto.QualityCodePB
to convert.- Returns:
- A
QualityCode
created from the given Protocol Buffers object.
-
fromAnnotationPB
Converts a Protocol Buffers representation of anAnnotationPoint
into anAnnotationPoint
object.- Parameters:
annotationPB
- TheComplexPointProto.AnnotationPointPB
to convert.- Returns:
- An
AnnotationPoint
created from the given Protocol Buffers object.
-
toAnnotationPB
Converts anAnnotationPoint
object into its Protocol Buffers representation.- Parameters:
ann
- TheAnnotationPoint
to convert.- Returns:
- An
ComplexPointProto.AnnotationPointPB
representing the givenAnnotationPoint
.
-
toMetadataPointPB
Converts aMetadataPoint
object into its Protocol Buffers representation.- Parameters:
any
- TheMetadataPoint
to convert.- Returns:
- A
ComplexPointProto.MetadataPointPB
representing the givenMetadataPoint
.
-
fromMetadataPointPB
Converts a Protocol Buffers representation of aMetadataPoint
into aMetadataPoint
object.- Parameters:
metadataPB
- TheComplexPointProto.MetadataPointPB
to convert.- Returns:
- A
MetadataPoint
created from the given Protocol Buffers object.
-
fromComplexPB
Converts a Protocol Buffers representation of aComplexPoint
into aComplexPoint
object.- Parameters:
complexPB
- TheComplexPointProto.ComplexPointPB
to convert.- Returns:
- A
ComplexPoint
created from the given Protocol Buffers object. - Throws:
IllegalArgumentException
- If theComplexPointProto.ComplexPointPB
type is unsupported.
-
toComplexPointPB
Converts aComplexPoint
object into its Protocol Buffers representation.- Parameters:
cp
- TheComplexPoint
to convert.- Returns:
- A
ComplexPointProto.ComplexPointPB
representing the givenComplexPoint
. - Throws:
IllegalArgumentException
- If theComplexPoint
type is unsupported.
-
fromProtoMilliToInstant
Converts a millisecond epoch value into anInstant
.If the provided epoch value is negative, this method returns
null
.- Parameters:
epochMilli
- The epoch time in milliseconds.- Returns:
- An
Instant
representing the epoch time, ornull
if the input is negative.
-
fromTimeRangePB
Converts aTimeRangeProto.TimeRangePB
Protocol Buffers object into aTimeRange
.- Parameters:
timeRangePB
- TheTimeRangeProto.TimeRangePB
to convert.- Returns:
- A
TimeRange
object created from the given Protocol Buffers object.
-
toTimeRangePB
Converts aTimeRange
object into its Protocol Buffers representation.- Parameters:
timeRange
- TheTimeRange
to convert.- Returns:
- A
TimeRangeProto.TimeRangePB
representing the givenTimeRange
.
-
toPropertySet
public static PropertySet toPropertySet(Map<String, GenericObjectProto.GenericObjectPB> propertiesMap) Converts a map of property names andGenericObjectProto.GenericObjectPB
values into aPropertySet
.- Parameters:
propertiesMap
- A map containing property names and their correspondingGenericObjectProto.GenericObjectPB
values.- Returns:
- A
PropertySet
created from the given map.
-
toPropertiesMap
Converts aPropertySet
into a map of property names andGenericObjectProto.GenericObjectPB
values.- Parameters:
data
- ThePropertySet
to convert.- Returns:
- A map containing property names and their corresponding
GenericObjectProto.GenericObjectPB
values.
-
toTimeWindowPB
Converts aTimeWindow
object into its Protocol Buffers representation.- Parameters:
window
- TheTimeWindow
to convert.- Returns:
- A
TimeWindowProto.TimeWindowPB
representing the givenTimeWindow
.
-
toTimeWindow
Converts aTimeWindowProto.TimeWindowPB
Protocol Buffers object into aTimeWindow
.- Parameters:
windowPB
- TheTimeWindowProto.TimeWindowPB
to convert.- Returns:
- A
TimeWindow
created from the given Protocol Buffers object.
-
toMetadataKeyPB
Converts aMetadataQueryKey
object into its Protocol Buffers representation.- Parameters:
key
- TheMetadataQueryKey
to convert.- Returns:
- A
ComplexQueryKeysProto.MetadataQueryKeyPB
representing the givenMetadataQueryKey
.
-
toMetadataKey
Converts a Protocol Buffers representation of aMetadataQueryKey
back into aMetadataQueryKey
object.- Parameters:
keyPB
- TheComplexQueryKeysProto.MetadataQueryKeyPB
to convert.- Returns:
- A
MetadataQueryKey
created from the givenComplexQueryKeysProto.MetadataQueryKeyPB
.
-
toAnnotationKey
Converts a Protocol Buffers representation of anAnnotationQueryKey
back into anAnnotationQueryKey
object.- Parameters:
keyPB
- TheComplexQueryKeysProto.AnnotationQueryKeyPB
to convert.- Returns:
- An
AnnotationQueryKey
created from the given Protocol Buffers object.
-
toAnnotationKeyPB
Converts anAnnotationQueryKey
object into its Protocol Buffers representation.- Parameters:
key
- TheAnnotationQueryKey
to convert.- Returns:
- A
ComplexQueryKeysProto.AnnotationQueryKeyPB
representing the givenAnnotationQueryKey
.
-
toAggregatedQueryKeyPB
public static DataPointQueryKeysProto.AggregatedQueryKeyPB toAggregatedQueryKeyPB(AggregatedQueryKey any) Converts anAggregatedQueryKey
object into its Protocol Buffers representation.- Parameters:
any
- TheAggregatedQueryKey
to convert.- Returns:
- A
DataPointQueryKeysProto.AggregatedQueryKeyPB
representing the givenAggregatedQueryKey
.
-
toAggregatedQueryKey
public static AggregatedQueryKey toAggregatedQueryKey(DataPointQueryKeysProto.AggregatedQueryKeyPB key) throws IOException Converts a Protocol Buffers representation of anAggregatedQueryKey
back into anAggregatedQueryKey
object.- Parameters:
key
- TheDataPointQueryKeysProto.AggregatedQueryKeyPB
to convert.- Returns:
- An
AggregatedQueryKey
created from the given Protocol Buffers object. - Throws:
IOException
- If an error occurs during the conversion process.
-