Exemple #1
0
 private static QualityCondition GetQualityCondition(
     [NotNull] IErrorObject errorObject,
     [NotNull] IRepository <QualityCondition> qualityConditionRepository)
 {
     return(errorObject.QualityConditionId.HasValue
                                ? qualityConditionRepository.Get(
                errorObject.QualityConditionId.Value)
                                : null);
 }
Exemple #2
0
        public static IEnumerable <IRow> GetInvolvedRows(
            [NotNull] IErrorObject errorObject,
            [NotNull] IModelContext modelContext,
            [NotNull] IQualityConditionRepository qualityConditionRepository)
        {
            Assert.ArgumentNotNull(errorObject, nameof(errorObject));
            Assert.ArgumentNotNull(modelContext, nameof(modelContext));

            var datasetResolver = new QualityConditionObjectDatasetResolver(modelContext);

            return(GetInvolvedRows(errorObject, modelContext, qualityConditionRepository,
                                   datasetResolver));
        }
Exemple #3
0
        public static IList <IFeature> GetInvolvedOrRelatedFeatures(
            [NotNull] IObject errorObject,
            [NotNull] IDatasetLookup datasetLookup,
            [NotNull] IModelContext modelContext,
            [NotNull] IQualityConditionRepository qualityConditionRepository)
        {
            Assert.ArgumentNotNull(errorObject, nameof(errorObject));
            Assert.ArgumentNotNull(datasetLookup, nameof(datasetLookup));
            Assert.ArgumentNotNull(modelContext, nameof(modelContext));

            var list = new List <IFeature>();

            IErrorDataset errorTable = GetErrorDataset(errorObject, datasetLookup);

            IErrorObject errorRow = CreateErrorObject(errorObject, errorTable, null);

            foreach (
                IRow involvedRow in
                GetInvolvedRows(errorRow, modelContext, qualityConditionRepository))
            {
                var feature = involvedRow as IFeature;

                if (feature != null)
                {
                    list.Add(feature);
                }
                else
                {
                    list.AddRange(GetDerivedTableGeometryFeatures((IObject)involvedRow,
                                                                  datasetLookup,
                                                                  modelContext));
                }
            }

            return(list);
        }
Exemple #4
0
        private static IEnumerable <IRow> GetInvolvedRows(
            [NotNull] IErrorObject errorObject,
            [NotNull] IDatasetContext datasetContext,
            [NotNull] IQualityConditionRepository qualityConditionRepository,
            [NotNull] IQualityConditionObjectDatasetResolver datasetResolver)
        {
            IList <InvolvedRow> involved = RowParser.Parse(errorObject.RawInvolvedObjects);

            QualityCondition qualityCondition = GetQualityCondition(errorObject,
                                                                    qualityConditionRepository);

            if (qualityCondition == null)
            {
                yield break;
            }

            foreach (KeyValuePair <string, IList <int> > pair in
                     GetInvolvedObjectIDsByTableName(involved))
            {
                string      tableName = pair.Key;
                IList <int> objectIDs = pair.Value;

                IObjectDataset dataset =
                    datasetResolver.GetDatasetByInvolvedRowTableName(tableName, qualityCondition);
                if (dataset == null)
                {
                    continue;
                }

                ITable table;
                try
                {
                    table = datasetContext.OpenTable(dataset);
                }
                catch (Exception e)
                {
                    _msg.WarnFormat("Error getting involved rows for table {0}: {1}", tableName,
                                    e.Message);
                    continue;
                }

                if (table == null)
                {
                    continue;
                }

                IEnumerable <IRow> rows = TryGetRows(table, objectIDs);

                if (rows == null)
                {
                    // error already logged in TryGetRows()
                    continue;
                }

                foreach (IRow row in rows)
                {
                    if (GdbObjectUtils.IsDeleted(row))
                    {
                        // don't return deleted rows
                        continue;
                    }

                    yield return(row);
                }
            }
        }