PageRenderTime 356ms CodeModel.GetById 181ms app.highlight 19ms RepoModel.GetById 152ms app.codeStats 0ms

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

http://thoughtsite.googlecode.com/
Java | 452 lines | 233 code | 71 blank | 148 comment | 2 complexity | 696dad4023e89a8dda2ec195b23c9b01 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 com.google.ie.common.util.StringUtility;
 19
 20import org.compass.annotations.Searchable;
 21import org.compass.annotations.SearchableId;
 22import org.compass.annotations.SearchableProperty;
 23
 24import java.io.Serializable;
 25import java.util.ArrayList;
 26import java.util.Date;
 27import java.util.HashSet;
 28import java.util.List;
 29import java.util.Set;
 30
 31import javax.jdo.annotations.Extension;
 32import javax.jdo.annotations.IdGeneratorStrategy;
 33import javax.jdo.annotations.IdentityType;
 34import javax.jdo.annotations.NotPersistent;
 35import javax.jdo.annotations.PersistenceCapable;
 36import javax.jdo.annotations.Persistent;
 37import javax.jdo.annotations.PrimaryKey;
 38
 39@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
 40@Searchable(alias = "Idea")
 41public class Idea implements Serializable {
 42    /** A unique identifier for the class */
 43    private static final long serialVersionUID = -2605556889201805705L;
 44
 45    /** variable for storing idea status value */
 46    public static final String STATUS_OBJECTIONABLE = "Objectionable";
 47    public static final String STATUS_PUBLISHED = "Published";
 48    public static final String STATUS_SAVED = "Saved";
 49    public static final String STATUS_DELETED = "Deleted";
 50    public static final String STATUS_DUPLICATE = "Duplicate";
 51
 52    /** variable for storing FlagType value */
 53    public static final String FLAG_TYPE_OBJECTIONABLE = "Objectionable";
 54    public static final String FLAG_TYPE_DUPLICATE = "Duplicate";
 55
 56    @PrimaryKey
 57    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 58    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
 59    @SearchableId
 60    private String key;
 61
 62    @Persistent
 63    @SearchableProperty
 64    private String title;
 65
 66    @Persistent
 67    @SearchableProperty
 68    private List<String> description = new ArrayList<String>();
 69
 70    @Persistent
 71    @SearchableProperty
 72    private String competition;
 73
 74    @Persistent
 75    private boolean ideaRightsGivenUp = false;
 76
 77    @Persistent
 78    private List<String> ideaSummary = new ArrayList<String>();
 79
 80    @Persistent
 81    private boolean ipGivenUp = false;
 82
 83    @Persistent
 84    @SearchableProperty
 85    private String monetization;
 86
 87    @Persistent
 88    @SearchableProperty
 89    private String targetAudience;
 90    @Persistent
 91    private long totalNegativeVotes;
 92    /* This would hold the algeberic sum of votes */
 93    @Persistent
 94    private long totalVotes;
 95    @Persistent
 96    private long totalPositiveVotes;
 97    @Persistent
 98    private Date publishDate;
 99    @Persistent
100    private Date lastUpdated;
101    /**
102     * Key of original idea
103     */
104    @Persistent
105    private String originalIdeaKey;
106    @Persistent
107    private String status;
108    /**
109     * Set of tag keys
110     */
111    @Persistent
112    private Set<String> tagKeys;
113
114    @SearchableProperty
115    @Persistent
116    private String tags;
117
118    @Persistent
119    private String creatorKey;
120
121    @Persistent
122    @SearchableProperty
123    private String ideaCategoryKey;
124
125    @NotPersistent
126    private String category;
127
128    private Set<String> flagType;
129
130    public Idea() {
131
132    }
133
134    /**
135     * @return the key
136     */
137    public String getKey() {
138        return key;
139    }
140
141    /**
142     * @return the flagType
143     */
144    public Set<String> getFlagType() {
145        if (flagType == null)
146            flagType = new HashSet<String>();
147        return flagType;
148    }
149
150    /**
151     * @param flagType the flagType to set
152     */
153    public void setFlagType(Set<String> flagType) {
154        this.flagType = flagType;
155    }
156
157    /**
158     * @param key the key to set
159     */
160    public void setKey(String key) {
161        this.key = key;
162    }
163
164    /**
165     * @return the title
166     */
167    public String getTitle() {
168        return title;
169    }
170
171    /**
172     * @param title the title to set
173     */
174    public void setTitle(String title) {
175        this.title = title;
176    }
177
178    /**
179     * @return the competition
180     */
181    public String getCompetition() {
182        return competition;
183    }
184
185    /**
186     * @param competition the competition to set
187     */
188    public void setCompetition(String competition) {
189        this.competition = competition;
190    }
191
192    /**
193     * @return the ideaRightsGivenUp
194     */
195    public boolean isIdeaRightsGivenUp() {
196        return ideaRightsGivenUp;
197    }
198
199    /**
200     * @param ideaRightsGivenUp the ideaRightsGivenUp to set
201     */
202    public void setIdeaRightsGivenUp(boolean ideaRightsGivenUp) {
203        this.ideaRightsGivenUp = ideaRightsGivenUp;
204    }
205
206    /**
207     * @return the ipGivenUp
208     */
209    public boolean isIpGivenUp() {
210        return ipGivenUp;
211    }
212
213    /**
214     * @param ipGivenUp the ipGivenUp to set
215     */
216    public void setIpGivenUp(boolean ipGivenUp) {
217        this.ipGivenUp = ipGivenUp;
218    }
219
220    /**
221     * @return the monetization
222     */
223    public String getMonetization() {
224        return monetization;
225    }
226
227    /**
228     * @param monetization the monetization to set
229     */
230    public void setMonetization(String monetization) {
231        this.monetization = monetization;
232    }
233
234    /**
235     * @return the targetAudience
236     */
237    public String getTargetAudience() {
238        return targetAudience;
239    }
240
241    /**
242     * @param targetAudience the targetAudience to set
243     */
244    public void setTargetAudience(String targetAudience) {
245        this.targetAudience = targetAudience;
246    }
247
248    /**
249     * @return the totalNegativeVotes
250     */
251    public long getTotalNegativeVotes() {
252        return totalNegativeVotes;
253    }
254
255    /**
256     * @param totalNegativeVotes the totalNegativeVotes to set
257     */
258    public void setTotalNegativeVotes(long totalNegativeVotes) {
259        this.totalNegativeVotes = totalNegativeVotes;
260    }
261
262    /**
263     * @return the totalPositiveVotes
264     */
265    public long getTotalPositiveVotes() {
266        return totalPositiveVotes;
267    }
268
269    /**
270     * @param totalPositiveVotes the totalPositiveVotes to set
271     */
272    public void setTotalPositiveVotes(long totalPositiveVotes) {
273        this.totalPositiveVotes = totalPositiveVotes;
274    }
275
276    /**
277     * @return the lastUpdated
278     */
279    public Date getLastUpdated() {
280        return lastUpdated;
281    }
282
283    /**
284     * @param lastUpdated the lastUpdated to set
285     */
286    public void setLastUpdated(Date lastUpdated) {
287        this.lastUpdated = lastUpdated;
288    }
289
290    /**
291     * @return the originalIdeaKey
292     */
293    public String getOriginalIdeaKey() {
294        return originalIdeaKey;
295    }
296
297    /**
298     * @param originalIdeaKey the originalIdeaKey to set
299     */
300    public void setOriginalIdeaKey(String originalIdeaKey) {
301        this.originalIdeaKey = originalIdeaKey;
302    }
303
304    /**
305     * @return the status
306     */
307    public String getStatus() {
308        return status;
309    }
310
311    /**
312     * @param status the status to set
313     */
314    public void setStatus(String status) {
315        this.status = status;
316    }
317
318    /**
319     * @return the creatorKey
320     */
321    public String getCreatorKey() {
322        return creatorKey;
323    }
324
325    /**
326     * @param creatorKey the creatorKey to set
327     */
328    public void setCreatorKey(String creatorKey) {
329        this.creatorKey = creatorKey;
330    }
331
332    /**
333     * @param tags the tags to set
334     */
335    public void setTags(String tags) {
336        this.tags = tags;
337    }
338
339    /**
340     * @return the tags
341     */
342    public String getTags() {
343        return tags;
344    }
345
346    /**
347     * @param description the description to set
348     */
349    public void setDescription(String description) {
350        this.description = StringUtility.convertStringToList(description);
351    }
352
353    /**
354     * @return the description
355     */
356    public String getDescription() {
357        return StringUtility.convertListToString(description);
358    }
359
360    /**
361     * @param ideaSummary the ideaSummary to set
362     */
363    public void setIdeaSummary(String ideaSummary) {
364        this.ideaSummary = StringUtility.convertStringToList(ideaSummary);
365    }
366
367    /**
368     * @return the ideaSummary
369     */
370    public String getIdeaSummary() {
371        return StringUtility.convertListToString(ideaSummary);
372    }
373
374    public void setIdeaCategoryKey(String ideaCategoryKey) {
375        this.ideaCategoryKey = ideaCategoryKey;
376    }
377
378    public String getIdeaCategoryKey() {
379        return ideaCategoryKey;
380    }
381
382    public void setCategory(String category) {
383        this.category = category;
384    }
385
386    public String getCategory() {
387        return category;
388    }
389
390    /**
391     * @param tagKeys the tagKeys to set
392     */
393    public void setTagKeys(Set<String> tagKeys) {
394        this.tagKeys = tagKeys;
395    }
396
397    /**
398     * @return the tagKeys
399     */
400    public Set<String> getTagKeys() {
401        return tagKeys;
402    }
403
404    /**
405     * @param totalVtes the totalVtes to set
406     */
407    public void setTotalVotes(long totalVotes) {
408        this.totalVotes = totalVotes;
409    }
410
411    /**
412     * @return the totalVotes
413     */
414    public long getTotalVotes() {
415        return totalVotes;
416    }
417
418    /**
419     * @param publishDate the publishDate to set
420     */
421    public void setPublishDate(Date publishDate) {
422        this.publishDate = publishDate;
423    }
424
425    /**
426     * @return the publishDate
427     */
428    public Date getPublishDate() {
429        return publishDate;
430    }
431
432    /*
433     * (non-Javadoc)
434     * @see java.lang.Object#toString()
435     */
436    @Override
437    public String toString() {
438        return "Idea [category=" + category + ", competition=" + competition + ", creatorKey="
439                        + creatorKey + ", description=" + description + ", flagType=" + flagType
440                        + ", ideaCategoryKey=" + ideaCategoryKey + ", ideaRightsGivenUp="
441                        + ideaRightsGivenUp + ", ideaSummary=" + ideaSummary + ", ipGivenUp="
442                        + ipGivenUp + ", key=" + key + ", lastUpdated=" + lastUpdated
443                        + ", monetization=" + monetization + ", originalIdeaKey=" + originalIdeaKey
444                        + ", publishDate=" + publishDate + ", status=" + status + ", tagKeys="
445                        + tagKeys + ", tags=" + tags + ", targetAudience=" + targetAudience
446                        + ", title=" + title + ", totalNegativeVotes=" + totalNegativeVotes
447                        + ", totalPositiveVotes=" + totalPositiveVotes + ", totalVotes="
448                        + totalVotes + "]";
449    }
450
451}
452