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 AnnotationPointfromAnnotationPB(ComplexPointProto.AnnotationPointPB annotationPB) Converts a Protocol Buffers representation of anAnnotationPointinto anAnnotationPointobject.static ComplexPoint<?>fromComplexPB(ComplexPointProto.ComplexPointPB complexPB) Converts a Protocol Buffers representation of aComplexPointinto aComplexPointobject.static MetadataPointfromMetadataPointPB(ComplexPointProto.MetadataPointPB metadataPB) Converts a Protocol Buffers representation of aMetadataPointinto aMetadataPointobject.static InstantfromProtoMilliToInstant(long epochMilli) Converts a millisecond epoch value into anInstant.static TimeRangefromTimeRangePB(TimeRangeProto.TimeRangePB timeRangePB) Converts aTimeRangeProto.TimeRangePBProtocol Buffers object into aTimeRange.static AggregatedQueryKeyConverts a Protocol Buffers representation of anAggregatedQueryKeyback into anAggregatedQueryKeyobject.Converts anAggregatedQueryKeyobject into its Protocol Buffers representation.static AnnotationQueryKeyConverts a Protocol Buffers representation of anAnnotationQueryKeyback into anAnnotationQueryKeyobject.Converts anAnnotationQueryKeyobject into its Protocol Buffers representation.Converts anAnnotationPointobject into its Protocol Buffers representation.static BasicQualifiedValueConverts aBasicQualifiedValueProto.BasicQualifiedValuePBProtocol Buffers object into aBasicQualifiedValue.Converts aQualifiedValueobject into itsBasicQualifiedValueProto.BasicQualifiedValuePBProtocol Buffers representation.toComplexPointPB(ComplexPoint<?> cp) Converts aComplexPointobject into its Protocol Buffers representation.toGenericObjectPB(Object value) Converts a Java object into itsGenericObjectProto.GenericObjectPBProtocol Buffers representation.static ObjectConverts aGenericObjectProto.GenericObjectPBProtocol Buffers object into a Java object.static MetadataQueryKeyConverts a Protocol Buffers representation of aMetadataQueryKeyback into aMetadataQueryKeyobject.Converts aMetadataQueryKeyobject into its Protocol Buffers representation.Converts aMetadataPointobject into its Protocol Buffers representation.toPropertiesMap(PropertySet data) Converts aPropertySetinto a map of property names andGenericObjectProto.GenericObjectPBvalues.static PropertySettoPropertySet(Map<String, GenericObjectProto.GenericObjectPB> propertiesMap) Converts a map of property names andGenericObjectProto.GenericObjectPBvalues into aPropertySet.Converts aQualifiedPathobject into itsQualifiedPathProto.QualifiedPathPBProtocol Buffers representation.static QualityCodeConverts aQualityCodeProto.QualityCodePBProtocol Buffers object into aQualityCode.Converts aQualityCodeobject into itsQualityCodeProto.QualityCodePBProtocol Buffers representation.static TimeRangeProto.TimeRangePBtoTimeRangePB(TimeRange timeRange) Converts aTimeRangeobject into its Protocol Buffers representation.static TimeWindowtoTimeWindow(TimeWindowProto.TimeWindowPB windowPB) Converts aTimeWindowProto.TimeWindowPBProtocol Buffers object into aTimeWindow.static TimeWindowProto.TimeWindowPBtoTimeWindowPB(TimeWindow window) Converts aTimeWindowobject into its Protocol Buffers representation.
-
Method Details
-
toGenericObjectPB
public static GenericObjectProto.GenericObjectPB toGenericObjectPB(@Nullable Object value) throws ProtoSerializationException Converts a Java object into itsGenericObjectProto.GenericObjectPBProtocol Buffers representation.- Parameters:
value- The Java object to convert. Can benull.- Returns:
- A
GenericObjectProto.GenericObjectPBrepresenting 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.GenericObjectPBProtocol Buffers object into a Java object.- Parameters:
objectPB- TheGenericObjectProto.GenericObjectPBto convert.- Returns:
- The corresponding Java object, or
nullif the data type is invalid. - Throws:
ProtoSerializationException- If the data type is unsupported.
-
toQualifiedPathPB
Converts aQualifiedPathobject into itsQualifiedPathProto.QualifiedPathPBProtocol Buffers representation.- Parameters:
path- TheQualifiedPathto convert.- Returns:
- A
QualifiedPathProto.QualifiedPathPBrepresenting the givenQualifiedPath.
-
toBasicQualifiedValuePB
public static BasicQualifiedValueProto.BasicQualifiedValuePB toBasicQualifiedValuePB(QualifiedValue value) Converts aQualifiedValueobject into itsBasicQualifiedValueProto.BasicQualifiedValuePBProtocol Buffers representation.- Parameters:
value- TheQualifiedValueto convert.- Returns:
- A
BasicQualifiedValueProto.BasicQualifiedValuePBrepresenting the givenQualifiedValue.
-
toQualityCodePB
Converts aQualityCodeobject into itsQualityCodeProto.QualityCodePBProtocol Buffers representation.- Parameters:
qc- TheQualityCodeto convert.- Returns:
- A
QualityCodeProto.QualityCodePBrepresenting the givenQualityCode.
-
toBasicQualifiedValue
public static BasicQualifiedValue toBasicQualifiedValue(BasicQualifiedValueProto.BasicQualifiedValuePB valuePB) throws ProtoSerializationException Converts aBasicQualifiedValueProto.BasicQualifiedValuePBProtocol Buffers object into aBasicQualifiedValue.- Parameters:
valuePB- TheBasicQualifiedValueProto.BasicQualifiedValuePBto convert.- Returns:
- A
BasicQualifiedValuecreated from the given Protocol Buffers object. - Throws:
ProtoSerializationException- If an error occurs during the conversion process.
-
toQualityCode
Converts aQualityCodeProto.QualityCodePBProtocol Buffers object into aQualityCode.- Parameters:
qcPB- TheQualityCodeProto.QualityCodePBto convert.- Returns:
- A
QualityCodecreated from the given Protocol Buffers object.
-
fromAnnotationPB
Converts a Protocol Buffers representation of anAnnotationPointinto anAnnotationPointobject.- Parameters:
annotationPB- TheComplexPointProto.AnnotationPointPBto convert.- Returns:
- An
AnnotationPointcreated from the given Protocol Buffers object.
-
toAnnotationPB
Converts anAnnotationPointobject into its Protocol Buffers representation.- Parameters:
ann- TheAnnotationPointto convert.- Returns:
- An
ComplexPointProto.AnnotationPointPBrepresenting the givenAnnotationPoint.
-
toMetadataPointPB
Converts aMetadataPointobject into its Protocol Buffers representation.- Parameters:
any- TheMetadataPointto convert.- Returns:
- A
ComplexPointProto.MetadataPointPBrepresenting the givenMetadataPoint.
-
fromMetadataPointPB
Converts a Protocol Buffers representation of aMetadataPointinto aMetadataPointobject.- Parameters:
metadataPB- TheComplexPointProto.MetadataPointPBto convert.- Returns:
- A
MetadataPointcreated from the given Protocol Buffers object.
-
fromComplexPB
Converts a Protocol Buffers representation of aComplexPointinto aComplexPointobject.- Parameters:
complexPB- TheComplexPointProto.ComplexPointPBto convert.- Returns:
- A
ComplexPointcreated from the given Protocol Buffers object. - Throws:
IllegalArgumentException- If theComplexPointProto.ComplexPointPBtype is unsupported.
-
toComplexPointPB
Converts aComplexPointobject into its Protocol Buffers representation.- Parameters:
cp- TheComplexPointto convert.- Returns:
- A
ComplexPointProto.ComplexPointPBrepresenting the givenComplexPoint. - Throws:
IllegalArgumentException- If theComplexPointtype 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
Instantrepresenting the epoch time, ornullif the input is negative.
-
fromTimeRangePB
Converts aTimeRangeProto.TimeRangePBProtocol Buffers object into aTimeRange.- Parameters:
timeRangePB- TheTimeRangeProto.TimeRangePBto convert.- Returns:
- A
TimeRangeobject created from the given Protocol Buffers object.
-
toTimeRangePB
Converts aTimeRangeobject into its Protocol Buffers representation.- Parameters:
timeRange- TheTimeRangeto convert.- Returns:
- A
TimeRangeProto.TimeRangePBrepresenting the givenTimeRange.
-
toPropertySet
public static PropertySet toPropertySet(Map<String, GenericObjectProto.GenericObjectPB> propertiesMap) Converts a map of property names andGenericObjectProto.GenericObjectPBvalues into aPropertySet.- Parameters:
propertiesMap- A map containing property names and their correspondingGenericObjectProto.GenericObjectPBvalues.- Returns:
- A
PropertySetcreated from the given map.
-
toPropertiesMap
Converts aPropertySetinto a map of property names andGenericObjectProto.GenericObjectPBvalues.- Parameters:
data- ThePropertySetto convert.- Returns:
- A map containing property names and their corresponding
GenericObjectProto.GenericObjectPBvalues.
-
toTimeWindowPB
Converts aTimeWindowobject into its Protocol Buffers representation.- Parameters:
window- TheTimeWindowto convert.- Returns:
- A
TimeWindowProto.TimeWindowPBrepresenting the givenTimeWindow.
-
toTimeWindow
Converts aTimeWindowProto.TimeWindowPBProtocol Buffers object into aTimeWindow.- Parameters:
windowPB- TheTimeWindowProto.TimeWindowPBto convert.- Returns:
- A
TimeWindowcreated from the given Protocol Buffers object.
-
toMetadataKeyPB
Converts aMetadataQueryKeyobject into its Protocol Buffers representation.- Parameters:
key- TheMetadataQueryKeyto convert.- Returns:
- A
ComplexQueryKeysProto.MetadataQueryKeyPBrepresenting the givenMetadataQueryKey.
-
toMetadataKey
Converts a Protocol Buffers representation of aMetadataQueryKeyback into aMetadataQueryKeyobject.- Parameters:
keyPB- TheComplexQueryKeysProto.MetadataQueryKeyPBto convert.- Returns:
- A
MetadataQueryKeycreated from the givenComplexQueryKeysProto.MetadataQueryKeyPB.
-
toAnnotationKey
Converts a Protocol Buffers representation of anAnnotationQueryKeyback into anAnnotationQueryKeyobject.- Parameters:
keyPB- TheComplexQueryKeysProto.AnnotationQueryKeyPBto convert.- Returns:
- An
AnnotationQueryKeycreated from the given Protocol Buffers object.
-
toAnnotationKeyPB
Converts anAnnotationQueryKeyobject into its Protocol Buffers representation.- Parameters:
key- TheAnnotationQueryKeyto convert.- Returns:
- A
ComplexQueryKeysProto.AnnotationQueryKeyPBrepresenting the givenAnnotationQueryKey.
-
toAggregatedQueryKeyPB
public static DataPointQueryKeysProto.AggregatedQueryKeyPB toAggregatedQueryKeyPB(AggregatedQueryKey any) Converts anAggregatedQueryKeyobject into its Protocol Buffers representation.- Parameters:
any- TheAggregatedQueryKeyto convert.- Returns:
- A
DataPointQueryKeysProto.AggregatedQueryKeyPBrepresenting the givenAggregatedQueryKey.
-
toAggregatedQueryKey
public static AggregatedQueryKey toAggregatedQueryKey(DataPointQueryKeysProto.AggregatedQueryKeyPB key) throws IOException Converts a Protocol Buffers representation of anAggregatedQueryKeyback into anAggregatedQueryKeyobject.- Parameters:
key- TheDataPointQueryKeysProto.AggregatedQueryKeyPBto convert.- Returns:
- An
AggregatedQueryKeycreated from the given Protocol Buffers object. - Throws:
IOException- If an error occurs during the conversion process.
-