KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > entities > content > ContentVersionVO


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.entities.content;
25
26 import java.util.Date JavaDoc;
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 JavaDoc WORKING_STATE = new Integer JavaDoc(0);
38     public static final Integer JavaDoc FINAL_STATE = new Integer JavaDoc(1);
39     public static final Integer JavaDoc PUBLISH_STATE = new Integer JavaDoc(2);
40     public static final Integer JavaDoc PUBLISHED_STATE = new Integer JavaDoc(3);
41     public static final Integer JavaDoc UNPUBLISH_STATE = new Integer JavaDoc(4);
42     public static final Integer JavaDoc UNPUBLISHED_STATE = new Integer JavaDoc(5);
43     
44     private Integer JavaDoc contentVersionId;
45     private Integer JavaDoc stateId = new Integer JavaDoc(0);
46     private Date JavaDoc modifiedDateTime = DateHelper.getSecondPreciseDate();
47     private String JavaDoc versionComment = "No comment";
48     private Boolean JavaDoc isCheckedOut = new Boolean JavaDoc(false);
49     private Boolean JavaDoc isActive = new Boolean JavaDoc(true);
50     
51     private Integer JavaDoc languageId = null;
52     private String JavaDoc languageName = "";
53     private Integer JavaDoc contentId = null;
54     private String JavaDoc contentName = "";
55     private Integer JavaDoc contentTypeDefinitionId = null;
56     private String JavaDoc versionModifier = null;
57     private String JavaDoc versionValue = "";
58         
59     public java.lang.Integer JavaDoc getContentVersionId()
60     {
61         return this.contentVersionId;
62     }
63                 
64     public void setContentVersionId(java.lang.Integer JavaDoc contentVersionId)
65     {
66         this.contentVersionId = contentVersionId;
67     }
68   
69     public Integer JavaDoc getContentId()
70     {
71         return this.contentId;
72     }
73                 
74     public void setContentId(Integer JavaDoc contentId)
75     {
76         this.contentId = contentId;
77     }
78     
79     public Integer JavaDoc getContentTypeDefinitionId()
80     {
81         return contentTypeDefinitionId;
82     }
83
84     public void setContentTypeDefinitionId(Integer JavaDoc id)
85     {
86         contentTypeDefinitionId = id;
87     }
88     
89     public Integer JavaDoc getStateId()
90     {
91         return this.stateId;
92     }
93                 
94     public void setStateId(Integer JavaDoc stateId)
95     {
96         this.stateId = stateId;
97     }
98     
99     public String JavaDoc getVersionValue()
100     {
101         return this.versionValue;
102     }
103                 
104     public void setVersionValue(String JavaDoc versionValue)
105     {
106         this.versionValue = versionValue;
107     }
108     
109     public Date JavaDoc getModifiedDateTime()
110     {
111         return this.modifiedDateTime;
112     }
113                 
114     public void setModifiedDateTime(Date JavaDoc modifiedDateTime)
115     {
116         this.modifiedDateTime = modifiedDateTime;
117     }
118     
119     public String JavaDoc getVersionComment()
120     {
121         return this.versionComment;
122     }
123                 
124     public void setVersionComment(String JavaDoc versionComment)
125     {
126         if(versionComment != null && !versionComment.equals(""))
127             this.versionComment = versionComment;
128     }
129     
130     public Boolean JavaDoc getIsCheckedOut()
131     {
132         return this.isCheckedOut;
133     }
134                 
135     public void setIsCheckedOut(Boolean JavaDoc isCheckedOut)
136     {
137         this.isCheckedOut = isCheckedOut;
138     }
139     
140     public Boolean JavaDoc getIsActive()
141     {
142         return this.isActive;
143     }
144     
145     public void setIsActive(Boolean JavaDoc isActive)
146     {
147         this.isActive = isActive;
148     }
149
150     /**
151      * @see org.infoglue.cms.entities.kernel.BaseEntityVO#getId()
152      */

153     public Integer JavaDoc getId()
154     {
155         return getContentVersionId();
156     }
157     
158     /**
159      * @see org.infoglue.cms.entities.kernel.BaseEntityVO#validate()
160      */

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 JavaDoc getLanguageId()
177     {
178         return languageId;
179     }
180
181     public void setLanguageId(Integer JavaDoc languageId)
182     {
183         this.languageId = languageId;
184     }
185
186
187     public String JavaDoc getVersionModifier()
188     {
189         return this.versionModifier;
190     }
191
192     public void setVersionModifier(String JavaDoc 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 JavaDoc(this.contentId.intValue()));
203         copy.setContentTypeDefinitionId(new Integer JavaDoc(this.contentTypeDefinitionId.intValue()));
204         copy.setIsActive(new Boolean JavaDoc(this.isActive.booleanValue()));
205         copy.setIsCheckedOut(new Boolean JavaDoc(this.isCheckedOut.booleanValue()));
206         copy.setLanguageId(new Integer JavaDoc(this.languageId.intValue()));
207         copy.setVersionModifier(this.versionModifier);
208         copy.setModifiedDateTime(new Date JavaDoc(this.modifiedDateTime.getTime()));
209         copy.setStateId(new Integer JavaDoc(this.stateId.intValue()));
210         copy.setVersionComment(new String JavaDoc(this.versionComment));
211         copy.setVersionValue(new String JavaDoc(this.versionValue));
212         
213         return copy;
214     }
215
216     public String JavaDoc getContentName()
217     {
218         return contentName;
219     }
220
221     public void setContentName(String JavaDoc string)
222     {
223         contentName = string;
224     }
225
226     public String JavaDoc getLanguageName()
227     {
228         return languageName;
229     }
230
231     public void setLanguageName(String JavaDoc string)
232     {
233         languageName = string;
234     }
235
236     public String JavaDoc toString()
237     {
238         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
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 JavaDoc 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