コード例 #1
0
ファイル: WorkflowsStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var workflowDefinitions = _workflowDefinitionRepository.Table.ToList();

            if (!workflowDefinitions.Any()) {
                return;
            }

            var root = new XElement("Workflows");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var workflowDefinition in workflowDefinitions.OrderBy(x => x.Name)) {
                root.Add(new XElement("Workflow",
                    new XAttribute("Name", workflowDefinition.Name),
                    new XAttribute("Enabled", workflowDefinition.Enabled),
                    new XElement("Activities", workflowDefinition.ActivityRecords.Select(activity =>
                        new XElement("Activity",
                            new XAttribute("Id", activity.Id),
                            new XAttribute("Name", activity.Name),
                            new XAttribute("Start", activity.Start),
                            new XAttribute("X", activity.X),
                            new XAttribute("Y", activity.Y),
                            new XElement("State", activity.State)))),
                        new XElement("Transitions", workflowDefinition.TransitionRecords.Select(transition =>
                            new XElement("Transition",
                                new XAttribute("SourceActivityId", transition.SourceActivityRecord.Id),
                                new XAttribute("SourceEndpoint", transition.SourceEndpoint ?? ""),
                                new XAttribute("DestinationActivityId", transition.DestinationActivityRecord.Id),
                                new XAttribute("DestinationEndpoint", transition.DestinationEndpoint ?? ""))))));
            }
        }
コード例 #2
0
ファイル: RulesStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var allRules = _rulesServices.GetRules().ToList();

            if (!allRules.Any()) {
                return;
            }

            var root = new XElement("Rules");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var rule in allRules) {
                root.Add(new XElement("Rule",
                    new XAttribute("Name", rule.Name),
                    new XAttribute("Enabled", rule.Enabled.ToString(CultureInfo.InvariantCulture)),
                    new XElement("Actions", rule.Actions.Select(action =>
                        new XElement("Action",
                            new XAttribute("Type", action.Type ?? string.Empty),
                            new XAttribute("Category", action.Category ?? string.Empty),
                            new XAttribute("Parameters", action.Parameters ?? string.Empty),
                            new XAttribute("Position", action.Position)
                        )
                    )),
                    new XElement("Events", rule.Events.Select(e =>
                        new XElement("Event",
                            new XAttribute("Type", e.Type ?? string.Empty),
                            new XAttribute("Category", e.Category ?? string.Empty),
                            new XAttribute("Parameters", e.Parameters ?? string.Empty)
                        )
                    ))
                ));
            }
        }
コード例 #3
0
ファイル: CustomStepsStep.cs プロジェクト: Higea/Orchard
 public override void Build(BuildContext context) {
     var exportContext = new ExportContext {
         Document = context.RecipeDocument,
         ExportOptions = new ExportOptions {
             CustomSteps = CustomSteps
         }
     };
     _exportEventHandlers.Invoke(x => x.Exporting(exportContext), Logger);
     _exportEventHandlers.Invoke(x => x.Exported(exportContext), Logger);
 }
コード例 #4
0
        public override void Build(BuildContext context)
        {
            var rootElement = context.RecipeDocument.Element("Orchard");
            var commonPartElements = rootElement.XPathSelectElements("//CommonPart").ToList();
            var publishedUtcAttributes = commonPartElements.Select(x => x.Attribute("PublishedUtc")).Where(x => x != null);

            foreach (var publishedUtcAttribute in publishedUtcAttributes)
            {
                publishedUtcAttribute.Remove();
            }
        }
コード例 #5
0
ファイル: RecipeBuilder.cs プロジェクト: Higea/Orchard
 public XDocument Build(IEnumerable<IRecipeBuilderStep> steps) {
     var context = new BuildContext {
         RecipeDocument = CreateRecipeRoot()
     };
     
     foreach (var step in steps.OrderByDescending(x => x.Priority)) {
         step.Build(context);
     }
     
     return context.RecipeDocument;
 }
コード例 #6
0
ファイル: RecipeMetadataStep.cs プロジェクト: Higea/Orchard
 public override void Build(BuildContext context) {
     var recipeElement = context.RecipeDocument.Element("Orchard").Element("Recipe");
     
     recipeElement.SetElementValue("Name", RecipeName);
     recipeElement.SetElementValue("Description", RecipeDescription);
     recipeElement.SetElementValue("Author", RecipeAuthor);
     recipeElement.SetElementValue("WebSite", RecipeWebsite);
     recipeElement.SetElementValue("Tags", RecipeTags);
     recipeElement.SetElementValue("Category", RecipeCategory);
     recipeElement.SetElementValue("Version", RecipeVersion);
     recipeElement.SetElementValue("IsSetupRecipe", IsSetupRecipe);
 }
コード例 #7
0
ファイル: RolesStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var roles = _roleRecordepository.Table.OrderBy(x => x.Name).ToList();

            if (!roles.Any())
                return;

            var root = new XElement("Roles");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var role in roles) {
                root.Add(
                    new XElement("Role",
                        new XAttribute("Name", role.Name),
                        new XAttribute("Permissions", string.Join(",", role.RolesPermissions.Select(rolePermission => rolePermission.Permission.Name)))));
            }
        }
コード例 #8
0
ファイル: FeatureStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            if (!ExportEnabledFeatures && !ExportDisabledFeatures)
                return;

            var enabledFeatures = _featureManager.GetEnabledFeatures();
            var disabledFeatures = _featureManager.GetDisabledFeatures();
            var orchardElement = context.RecipeDocument.Element("Orchard");
            var root = new XElement("Feature");

            if(ExportEnabledFeatures)
                root.Add(new XAttribute("enable", String.Join(", ", enabledFeatures.Select(x => x.Id).OrderBy(x => x))));

            if (ExportDisabledFeatures)
                root.Add(new XAttribute("disable", String.Join(", ", disabledFeatures.Select(x => x.Id).OrderBy(x => x))));

            orchardElement.Add(root);
        }
