001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sections/tags/sakai_2-4-1/sections-impl/standalone/src/java/org/sakaiproject/component/section/UserImpl.java $
003: * $Id: UserImpl.java 18134 2006-11-14 18:59:25Z jholtzman@berkeley.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Regents of the University of California and The Regents of the University of Michigan
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.component.section;
021:
022: import java.io.Serializable;
023:
024: import org.apache.commons.lang.builder.EqualsBuilder;
025: import org.apache.commons.lang.builder.HashCodeBuilder;
026: import org.apache.commons.lang.builder.ToStringBuilder;
027: import org.sakaiproject.section.api.coursemanagement.User;
028:
029: /**
030: * A detachable User for persistent storage.
031: *
032: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
033: *
034: */
035: public class UserImpl extends AbstractPersistentObject implements User,
036: Serializable {
037:
038: private static final long serialVersionUID = 1L;
039:
040: protected String userUid;
041: protected String sortName;
042: protected String displayId;
043: protected String displayName;
044:
045: protected long id;
046: protected int version;
047:
048: /**
049: * No-arg constructor needed for hibernate
050: */
051: public UserImpl() {
052: }
053:
054: public UserImpl(String displayName, String displayId,
055: String sortName, String userUid) {
056: this .displayName = displayName;
057: this .displayId = displayId;
058: this .sortName = sortName;
059: this .userUid = userUid;
060: }
061:
062: public String getDisplayName() {
063: return displayName;
064: }
065:
066: public String getDisplayId() {
067: return displayId;
068: }
069:
070: public String getSortName() {
071: return sortName;
072: }
073:
074: public String getUserUid() {
075: return userUid;
076: }
077:
078: public long getId() {
079: return id;
080: }
081:
082: public void setId(long id) {
083: this .id = id;
084: }
085:
086: public int getVersion() {
087: return version;
088: }
089:
090: public void setVersion(int version) {
091: this .version = version;
092: }
093:
094: public boolean equals(Object o) {
095: if (o == this ) {
096: return true;
097: }
098: if (o instanceof UserImpl) {
099: UserImpl other = (UserImpl) o;
100: return new EqualsBuilder().append(userUid, other.userUid)
101: .isEquals();
102: }
103: return false;
104: }
105:
106: public int hashCode() {
107: return new HashCodeBuilder(17, 37).append(userUid).toHashCode();
108: }
109:
110: public String toString() {
111: return new ToStringBuilder(this).append(displayName).append(
112: userUid).append(id).toString();
113: }
114: }
|