PageRenderTime 443ms CodeModel.GetById 171ms app.highlight 10ms RepoModel.GetById 174ms app.codeStats 0ms

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

http://thoughtsite.googlecode.com/
Java | 230 lines | 121 code | 34 blank | 75 comment | 2 complexity | 942f6fb71116940432fcb1e1f9f10310 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.appengine.api.datastore.Blob;
 19import com.google.ie.common.util.StringUtility;
 20
 21import org.compass.annotations.Searchable;
 22import org.compass.annotations.SearchableId;
 23import org.compass.annotations.SearchableProperty;
 24
 25import java.io.Serializable;
 26import java.util.ArrayList;
 27import java.util.Date;
 28import java.util.List;
 29
 30import javax.jdo.annotations.Extension;
 31import javax.jdo.annotations.IdGeneratorStrategy;
 32import javax.jdo.annotations.IdentityType;
 33import javax.jdo.annotations.PersistenceCapable;
 34import javax.jdo.annotations.Persistent;
 35import javax.jdo.annotations.PrimaryKey;
 36import javax.persistence.Transient;
 37
 38@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
 39@Searchable(alias = "Project")
 40public class Project implements Serializable {
 41    public static final String STATUS_CREATED = "Created";
 42    public static final String STATUS_DELETED = "Deleted";
 43    public static final String PROJECT_FIELD_CREATED_ON = "createdOn";
 44    /** A unique identifier for the class */
 45    private static final long serialVersionUID = 6752251754854682164L;
 46
 47    @PrimaryKey
 48    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 49    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
 50    @SearchableId
 51    private String key;
 52    @Persistent
 53    @SearchableProperty
 54    private String name;
 55    @Persistent
 56    private String status;
 57    @Persistent
 58    private String creatorKey;
 59    @Persistent
 60    @SearchableProperty
 61    private List<String> description = new ArrayList<String>();
 62    @Persistent
 63    private String ideaKey;
 64
 65    @Persistent
 66    private Date createdOn;
 67    @Persistent
 68    private Date updatedOn;
 69    @Persistent
 70    private Blob logo;
 71    @Transient
 72    private String descriptionAsString;
 73
 74    /**
 75     * @return the descriptionAsString
 76     */
 77    public String getDescriptionAsString() {
 78        return descriptionAsString;
 79    }
 80
 81    /**
 82     * @param descriptionAsString the descriptionAsString to set
 83     */
 84    public void setDescriptionAsString(String descriptionAsString) {
 85        this.descriptionAsString = descriptionAsString;
 86    }
 87
 88    private byte[] img;
 89
 90    /**
 91     * @return the img
 92     */
 93    public byte[] getImg() {
 94        if (logo != null)
 95            img = logo.getBytes();
 96        return img;
 97    }
 98
 99    /**
100     * @param img the img to set
101     */
102    public void setImg(byte[] img) {
103        this.img = img;
104    }
105
106    public Blob getLogo() {
107        return logo;
108    }
109
110    public void setLogo(Blob logo) {
111        this.logo = logo;
112    }
113
114    public Project() {
115
116    }
117
118    /**
119     * @return the name
120     */
121    public String getName() {
122        return name;
123    }
124
125    /**
126     * @param name the name to set
127     */
128    public void setName(String name) {
129        this.name = name;
130    }
131
132    /**
133     * @return the status
134     */
135    public String getStatus() {
136        return status;
137    }
138
139    /**
140     * @param status the status to set
141     */
142    public void setStatus(String status) {
143        this.status = status;
144    }
145
146    /**
147     * @return the createdOn
148     */
149    public Date getCreatedOn() {
150        return createdOn;
151    }
152
153    /**
154     * @param createdOn the createdOn to set
155     */
156    public void setCreatedOn(Date createdOn) {
157        this.createdOn = createdOn;
158    }
159
160    /**
161     * @return the key
162     */
163    public String getKey() {
164        return key;
165    }
166
167    /**
168     * @param key the key to set
169     */
170    public void setKey(String key) {
171        this.key = key;
172    }
173
174    /**
175     * @return the ideaKey
176     */
177    public String getIdeaKey() {
178        return ideaKey;
179    }
180
181    /**
182     * @param ideaKey the ideaKey to set
183     */
184    public void setIdeaKey(String ideaKey) {
185        this.ideaKey = ideaKey;
186    }
187
188    /**
189     * @param updatedOn the updatedOn to set
190     */
191    public void setUpdatedOn(Date updatedOn) {
192        this.updatedOn = updatedOn;
193    }
194
195    /**
196     * @return the updatedOn
197     */
198    public Date getUpdatedOn() {
199        return updatedOn;
200    }
201
202    /**
203     * @param creatorKey the creatorKey to set
204     */
205    public void setCreatorKey(String creatorKey) {
206        this.creatorKey = creatorKey;
207    }
208
209    /**
210     * @return the creatorKey
211     */
212    public String getCreatorKey() {
213        return creatorKey;
214    }
215
216    /**
217     * @param description the description to set
218     */
219    public void setDescription(String description) {
220        this.description = StringUtility.convertStringToList(description);
221    }
222
223    /**
224     * @return the description
225     */
226    public String getDescription() {
227        return StringUtility.convertListToString(description);
228    }
229}
230