Exemplo n.º 1
0
        public static ItemImportMap BuildMapInfo(ID mapId)
        {
            var database         = Sitecore.Configuration.Factory.GetDatabase("master");
            var mapItem          = database.GetItem(mapId);
            var inputColumnsItem =
                mapItem.FirstChildInheritingFrom(InputColumnCollectionItem.TemplateId);

            var mapInfo = new ItemImportMap
            {
                InputFields = inputColumnsItem.Children.Select(c => new InputField {
                    Name                    = c.Name,
                    XsltSelector            = c["xsltselector"],
                    Property                = c["property"],
                    TextOnly                = ((Sitecore.Data.Fields.CheckboxField)c.Fields["TextOnly"]).Checked,
                    ReplacementRegexPattern = c["ReplacementRegexPattern"],
                    ReplacementText         = c["ReplacementText"],
                    Fields                  = c.Children.Select(f => new InputField
                    {
                        Name                    = f.Name,
                        XsltSelector            = f["xsltselector"],
                        Property                = f["property"],
                        TextOnly                = ((Sitecore.Data.Fields.CheckboxField)f.Fields["TextOnly"]).Checked,
                        ReplacementRegexPattern = f["ReplacementRegexPattern"],
                        ReplacementText         = f["ReplacementText"]
                    }).ToList()
                }).ToList(),
                OutputMaps = mapItem.Children
                             .Where(c => c.InheritsFrom(OutputMapTemplateItem.TemplateId))
                             .Select(om => CreateOutputMap(om, null))
                             .ToList()
            };

            return(mapInfo);
        }
Exemplo n.º 2
0
        public static ItemImportMap BuildMapInfo(ID mapId)
        {
            var database = Sitecore.Configuration.Factory.GetDatabase("master");
            var mapItem = database.GetItem(mapId);
            var inputColumnsItem =
                mapItem.FirstChildInheritingFrom(InputColumnCollectionItem.TemplateId);

            var mapInfo = new ItemImportMap
            {
                InputFields = inputColumnsItem.Children.Select(c => new InputField {Name = c.Name}).ToList(),
                OutputMaps = mapItem.Children
                    .Where(c => c.InheritsFrom(OutputMapTemplateItem.TemplateId))
                    .Select(om => CreateOutputMap(om, null))
                    .ToList()
            };
            return mapInfo;
        }
Exemplo n.º 3
0
        public static ItemImportMap BuildMapInfo(ID mapId)
        {
            var database         = Sitecore.Configuration.Factory.GetDatabase("master");
            var mapItem          = database.GetItem(mapId);
            var inputColumnsItem =
                mapItem.FirstChildInheritingFrom(InputColumnCollectionItem.TemplateId);

            var mapInfo = new ItemImportMap
            {
                InputFields = inputColumnsItem.Children.Select(c => new InputField {
                    Name = c.Name
                }).ToList(),
                OutputMaps = mapItem.Children
                             .Where(c => c.InheritsFrom(OutputMapTemplateItem.TemplateId))
                             .Select(om => CreateOutputMap(om, null))
                             .ToList()
            };

            return(mapInfo);
        }