View Javadoc
1   /**
2    * This file Copyright (c) 2008-2015 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.rssaggregator.setup;
35  
36  import info.magnolia.cms.security.Permission;
37  import info.magnolia.dam.app.setup.migration.ChangeDataDmsReferenceToDamMigrationTask;
38  import info.magnolia.jcr.util.NodeTypes;
39  import info.magnolia.module.DefaultModuleVersionHandler;
40  import info.magnolia.module.InstallContext;
41  import info.magnolia.module.cache.RegisterWorkspaceForCacheFlushingTask;
42  import info.magnolia.module.delta.AddPermissionTask;
43  import info.magnolia.module.delta.ArrayDelegateTask;
44  import info.magnolia.module.delta.BootstrapConditionally;
45  import info.magnolia.module.delta.BootstrapSingleModuleResource;
46  import info.magnolia.module.delta.BootstrapSingleResource;
47  import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
48  import info.magnolia.module.delta.CheckOrCreatePropertyTask;
49  import info.magnolia.module.delta.CreateNodeTask;
50  import info.magnolia.module.delta.DeltaBuilder;
51  import info.magnolia.module.delta.ModuleDependencyBootstrapTask;
52  import info.magnolia.module.delta.MoveNodeTask;
53  import info.magnolia.module.delta.NewPropertyTask;
54  import info.magnolia.module.delta.NodeExistsDelegateTask;
55  import info.magnolia.module.delta.OrderNodeBeforeTask;
56  import info.magnolia.module.delta.PartialBootstrapTask;
57  import info.magnolia.module.delta.PropertyExistsDelegateTask;
58  import info.magnolia.module.delta.PropertyValueDelegateTask;
59  import info.magnolia.module.delta.RemoveNodeTask;
60  import info.magnolia.module.delta.SetPropertyTask;
61  import info.magnolia.module.delta.SetupModuleRepositoriesTask;
62  import info.magnolia.module.delta.Task;
63  import info.magnolia.module.model.Version;
64  import info.magnolia.module.rssaggregator.RSSAggregatorConstants;
65  import info.magnolia.repository.RepositoryConstants;
66  import info.magnolia.ui.admincentral.setup.ConvertAclToAppPermissionTask;
67  import info.magnolia.ui.contentapp.setup.for5_3.ContentAppMigrationTask;
68  import info.magnolia.ui.framework.setup.AddIsPublishedRuleToAllDeactivateActionsTask;
69  import info.magnolia.ui.framework.setup.SetWritePermissionForActionsTask;
70  
71  import java.util.ArrayList;
72  import java.util.Arrays;
73  import java.util.List;
74  
75  import javax.jcr.ImportUUIDBehavior;
76  
77  /**
78   * {@link info.magnolia.module.DefaultModuleVersionHandler} of {@link info.magnolia.module.rssaggregator.RSSAggregator}.
79   */
80  public class RSSAggregatorVersionHandler extends DefaultModuleVersionHandler {
81  
82      protected static final String RSSAGGREGATOR_APP_ACTIONS = "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/";
83  
84      private final ArrayDelegateTask setDefaultValues = new ArrayDelegateTask("Default RSS config", "Creates default config used for RSS scheduling",
85              new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "automatedImport", null, new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "automatedImport", "false")),
86              new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "cron", null, new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "cron", "0 0 0/1 1/1 * ? *")),
87              new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "importTimingSetter", null, new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "importTimingSetter", "Disabled")));
88  
89      public RSSAggregatorVersionHandler() {
90  
91          register(DeltaBuilder.checkPrecondition("1.3", "2.0"));
92  
93          register(DeltaBuilder.update("1.4", "")
94                  .addTask(new BootstrapSingleResource("Planet feed component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.planetFeeds.xml"))
95                  .addTask(new BootstrapSingleResource("Planet feed statistics component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedStatistics.xml"))
96                  .addTask(new BootstrapSingleResource("Planet feed subscriptions component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedSubscriptions.xml"))
97                  // settings for feed syndication
98                  .addTask(new BootstrapSingleResource("Virtual URI mapping for planet feeds.", "", "/mgnl-bootstrap/rssaggregator/config.modules.rssaggregator.virtualURIMapping.planetFeeds.xml"))
99                  .addTask(new BootstrapSingleResource("Feed generator for planet feeds.", "", "/mgnl-bootstrap/rssaggregator/config/feedGenerators/config.modules.rssaggregator.config.feedGenerators.planet.xml"))
100                 .addTask(new BootstrapSingleResource("Feed syndication component.", "", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedSyndication.xml"))
101                 // planet commands
102                 .addTask(new BootstrapConditionally("Commands for planet RSS.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.rssaggregator.commands.xml"))
103                 .addTask(new BootstrapConditionally("Scheduled job for planet archive.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.scheduler.config.jobs.generatePlanetData.xml"))
104                 .addTask(new BootstrapConditionally("Scheduled job for planet statistics.", "", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.scheduler.config.jobs.collectPlanetStatistics.xml"))
105                 // add config options for planet
106                 .addTask(new CreateNodeTask("Planet feed options.", "Add options for planet feeds to the RSSAggregator module.",
107                         RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "planetOptions", "mgnl:contentNode"))
108                 .addTask(new CheckOrCreatePropertyTask("Option for relevant months to be included in statistics", "",
109                         RepositoryConstants.CONFIG, "/modules/rssaggregator/config/planetOptions", "lastMonthsIncluded", "3"))
110                 // move virtualURImappings to rssaggregator module from adminInterface
111                 .addTask(new MoveNodeTask("Move rssFeeds node.", "Move rssFeeds node to rssaggregator module.", "config", "/modules/adminInterface/virtualURIMapping/rssFeeds", "/modules/rssaggregator/virtualURIMapping/rssFeeds", false)));
112 
113         register(DeltaBuilder.update("1.4.3", "")
114                 .addTask(new ArrayDelegateTask("Bootstrap missing components",
115                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph",
116                                 new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of combinedFeedsParagraphs", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/combinedFeed.ftl", "/rssaggregator/components/combinedFeed.ftl"),
117                                 new BootstrapSingleResource("Bootstrap component", "Bootstrap combinedFeedsParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.combinedFeedsParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)),
118                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph",
119                                 new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of feedListParagraph", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/feedList.ftl", "/rssaggregator/components/feedList.ftl"),
120                                 new BootstrapSingleResource("Bootstrap component", "Bootstrap feedListParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedListParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING))))
121                 .addTask(new NodeExistsDelegateTask("Add property", "Add property backup to rssaggregator importer", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator",
122                         new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", null,
123                                 new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", Boolean.TRUE)))));
124 
125         register(DeltaBuilder.update("2.0", "")
126                 .addTask(new RemoveNodeTask("Remove old page", "Remove old adminInterface page", RepositoryConstants.CONFIG, "/modules/adminInterface/pages/rssaggregator"))
127                 .addTask(new RemoveNodeTask("Remove old menu", "Remove old adminInterface menu", RepositoryConstants.CONFIG, "/modules/adminInterface/config/menu/coonfiguration/rssaggregator")));
128 
129         register(DeltaBuilder.update("2.0.2", "")
130                 .addTask(new ArrayDelegateTask("Bootstrap missing components",
131                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph",
132                                 new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of combinedFeedsParagraphs", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/combinedFeedsParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/combinedFeed.ftl", "/rssaggregator/components/combinedFeed.ftl"),
133                                 new BootstrapSingleResource("Bootstrap component", "Bootstrap combinedFeedsParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.combinedFeedsParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)),
134                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph",
135                                 new CheckAndModifyPropertyValueTask("Change templateScript", "Change templateScript of feedListParagraph", RepositoryConstants.CONFIG, "/modules/rssaggregator/templates/components/feedListParagraph", "templateScript", "/info/magnolia/module/rssaggregator/paragraphs/feedList.ftl", "/rssaggregator/components/feedList.ftl"),
136                                 new BootstrapSingleResource("Bootstrap component", "Bootstrap feedListParagraph", "/mgnl-bootstrap/rssaggregator/templates/components/config.modules.rssaggregator.templates.components.feedListParagraph.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)))));
137 
138         register(DeltaBuilder.update("2.0.3", "")
139                 .addTask(new NodeExistsDelegateTask("Add property", "Add property backup to rssaggregator importer", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator",
140                         new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", null,
141                                 new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", Boolean.TRUE)))));
142 
143         register(DeltaBuilder.update("2.2", "")
144                 .addTask(new PropertyExistsDelegateTask("Add property", "Add property backup to rssaggregator importer", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", null,
145                         new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "backup", Boolean.TRUE)))
146 
147                 .addTask(new PropertyExistsDelegateTask("Set property", "Set workspace for scheduler jobs", RepositoryConstants.CONFIG, "/modules/scheduler/config/jobs/generatePlanetData/params", "repository",
148                         new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/scheduler/config/jobs/generatePlanetData/params", "repository", RSSAggregatorConstants.WORKSPACE), null))
149 
150                 .addTask(new PropertyExistsDelegateTask("Set property", "Set workspace for scheduler jobs", RepositoryConstants.CONFIG, "/modules/scheduler/config/jobs/collectPlanetStatistics/params", "repository",
151                         new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/scheduler/config/jobs/collectPlanetStatistics/params", "repository", RSSAggregatorConstants.WORKSPACE), null))
152 
153                 .addTask(new PropertyExistsDelegateTask("Set property", "Set workspace for rss importer", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator/targets/main", "targetPath",
154                         new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator/targets/main", "targetPath", "/"), null))
155 
156                 .addTask(new PropertyExistsDelegateTask("Set property", "Set workspace for rss importer", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "repository",
157                         new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", "repository", RSSAggregatorConstants.WORKSPACE), null))
158 
159                 // Get rid of old artifacts
160                 .addTask(new RemoveNodeTask("Remove page", "Remove old adminInterface page", "config", "/modules/rssaggregator/pages"))
161                 .addTask(new RemoveNodeTask("Remove old app", "Delete old app from app launcher if exists", "config", "/modules/ui-admincentral/config/appLauncherLayout/data/apps/RssAggregatorApp"))
162                 .addTask(new RemoveNodeTask("Remove old dialogs", "Remove old adminInterface dialogs", "config", "/modules/rssaggregator/dialogs"))
163                 .addTask(new RemoveNodeTask("Remove old dialogs", "Remove RSSAggregator dialog from data", "config", "/modules/data/dialogs/RssAggregator"))
164                 .addTask(new RemoveNodeTask("Remove rss aggregator tree", "Remove RSSAggregator tree from data module", "config", "/modules/data/trees/RssAggregator"))
165                 .addTask(new RemoveNodeTask("Remove rss aggregator type", "Remove RSSAggregator type from data module", "config", "/modules/data/config/types/RssAggregator"))
166                 .addTask(new RemoveNodeTask("Remove rss aggregator menu", "Remove RSSAggregator menu from adminInterface-legacy module", "config", "/modules/adminInterface/config/menu/data/RssAggregator"))
167 
168                 // Bootstrap new rssaggregator app
169                 .addTask(new BootstrapSingleModuleResource("Bootstrap app", "Bootstrap rssaggregator app", "app/config.modules.rssaggregator.apps.xml"))
170                 .addTask(new BootstrapSingleModuleResource("Add app to app-launcher", "Add rssaggregator app to App Launcher", "app/config.modules.ui-admincentral.config.appLauncherLayout.groups.manage.apps.rssAggregator.xml"))
171                 .addTask(new BootstrapSingleModuleResource("Bootstrap dialogs", "Remove old adminInterface dialogs", "dialogs/config.modules.rssaggregator.dialogs.xml"))
172                 .addTask(new RSSAggregatorDataTypeMigrationTask("Migrate data", "Migrate RSS Aggregator data to RSS workspace", "/rssaggregator", "/", RSSAggregatorConstants.WORKSPACE))
173                 .addTask(new ChangeDataDmsReferenceToDamMigrationTask("Migrate Hackergotchi user pics", "Migrate user pics from DMS to DAM", RSSAggregatorConstants.WORKSPACE, Arrays.asList("/"), "", ""))
174                 .addTask(new SetupModuleRepositoriesTask())
175                 .addTask(new ConvertAclToAppPermissionTask("Convert ACLs to permissions for 'rssAggregator' app", "Convert ACL permissions to dms to new 'assets' app permissions",
176                         "/modules/adminInterface/config/menu/data/RssAggregator", "/modules/rssaggregator/apps/rssAggregator", false))
177                 .addTask(new NodeExistsDelegateTask("Reorder RSS in MANAGE group", "This reorders the RSS app before Config in the Manage group of the applauncher.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage/apps/configuration",
178                         new OrderNodeBeforeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage/apps/rssAggregator", "configuration"))));
179 
180         register(DeltaBuilder.update("2.2.1", "")
181                 .addTask(new RemovePropertyIfExists("Forbid nested RSS-Aggregators in 'add action' availability", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/addRSSAggregator/availability/nodeTypes/", "rssFeed")));
182 
183         register(DeltaBuilder.update("2.2.2", "")
184                 .addTask(new NodeExistsDelegateTask("Delete old app from app launcher if exists", "Delete old app from app launcher if exists", RepositoryConstants.CONFIG,
185                         "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/RssAggregatorApp",
186                         new RemoveNodeTask("Delete old app from app launcher", "Delete old app from app launcher", RepositoryConstants.CONFIG,
187                                 "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/RssAggregatorApp"))));
188 
189         register(DeltaBuilder.update("2.3", "")
190                 .addTask(new ContentAppMigrationTask("/modules/rssaggregator"))
191                 .addTask(new BootstrapSingleModuleResource("Bootstrap button", "Bootstrap button for immediate import", "config.modules.rssaggregator.fieldTypes.xml"))
192                 .addTask(setDefaultValues)
193                 .addTask(new PartialBootstrapTask("Bootstrap schedule tab", "Updates app with tab enabling RSS scheduling", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
194                 .addTask(new PartialBootstrapTask("Bootstrap command", "Bootstraps default rss import command", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.rssaggregator.commands.xml", "/commands/rss", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
195                 .addTask(new RemoveNodeTask("Remove config", "Remove old configuration app co the new one can be bootstrapen", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config"))
196                 .addTask(new PartialBootstrapTask("Bootstrap new config", "Bootstraps new configuration sub-app", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/config", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
197                 .addTask(new PartialBootstrapTask("Bootstrap action", "Bootstraps import action", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/browser/actions/runImport", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
198                 .addTask(new PartialBootstrapTask("Bootstrap action", "Bootstraps import all action", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/browser/actions/runImportOnAllRSS", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
199                 .addTask(new PartialBootstrapTask("Bootstrap action", "Place import all action to action bar", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/browser/actionbar/sections/root/groups/feedImportActions", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
200                 .addTask(new PartialBootstrapTask("Bootstrap action", "Place import action to action bar", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/browser/actionbar/sections/rssAggregator/groups/feedImportActions", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
201                 .addTask(new OrderNodeBeforeTask("Order action bar", "Place import feed action to proper place", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actionbar/sections/rssAggregator/groups/feedImportActions", "importExportActions"))
202                 .addTask(new NodeExistsDelegateTask("Add property", "Add property for vertical layout of fields", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/feeds/field", new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/feeds/field", "layout", "vertical")))
203                 .addTask(new NodeExistsDelegateTask("Add property", "Add property for vertical layout of fields", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/filters/field", new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/filters/field", "layout", "vertical")))
204                 .addTask(new NodeExistsDelegateTask("Change save action", "Replace form save action with RSS specific one.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/actions/commit", new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/actions/commit", "implementationClass", "info.magnolia.module.rssaggregator.action.SaveRSSAction")))
205                 .addTask(new NodeExistsDelegateTask("Add transformer", "Add proper transformer class for name field.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/name", new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/name", "transformerClass", "info.magnolia.module.rssaggregator.action.RSSBasicTransformer")))
206                 .addTask(new NodeExistsDelegateTask("JCR agnostic remove node", "Remove nodeTypes node.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/editRSSAggregator/availability/nodeTypes", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/editRSSAggregator/availability/nodeTypes")))
207                 .addTask(new RegisterWorkspaceForCacheFlushingTask("rss"))
208                 .addTask(new RenameFilterFieldsPropertiesTask()));
209 
210         register(DeltaBuilder.update("2.3.1", "")
211                 .addTask(new SetWritePermissionForActionsTask(RSSAGGREGATOR_APP_ACTIONS, new String[]{"addFolder", "editFolder", "addRSSAggregator", "delete", "editRSSAggregator", "import", "restorePreviousVersion", "confirmDeleteRSSAggregator", "runImport", "runImportOnAllRSS", "activate", "deactivate", "activateDeleted"})));
212 
213         register(DeltaBuilder.update("2.3.2", "")
214                 .addTask(new AddPermissionTask("Add read permission for rss workspace to 'rss-aggregator-base' role", "rss-aggregator-base", RSSAggregatorConstants.WORKSPACE, "/*", Permission.READ, false))
215                 .addTask(new AddIsPublishedRuleToAllDeactivateActionsTask("", "/modules/rssaggregator/apps/")));
216 
217         register(DeltaBuilder.update("2.3.4", "")
218                 .addTask(new ArrayDelegateTask("Change config subApp and feed import settings tab.",
219                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/automatedImport",
220                             new RemoveNodeTask("Remove old automatedImport field from config.", "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/automatedImport")),
221                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/cron",
222                             new RemoveNodeTask("Remove old cron field from config.","/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/cron")),
223                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields",
224                             new PartialBootstrapTask("Add new switchable field to config.", "", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields")),
225                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields/overrideDefault",
226                             new RemoveNodeTask("Remove old overrideDefault field from detail.", "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields/overrideDefault")),
227                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields",
228                             new PartialBootstrapTask("Add new switchable field and checkbox to detail.", "", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields"))
229                 ))
230                 .addTask(new NodeExistsDelegateTask("Set new property importTimingSetter value.", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config",
231                         new PropertyExistsDelegateTask("", "/modules/rssaggregator/config", "automatedImport",
232                                 new PropertyValueDelegateTask("", "/modules/rssaggregator/config", "automatedImport", "false", true,
233                                         new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "importTimingSetter", "Disabled"),
234                                         new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "importTimingSetter", "CronString")
235                                 )
236 
237                         )
238                 ))
239                 .addTask(new SetImportTimingSetterPropertyInitialValue(""))
240                 .addTask(new NodeExistsDelegateTask("Remove rssaggregator from '/modules/data/config/importers/rssaggregator'", "", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator",
241                             new RemoveNodeTask("Remove rssaggregator from '/modules/data/config/importers/rssaggregator'", "/modules/data/config/importers/rssaggregator")))
242                 .addTask(new ArrayDelegateTask("Set property fetcherClass according to /modules/rssaggregator/config/fetcher@class or to default value 'info.magnolia.module.rssaggregator.importhandler.FastRSSFeedFetcher' and remove /modules/rssaggregator/config/fetcher node.",
243                             new PropertyExistsDelegateTask("Set property fetcherClass according to /modules/rssaggregator/config/fetcher@class", "/modules/rssaggregator/config/fetcher", "class",
244                                 new SetFetcherClassPropertyTask(),
245                                 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/config", "fetcherClass", "info.magnolia.module.rssaggregator.importhandler.FastRSSFeedFetcher")),
246                             new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/config/fetcher",
247                                 new RemoveNodeTask("Remove /modules/rssaggregator/config/fetcher node.", "/modules/rssaggregator/config/fetcher"))
248                         ))
249                 .addTask(new ArrayDelegateTask("Add field fetcherClass to config/agregateConfig, so user can set/override fetcher.",
250                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/", null,
251                                 new ArrayDelegateTask("Add field fetcherClass to config.",
252                                     new CreateNodeTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/", "fetcherClass", NodeTypes.ContentNode.NAME),
253                                     new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/fetcherClass/", "class", "info.magnolia.ui.form.field.definition.TextFieldDefinition"))),
254                         new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields/", null,
255                                 new ArrayDelegateTask("Add field fetcherClass to agregateConfig.",
256                                         new CreateNodeTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields/", "fetcherClass", NodeTypes.ContentNode.NAME),
257                                         new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab/fields/fetcherClass/", "class", "info.magnolia.ui.form.field.definition.TextFieldDefinition")))
258                 ))
259         );
260     }
261 
262     @Override
263     protected List<Task> getExtraInstallTasks(InstallContext installContext) {
264         List<Task> tasks = new ArrayList<Task>();
265         tasks.add(new ModuleDependencyBootstrapTask("observation"));
266         tasks.addAll(super.getExtraInstallTasks(installContext));
267         tasks.add(new NodeExistsDelegateTask("Reorder RSS in MANAGE group", "This reorders the RSS app before Config in the Manage group of the applauncher.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage/apps/configuration",
268                 new OrderNodeBeforeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage/apps/rssAggregator", "configuration")));
269         tasks.add(setDefaultValues);
270         tasks.add(new RegisterWorkspaceForCacheFlushingTask("rss"));
271         return tasks;
272     }
273 
274     @Override
275     protected List<Task> getDefaultUpdateTasks(Version forVersion) {
276         final List<Task> tasks = new ArrayList<Task>();
277         tasks.addAll(super.getDefaultUpdateTasks(forVersion));
278         return tasks;
279     }
280 }