Exemple #1
0
        /// <summary>
        /// Gets an <see cref="IQueryable{RigUtilization}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <RigUtilization> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                var objectType = parentUri.Value.ObjectType;
                var objectId   = parentUri.Value.ObjectId;

                if (ObjectTypes.Rig.EqualsIgnoreCase(objectType) && !string.IsNullOrWhiteSpace(objectId))
                {
                    query = query.Where(x => x.Rig.Uuid == objectId);
                }

                if (ObjectTypes.Wellbore.EqualsIgnoreCase(objectType) && !string.IsNullOrWhiteSpace(objectId))
                {
                    query = query.Where(x => x.Wellbore.Uuid == objectId);
                }

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
Exemple #2
0
        /// <summary>
        /// Gets an <see cref="IQueryable{StimJob}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <StimJob> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                var ids         = parentUri.Value.GetObjectIds().ToDictionary(x => x.ObjectType, y => y.ObjectId, StringComparer.CurrentCultureIgnoreCase);
                var uidWellbore = ids[ObjectTypes.Wellbore];
                var uidWell     = ids[ObjectTypes.Well];

                if (!string.IsNullOrWhiteSpace(uidWell))
                {
                    query = query.Where(x => x.UidWell == uidWell);
                }

                if (!string.IsNullOrWhiteSpace(uidWellbore))
                {
                    query = query.Where(x => x.UidWellbore == uidWellbore);
                }

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <ToolErrorTermSet> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all ToolErrorTermSets; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Name)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <DataAssuranceRecord> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all DataAssuranceRecords; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
Exemple #5
0
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <ActivityTemplate> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all ActivityTemplates; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <WellCompletion> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all WellCompletions; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Name)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <DbAuditHistory> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all ChangeLogs; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Name)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <DepthRegImage> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all DepthRegImages; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <WellboreGeometry> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all WellboreGeometries; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
Exemple #10
0
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <RigUtilization> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all RigUtilizations; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <ToolErrorModel> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all ToolErrorModels; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
Exemple #12
0
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <StimJob> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all StimJobs; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Name)
                   .ToList());
        }
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <DownholeComponent> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all DownholeComponents; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
Exemple #14
0
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <SurveyProgram> GetAll(EtpUri?parentUri)
        {
            Logger.DebugFormat("Fetching all SurveyPrograms; Parent URI: {0}", parentUri);

            return(GetAllQuery(parentUri)
                   .OrderBy(x => x.Citation.Title)
                   .ToList());
        }
Exemple #15
0
        /// <summary>
        /// Gets a collection of data objects related to the specified URI.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>A collection of data objects.</returns>
        public override List <MongoDbTransaction> GetAll(EtpUri?parentUri = null)
        {
            var query = GetQuery().AsQueryable();
            var uri   = parentUri?.Uri;

            if (!string.IsNullOrWhiteSpace(parentUri?.Query))
            {
                query = query.LinqToQuerystring(parentUri.Value.Query);
                uri   = uri.Substring(0, uri.IndexOf('?'));
            }

            query = query.Where(x => x.Uri == uri);

            return(query.ToList());
        }
        /// <summary>
        /// Gets an <see cref="IQueryable{Well}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <Well> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                // no ObjectId parameters

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
        /// <summary>
        /// Gets an <see cref="IQueryable{ToolErrorModel}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <ToolErrorModel> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                //var uidWellbore = parentUri.Value.ObjectId;
                //query = query.Where(x => x.Wellbore.Uuid == uidWellbore);

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
        /// <summary>
        /// Gets an <see cref="IQueryable{WellCompletion}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <WellCompletion> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                var uidWell = parentUri.Value.ObjectId;

                if (!string.IsNullOrWhiteSpace(uidWell))
                {
                    query = query.Where(x => x.UidWell == uidWell);
                }

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
        /// <summary>
        /// Gets an <see cref="IQueryable{DataAssuranceRecord}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <DataAssuranceRecord> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                if (!parentUri.Value.IsBaseUri && !ObjectTypes.DataAssuranceRecord.Equals(parentUri.Value.ObjectType))
                {
                    var objectId    = parentUri.Value.ObjectId;
                    var contentType = parentUri.Value.ContentType.ToString();

                    query = query.Where(x =>
                                        x.ReferencedData.Uuid == objectId &&
                                        x.ReferencedData.ContentType == contentType);
                }

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
Exemple #20
0
        /// <summary>
        /// Gets an <see cref="IQueryable{Activity}" /> instance to by used by the GetAll method.
        /// </summary>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An executable query.</returns>
        protected override IQueryable <Activity> GetAllQuery(EtpUri?parentUri)
        {
            var query = GetQuery().AsQueryable();

            if (parentUri != null)
            {
                if (!parentUri.Value.IsBaseUri && !ObjectTypes.Activity.Equals(parentUri.Value.ObjectType))
                {
                    var objectId    = parentUri.Value.ObjectId;
                    var contentType = parentUri.Value.ContentType.ToString();

                    query = query.Where(x =>
                                        x.ActivityDescriptor.Uuid == objectId &&
                                        x.ActivityDescriptor.ContentType == contentType);
                }

                if (!string.IsNullOrWhiteSpace(parentUri.Value.Query))
                {
                    query = query.LinqToQuerystring(parentUri.Value.Query);
                }
            }

            return(query);
        }
Exemple #21
0
 /// <summary>
 /// Gets a collection of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>A collection of data objects.</returns>
 IList IEtpDataProvider.GetAll(EtpUri?parentUri)
 {
     return(GetAll(parentUri));
 }
Exemple #22
0
 /// <summary>
 /// Gets a collection of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>A collection of data objects.</returns>
 public virtual List <TObject> GetAll(EtpUri?parentUri = null)
 {
     return(DataAdapter.GetAll(parentUri));
 }
Exemple #23
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>()
            });
        }
 /// <summary>
 /// Gets a collection of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>A collection of data objects.</returns>
 public virtual List <T> GetAll(EtpUri?parentUri = null)
 {
     return(new List <T>());
 }
Exemple #25
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>()
            });
        }
 /// <summary>
 /// Gets an <see cref="IQueryable{T}"/> instance to by used by the GetAll method.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>An executable query.</returns>
 protected virtual IQueryable <T> GetAllQuery(EtpUri?parentUri)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Gets a collection of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>A collection of data objects.</returns>
 IList IWitsmlDataAdapter.GetAll(EtpUri?parentUri)
 {
     return(GetAll(parentUri));
 }
 /// <summary>
 /// Gets a collection of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>A collection of data objects.</returns>
 public virtual List <T> GetAll(EtpUri?parentUri = null)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Determines if the specified URI has child data objects.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>If there are any related data objects.</returns>
 public virtual bool Any(EtpUri?parentUri = null)
 {
     return(GetAllQuery(parentUri).Any());
 }
 /// <summary>
 /// Gets the count of data objects related to the specified URI.
 /// </summary>
 /// <param name="parentUri">The parent URI.</param>
 /// <returns>The count of related data objects.</returns>
 public virtual int Count(EtpUri?parentUri = null)
 {
     return(GetAllQuery(parentUri).Count());
 }