001package org.apache.fulcrum.security.model.turbine.entity.impl;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.commons.lang3.builder.HashCodeBuilder;
023import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
024
025/**
026 * Represents the "turbine" model where permissions are in a many to many
027 * relationship to roles, roles are related to groups are related to users, all
028 * in many to many relationships.
029 *
030 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
031 * @version $Id: TurbineUser.java 437451 2006-08-27 20:20:44Z tv $
032 */
033public class TurbineUserImpl extends AbstractTurbineSecurityEntityImpl implements TurbineUser
034{
035    /**
036     * Serial number
037     */
038    private static final long serialVersionUID = -7309619325167081811L;
039
040    private String password;
041    private String firstName;
042    private String lastName;
043    private String email;
044    private transient byte[] objectData;
045
046    /**
047     * Get the password
048     *
049     * @return the password
050     */
051    @Override
052        public String getPassword()
053    {
054        return password;
055    }
056
057    /**
058     * Set the password
059     *
060     * @param password the new password
061     */
062    @Override
063        public void setPassword(String password)
064    {
065        this.password = password;
066    }
067
068    /**
069     * Returns the first name of the User
070     *
071     * @return The first name of the User
072     */
073    @Override
074        public String getFirstName()
075    {
076        return this.firstName;
077    }
078
079    /**
080     * Sets the first name of the User
081     *
082     * @param firstName The new first name of the User
083     */
084    @Override
085        public void setFirstName(String firstName)
086    {
087        this.firstName = firstName;
088    }
089
090    /**
091     * Returns the last name of the User
092     *
093     * @return The last name of the User
094     */
095    @Override
096        public String getLastName()
097    {
098        return this.lastName;
099    }
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}