1 package org.apache.archiva.redback.integration.model;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.redback.users.User;
23 import org.apache.archiva.redback.users.UserManager;
24 import org.codehaus.plexus.util.StringUtils;
26 import java.io.Serializable;
31 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
34 public abstract class UserCredentials
35 implements Serializable
37 // Potentially Editable Field.
38 private String username;
41 private String password;
43 private String confirmPassword;
45 private String fullName;
49 // Display Only Fields.
50 private String timestampAccountCreation;
52 private String timestampLastLogin;
54 private String timestampLastPasswordChange;
56 public User createUser( UserManager um )
58 User user = um.createUser( username, fullName, email );
60 user.setPassword( password );
65 public String toString()
67 StringBuffer sb = new StringBuffer();
69 sb.append( "UserCredentials[" );
70 sb.append( "username=" ).append( username );
71 sb.append( ",fullName=" ).append( fullName );
72 sb.append( ",email=" ).append( email );
73 sb.append( ",password=" );
74 if ( StringUtils.isNotEmpty( password ) )
80 sb.append( "<empty>" );
82 sb.append( ",confirmPassword=" );
83 if ( StringUtils.isNotEmpty( confirmPassword ) )
89 sb.append( "<empty>" );
92 return sb.append( "]" ).toString();
95 public String getConfirmPassword()
97 return confirmPassword;
100 public void setConfirmPassword( String confirmPassword )
102 this.confirmPassword = confirmPassword;
105 public String getEmail()
110 public void setEmail( String email )
115 public String getFullName()
120 public void setFullName( String fullName )
122 this.fullName = fullName;
125 public String getPassword()
130 public void setPassword( String password )
132 this.password = password;
135 public String getUsername()
140 public void setUsername( String username )
142 this.username = username;
145 public abstract boolean isEdit();
147 public String getTimestampAccountCreation()
149 return timestampAccountCreation;
152 public String getTimestampLastLogin()
154 return timestampLastLogin;
157 public String getTimestampLastPasswordChange()
159 return timestampLastPasswordChange;
162 public void setTimestampAccountCreation( String timestampAccountCreation )
164 this.timestampAccountCreation = timestampAccountCreation;
167 public void setTimestampLastLogin( String timestampLastLogin )
169 this.timestampLastLogin = timestampLastLogin;
172 public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
174 this.timestampLastPasswordChange = timestampLastPasswordChange;