1 23 24 package org.infoglue.cms.entities.content; 25 26 import java.util.Date ; 27 28 import org.infoglue.cms.entities.kernel.BaseEntityVO; 29 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO; 30 import org.infoglue.cms.util.ConstraintExceptionBuffer; 31 import org.infoglue.cms.util.DateHelper; 32 import org.infoglue.cms.util.validators.ContentVersionValidator; 33 34 public class ContentVersionVO implements BaseEntityVO 35 { 36 37 public static final Integer WORKING_STATE = new Integer (0); 38 public static final Integer FINAL_STATE = new Integer (1); 39 public static final Integer PUBLISH_STATE = new Integer (2); 40 public static final Integer PUBLISHED_STATE = new Integer (3); 41 public static final Integer UNPUBLISH_STATE = new Integer (4); 42 public static final Integer UNPUBLISHED_STATE = new Integer (5); 43 44 private Integer contentVersionId; 45 private Integer stateId = new Integer (0); 46 private Date modifiedDateTime = DateHelper.getSecondPreciseDate(); 47 private String versionComment = "No comment"; 48 private Boolean isCheckedOut = new Boolean (false); 49 private Boolean isActive = new Boolean (true); 50 51 private Integer languageId = null; 52 private String languageName = ""; 53 private Integer contentId = null; 54 private String contentName = ""; 55 private Integer contentTypeDefinitionId = null; 56 private String versionModifier = null; 57 private String versionValue = ""; 58 59 public java.lang.Integer getContentVersionId() 60 { 61 return this.contentVersionId; 62 } 63 64 public void setContentVersionId(java.lang.Integer contentVersionId) 65 { 66 this.contentVersionId = contentVersionId; 67 } 68 69 public Integer getContentId() 70 { 71 return this.contentId; 72 } 73 74 public void setContentId(Integer contentId) 75 { 76 this.contentId = contentId; 77 } 78 79 public Integer getContentTypeDefinitionId() 80 { 81 return contentTypeDefinitionId; 82 } 83 84 public void setContentTypeDefinitionId(Integer id) 85 { 86 contentTypeDefinitionId = id; 87 } 88 89 public Integer getStateId() 90 { 91 return this.stateId; 92 } 93 94 public void setStateId(Integer stateId) 95 { 96 this.stateId = stateId; 97 } 98 99 public String getVersionValue() 100 { 101 return this.versionValue; 102 } 103 104 public void setVersionValue(String versionValue) 105 { 106 this.versionValue = versionValue; 107 } 108 109 public Date getModifiedDateTime() 110 { 111 return this.modifiedDateTime; 112 } 113 114 public void setModifiedDateTime(Date modifiedDateTime) 115 { 116 this.modifiedDateTime = modifiedDateTime; 117 } 118 119 public String getVersionComment() 120 { 121 return this.versionComment; 122 } 123 124 public void setVersionComment(String versionComment) 125 { 126 if(versionComment != null && !versionComment.equals("")) 127 this.versionComment = versionComment; 128 } 129 130 public Boolean getIsCheckedOut() 131 { 132 return this.isCheckedOut; 133 } 134 135 public void setIsCheckedOut(Boolean isCheckedOut) 136 { 137 this.isCheckedOut = isCheckedOut; 138 } 139 140 public Boolean getIsActive() 141 { 142 return this.isActive; 143 } 144 145 public void setIsActive(Boolean isActive) 146 { 147 this.isActive = isActive; 148 } 149 150 153 public Integer getId() 154 { 155 return getContentVersionId(); 156 } 157 158 161 public ConstraintExceptionBuffer validate() 162 { 163 ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer(); 164 165 return ceb; 166 } 167 168 public ConstraintExceptionBuffer validateAdvanced(ContentTypeDefinitionVO contentTypeDefinition) 169 { 170 ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer(); 171 ceb.add(new ContentVersionValidator().validate(contentTypeDefinition, this)); 172 173 return ceb; 174 } 175 176 public Integer getLanguageId() 177 { 178 return languageId; 179 } 180 181 public void setLanguageId(Integer languageId) 182 { 183 this.languageId = languageId; 184 } 185 186 187 public String getVersionModifier() 188 { 189 return this.versionModifier; 190 } 191 192 public void setVersionModifier(String versionModifier) 193 { 194 this.versionModifier = versionModifier; 195 } 196 197 198 public ContentVersionVO copy() 199 { 200 ContentVersionVO copy = new ContentVersionVO(); 201 202 copy.setContentId(new Integer (this.contentId.intValue())); 203 copy.setContentTypeDefinitionId(new Integer (this.contentTypeDefinitionId.intValue())); 204 copy.setIsActive(new Boolean (this.isActive.booleanValue())); 205 copy.setIsCheckedOut(new Boolean (this.isCheckedOut.booleanValue())); 206 copy.setLanguageId(new Integer (this.languageId.intValue())); 207 copy.setVersionModifier(this.versionModifier); 208 copy.setModifiedDateTime(new Date (this.modifiedDateTime.getTime())); 209 copy.setStateId(new Integer (this.stateId.intValue())); 210 copy.setVersionComment(new String (this.versionComment)); 211 copy.setVersionValue(new String (this.versionValue)); 212 213 return copy; 214 } 215 216 public String getContentName() 217 { 218 return contentName; 219 } 220 221 public void setContentName(String string) 222 { 223 contentName = string; 224 } 225 226 public String getLanguageName() 227 { 228 return languageName; 229 } 230 231 public void setLanguageName(String string) 232 { 233 languageName = string; 234 } 235 236 public String toString() 237 { 238 StringBuffer sb = new StringBuffer (); 239 sb.append("id=").append(contentVersionId) 240 .append(" contentId=").append(contentId) 241 .append(" contentName=").append(contentName) 242 .append(" contentTypeDefinitionId=").append(contentTypeDefinitionId) 243 .append(" languageId=").append(languageId) 244 .append(" languageName=").append(languageName) 245 .append(" isActive=").append(isActive) 246 .append(" isCheckedOut=").append(isCheckedOut) 247 .append(" stateId=").append(stateId) 248 .append(" versionModifier=").append(versionModifier) 249 .append(" versionComment=").append(versionComment); 250 return sb.toString(); 251 } 252 253 public boolean equals(Object o) 254 { 255 boolean equals = false; 256 257 if(o instanceof ContentVersionVO) 258 { 259 ContentVersionVO cv = (ContentVersionVO)o; 260 if(cv != null && cv.getContentVersionId().equals(this.contentVersionId)) 261 equals = true; 262 } 263 264 return equals; 265 } 266 267 public int hashCode() 268 { 269 return this.contentVersionId.intValue(); 270 } 271 } 272 273 | Popular Tags |