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 fr.paris.lutece.portal.service.user.attribute;
35
36 import fr.paris.lutece.portal.business.user.AdminUser;
37 import fr.paris.lutece.portal.business.user.attribute.AdminUserField;
38 import fr.paris.lutece.portal.business.user.attribute.AdminUserFieldListener;
39 import fr.paris.lutece.portal.business.user.attribute.SimpleAdminUserFieldListener;
40
41 import java.util.ArrayList;
42 import java.util.List;
43 import java.util.Locale;
44
45 import javax.servlet.http.HttpServletRequest;
46
47
48
49
50
51
52 public class AdminUserFieldListenerService
53 {
54 private List<AdminUserFieldListener> _listRegisteredListeners = new ArrayList<>( );
55
56
57
58
59
60
61
62 public void registerListener( AdminUserFieldListener listener )
63 {
64 _listRegisteredListeners.add( listener );
65 }
66
67
68
69
70
71
72
73
74
75
76
77 public void doCreateUserFields( AdminUser user, HttpServletRequest request, Locale locale )
78 {
79 for ( AdminUserFieldListener listener : _listRegisteredListeners )
80 {
81 listener.doCreateUserFields( user, request, locale );
82 }
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96
97 public void doModifyUserFields( AdminUserl/business/user/AdminUser.html#AdminUser">AdminUser user, HttpServletRequest request, Locale locale, AdminUser currentUser )
98 {
99 for ( AdminUserFieldListener listener : _listRegisteredListeners )
100 {
101 listener.doModifyUserFields( user, request, locale, currentUser );
102 }
103 }
104
105
106
107
108
109
110
111
112
113
114
115 public void doRemoveUserFields( AdminUser user, HttpServletRequest request, Locale locale )
116 {
117 for ( AdminUserFieldListener listener : _listRegisteredListeners )
118 {
119 listener.doRemoveUserFields( user, request, locale );
120 }
121 }
122
123
124
125
126
127
128
129
130
131
132
133 public void doCreateUserFields( AdminUser user, List<AdminUserField> listUserFields, Locale locale )
134 {
135 for ( AdminUserFieldListener listener : _listRegisteredListeners )
136 {
137 if ( listener instanceof SimpleAdminUserFieldListener )
138 {
139 ( (SimpleAdminUserFieldListener) listener ).doCreateUserFields( user, listUserFields, locale );
140 }
141 }
142 }
143
144
145
146
147
148
149
150
151
152
153
154
155
156 public void doModifyUserFields( AdminUser/AdminUser.html#AdminUser">AdminUser user, List<AdminUserField> listUserFields, Locale locale, AdminUser currentUser )
157 {
158 for ( AdminUserFieldListener listener : _listRegisteredListeners )
159 {
160 if ( listener instanceof SimpleAdminUserFieldListener )
161 {
162 ( (SimpleAdminUserFieldListener) listener ).doModifyUserFields( user, listUserFields, locale, currentUser );
163 }
164 }
165 }
166
167
168
169
170
171
172
173
174
175 public void doRemoveUserFields( AdminUser user, Locale locale )
176 {
177 for ( AdminUserFieldListener listener : _listRegisteredListeners )
178 {
179 if ( listener instanceof SimpleAdminUserFieldListener )
180 {
181 ( (SimpleAdminUserFieldListener) listener ).doRemoveUserFields( user, locale );
182 }
183 }
184 }
185 }