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