1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.module.rssaggregator.setup;
35
36 import info.magnolia.migration.task.SimpleSTKRelatedModuleMigrationTask;
37 import info.magnolia.module.DefaultModuleVersionHandler;
38 import info.magnolia.module.InstallContext;
39 import info.magnolia.module.data.setup.RegisterNodeTypeTask;
40 import info.magnolia.module.delta.ArrayDelegateTask;
41 import info.magnolia.module.delta.BootstrapConditionally;
42 import info.magnolia.module.delta.BootstrapSingleResource;
43 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
44 import info.magnolia.module.delta.CheckOrCreatePropertyTask;
45 import info.magnolia.module.delta.CreateNodeTask;
46 import info.magnolia.module.delta.DeltaBuilder;
47 import info.magnolia.module.delta.ModuleDependencyBootstrapTask;
48 import info.magnolia.module.delta.NodeExistsDelegateTask;
49 import info.magnolia.module.delta.Task;
50 import info.magnolia.module.model.Version;
51 import info.magnolia.repository.RepositoryConstants;
52
53 import java.util.ArrayList;
54 import java.util.Arrays;
55 import java.util.List;
56
57
58
59
60
61
62
63
64 public class RSSAggregatorVersionHandler extends DefaultModuleVersionHandler {
65
66 public RSSAggregatorVersionHandler() {
67
68 register(DeltaBuilder.checkPrecondition("1.2.2", "1.3"));
69
70 register(DeltaBuilder.update("1.3", "")
71 .addTask(new SimpleSTKRelatedModuleMigrationTask("Migration task: Migrate RSS configuration repository", "Migrate configuration of templates, dialogs and site definitions", "rssaggregator", false, Arrays.asList("")))
72 .addTask(new NodeExistsDelegateTask("Renamed modelClass", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/paragraphs",
73 new ArrayDelegateTask("Renamed modelClass ", "",
74 new CheckAndModifyPropertyValueTask("Renamed modelClass of the combinedFeedsParagraph node", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/paragraphs/combinedFeedsParagraph", "modelClass", "info.magnolia.module.rssaggregator.CombinedFeedAction", "info.magnolia.module.rssaggregator.templates.components.CombinedFeedModel"),
75 new CheckAndModifyPropertyValueTask("Renamed modelClass of the feedListParagraph node", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/paragraphs/feedListParagraph", "modelClass", "info.magnolia.module.rssaggregator.FeedListAction", "info.magnolia.module.rssaggregator.templates.components.FeedListModel")),
76 new ArrayDelegateTask("Renamed modelClass ", "",
77 new CheckAndModifyPropertyValueTask("Renamed modelClass of the combinedFeedsParagraph node", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph", "modelClass", "info.magnolia.module.rssaggregator.CombinedFeedAction", "info.magnolia.module.rssaggregator.templates.components.CombinedFeedModel"),
78 new CheckAndModifyPropertyValueTask("Renamed modelClass of the feedListParagraph node", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph", "modelClass", "info.magnolia.module.rssaggregator.FeedListAction", "info.magnolia.module.rssaggregator.templates.components.FeedListModel"))
79 )
80 )
81 );
82
83 register(DeltaBuilder.update("1.4", "")
84 .addTask(new BootstrapSingleResource("Planet feed component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.planetFeeds.xml"))
85 .addTask(new BootstrapSingleResource("Planet feed dialog.", "", "/mgnl-bootstrap/rssaggregator/dialogs/config.modules.rssaggregator.dialogs.planetFeeds.xml"))
86 .addTask(new BootstrapSingleResource("Planet feed statistics component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedStatistics.xml"))
87 .addTask(new BootstrapSingleResource("Planet feed statistics dialog.", "", "/mgnl-bootstrap/rssaggregator/dialogs/config.modules.rssaggregator.dialogs.feedStatistics.xml"))
88 .addTask(new BootstrapSingleResource("Planet feed subcriptions component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedSubscriptions.xml"))
89 .addTask(new BootstrapSingleResource("Planet feed subcriptions dialog.", "", "/mgnl-bootstrap/rssaggregator/dialogs/config.modules.rssaggregator.dialogs.feedSubscriptions.xml"))
90
91 .addTask(new BootstrapSingleResource("Virtual URI mapping for planet feeds.", "", "/mgnl-bootstrap/rssaggregator/config.modules.adminInterface.virtualURIMapping.planetFeeds.xml"))
92 .addTask(new BootstrapSingleResource("Feed generator for planet feeds.", "", "/mgnl-bootstrap/rssaggregator/config/feedGenerators/config.modules.rssaggregator.config.feedGenerators.planet.xml"))
93 .addTask(new BootstrapSingleResource("Feed syndication component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedSyndication.xml"))
94 .addTask(new BootstrapSingleResource("Feed syndication dialog.", "", "/mgnl-bootstrap/rssaggregator/dialogs/config.modules.rssaggregator.dialogs.feedSyndication.xml"))
95
96 .addTask(new BootstrapConditionally("Commands for planet RSS.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.rssaggregator.commands.xml"))
97 .addTask(new BootstrapConditionally("Scheduled job for planet archive.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.scheduler.config.jobs.generatePlanetData.xml"))
98 .addTask(new BootstrapConditionally("Scheduled job for planet statistics.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.scheduler.config.jobs.collectPlanetStatistics.xml"))
99
100 .addTask(new CreateNodeTask("Planet feed option for combined RSS feeds.", "Add an option to check if an RSS feed is a planet feed.",
101 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab", "planetFeed", "mgnl:contentNode"))
102 .addTask(new CheckOrCreatePropertyTask("Control property for planet option.", "",
103 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab/planetFeed", "controlType", "checkboxSwitch"))
104 .addTask(new CheckOrCreatePropertyTask("Control property for planet option.", "Add a property for the RSS feed dialog.",
105 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab/planetFeed", "description", "rssaggregator.data.dialog.planetFeed.description"))
106 .addTask(new CheckOrCreatePropertyTask("Control property for planet option.", "Add a property for the RSS feed dialog.",
107 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab/planetFeed", "label", "rssaggregator.data.dialog.planetFeed.label"))
108 .addTask(new CheckOrCreatePropertyTask("Control property for planet option.", "Add a property for the RSS feed dialog.",
109 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab/planetFeed", "selected", "false"))
110 .addTask(new CheckOrCreatePropertyTask("Control property for planet option.", "Add a property for the RSS feed dialog.",
111 RepositoryConstants.CONFIG, "/modules/data/dialogs/RssAggregator/mainTab/planetFeed", "type", "String"))
112
113 .addTask(new CreateNodeTask("Planet feed options.", "Add options for planet feeds to the RSSAggregator module.",
114 RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "planetOptions", "mgnl:contentNode"))
115 .addTask(new CheckOrCreatePropertyTask("Option for relevant months to be included in statistics", "",
116 RepositoryConstants.CONFIG, "/modules/rssaggregator/config/planetOptions", "lastMonthsIncluded", "3"))
117 );
118
119 }
120
121 @Override
122 protected List<Task> getBasicInstallTasks(InstallContext installContext) {
123 final List<Task> installTasks = new ArrayList<Task>();
124
125 installTasks.add(new RegisterNodeTypeTask("RssAggregator"));
126 installTasks.addAll(super.getBasicInstallTasks(installContext));
127 return installTasks;
128 }
129
130 @Override
131 protected List<Task> getExtraInstallTasks(InstallContext installContext) {
132 List<Task> tasks = new ArrayList<Task>();
133 tasks.add(new ModuleDependencyBootstrapTask("observation"));
134 tasks.addAll(super.getExtraInstallTasks(installContext));
135 return tasks;
136 }
137
138 @Override
139 protected List<Task> getDefaultUpdateTasks(Version forVersion) {
140 final List<Task> tasks = new ArrayList<Task>();
141 tasks.addAll(super.getDefaultUpdateTasks(forVersion));
142 return tasks;
143 }
144 }