Exemplo n.º 1
0
        /// <summary>
        /// Creates a new index metadata record.
        /// </summary>
        /// <param name="etpAdapter">The ETP adapter.</param>
        /// <param name="uri">The URI.</param>
        /// <param name="isTimeIndex">if set to <c>true</c> [is time index].</param>
        /// <param name="isIncreasing">if set to <c>true</c> [is increasing].</param>
        /// <returns>A new <see cref="IIndexMetadataRecord" /> instance.</returns>
        public static IIndexMetadataRecord CreateIndexMetadata(this IEtpAdapter etpAdapter, EtpUri?uri = null, bool isTimeIndex = true, bool isIncreasing = true)
        {
            if (etpAdapter is Energistics.Etp.v11.Etp11Adapter)
            {
                return(new Energistics.Etp.v11.Datatypes.ChannelData.IndexMetadataRecord
                {
                    Uri = uri?.ToString(),
                    IndexType = isTimeIndex
                        ? Energistics.Etp.v11.Datatypes.ChannelData.ChannelIndexTypes.Time
                        : Energistics.Etp.v11.Datatypes.ChannelData.ChannelIndexTypes.Depth,
                    Direction = isIncreasing
                        ? Energistics.Etp.v11.Datatypes.ChannelData.IndexDirections.Increasing
                        : Energistics.Etp.v11.Datatypes.ChannelData.IndexDirections.Decreasing,
                    CustomData = new Dictionary <string, Energistics.Etp.v11.Datatypes.DataValue>()
                });
            }

            return(new Energistics.Etp.v12.Datatypes.ChannelData.IndexMetadataRecord
            {
                Uri = uri?.ToString(),
                IndexKind = isTimeIndex
                    ? Energistics.Etp.v12.Datatypes.ChannelData.ChannelIndexKinds.Time
                    : Energistics.Etp.v12.Datatypes.ChannelData.ChannelIndexKinds.Depth,
                Direction = isIncreasing
                    ? Energistics.Etp.v12.Datatypes.ChannelData.IndexDirections.Increasing
                    : Energistics.Etp.v12.Datatypes.ChannelData.IndexDirections.Decreasing,
                DepthDatum = string.Empty,
                TimeDatum = string.Empty,
                CustomData = new Dictionary <string, Energistics.Etp.v12.Datatypes.DataValue>()
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Growings the object append.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="wellboreUri">The wellbore URI.</param>
        public void UpdateLastAppendDateTime(EtpUri uri, EtpUri wellboreUri)
        {
            uri = new EtpUri(uri.ToString().ToLowerInvariant());

            var growingObject      = GetEntity(uri);
            var lastAppendDateTime = DateTime.UtcNow;

            if (growingObject == null)
            {
                growingObject = new DbGrowingObject()
                {
                    Uri                = uri,
                    ObjectType         = uri.ObjectType,
                    WellboreUri        = wellboreUri,
                    LastAppendDateTime = lastAppendDateTime
                };

                InsertEntity(growingObject);
            }
            else
            {
                growingObject.LastAppendDateTime = lastAppendDateTime;
                ReplaceEntity(growingObject, uri);
            }
        }
Exemplo n.º 3
0
        private List <ChannelDataChunk> GetDataChunks(EtpUri uri)
        {
            var filter     = MongoDbUtility.BuildFilter <ChannelDataChunk>("Uri", uri.ToString());
            var database   = _provider.GetDatabase();
            var collection = database.GetCollection <ChannelDataChunk>("channelDataChunk");

            return(collection.Find(filter).ToList());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new channel metadata record.
        /// </summary>
        /// <param name="etpAdapter">The ETP adapter.</param>
        /// <param name="uri">The URI.</param>
        /// <returns>A new <see cref="IChannelMetadataRecord"/> instance.</returns>
        public static IChannelMetadataRecord CreateChannelMetadata(this IEtpAdapter etpAdapter, EtpUri?uri = null)
        {
            if (etpAdapter is Energistics.Etp.v11.Etp11Adapter)
            {
                return(new Energistics.Etp.v11.Datatypes.ChannelData.ChannelMetadataRecord
                {
                    ChannelUri = uri?.ToString(),
                    ContentType = uri?.ContentType.ToString(),
                    Status = Energistics.Etp.v11.Datatypes.ChannelData.ChannelStatuses.Active,
                    CustomData = new Dictionary <string, Energistics.Etp.v11.Datatypes.DataValue>()
                });
            }

            return(new Energistics.Etp.v12.Datatypes.ChannelData.ChannelMetadataRecord
            {
                ChannelUri = uri?.ToString(),
                ContentType = uri?.ContentType.ToString(),
                Status = Energistics.Etp.v12.Datatypes.ChannelData.ChannelStatuses.Active,
                AttributeMetadata = new List <Energistics.Etp.v12.Datatypes.AttributeMetadataRecord>(),
                CustomData = new Dictionary <string, Energistics.Etp.v12.Datatypes.DataValue>()
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new channel metadata record.
        /// </summary>
        /// <param name="etpAdapter">The ETP adapter.</param>
        /// <param name="uri">The URI.</param>
        /// <returns>A new <see cref="IChannelMetadataRecord"/> instance.</returns>
        public static IChannelMetadataRecord CreateChannelMetadata(this IEtpAdapter etpAdapter, EtpUri?uri = null)
        {
            if (etpAdapter.SupportedVersion == EtpVersion.v11)
            {
                return(new Energistics.Etp.v11.Datatypes.ChannelData.ChannelMetadataRecord
                {
                    ChannelUri = uri?.ToString(),
                    ContentType = uri?.ContentType.ToString(),
                    Status = Energistics.Etp.v11.Datatypes.ChannelData.ChannelStatuses.Active,
                    CustomData = new Dictionary <string, Energistics.Etp.v11.Datatypes.DataValue>()
                });
            }

            return(new Energistics.Etp.v12.Datatypes.ChannelData.ChannelMetadataRecord
            {
                ChannelUri = uri?.ToString(),
                ContentType = uri?.ContentType.ToString(),
                Status = Energistics.Etp.v12.Datatypes.ChannelData.ChannelStatusKind.Active,
                AttributeMetadata = new List <Energistics.Etp.v12.Datatypes.AttributeMetadataRecord>(),
                CustomData = new Dictionary <string, Energistics.Etp.v12.Datatypes.DataValue>(),
                AxisVectorLengths = new List <int>()
            });
        }
Exemplo n.º 6
0
 /// <summary>
 /// Gets the entity filter for the specified URI.
 /// </summary>
 /// <typeparam name="TObject">The type of the object.</typeparam>
 /// <param name="uri">The URI.</param>
 /// <param name="idPropertyName">Name of the identifier property.</param>
 /// <returns>The entity filter.</returns>
 protected override FilterDefinition <TObject> GetEntityFilter <TObject>(EtpUri uri, string idPropertyName)
 {
     return(MongoDbUtility.BuildFilter <TObject>(idPropertyName, uri.ToString()));
 }