/
UserRegistrationConfiguration.java
254 lines (191 loc) · 6.96 KB
/
UserRegistrationConfiguration.java
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
* (C) Copyright 2011 Nuxeo SAS (http://nuxeo.com/) and contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* Contributors:
* Nuxeo - initial API and implementation
*/
package org.nuxeo.ecm.user.invite;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuxeo.common.xmap.annotation.XNode;
import org.nuxeo.common.xmap.annotation.XObject;
@XObject("configuration")
public class UserRegistrationConfiguration {
private static Log log = LogFactory.getLog(UserRegistrationConfiguration.class);
public static final String DEFAULT_CONFIGURATION_NAME = "default_registration";
@XNode("@merge")
private boolean merge = false;
@XNode("@remove")
private boolean remove = false;
@XNode("@name")
private String name = DEFAULT_CONFIGURATION_NAME;
@XNode("requestDocType")
private String requestDocType;
@XNode("container/docType")
private String containerDocType;
@XNode("container/parentPath")
private String containerParentPath;
@XNode("container/name")
private String containerName;
@XNode("container/title")
private String containerTitle;
@XNode("validationEmail/title")
private String validationEmailTitle;
@XNode("validationEmail/template")
private String validationEmailTemplate;
@XNode("successEmail/title")
private String successEmailTitle;
@XNode("successEmail/template")
private String successEmailTemplate;
@XNode("reviveEmail/title")
private String reviveEmailTitle;
@XNode("reviveEmail/template")
private String reviveEmailTemplate;
@XNode("registrationUserFactory")
private Class<? extends InvitationUserFactory> registrationUserFactory;
@XNode("validationRelUrl")
private String validationRelUrl;
@XNode("enterPasswordUrl")
private String enterPasswordUrl;
@XNode("invitationLayout")
private String invitationLayout = "user_invitation_info";
@XNode("listingContentView")
private String listingLocalContentView = "local_user_requests_view";
public String getRequestDocType() {
return requestDocType;
}
public String getContainerDocType() {
return containerDocType;
}
public String getContainerParentPath() {
return containerParentPath;
}
public String getContainerName() {
return containerName;
}
public String getContainerTitle() {
return containerTitle;
}
public String getValidationEmailTitle() {
return validationEmailTitle;
}
public String getValidationEmailTemplate() {
return validationEmailTemplate;
}
public String getSuccessEmailTitle() {
return successEmailTitle;
}
public String getSuccessEmailTemplate() {
return successEmailTemplate;
}
public Class<? extends InvitationUserFactory> getRegistrationUserFactory() {
return registrationUserFactory;
}
public String getValidationRelUrl() {
if (StringUtils.isBlank(validationRelUrl)) {
log.info("Configuration " + name + " has empty validation url");
return "";
}
return validationRelUrl;
}
public String getEnterPasswordUrl() {
if (StringUtils.isBlank(enterPasswordUrl)) {
log.info("Configuration " + name + " has empty validation url");
return "";
}
return enterPasswordUrl;
}
public String getReviveEmailTitle() {
return reviveEmailTitle;
}
public String getReviveEmailTemplate() {
return reviveEmailTemplate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isMerge() {
return merge;
}
public void setMerge(boolean merge) {
this.merge = merge;
}
public boolean isRemove() {
return remove;
}
public void setRemove(boolean remove) {
this.remove = remove;
}
public String getInvitationLayout() {
return invitationLayout;
}
public void setInvitationLayout(String invitationLayout) {
this.invitationLayout = invitationLayout;
}
public String getListingLocalContentView() {
return listingLocalContentView;
}
public void setListingLocalContentView(String listingLocalContentView) {
this.listingLocalContentView = listingLocalContentView;
}
public void mergeWith(UserRegistrationConfiguration other) {
if (!StringUtils.isEmpty(other.requestDocType)) {
this.requestDocType = other.requestDocType;
}
if (!StringUtils.isEmpty(other.containerDocType)) {
this.containerDocType = other.containerDocType;
}
if (!StringUtils.isEmpty(other.containerParentPath)) {
this.containerParentPath = other.containerParentPath;
}
if (!StringUtils.isEmpty(other.containerName)) {
this.containerName = other.containerName;
}
if (!StringUtils.isEmpty(other.containerTitle)) {
this.containerTitle = other.containerTitle;
}
if (!StringUtils.isEmpty(other.validationEmailTitle)) {
this.validationEmailTitle = other.validationEmailTitle;
}
if (!StringUtils.isEmpty(other.validationEmailTemplate)) {
this.validationEmailTemplate = other.validationEmailTemplate;
}
if (!StringUtils.isEmpty(other.successEmailTitle)) {
this.successEmailTitle = other.successEmailTitle;
}
if (!StringUtils.isEmpty(other.successEmailTemplate)) {
this.successEmailTemplate = other.successEmailTemplate;
}
if (!StringUtils.isEmpty(other.reviveEmailTitle)) {
this.reviveEmailTitle = other.reviveEmailTitle;
}
if (!StringUtils.isEmpty(other.reviveEmailTemplate)) {
this.reviveEmailTemplate = other.reviveEmailTemplate;
}
if (other.getRegistrationUserFactory() != null) {
this.registrationUserFactory = other.registrationUserFactory;
}
if (!StringUtils.isEmpty(other.validationRelUrl)) {
this.validationRelUrl = other.validationRelUrl;
}
if (!StringUtils.isEmpty(other.invitationLayout)) {
this.invitationLayout = other.invitationLayout;
}
if (!StringUtils.isEmpty(other.listingLocalContentView)) {
this.listingLocalContentView = other.listingLocalContentView;
}
}
}