示例#1
0
        protected override void CollectInput()
        {
            IEnumerable <SchemaData>       schemas       = new List <SchemaData>();
            IEnumerable <PageTemplateData> pageTemplates = new List <PageTemplateData>();

            if (!string.IsNullOrEmpty(Config.SchemaId))
            {
                schemas = SchemaCollector.FindSchema(Config.SchemaId);
            }
            else if (!string.IsNullOrEmpty(Config.TemplateId))
            {
                pageTemplates = TemplateCollector.FindTemplate(Config.TemplateId, true).Cast <PageTemplateData>();
            }
            else if (!string.IsNullOrEmpty(Config.PublicationId))
            {
                schemas       = SchemaCollector.FindSchemasForPublication(Config.PublicationId);
                pageTemplates = TemplateCollector.FindTemplatesForPublication(Config.PublicationId, true).Cast <PageTemplateData>();
            }
            else if (!string.IsNullOrEmpty(Config.FolderId))
            {
                schemas       = SchemaCollector.FindSchemasForFolder(Config.FolderId);
                pageTemplates = TemplateCollector.FindTemplatesForFolder(Config.FolderId, true).Cast <PageTemplateData>();
            }
            else
            {
                throw new Exception("You need to specify one of the following: schema (-s), publication (-p) or folder (-f)");
            }
            log.Info($"Found {schemas.Count()} schemas");
            ModelRegistry.GetInstance(Config).AddSchemas(schemas);
            log.Info($"Found {pageTemplates.Count()} page templates");
            ModelRegistry.GetInstance(Config).AddPageTemplates(pageTemplates);
        }
示例#2
0
        public GeneratorBase(IGeneratorConfiguration config)
        {
            DefaultConfigurationSetter.ApplyDefaults(config);

            log = LogManager.GetLogger(GetType());
            Logger.Setup(config);
            log.Debug($"started {GetType().Name}");
            Config            = config;
            SchemaCollector   = new SchemaCollector(config);
            TemplateCollector = new TemplateCollector(config);
            Client            = CoreserviceClientFactory.GetClient();
        }
示例#3
0
        protected override void CollectInput()
        {
            IEnumerable <TemplateData> templates;

            if (!string.IsNullOrEmpty(Config.TemplateId))
            {
                templates = TemplateCollector.FindTemplate(Config.TemplateId);
            }
            else if (!string.IsNullOrEmpty(Config.PublicationId))
            {
                templates = TemplateCollector.FindTemplatesForPublication(Config.PublicationId);
            }
            else if (!string.IsNullOrEmpty(Config.FolderId))
            {
                templates = TemplateCollector.FindTemplatesForFolder(Config.FolderId);
            }
            else
            {
                throw new Exception("You need to specify one of the following: template (-t), publication (-p) or folder (-f)");
            }
            log.Info($"Found {templates.Count()} templates");
            ViewRegistry.GetInstance(Config).AddTemplates(templates);
        }