public void Execute(Stream stream) { var p = "/"; foreach (var f in ParentFolder.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)) { folderService.Create(f, p); p += p == "/" ? f: "/" + f; } var xmlDoc = new XmlDocument(); using (StreamReader reader = new StreamReader(stream)) xmlDoc.Load(reader); var root = xmlDoc.FirstChild.NextSibling; foreach (var childParser in ChildParsers) { childParser.Root = this; childParser.Parent = null; childParser.ParentPath = ParentFolder; if (childParser is IParserPathable) { ((IParserPathable)childParser).RootPath = RootPath; } childParser.Execute(root); } }
/// <summary> /// Imports the specified structure info. /// </summary> /// <param name="structureInfo"> The structure info. </param> /// <param name="folder"> The folder. </param> /// <param name="parentId"> The parent id. </param> protected virtual void Import(StructureInfo structureInfo, Folder folder, Guid parentId) { foreach (var folderCarrier in structureInfo.MediaArchive.Folders.Where(x => x.ParentFolderSystemId == parentId)) { var newFolder = new Folder(structureInfo.MediaArchive.FolderTemplateId, folderCarrier.Name) { SystemId = structureInfo.Id(folderCarrier.SystemId), ParentFolderSystemId = folder.SystemId, }; foreach (var item in folderCarrier.AccessControlList) { newFolder.AccessControlList.Add(new AccessControlEntry(item.Operation, structureInfo.Id(structureInfo.Foundation.VisitorGroupId))); } _folderService.Create(newFolder); if (structureInfo.CreateExampleProducts) { Import(structureInfo, newFolder, folderCarrier.SystemId); } else { ImportFiles(structureInfo, newFolder, folderCarrier.SystemId); } } ImportFiles(structureInfo, folder, parentId); }
public void CreateFolderAtRootLevel() { var rs = GetReportingService(); var service = new FolderService(rs); service.Create("ChildFolder", "/"); Assert.That(rs.GetItemType("/ChildFolder"), Is.EqualTo("Folder")); }
public void CreateAlreadyExistingFolder() { var rs = GetReportingService(); rs.CreateFolder("ChildFolder", "/", null); var service = new FolderService(rs); service.Create("ChildFolder", "/"); Assert.That(rs.GetItemType("/ChildFolder"), Is.EqualTo("Folder")); }
public void CreateFolderAtSecondLevel() { var rs = GetReportingService(); rs.CreateFolder("FirstFolder", "/", null); var service = new FolderService(rs); service.Create("SecondFolder", "/FirstFolder"); Assert.That(rs.GetItemType("/FirstFolder/SecondFolder"), Is.EqualTo("Folder")); }
private Folder CreateFolder(Guid parentId, string name, Guid folderTemplateId) { var f = new Folder(folderTemplateId, name) { ParentFolderSystemId = parentId, SystemId = Guid.NewGuid() }; _folderService.Create(f); return(f); }
public virtual void Execute(XmlNode node) { var folderNodes = node.SelectNodes("./Folder"); foreach (XmlNode folderNode in folderNodes) { var name = folderNode.Attributes["Name"].Value; folderService.Create(name, ParentPath); foreach (var parser in ChildrenParsers) { parser.ParentPath = this.ParentPath == "/" ? $"/{name}" : $"{this.ParentPath}/{name}"; parser.Execute(folderNode); } var childFolderParser = (FolderParser)this.MemberwiseClone(); childFolderParser.ParentPath = this.ParentPath == "/" ? $"/{name}" : $"{ParentPath}/{name}"; childFolderParser.Execute(folderNode); } }
public PackageInfo CreatePackageInfo(StructureInfo structureInfo, string name, string domainName) { Type = name.Replace(" ", ""); CreateBasicMaping(structureInfo); var assortment = CreateAssortment(structureInfo, name, domainName); CreateDomainName(domainName, structureInfo); CreateWebsite(name, structureInfo); if (structureInfo.Website.Market != null) { CreateMarket(structureInfo, assortment.SystemId, name); } var channel = CreateChannel(structureInfo, structureInfo.Website.Website.SystemId, ExtractUrlPath(domainName), name); var folderTemplateId = _fieldTemplateService.GetAll().First(c => (c is FolderFieldTemplate)).SystemId; var newFolder = new Folder(folderTemplateId, name); var visitorGroupSystemId = (_groupService.Get <Group>("Visitors") ?? _groupService.Get <Group>("Besökare"))?.SystemId ?? Guid.Empty; if (visitorGroupSystemId != Guid.Empty) { newFolder.AccessControlList.Add(new AccessControlEntry(Operations.Entity.Read, visitorGroupSystemId)); } _folderService.Create(newFolder); var priceList = CreatePriceList(structureInfo.Website.Website, structureInfo); return(new PackageInfo { Channel = channel, Market = structureInfo.Website.Market, Website = structureInfo.Website.Website, Assortment = assortment, Folder = newFolder, Inventory = CreateInventory(name, structureInfo), PriceList = priceList, DeliveryMethods = structureInfo.ECommerce.DeliveryMethod, PaymentMethods = structureInfo.ECommerce.PaymentMethod }); }
public void Commit() { FolderService.Create(Path); WriterService.CreateMenuItem(this); }
public void Commit() { FolderService.Create(Path); WriterService.CreatePageItem(this, SnippetPath, Description); }