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.setup.for3_5;
35
36 import info.magnolia.cms.core.Content;
37 import info.magnolia.cms.core.HierarchyManager;
38 import info.magnolia.module.InstallContext;
39 import info.magnolia.module.delta.AllModulesNodeOperation;
40 import info.magnolia.module.delta.TaskExecutionException;
41
42 import javax.jcr.RepositoryException;
43
44
45
46
47
48
49 public class RenamedRenderersToTemplateRenderers extends AllModulesNodeOperation {
50 private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(RenamedRenderersToTemplateRenderers.class);
51
52 private static final String OLDNAME = "renderers";
53 private static final String NEWNAME = "template-renderers";
54
55 public RenamedRenderersToTemplateRenderers() {
56 super("Template renderers", "Modules' renderers nodes were renamed to template-renderers.");
57 }
58
59 protected void operateOnModuleNode(Content parent, HierarchyManager hm, InstallContext ctx) throws TaskExecutionException {
60 final String moduleNodePath = parent.getHandle();
61 final String oldPath = moduleNodePath + "/" + OLDNAME;
62 final String newPath = moduleNodePath + "/" + NEWNAME;
63 if (hm.isExist(oldPath)) {
64 log.debug("Will move " + oldPath + " to " + newPath);
65 try {
66 hm.moveTo(oldPath, newPath);
67 } catch (RepositoryException e) {
68 ctx.error("Could not rename " + oldPath + " to " + newPath, e);
69 }
70 }
71 }
72
73 }