1 package org.apache.fulcrum.security.model.turbine.entity.impl;
2
3 /*
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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
19 * under the License.
20 */
21
22 import org.apache.commons.lang3.builder.HashCodeBuilder;
23 import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
24
25 /**
26 * Represents the "turbine" model where permissions are in a many to many
27 * relationship to roles, roles are related to groups are related to users, all
28 * in many to many relationships.
29 *
30 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
31 * @version $Id: TurbineUser.java 437451 2006-08-27 20:20:44Z tv $
32 */
33 public class TurbineUserImpl extends AbstractTurbineSecurityEntityImpl implements TurbineUser
34 {
35 /**
36 * Serial number
37 */
38 private static final long serialVersionUID = -7309619325167081811L;
39
40 private String password;
41 private String firstName;
42 private String lastName;
43 private String email;
44 private transient byte[] objectData;
45
46 /**
47 * Get the password
48 *
49 * @return the password
50 */
51 @Override
52 public String getPassword()
53 {
54 return password;
55 }
56
57 /**
58 * Set the password
59 *
60 * @param password the new password
61 */
62 @Override
63 public void setPassword(String password)
64 {
65 this.password = password;
66 }
67
68 /**
69 * Returns the first name of the User
70 *
71 * @return The first name of the User
72 */
73 @Override
74 public String getFirstName()
75 {
76 return this.firstName;
77 }
78
79 /**
80 * Sets the first name of the User
81 *
82 * @param firstName The new first name of the User
83 */
84 @Override
85 public void setFirstName(String firstName)
86 {
87 this.firstName = firstName;
88 }
89
90 /**
91 * Returns the last name of the User
92 *
93 * @return The last name of the User
94 */
95 @Override
96 public String getLastName()
97 {
98 return this.lastName;
99 }
100
101 /**
102 * Sets the last name of User
103 *
104 * @param lastName The new last name of the User
105 */
106 @Override
107 public void setLastName(String lastName)
108 {
109 this.lastName = lastName;
110 }
111
112 /**
113 * Returns the email address of the user
114 *
115 * @return The email address of the user
116 */
117 @Override
118 public String getEmail()
119 {
120 return this.email;
121 }
122
123 /**
124 * Sets the new email address of the user
125 *
126 * @param email The new email address of the user
127 */
128 @Override
129 public void setEmail(String email)
130 {
131 this.email = email;
132 }
133
134 /**
135 * Returns the value of the objectdata for this user.
136 * Objectdata is a storage area used
137 * to store the permanent storage table from the User
138 * object.
139 *
140 * @return The bytes in the objectdata for this user
141 */
142 @Override
143 public byte[] getObjectdata()
144 {
145 return this.objectData;
146 }
147
148 /**
149 * Sets the value of the objectdata for the user
150 *
151 * @param objectdata The new permanent storage for the user
152 */
153 @Override
154 public void setObjectdata(byte[] objectdata)
155 {
156 this.objectData = objectdata;
157 }
158
159 /**
160 * Calculate a hash code for this object
161 *
162 * @see org.apache.fulcrum.security.entity.impl.SecurityEntityImpl#hashCode()
163 */
164 @Override
165 public int hashCode()
166 {
167 return new HashCodeBuilder(41, 15)
168 .append(getPassword())
169 .append(getFirstName())
170 .append(getLastName())
171 .append(getEmail())
172 .appendSuper(super.hashCode()).toHashCode();
173 }
174 }