1 23 24 package org.infoglue.cms.entities.content; 25 26 import java.util.Calendar ; 27 import java.util.Hashtable ; 28 import java.util.Map ; 29 30 import org.infoglue.cms.entities.kernel.BaseEntityVO; 31 import org.infoglue.cms.exception.ConstraintException; 32 import org.infoglue.cms.util.ConstraintExceptionBuffer; 33 import org.infoglue.cms.util.DateHelper; 34 import org.infoglue.cms.util.validators.ValidatorFactory; 35 36 public class ContentVO implements BaseEntityVO 37 { 38 public static final Integer NO = new Integer (0); 39 public static final Integer YES = new Integer (1); 40 public static final Integer INHERITED = new Integer (2); 41 42 private java.lang.Integer contentId; 43 private java.lang.String name = ""; 44 private java.util.Date publishDateTime = DateHelper.getSecondPreciseDate(); 45 private java.util.Date expireDateTime = DateHelper.getSecondPreciseDate(); 46 private java.lang.Boolean isBranch = new Boolean (false); 47 private java.lang.Integer isProtected = INHERITED; 48 private java.lang.Integer repositoryId = null; 49 private java.lang.Integer contentTypeDefinitionId = null; 50 private java.lang.Integer parentContentId = null; 51 52 private Integer childCount; 53 private String creatorName; 54 55 private Map extraProperties = new Hashtable (); 57 58 public ContentVO() 59 { 60 Calendar calendar = Calendar.getInstance(); 62 calendar.add(Calendar.YEAR, 50); 63 expireDateTime = calendar.getTime(); 64 } 65 66 69 public Integer getId() 70 { 71 return getContentId(); 72 } 73 74 public java.lang.Integer getContentId() 75 { 76 return this.contentId; 77 } 78 79 public void setRepositoryId(java.lang.Integer repositoryId) 80 { 81 this.repositoryId = repositoryId; 82 } 83 84 public java.lang.Integer getRepositoryId() 85 { 86 return this.repositoryId; 87 } 88 89 90 public void setContentId(java.lang.Integer contentId) 91 { 92 this.contentId = contentId; 93 } 94 95 public java.lang.String getName() 96 { 97 return this.name; 98 } 99 100 public void setName(java.lang.String name) 101 { 102 this.name = name; 103 } 104 105 public java.util.Date getPublishDateTime() 106 { 107 return this.publishDateTime; 108 } 109 110 public void setPublishDateTime(java.util.Date publishDateTime) 111 { 112 this.publishDateTime = publishDateTime; 113 } 114 115 public java.util.Date getExpireDateTime() 116 { 117 return this.expireDateTime; 118 } 119 120 public void setExpireDateTime(java.util.Date expireDateTime) 121 { 122 this.expireDateTime = expireDateTime; 123 } 124 125 public java.lang.Boolean getIsBranch() 126 { 127 return this.isBranch; 128 } 129 130 public void setIsBranch(java.lang.Boolean isBranch) 131 { 132 this.isBranch = isBranch; 133 } 134 135 136 139 public ConstraintExceptionBuffer validate() 140 { 141 ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer(); 142 ValidatorFactory.createStringValidator("Content.name", true, 2, 100).validate(name, ceb); 143 144 if(this.publishDateTime == null) 145 ceb.add(new ConstraintException("Content.publishDateTime", "300")); 146 if(this.expireDateTime == null) 147 ceb.add(new ConstraintException("Content.expireDateTime", "300")); 148 if(this.publishDateTime != null && this.expireDateTime != null) 149 if(this.publishDateTime.after(this.expireDateTime)) 150 ceb.add(new ConstraintException("Content.publishDateTime", "308")); 151 152 return ceb; 153 } 154 155 159 public Integer getChildCount() 160 { 161 return childCount; 162 } 163 164 168 public void setChildCount(Integer childCount) 169 { 170 this.childCount = childCount; 171 } 172 173 177 public String getCreatorName() 178 { 179 return creatorName; 180 } 181 182 186 public void setCreatorName(String creatorName) 187 { 188 this.creatorName = creatorName; 189 } 190 191 public java.lang.Integer getIsProtected() 192 { 193 return isProtected; 194 } 195 196 public void setIsProtected(java.lang.Integer isProtected) 197 { 198 this.isProtected = isProtected; 199 } 200 201 public java.lang.Integer getContentTypeDefinitionId() 202 { 203 return contentTypeDefinitionId; 204 } 205 206 public void setContentTypeDefinitionId(java.lang.Integer contentTypeDefinitionId) 207 { 208 this.contentTypeDefinitionId = contentTypeDefinitionId; 209 } 210 211 public java.lang.Integer getParentContentId() 212 { 213 return parentContentId; 214 } 215 216 public void setParentContentId(java.lang.Integer parentContentId) 217 { 218 this.parentContentId = parentContentId; 219 } 220 221 public String toString() 222 { 223 StringBuffer sb = new StringBuffer (); 224 sb.append("id=").append(contentId) 225 .append(" name=").append(name) 226 .append(" publishDateTime=").append(publishDateTime) 227 .append(" expireDateTime=").append(expireDateTime) 228 .append(" isBranch=").append(isBranch) 229 .append(" isProtected=").append(isProtected) 230 .append(" repositoryId=").append(repositoryId) 231 .append(" contentTypeDefinitionId=").append(contentTypeDefinitionId) 232 .append(" parentContentId=").append(parentContentId) 233 .append(" creatorName=").append(creatorName); 234 return sb.toString(); 235 } 236 237 public Map getExtraProperties() 238 { 239 return extraProperties; 240 } 241 242 public void setExtraProperties(Map extraProperties) 243 { 244 this.extraProperties = extraProperties; 245 } 246 } 247 248 | Popular Tags |