KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > cms > slide > SlideContentItem


1 /* ====================================================================
2  * The Apache Software License, Version 1.1
3  *
4  * Copyright (c) 2001 The Apache Software Foundation. All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  * if any, must include the following acknowledgment:
21  * "This product includes software developed by the
22  * Apache Software Foundation (http://www.apache.org/)."
23  * Alternately, this acknowledgment may appear in the software itself,
24  * if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Apache" and "Apache Software Foundation" and
27  * "Apache Jetspeed" must not be used to endorse or promote products
28  * derived from this software without prior written permission. For
29  * written permission, please contact apache@apache.org.
30  *
31  * 5. Products derived from this software may not be called "Apache",
32  * "Apache Jetspeed", nor may "Apache" appear in their name, without
33  * prior written permission of the Apache Software Foundation.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Software Foundation. For more
51  * information on the Apache Software Foundation, please see
52  * <http://www.apache.org/>.
53  */

54 package org.apache.jetspeed.om.cms.slide;
55
56 import org.apache.turbine.util.Log;
57
58 import org.apache.jetspeed.om.cms.*;
59
60
61 /**
62  * <p> Wrapper class for a content Item (ObjectNode).<br>
63  * Used to access to the content attributes
64  *
65  * @author <a HREF="mailto:christophe.lombart@skynet.be">Christophe Lombart</a>
66  *
67  */

