Пример #1
0
        /// <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);
        }
Пример #2
0
        private IChannelMetadataRecord ToChannelMetadataRecord(IEtpAdapter etpAdapter, Trajectory entity, IIndexMetadataRecord indexMetadata)
        {
            var uri         = entity.GetUri();
            var lastChanged = entity.Citation.LastUpdate.ToUnixTimeMicroseconds().GetValueOrDefault();

            var dataObject = etpAdapter.CreateDataObject();

            etpAdapter.SetDataObject(dataObject, entity, uri, entity.Citation.Title, 0, lastChanged);

            var metadata = etpAdapter.CreateChannelMetadata(uri);

            metadata.DataType     = [email protected]();
            metadata.Description  = entity.Citation.Description ?? entity.Citation.Title;
            metadata.ChannelName  = entity.Citation.Title;
            metadata.Uom          = Units.GetUnit(entity.MDMin?.Uom.ToString());
            metadata.MeasureClass = ObjectTypes.Unknown;
            metadata.Source       = ObjectTypes.Unknown;
            metadata.Uuid         = entity.Uuid;
            metadata.DomainObject = dataObject;
            metadata.Status       = etpAdapter.GetChannelStatus(entity.GrowingStatus == ChannelStatus.active);
            metadata.StartIndex   = entity.MDMin?.Value.IndexToScale(indexMetadata.Scale);
            metadata.EndIndex     = entity.MDMax?.Value.IndexToScale(indexMetadata.Scale);
            metadata.Indexes      = etpAdapter.ToList(new List <IIndexMetadataRecord> {
                indexMetadata
            });

            return(metadata);
        }