Ejemplo n.º 1
0
        /// <summary>
        /// uses the sitecore database and xpath query to retrieve data
        /// </summary>
        /// <returns></returns>
        public override IEnumerable <object> GetImportData()
        {
            var items = new List <object>();

            foreach (var query in Query.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                IEnumerable <Item> queriedItems = FromDB.SelectItems(query);

                if (SkipIfExists)
                {
                    queriedItems = queriedItems.Where(i => ToDB.GetItem(i.ID) == null);
                }

                items.AddRange(queriedItems);

                foreach (var i in queriedItems)
                {
                    items.Add(i);
                    if (!RecursivelyFetchChildren)
                    {
                        continue;
                    }

                    items.AddRange(i.Axes.GetDescendants());
                }
            }

            return(items);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// uses the sitecore database and xpath query to retrieve data
        /// </summary>
        /// <returns></returns>
        public override IEnumerable <object> GetImportData()
        {
            var items = new List <object>();

            foreach (var query in Query.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                var cleanQuery = StringUtility.CleanXPath(query);
                Logger.Log("SitecoreDataMap.GetImportData", string.Format("Running query: {0}", cleanQuery));
                items.AddRange(FromDB.SelectItems(cleanQuery));
            }

            return(items);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// uses the sitecore database and xpath query to retrieve data
        /// </summary>
        /// <returns></returns>
        public override IEnumerable <object> GetImportData()
        {
            var items = new List <object>();

            foreach (var query in Query.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (Guid.TryParse(query, out var id))
                {
                    Logger.Log("SitecoreDataMap.GetImportData", string.Format("Adding item: {0}", id));
                    items.Add(FromDB.GetItem(new ID(id)));
                    continue;
                }
                Logger.Log("SitecoreDataMap.GetImportData", string.Format("Running query: {0}", query));
                items.AddRange(FromDB.SelectItems(query));
            }

            return(items);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// uses the sitecore database and xpath query to retrieve data
 /// </summary>
 /// <returns></returns>
 public override IEnumerable <object> GetImportData()
 {
     return(FromDB.SelectItems(StringUtility.CleanXPath(Query)));
 }