68
69 public class SlideContentItem extends SlideResource implements ContentItem
70 {
71     private String JavaDoc logicalName = "";
72     private String JavaDoc description = "";
73     private String JavaDoc contentType= ""; // URL, HTML Text or upload// if contentType = URL => external or portal link
74
private String JavaDoc contentReference = ""; // url or HTML content
75
private String JavaDoc contentClass="" ; // Application or Document
76
private String JavaDoc title = "";
77     private String JavaDoc author = "";
78     private Integer JavaDoc creationDate_year;
79     private Integer JavaDoc creationDate_month;
80     private Integer JavaDoc creationDate_day;
81     private String JavaDoc parentUri;
82
83     public static String JavaDoc TYPE = "ContentItem";
84
85     /**
86     * getKey() : use in the comparator defined in the Catalog.java class
87     */

88     public String JavaDoc getKey()
89     {
90         return "2" + this.getTitle( ); // "2" because the contentItem should
91
// after the catalogs reference
92
}
93
94     public boolean contentTypeisURLPortal()
95     {
96         String JavaDoc type = this.getContentType();
97
98         if (type == null)
99         {
100             return false;
101         }
102
103         return type.equals("URLPORT");
104     }
105
106     public boolean contentTypeisURLInternet()
107     {
108         String JavaDoc type = this.getContentType();
109
110         if (type == null)
111         {
112             return false;
113         }
114
115         return type.equals("URLINT");
116     }
117
118     public boolean contentTypeisHTML()
119     {
120         String JavaDoc type = this.getContentType();
121
122         if (type == null)
123         {
124             return false;
125         }
126
127         return type.equals("HTML");
128     }
129
130     public boolean contentTypeisUpload()
131     {
132         String JavaDoc type = this.getContentType();
133
134         if (type == null)
135         {
136             return false;
137         }
138
139         return type.equals("UPLOAD");
140     }
141
142     public void setContentClass(String JavaDoc contentClass)
143     {
144         if (descriptor != null)
145         {
146             descriptor.setProperty("contentClass", contentClass);
147         }
148
149         this.contentClass = contentClass;
150     }
151
152     public String JavaDoc getContentClass()
153     {
154         if ((descriptor != null) && ((this.contentClass == null) || (this.contentClass.equals(""))))
155         {
156             this.contentClass = (String JavaDoc) this.getProperty("contentClass");
157         }
158
159         return this.contentClass;
160     }
161
162     public void setLogicalName(String JavaDoc logicalName)
163     {
164         if (descriptor != null)
165         {
166             descriptor.setProperty("logicalName", logicalName);
167         }
168
169         this.logicalName = logicalName;
170     }
171
172     public String JavaDoc getLogicalName()
173     {
174
175         if (Log.getLogger().isDebugEnabled())
176         {
177             Log.debug("ContentItem.getLogicalName() :" + this.uri);
178         }
179
180         if ((descriptor != null) && ((this.logicalName == null) || (this.logicalName.equals(""))))
181         {
182             this.logicalName = (String JavaDoc) this.getProperty("logicalName");
183         }
184
185         return this.logicalName;
186     }
187
188     public void setDescription(String JavaDoc description)
189     {
190         if (descriptor != null)
191         {
192             descriptor.setProperty("description", description);
193         }
194
195         this.description = description;
196     }
197
198     public String JavaDoc getDescription()
199     {
200         if ((descriptor != null) && ((this.description == null) || (this.description.equals(""))))
201         {
202             this.description = (String JavaDoc) this.getProperty("description");
203         }
204
205         return this.description;
206     }
207
208     public void setContentType(String JavaDoc contentType)
209     {
210         if (descriptor != null)
211         {
212             descriptor.setProperty("contentType", contentType);
213         }
214
215         this.contentType = contentType;
216     }
217
218     public String JavaDoc getContentType()
219     {
220         if ((descriptor != null) && ((this.contentType == null) || (this.contentType.equals(""))))
221         {
222             this.contentType = (String JavaDoc) this.getProperty("contentType");
223         }
224
225         return this.contentType;
226     }
227
228     public void setContentReference(String JavaDoc contentReference)
229     {
230         if (descriptor != null)
231         {
232             descriptor.setProperty("contentReference", contentReference);
233         }
234       this.contentReference = contentReference;
235     }
236
237     public String JavaDoc getContentReference()
238     {
239         if ((descriptor != null) && ((this.contentReference == null) || (this.contentReference.equals(""))))
240         {
241             this.contentReference = (String JavaDoc) this.getProperty("contentReference");
242         }
243
244         return this.contentReference;
245     }
246
247     public void setTitle(String JavaDoc title)
248     {
249         if (descriptor != null)
250         {
251             descriptor.setProperty("title", title);
252         }
253
254         this.title = title;
255     }
256
257     public String JavaDoc getTitle()
258     {
259         if ((descriptor != null) && ((this.title == null) || (this.title.equals(""))))
260         {
261             this.title = (String JavaDoc) this.getProperty("title");
262         }
263
264         return this.title;
265     }
266
267     public void setAuthor(String JavaDoc author)
268     {
269         if (descriptor != null)
270         {
271             descriptor.setProperty("author", author);
272         }
273
274         this.author = author;
275     }
276
277     public String JavaDoc getAuthor()
278     {
279         if ((descriptor != null) && ((this.author == null) || (this.author.equals(""))))
280         {
281             this.author = (String JavaDoc) this.getProperty("author");
282         }
283
284         return this.author;
285     }
286
287     public void setCreationDate_year(Integer JavaDoc creationDate_year)
288     {
289         if (descriptor != null)
290         {
291             descriptor.setProperty("creationDate_year", creationDate_year);
292         }
293
294         this.creationDate_year = creationDate_year;
295     }
296
297     public Integer JavaDoc getCreationDate_year()
298     {
299         if ((descriptor != null) && ((this.creationDate_year == null)))
300         {
301             this.creationDate_year = (Integer JavaDoc)this.getProperty("creationDate_year");
302         }
303
304         return this.creationDate_year;
305     }
306
307     public void setCreationDate_month(Integer JavaDoc creationDate_month)
308     {
309         if (descriptor != null)
310         {
311             descriptor.setProperty("creationDate_month", creationDate_month);
312         }
313
314         this.creationDate_month = creationDate_month;
315     }
316
317     public Integer JavaDoc getCreationDate_month()
318     {
319         if ((descriptor != null) && ((this.creationDate_month == null)))
320         {
321             this.creationDate_month = (Integer JavaDoc) this.getProperty("creationDate_month");
322         }
323
324         return this.creationDate_month;
325     }
326
327     public void setCreationDate_day(Integer JavaDoc creationDate_day)
328     {
329         if (descriptor != null)
330         {
331             descriptor.setProperty("creationDate_day", creationDate_day);
332         }
333
334         this.creationDate_day = creationDate_day;
335     }
336
337     public Integer JavaDoc getCreationDate_day()
338     {
339         if ((descriptor != null) && ((this.creationDate_day == null)))
340         {
341             this.creationDate_day = (Integer JavaDoc)this.getProperty("creationDate_day");
342         }
343
344         return this.creationDate_day;
345     }
346
347     public void setParentUri(String JavaDoc parentUri)
348     {
349         if (descriptor != null)
350         {
351             descriptor.setProperty("parentUri", parentUri);
352         }
353
354         this.parentUri = parentUri;
355     }
356
357     public String JavaDoc getParentUri()
358     {
359         if ((descriptor != null) && ((this.parentUri == null) || (this.parentUri.equals(""))))
360         {
361             this.parentUri = (String JavaDoc) this.getProperty("parentUri");
362         }
363
364         return this.parentUri;
365     }
366
367     public String JavaDoc getType()
368     {
369         return SlideContentItem.TYPE;
370     }
371 }
Popular Tags