Esempio n. 1
0
        public static IndexingPolicy ConvertPSIndexingToIndexingPolicy(PSIndexingPolicy pSIndexingPolicy)
        {
            IndexingPolicy indexingPolicy = new IndexingPolicy
            {
                Automatic    = pSIndexingPolicy.Automatic,
                IndexingMode = pSIndexingPolicy.IndexingMode,
            };

            if (pSIndexingPolicy.IncludedPaths != null)
            {
                IList <IncludedPath> includedPaths = new List <IncludedPath>();
                foreach (PSIncludedPath pSIncludedPath in pSIndexingPolicy.IncludedPaths)
                {
                    includedPaths.Add(PSIncludedPath.ConvertPSIncludedPathToIncludedPath(pSIncludedPath));
                }
                indexingPolicy.IncludedPaths = includedPaths;
            }

            if (pSIndexingPolicy.ExcludedPaths != null && pSIndexingPolicy.ExcludedPaths.Count > 0)
            {
                IList <ExcludedPath> excludedPaths = new List <ExcludedPath>();
                foreach (PSExcludedPath pSExcludedPath in pSIndexingPolicy.ExcludedPaths)
                {
                    excludedPaths.Add(PSExcludedPath.ConvertPSExcludedPathToExcludedPath(pSExcludedPath));
                }
                indexingPolicy.ExcludedPaths = excludedPaths;
            }

            if (pSIndexingPolicy.CompositeIndexes != null)
            {
                IList <IList <CompositePath> > compositeIndexes = new List <IList <CompositePath> >();

                foreach (IList <PSCompositePath> pSCompositePathList in pSIndexingPolicy.CompositeIndexes)
                {
                    IList <CompositePath> compositePathList = new List <CompositePath>();
                    foreach (PSCompositePath pSCompositePath in pSCompositePathList)
                    {
                        compositePathList.Add(PSCompositePath.ConvertPSCompositePathToCompositePath(pSCompositePath));
                    }
                    compositeIndexes.Add(compositePathList);
                }

                indexingPolicy.CompositeIndexes = compositeIndexes;
            }

            if (pSIndexingPolicy.SpatialIndexes != null && pSIndexingPolicy.SpatialIndexes.Count > 0)
            {
                IList <SpatialSpec> spatialIndexes = new List <SpatialSpec>();

                foreach (PSSpatialSpec pSSpatialSpec in pSIndexingPolicy.SpatialIndexes)
                {
                    spatialIndexes.Add(PSSpatialSpec.ConvertPSSpatialSpecToSpatialSpec(pSSpatialSpec));
                }

                indexingPolicy.SpatialIndexes = new List <SpatialSpec>(spatialIndexes);
            }

            return(indexingPolicy);
        }
Esempio n. 2
0
 public static CompositePath ConvertPSCompositePathToCompositePath(PSCompositePath pSCompositePath)
 {
     return(new CompositePath
     {
         Order = pSCompositePath.Order,
         Path = pSCompositePath.Path
     });
 }
Esempio n. 3
0
        public static CompositePath ToSDKModel(PSCompositePath pSCompositePath)
        {
            if (pSCompositePath == null)
            {
                return(null);
            }

            return(new CompositePath
            {
                Order = pSCompositePath.Order,
                Path = pSCompositePath.Path
            });
        }
Esempio n. 4
0
        public static IndexingPolicy ToSDKModel(PSIndexingPolicy pSIndexingPolicy)
        {
            if (pSIndexingPolicy == null)
            {
                return(null);
            }

            IndexingPolicy indexingPolicy = new IndexingPolicy
            {
                Automatic = pSIndexingPolicy.Automatic,
            };

            if (pSIndexingPolicy.IndexingMode != null)
            {
                indexingPolicy.IndexingMode = pSIndexingPolicy.IndexingMode;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.IncludedPaths))
            {
                IList <IncludedPath> includedPaths = new List <IncludedPath>();
                foreach (PSIncludedPath pSIncludedPath in pSIndexingPolicy.IncludedPaths)
                {
                    includedPaths.Add(PSIncludedPath.ToSDKModel(pSIncludedPath));
                }
                indexingPolicy.IncludedPaths = includedPaths;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.ExcludedPaths))
            {
                IList <ExcludedPath> excludedPaths = new List <ExcludedPath>();
                foreach (PSExcludedPath pSExcludedPath in pSIndexingPolicy.ExcludedPaths)
                {
                    excludedPaths.Add(PSExcludedPath.ToSDKModel(pSExcludedPath));
                }
                indexingPolicy.ExcludedPaths = excludedPaths;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.CompositeIndexes))
            {
                IList <IList <CompositePath> > compositeIndexes = new List <IList <CompositePath> >();
                foreach (IList <PSCompositePath> pSCompositePathList in pSIndexingPolicy.CompositeIndexes)
                {
                    if (ModelHelper.IsNotNullOrEmpty(pSCompositePathList))
                    {
                        IList <CompositePath> compositePathList = new List <CompositePath>();
                        foreach (PSCompositePath pSCompositePath in pSCompositePathList)
                        {
                            compositePathList.Add(PSCompositePath.ToSDKModel(pSCompositePath));
                        }
                        compositeIndexes.Add(compositePathList);
                    }
                }
                indexingPolicy.CompositeIndexes = compositeIndexes;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSIndexingPolicy.SpatialIndexes))
            {
                IList <SpatialSpec> spatialIndexes = new List <SpatialSpec>();
                foreach (PSSpatialSpec pSSpatialSpec in pSIndexingPolicy.SpatialIndexes)
                {
                    spatialIndexes.Add(PSSpatialSpec.ToSDKModel(pSSpatialSpec));
                }
                indexingPolicy.SpatialIndexes = new List <SpatialSpec>(spatialIndexes);
            }

            return(indexingPolicy);
        }