1 package org.apache.archiva.redback.integration.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.archiva.redback.users.User;
23 import org.apache.archiva.redback.users.UserManager;
24 import org.apache.archiva.redback.users.UserManagerException;
25 import org.apache.commons.lang.StringUtils;
26
27
28 import java.io.Serializable;
29
30
31
32
33
34
35 public abstract class UserCredentials
36 implements Serializable
37 {
38
39 private String username;
40
41
42 private String password;
43
44 private String confirmPassword;
45
46 private String fullName;
47
48 private String email;
49
50
51 private String timestampAccountCreation;
52
53 private String timestampLastLogin;
54
55 private String timestampLastPasswordChange;
56
57 public User createUser( UserManager um )
58 throws UserManagerException
59 {
60 User user = um.createUser( username, fullName, email );
61
62 user.setPassword( password );
63
64 return user;
65 }
66
67 public String toString()
68 {
69 StringBuilder sb = new StringBuilder();
70
71 sb.append( "UserCredentials[" );
72 sb.append( "username=" ).append( username );
73 sb.append( ",fullName=" ).append( fullName );
74 sb.append( ",email=" ).append( email );
75 sb.append( ",password=" );
76 if ( StringUtils.isNotEmpty( password ) )
77 {
78 sb.append( "<***>" );
79 }
80 else
81 {
82 sb.append( "<empty>" );
83 }
84 sb.append( ",confirmPassword=" );
85 if ( StringUtils.isNotEmpty( confirmPassword ) )
86 {
87 sb.append( "<***>" );
88 }
89 else
90 {
91 sb.append( "<empty>" );
92 }
93
94 return sb.append( "]" ).toString();
95 }
96
97 public String getConfirmPassword()
98 {
99 return confirmPassword;
100 }
101
102 public void setConfirmPassword( String confirmPassword )
103 {
104 this.confirmPassword = confirmPassword;
105 }
106
107 public String getEmail()
108 {
109 return email;
110 }
111
112 public void setEmail( String email )
113 {
114 this.email = email;
115 }
116
117 public String getFullName()
118 {
119 return fullName;
120 }
121
122 public void setFullName( String fullName )
123 {
124 this.fullName = fullName;
125 }
126
127 public String getPassword()
128 {
129 return password;
130 }
131
132 public void setPassword( String password )
133 {
134 this.password = password;
135 }
136
137 public String getUsername()
138 {
139 return username;
140 }
141
142 public void setUsername( String username )
143 {
144 this.username = username;
145 }
146
147 public abstract boolean isEdit();
148
149 public String getTimestampAccountCreation()
150 {
151 return timestampAccountCreation;
152 }
153
154 public String getTimestampLastLogin()
155 {
156 return timestampLastLogin;
157 }
158
159 public String getTimestampLastPasswordChange()
160 {
161 return timestampLastPasswordChange;
162 }
163
164 public void setTimestampAccountCreation( String timestampAccountCreation )
165 {
166 this.timestampAccountCreation = timestampAccountCreation;
167 }
168
169 public void setTimestampLastLogin( String timestampLastLogin )
170 {
171 this.timestampLastLogin = timestampLastLogin;
172 }
173
174 public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
175 {
176 this.timestampLastPasswordChange = timestampLastPasswordChange;
177 }
178 }