PageRenderTime 47ms CodeModel.GetById 14ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/com/google/ie/business/domain/User.java

http://thoughtsite.googlecode.com/
Java | 233 lines | 125 code | 38 blank | 70 comment | 2 complexity | 7fe06c36a54ed092833c983d1285e4bb MD5 | raw file
  1/* Copyright 2010 Google Inc.
  2 * 
  3 * Licensed under the Apache License, Version 2.0 (the "License");
  4 * you may not use this file except in compliance with the License.
  5 * You may obtain a copy of the License at
  6 * 
  7 *      http://www.apache.org/licenses/LICENSE-2.0
  8 * 
  9 * Unless required by applicable law or agreed to in writing, software
 10 * distributed under the License is distributed on an "AS IS" BASIS.
 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12 * See the License for the specific language governing permissions and
 13 * limitations under the License
 14 */
 15
 16package com.google.ie.business.domain;
 17
 18import org.compass.annotations.Searchable;
 19import org.compass.annotations.SearchableId;
 20import org.compass.annotations.SearchableProperty;
 21
 22import java.io.Serializable;
 23import java.util.Date;
 24import java.util.HashSet;
 25import java.util.Set;
 26
 27import javax.jdo.annotations.Extension;
 28import javax.jdo.annotations.IdGeneratorStrategy;
 29import javax.jdo.annotations.IdentityType;
 30import javax.jdo.annotations.PersistenceCapable;
 31import javax.jdo.annotations.Persistent;
 32import javax.jdo.annotations.PrimaryKey;
 33
 34@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
 35@Searchable(alias = "User")
 36public class User implements Serializable {
 37
 38    /** A unique identifier for the class */
 39    private static final long serialVersionUID = -1507109590723476666L;
 40    /** Constant for rolename user */
 41    public static final String ROLE_USER = "user";
 42    /** Constant for rolename admin */
 43    public static final String ROLE_ADMIN = "admin";
 44
 45    /** Constant for rolename admin */
 46    public static final String STATUS_ACTIVE = "active";
 47    public static final String STATUS_BANNED = "banned";
 48
 49    @PrimaryKey
 50    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 51    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
 52    @SearchableId
 53    private String userKey;
 54
 55    @Persistent
 56    private long reputationPoints;
 57    @Persistent
 58    private String roleName;
 59    @Persistent
 60    private String id;
 61    @Persistent
 62    private Set<String> ideaKeys;
 63    @Persistent
 64    private Date createdOn;
 65    @Persistent
 66    private String thumbnailUrl;
 67    @Persistent
 68    @SearchableProperty
 69    private String displayName;
 70
 71    @Persistent
 72    private String emailId;
 73
 74    @Persistent
 75    private String status;
 76
 77    /**
 78     * @return the emailId
 79     */
 80    public String getEmailId() {
 81        return emailId;
 82    }
 83
 84    /**
 85     * @param emailId the emailId to set
 86     */
 87    public void setEmailId(String emailId) {
 88        this.emailId = emailId;
 89    }
 90
 91    public User() {
 92        this.status = STATUS_ACTIVE;
 93
 94    }
 95
 96    /**
 97     * @return the ideaKeys
 98     */
 99    public Set<String> getIdeaKeys() {
100        if (ideaKeys == null)
101            ideaKeys = new HashSet<String>();
102        return ideaKeys;
103    }
104
105    /**
106     * @param ideaKeys the ideaKeys to set
107     */
108    public void setIdeaKeys(Set<String> ideaKeys) {
109        this.ideaKeys = ideaKeys;
110    }
111
112    /**
113     * @return the status
114     */
115    public String getStatus() {
116        return status;
117    }
118
119    /**
120     * @param status the status to set
121     */
122    public void setStatus(String status) {
123        this.status = status;
124    }
125
126    public String getDisplayName() {
127        return displayName;
128    }
129
130    public String getId() {
131        return id;
132    }
133
134    /**
135     * @return the key
136     */
137    public String getUserKey() {
138        return userKey;
139    }
140
141    /**
142     * @return the reputationPoints
143     */
144    public long getReputationPoints() {
145        return reputationPoints;
146    }
147
148    /**
149     * @return the roleName
150     */
151    public String getRoleName() {
152        return roleName;
153    }
154
155    public String getThumbnailUrl() {
156        return thumbnailUrl;
157    }
158
159    public void setDisplayName(String displayName) {
160        this.displayName = displayName;
161    }
162
163    public void setId(String id) {
164        this.id = id;
165    }
166
167    /**
168     * @param key the key to set
169     */
170    public void setUserKey(String key) {
171        this.userKey = key;
172    }
173
174    /**
175     * @param reputationPoints the reputationPoints to set
176     */
177    public void setReputationPoints(long reputationPoints) {
178        this.reputationPoints = reputationPoints;
179    }
180
181    /**
182     * @param roleName the roleName to set
183     */
184    public void setRoleName(String roleName) {
185        this.roleName = roleName;
186    }
187
188    public void setThumbnailUrl(String thumbnailUrl) {
189        this.thumbnailUrl = thumbnailUrl;
190    }
191
192    /**
193     * @param userIdeaKeys the userIdeaKeys to set
194     */
195    public void setUserIdeaKeys(Set<String> userIdeaKeys) {
196        this.ideaKeys = userIdeaKeys;
197    }
198
199    /**
200     * @return the userIdeaKeys
201     */
202    public Set<String> getUserIdeaKeys() {
203        return ideaKeys;
204    }
205
206    /**
207     * @param createdOn the createdOn to set
208     */
209    public void setCreatedOn(Date createdOn) {
210        this.createdOn = createdOn;
211    }
212
213    /**
214     * @return the createdOn
215     */
216    public Date getCreatedOn() {
217        return createdOn;
218    }
219
220    /*
221     * (non-Javadoc)
222     * @see java.lang.Object#toString()
223     */
224    @Override
225    public String toString() {
226        return "User [createdOn=" + createdOn + ", displayName=" + displayName + ", emailId="
227                        + emailId + ", id=" + id + ", ideaKeys=" + ideaKeys + ", reputationPoints="
228                        + reputationPoints + ", roleName=" + roleName + ", status=" + status
229                        + ", thumbnailUrl=" + thumbnailUrl + ", userKey=" + userKey + "]";
230    }
231
232}
233