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.delta;
35
36 import info.magnolia.cms.util.WorkspaceXmlUtil;
37
38 import java.util.List;
39
40
41
42
43
44 public class WorkspaceXmlConditionsUtil {
45 private final List<Condition> conditions;
46
47 public WorkspaceXmlConditionsUtil(List<Condition> conditions) {
48 this.conditions = conditions;
49 }
50
51
52
53
54 @Deprecated
55 public void workspaceHasOldIndexer() {
56 textFilterClassesAreNotSet();
57 }
58
59 public void textFilterClassesAreNotSet() {
60 List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='textFilterClasses']/@value");
61
62 if (names.size() > 0) {
63 for (int i = 0; i < names.size(); i++) {
64 conditions.add(new FalseCondition("workspace.xml updates",
65 "Workspace definition in workspace " + names.get(i) +
66 " references indexer which has changed; please remove the parameter 'textFilterClasses'."));
67 }
68 }
69 }
70
71
72
73
74 public void paramAnalyzerIsNotSet() {
75 List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='analyzer']/@value");
76 if (names.size() > 0) {
77 for (int i = 0; i < names.size(); i++) {
78 conditions.add(new WarnCondition("workspace.xml updates",
79 "Workspace definition in workspace " + names.get(i) +
80 " Should not have an analyzer set - this will lead to error-logs when strarting up your server."));
81 }
82 }
83 }
84
85 public void accessControlProviderIsSet() {
86 List<String> names = WorkspaceXmlUtil.getWorkspaceNames("/Workspace/WorkspaceSecurity/AccessControlProvider/@class", null);
87 if (names.size() > 0) {
88 for (int i = 0; i < names.size(); i++) {
89 conditions.add(new FalseCondition("workspace.xml updates",
90 "Workspace definition in workspace " + names.get(i) +
91 " must have an AccessControlProvider set."));
92 }
93 }
94 }
95 }