/// <summary> /// Converts a logCurveInfo to a channel metadata record. /// </summary> /// <param name="entity">The entity.</param> /// <param name="curve">The curve.</param> /// <param name="indexMetadata">The index metadata.</param> /// <returns></returns> protected override ChannelMetadataRecord ToChannelMetadataRecord(Log entity, LogCurveInfo curve, IndexMetadataRecord indexMetadata) { var uri = curve.GetUri(entity); var isTimeLog = IsTimeLog(entity, true); var curveIndexes = GetCurrentIndexRange(entity); var dataObject = new DataObject(); var unixTime = entity.CommonData.DateTimeLastChange.ToUnixTimeMicroseconds(); StoreStoreProvider.SetDataObject(dataObject, curve, uri, curve.Mnemonic.Value, 0, unixTime.GetValueOrDefault()); return(new ChannelMetadataRecord() { ChannelUri = uri, ContentType = uri.ContentType, DataType = curve.TypeLogData.GetValueOrDefault(LogDataType.@double).ToString().Replace("@", string.Empty), Description = curve.CurveDescription ?? curve.Mnemonic.Value, ChannelName = curve.Mnemonic.Value, Uom = Units.GetUnit(curve.Unit), MeasureClass = curve.ClassWitsml ?? ObjectTypes.Unknown, Source = curve.DataSource ?? ObjectTypes.Unknown, DomainObject = dataObject, Status = entity.ObjectGrowing.GetValueOrDefault() ? ChannelStatuses.Active : ChannelStatuses.Inactive, StartIndex = curveIndexes[curve.Mnemonic.Value].Start.IndexToScale(indexMetadata.Scale, isTimeLog), EndIndex = curveIndexes[curve.Mnemonic.Value].End.IndexToScale(indexMetadata.Scale, isTimeLog), Indexes = new List <IndexMetadataRecord>() { indexMetadata }, CustomData = new Dictionary <string, DataValue>() }); }
/// <summary> /// Converts a logCurveInfo to a channel metadata record. /// </summary> /// <param name="etpAdapter">The ETP adapter.</param> /// <param name="entity">The entity.</param> /// <param name="curve">The curve.</param> /// <param name="indexMetadata">The index metadata.</param> /// <returns></returns> protected override IChannelMetadataRecord ToChannelMetadataRecord(IEtpAdapter etpAdapter, Log entity, LogCurveInfo curve, IIndexMetadataRecord indexMetadata) { var uri = curve.GetUri(entity); var isTimeLog = IsTimeLog(entity, true); var curveIndexes = GetCurrentIndexRange(entity); var unixTime = entity.CommonData.DateTimeLastChange.ToUnixTimeMicroseconds(); var dataObject = etpAdapter.CreateDataObject(); etpAdapter.SetDataObject(dataObject, curve, uri, curve.Mnemonic, 0, unixTime.GetValueOrDefault()); var metadata = etpAdapter.CreateChannelMetadata(uri); metadata.DataType = curve.TypeLogData.GetValueOrDefault(LogDataType.@double).ToString().Replace("@", string.Empty); metadata.Description = curve.CurveDescription ?? curve.Mnemonic; metadata.ChannelName = curve.Mnemonic; metadata.Uom = Units.GetUnit(curve.Unit); metadata.MeasureClass = curve.ClassWitsml?.Name ?? ObjectTypes.Unknown; metadata.Source = curve.DataSource ?? ObjectTypes.Unknown; metadata.DomainObject = dataObject; metadata.Status = etpAdapter.GetChannelStatus(entity.ObjectGrowing.GetValueOrDefault()); metadata.StartIndex = curveIndexes[curve.Mnemonic].Start.IndexToScale(indexMetadata.Scale, isTimeLog); metadata.EndIndex = curveIndexes[curve.Mnemonic].End.IndexToScale(indexMetadata.Scale, isTimeLog); metadata.Indexes = etpAdapter.ToList(new List <IIndexMetadataRecord> { indexMetadata }); return(metadata); }
private Resource ToResource(Log log, LogCurveInfo curve) { return(DiscoveryStoreProvider.New( uuid: curve.Uid, uri: curve.GetUri(log), resourceType: ResourceTypes.DataObject, name: curve.Mnemonic)); }
private IResource ToResource(IEtpAdapter etpAdapter, Log log, LogCurveInfo curve) { return(etpAdapter.CreateResource( uuid: null, uri: curve.GetUri(log), resourceType: ResourceTypes.DataObject, name: curve.Mnemonic, lastChanged: log.GetLastChangedMicroseconds())); }
/// <summary> /// Converts a logCurveInfo to an index metadata record. /// </summary> /// <param name="etpAdapter">The ETP adapter.</param> /// <param name="entity">The entity.</param> /// <param name="indexCurve">The index curve.</param> /// <param name="scale">The scale.</param> /// <returns></returns> protected override IIndexMetadataRecord ToIndexMetadataRecord(IEtpAdapter etpAdapter, Log entity, LogCurveInfo indexCurve, int scale = 3) { var metadata = etpAdapter.CreateIndexMetadata( uri: indexCurve.GetUri(entity), isTimeIndex: IsTimeLog(entity, true), isIncreasing: IsIncreasing(entity)); metadata.Mnemonic = indexCurve.Mnemonic; metadata.Description = indexCurve.CurveDescription; metadata.Uom = Units.GetUnit(indexCurve.Unit); metadata.Scale = scale; return(metadata); }
/// <summary> /// Converts a logCurveInfo to an index metadata record. /// </summary> /// <param name="entity">The entity.</param> /// <param name="indexCurve">The index curve.</param> /// <param name="scale">The scale.</param> /// <returns></returns> protected override IndexMetadataRecord ToIndexMetadataRecord(Log entity, LogCurveInfo indexCurve, int scale = 3) { return(new IndexMetadataRecord() { Uri = indexCurve.GetUri(entity), Mnemonic = indexCurve.Mnemonic.Value, Description = indexCurve.CurveDescription, Uom = Units.GetUnit(indexCurve.Unit), Scale = scale, IndexType = IsTimeLog(entity, true) ? ChannelIndexTypes.Time : ChannelIndexTypes.Depth, Direction = IsIncreasing(entity) ? IndexDirections.Increasing : IndexDirections.Decreasing, CustomData = new Dictionary <string, DataValue>(0), }); }
/// <summary> /// Gets the channel URI. /// </summary> /// <param name="channel">The channel.</param> /// <param name="entity">The data object.</param> /// <returns>The channel URI.</returns> protected override EtpUri GetChannelUri(LogCurveInfo channel, Log entity) { return(channel.GetUri(entity)); }