Exemplo n.º 1
0
        private List <Channel> GetChannelsByUris(params EtpUri[] uris)
        {
            if (uris.Any(u => u.IsBaseUri))
            {
                return(GetAll(null));
            }

            var channelUris  = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Channel);
            var wellboreUris = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Wellbore);
            var wellUris     = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Well);

            if (wellUris.Any())
            {
                var wellboreFilters = wellUris.Select(wellUri => MongoDbUtility.BuildFilter <Wellbore>("Well.Uuid", wellUri.ObjectId)).ToList();
                var wellbores       = GetCollection <Wellbore>(ObjectNames.Wellbore200)
                                      .Find(Builders <Wellbore> .Filter.Or(wellboreFilters)).ToList();
                wellboreUris.AddRange(wellbores.Select(w => w.GetUri()).Where(u => !wellboreUris.Contains(u)));
            }

            var channelFilters = wellboreUris.Select(wellboreUri => MongoDbUtility.BuildFilter <Channel>("Wellbore.Uuid", wellboreUri.ObjectId)).ToList();

            channelFilters.AddRange(channelUris.Select(u => MongoDbUtility.GetEntityFilter <Channel>(u, IdPropertyName)));

            return(channelFilters.Any() ? GetCollection().Find(Builders <Channel> .Filter.Or(channelFilters)).ToList() : new List <Channel>());
        }
Exemplo n.º 2
0
        private List <Log> GetLogsByUris(List <EtpUri> uris)
        {
            if (uris.Any(u => u.IsBaseUri))
            {
                return(GetAll(null));
            }

            var logUris      = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Log);
            var wellboreUris = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Wellbore);
            var wellUris     = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Well);

            if (wellUris.Any())
            {
                var wellboreFilters = wellUris.Select(wellUri => MongoDbUtility.BuildFilter <Wellbore>("Well.Uuid", wellUri.ObjectId)).ToList();
                var wellbores       = GetCollection <Wellbore>(ObjectNames.Wellbore200)
                                      .Find(Builders <Wellbore> .Filter.Or(wellboreFilters)).ToList();
                wellboreUris.AddRange(wellbores.Select(w => w.GetUri()).Where(u => !wellboreUris.Contains(u)));
            }

            var logFilters = wellboreUris.Select(wellboreUri => MongoDbUtility.BuildFilter <Log>("Wellbore.Uuid", wellboreUri.ObjectId)).ToList();

            logFilters.AddRange(logUris.Select(logUri => MongoDbUtility.GetEntityFilter <Log>(logUri, IdPropertyName)));

            return(logFilters.Any() ? GetCollection().Find(Builders <Log> .Filter.Or(logFilters)).ToList() : new List <Log>());
        }
        private List <ChannelSet> GetChannelSetByUris(List <EtpUri> uris)
        {
            if (uris.Any(u => u.IsBaseUri))
            {
                return(GetAll(null));
            }

            _wellboreUris   = new List <EtpUri>();
            _channelSetUris = new List <EtpUri>();

            var channelSetUris = MongoDbUtility.GetObjectUris(uris, ObjectTypes.ChannelSet);
            var wellboreUris   = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Wellbore);
            var wellUris       = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Well);

            if (wellUris.Any())
            {
                var wellboreFilters = wellUris.Select(wellUri => MongoDbUtility.BuildFilter <Wellbore>("Well.Uuid", wellUri.ObjectId)).ToList();
                var wellbores       = GetCollection <Wellbore>(ObjectNames.Wellbore200)
                                      .Find(Builders <Wellbore> .Filter.Or(wellboreFilters)).ToList();
                wellboreUris.AddRange(wellbores.Select(w => w.GetUri()).Where(u => !wellboreUris.Contains(u)));
            }

            _wellboreUris.AddRange(wellboreUris);
            var channelSetFilters = wellboreUris.Select(wellboreUri => MongoDbUtility.BuildFilter <ChannelSet>("Wellbore.Uuid", wellboreUri.ObjectId)).ToList();

            _channelSetUris.AddRange(channelSetUris);
            channelSetFilters.AddRange(channelSetUris.Select(GetEntityFilter));

            var channelUris = MongoDbUtility.GetObjectUris(uris, ObjectTypes.Channel).Where(u => u.Parent.ObjectType == ObjectTypes.ChannelSet);

            foreach (var channelUri in channelUris)
            {
                channelSetFilters.Add(MongoDbUtility.BuildFilter <ChannelSet>(IdPropertyName, channelUri.Parent.ObjectId));
            }

            return(channelSetFilters.Any() ? GetCollection().Find(Builders <ChannelSet> .Filter.Or(channelSetFilters)).ToList() : new List <ChannelSet>());
        }