1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.efaps.update.schema.user;
22
23 import java.net.URL;
24 import java.util.List;
25 import java.util.Map;
26
27 import org.efaps.db.Insert;
28 import org.efaps.update.AbstractUpdate;
29 import org.efaps.update.util.InstallationException;
30 import org.efaps.util.EFapsException;
31
32
33
34
35
36
37 public class JAASSystemUpdate
38 extends AbstractUpdate
39 {
40
41
42
43
44 public JAASSystemUpdate(final URL _url)
45 {
46 super(_url, "Admin_User_JAASSystem");
47 }
48
49
50
51
52
53
54
55 @Override
56 protected AbstractDefinition newDefinition()
57 {
58 return new Definition();
59 }
60
61
62
63
64 private class Definition
65 extends AbstractDefinition
66 {
67
68 @Override
69 protected void readXML(final List<String> _tags,
70 final Map<String, String> _attributes,
71 final String _text)
72 throws EFapsException
73 {
74 final String value = _tags.get(0);
75 if ("group".equals(value)) {
76 if (_tags.size() > 1) {
77 final String subValue = _tags.get(1);
78 if ("classname".equals(subValue)) {
79 addValue("ClassNameGroup", _text);
80 } else if ("key-method".equals(subValue)) {
81 addValue("MethodNameGroupKey", _text);
82 }
83 }
84 } else if ("person".equals(value)) {
85 if (_tags.size() > 1) {
86 final String subValue = _tags.get(1);
87 if ("classname".equals(subValue)) {
88 addValue("ClassNamePerson", _text);
89 } else if ("email-method".equals(subValue)) {
90 addValue("MethodNamePersonEmail", _text);
91 } else if ("firstname-method".equals(subValue)) {
92 addValue("MethodNamePersonFirstName", _text);
93 } else if ("key-method".equals(subValue)) {
94 addValue("MethodNamePersonKey", _text);
95 } else if ("lastname-method".equals(subValue)) {
96 addValue("MethodNamePersonLastName", _text);
97 } else if ("name-method".equals(subValue)) {
98 addValue("MethodNamePersonName", _text);
99 }
100 }
101 } else if ("role".equals(value)) {
102 if (_tags.size() > 1) {
103 final String subValue = _tags.get(1);
104 if ("classname".equals(subValue)) {
105 addValue("ClassNameRole", _text);
106 } else if ("key-method".equals(subValue)) {
107 addValue("MethodNameRoleKey", _text);
108 }
109 }
110 } else {
111 super.readXML(_tags, _attributes, _text);
112 }
113 }
114
115
116
117
118
119
120
121
122
123 @Override
124 protected void createInDB(final Insert _insert)
125 throws InstallationException
126 {
127 try {
128 _insert.add("ClassNamePerson", getValue("ClassNamePerson"));
129 } catch (final EFapsException e) {
130 throw new InstallationException("Attribute 'ClassNamePerson' for person could not be defined", e);
131 }
132 try {
133 _insert.add("MethodNamePersonKey", getValue("MethodNamePersonKey"));
134 } catch (final EFapsException e) {
135 throw new InstallationException("Attribute 'MethodNamePersonKey' for person could not be defined", e);
136 }
137 try {
138 _insert.add("MethodNamePersonName", getValue("MethodNamePersonName"));
139 } catch (final EFapsException e) {
140 throw new InstallationException("Attribute 'MethodNamePersonName' for person could not be defined", e);
141 }
142 super.createInDB(_insert);
143 }
144 }
145 }