public static IEnumerable <IContentType> ImportContentType(this XElement node)
        {
            XElement idElement = node.Element("Info").Element("Id");
            IEnumerable <IContentType> imported = _packageService.ImportContentTypes(node, false, raiseEvents: false);

            return(imported);
        }
Exemplo n.º 2
0
        private async Task Import(string[] args)
        {
            if (!args.Any())
            {
                await Out.WriteLineAsync("No import target defined");

                return;
            }

            var deliveryName = args[0].Trim();

            string directory;

            if (!settings.TryGetChauffeurDirectory(out directory))
            {
                return;
            }

            var file = fileSystem.Path.Combine(directory, deliveryName + ".xml");

            if (!fileSystem.File.Exists(file))
            {
                await Out.WriteLineFormattedAsync("Unable to located the import script '{0}'", deliveryName);

                return;
            }

            var xml = XDocument.Load(file);

            packagingService.ImportContentTypes(xml.Elements().First());

            await Out.WriteLineFormattedAsync("Content Type has been imported");
        }
Exemplo n.º 3
0
        private async Task UnpackDocumentTypes(IEnumerable <XElement> elements)
        {
            foreach (var element in elements)
            {
                var name = (string)element.Element("Info").Element("Name");
                await Out.WriteLineFormattedAsync("Importing DocumentType '{0}'", name);

                packagingService.ImportContentTypes(element);
            }
        }
Exemplo n.º 4
0
        public static IEnumerable <IContentType> ImportContentType(this XElement node)
        {
            XElement idElement = node.Element("Info").Element("Id");

            try
            {
                IEnumerable <IContentType> imported = _packageService.ImportContentTypes(node, false, raiseEvents: false);
                return(imported);
            }
            catch (Exception ex)
            {
                LogHelper.Error <SyncDocType>(string.Format("Failed to import {0}", node.Element("Info").Element("Alias").Value), ex);
                return(null);
            }
        }
        private IEnumerable <IContentType> InstallDocumentTypes(XElement documentTypes, int userId = 0)
        {
            if (string.Equals(Constants.Packaging.DocumentTypesNodeName, documentTypes.Name.LocalName) == false)
            {
                if (string.Equals(Constants.Packaging.DocumentTypeNodeName, documentTypes.Name.LocalName) == false)
                {
                    throw new ArgumentException(
                              "Must be \"" + Constants.Packaging.DocumentTypesNodeName + "\" as root", "documentTypes");
                }

                documentTypes = new XElement(Constants.Packaging.DocumentTypesNodeName, documentTypes);
            }

            return(_packagingService.ImportContentTypes(documentTypes, userId));
        }
Exemplo n.º 6
0
 public IEnumerable <IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true)
 {
     return(realPackagingService.ImportContentTypes(element, importStructure, userId, raiseEvents));
 }
Exemplo n.º 7
0
        private async Task <IEnumerable <IContentType> > UnpackDocumentTypes(XElement elements)
        {
            await Out.WriteLineAsync("Importing content types");

            return(packagingService.ImportContentTypes(elements));
        }