コード例 #9
0
ファイル: HomeAliasStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var homeAliasRoute = _homeAliasService.GetHomeRoute() ?? new RouteValueDictionary();
            var root = new XElement("HomeAlias");
            var homePage = _homeAliasService.GetHomePage(VersionOptions.Latest);

            // If the home alias points to a content item, store its identifier in addition to the routevalues,
            // so we can publish the home page alias during import where the ID primary key value of the home page might have changed,
            // so we can't rely on the route values in that case.
            if (homePage != null) {
                var homePageIdentifier = _contentManager.GetItemMetadata(homePage).Identity.ToString();
                root.Attr("Id", homePageIdentifier);
            }
            else {
                // The alias does not point to a content item, so export the route values instead.
                root.Add(homeAliasRoute.Select(x => new XElement(Capitalize(x.Key), x.Value)).ToArray());
            }

            context.RecipeDocument.Element("Orchard").Add(root);
        }
コード例 #10
0
ファイル: CustomElementsStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var elements = _repository.Table.OrderBy(x => x.ElementTypeName).ToList();

            if (!elements.Any()) {
                return;
            }

            var root = new XElement("CustomElements");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var element in elements) {
                root.Add(new XElement("Element",
                    new XAttribute("ElementTypeName", element.ElementTypeName),
                    new XAttribute("BaseElementTypeName", element.BaseElementTypeName),
                    new XAttribute("ElementDisplayName", element.ElementDisplayName),
                    new XAttribute("ElementDescription", element.ElementDescription),
                    new XAttribute("ElementCategory", element.ElementCategory),
                    new XElement("BaseElementState", new XCData(element.BaseElementState))));
            }
        }
コード例 #11
0
ファイル: AliasStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var aliases = _aliasHolder.GetMaps().SelectMany(m => m.GetAliases()).Where(m => m.IsManaged == false).OrderBy(m => m.Path).ToList();

            if (!aliases.Any())
                return;

            var root = new XElement("Aliases");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var alias in aliases) {
                var aliasElement = new XElement("Alias", new XAttribute("Path", alias.Path));

                var routeValuesElement = new XElement("RouteValues");
                foreach (var routeValue in alias.RouteValues) {
                    routeValuesElement.Add(new XElement("Add", new XAttribute("Key", routeValue.Key), new XAttribute("Value", routeValue.Value)));
                }

                aliasElement.Add(routeValuesElement);
                root.Add(aliasElement);
            }
        }
コード例 #12
0
        public override void Build(BuildContext context)
        {
            var submissions = _formService.GetSubmissions().ToArray();

            if (!submissions.Any()) {
                return;
            }

            var forms = submissions.GroupBy(x => x.FormName);
            var root = new XElement("Forms");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var form in forms) {
                root.Add(new XElement("Form",
                    new XAttribute("Name", form.Key),
                    new XElement("Submissions", form.Select(submission =>
                        new XElement("Submission",
                            new XAttribute("CreatedUtc", submission.CreatedUtc),
                            new XCData(submission.FormData))))));
            }
        }
コード例 #13
0
ファイル: AuditTrailStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var records = _auditTrailEventRepository.Table.ToList();

            if (!records.Any()) {
                return;
            }

            var root = new XElement("AuditTrail");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var record in records) {
                root.Add(new XElement("Event",
                    CreateAttribute("Name", record.EventName),
                    CreateAttribute("FullName", record.FullEventName),
                    CreateAttribute("Category", record.Category),
                    CreateAttribute("User", record.UserName),
                    CreateAttribute("CreatedUtc", record.CreatedUtc),
                    CreateAttribute("EventFilterKey", record.EventFilterKey),
                    CreateAttribute("EventFilterData", record.EventFilterData),
                    CreateElement("Comment", record.Comment),
                    ParseEventData(record.EventData)));
            }
        }
コード例 #14
0
ファイル: RecipeBuilderStep.cs プロジェクト: rodpl/Orchard2
 public virtual void Build(BuildContext context) { }
コード例 #15
0
ファイル: SettingsStep.cs プロジェクト: Higea/Orchard
 public override void Build(BuildContext context) {
     context.RecipeDocument.Element("Orchard").Add(ExportSiteSettings());
 }
コード例 #16
0
ファイル: CurrentThemeStep.cs プロジェクト: Higea/Orchard
 public override void Build(BuildContext context) {
     var currentThemeId = _siteThemeService.GetCurrentThemeName();
     var root = new XElement("CurrentTheme", new XAttribute("id", currentThemeId));
     context.RecipeDocument.Element("Orchard").Add(root);
 }
コード例 #17
0
ファイル: ContentStep.cs プロジェクト: Higea/Orchard
        public override void Build(BuildContext context) {
            var dataContentTypes = DataContentTypes;
            var schemaContentTypes = SchemaContentTypes;
            var exportVersionOptions = GetContentExportVersionOptions(VersionHistoryOptions);
            var contentItems = dataContentTypes.Any()
                ? _orchardServices.ContentManager.Query(exportVersionOptions, dataContentTypes.ToArray()).List().ToArray()
                : Enumerable.Empty<ContentItem>();

            if(schemaContentTypes.Any())
                context.RecipeDocument.Element("Orchard").Add(ExportMetadata(schemaContentTypes));

            if(contentItems.Any())
                context.RecipeDocument.Element("Orchard").Add(ExportData(dataContentTypes, contentItems));
        }