KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > pages > JahiaPageDefinitionTemp


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13
// 28.01.2002 NK added page def ACL
14
//
15

16 package org.jahia.services.pages;
17
18
19 /**
20  * Can be used to handle every page definition parameters without changing/creating
21  * a real object in storage until the user really want to save it.
22  *
23  * @author Khue Nguyen
24  */

25 public class JahiaPageDefinitionTemp {
26
27     private static final String JavaDoc CLASS_NAME = JahiaPageDefinitionTemp.class.getName ();
28
29     private int mID;
30     private int mSiteID;
31     private String JavaDoc mName;
32     private String JavaDoc mSourcePath; // JSP source path
33
private boolean mAvailable; // Available or not for a user.
34
private String JavaDoc mImage;
35     private boolean mIsDefault = false;
36
37     //-------------------------------------------------------------------------
38
/**
39      * Default constructor.
40      *
41      * @param int ID Unique identification number of the page definition ( dummy ).
42      * @param int jahiaID Jahia site unique identification number
43      * @param String name Name of the page definition.
44      * @param String sourcePath Source path of the page definition
45      * @param boolean isAvailable Not available to users if false
46      * @param String image A thumbnail
47      * @param boolean isDefault true if this template is the default template
48      */

49     public JahiaPageDefinitionTemp (int ID, int siteID, String JavaDoc name,
50                                     String JavaDoc sourcePath, boolean isAvailable,
51                                     String JavaDoc image, boolean isDefault) {
52         mID = ID;
53         mSiteID = siteID;
54
55         if (name == null) {
56             name = "";
57         }
58         mName = name;
59
60         if (sourcePath == null) {
61             sourcePath = "";
62         }
63         mSourcePath = sourcePath;
64
65         mAvailable = isAvailable;
66
67         if (image == null) {
68             image = "";
69         }
70         mImage = image;
71
72         mIsDefault = isDefault;
73
74     }
75
76     //-------------------------------------------------------------------------
77
/**
78      * Build from an existing page definition
79      *
80      * @param JahiaPageDefinition template
81      * @param boolean isDefault , true if the template the site's default template.
82      */

83     public JahiaPageDefinitionTemp (JahiaPageDefinition template, boolean isDefault) {
84         if (template == null)
85             return;
86
87         mID = template.getID ();
88         mSiteID = template.getJahiaID ();
89         mName = template.getName ();
90         mSourcePath = template.getSourcePath ();
91         mAvailable = template.isAvailable ();
92         mImage = template.getImage ();
93         mIsDefault = isDefault;
94     }
95
96     //-------------------------------------------------------------------------
97
/**
98      * Return the page definition unique identification number.
99      *
100      * @return The identification number.
101      */

102     public final int getID () {
103         return mID;
104     }
105
106
107     //-------------------------------------------------------------------------
108
/**
109      * Get the image path
110      *
111      * @return String path to the image.
112      */

113     public String JavaDoc getImage () {
114         return mImage;
115     }
116
117
118     //-------------------------------------------------------------------------
119
/**
120      * Return the site unique identification number.
121      *
122      * @return The site identification number.
123      */

124     public final int getJahiaID () {
125         return mSiteID;
126     }
127
128
129     //-------------------------------------------------------------------------
130
/**
131      * Return the page definition name.
132      *
133      * @return The page definition name.
134      */

135     public final String JavaDoc getName () {
136         return mName;
137     }
138
139
140     //-------------------------------------------------------------------------
141
/**
142      * Return the JSP file associated with the page definition.
143      *
144      * @return The source path.
145      */

146     public final String JavaDoc getSourcePath () {
147         return mSourcePath;
148     }
149
150
151     //-------------------------------------------------------------------------
152
/**
153      * Get the Available status
154      *
155      * @return Return true if the page definition is available or false if
156      * it's not.
157      */

158     public final boolean isAvailable () {
159         return mAvailable;
160     }
161
162     //-------------------------------------------------------------------------
163
/**
164      * Get the Default status
165      *
166      * @return Return true if the page definition is the site's default template
167      * or false if it's not.
168      */

169     public final boolean isDefault () {
170         return mIsDefault;
171     }
172
173     //-------------------------------------------------------------------------
174
/**
175      * Set the image's path
176      *
177      * @param value The new image path.
178      */

179     public void setImage (String JavaDoc value) {
180         mImage = value;
181     }
182
183
184     //-------------------------------------------------------------------------
185
/**
186      * Set the Jahia ID.
187      *
188      * @param value The new Jahia ID.
189      */

190     public void setJahiaID (int value) {
191         mSiteID = value;
192     }
193
194
195     //-------------------------------------------------------------------------
196
/**
197      * Set the page definition name.
198      *
199      * @param value The new page definition name.
200      */

201     public void setName (String JavaDoc value) {
202         mName = value;
203     }
204
205     //-------------------------------------------------------------------------
206
/**
207      * Set the source path.
208      *
209      * @param value The new source path.
210      */

211     public void setSourcePath (String JavaDoc value) {
212         mSourcePath = value;
213     }
214
215     //-------------------------------------------------------------------------
216
/**
217      * Set the available status.
218      *
219      * @param value Set the new available status. True the Definition page
220      * will be available, false it won't.
221      */

222     public void setAvailable (boolean value) {
223         mAvailable = value;
224     }
225
226     //-------------------------------------------------------------------------
227
/**
228      * Set the default status.
229      *
230      * @param value Set the new default status. True the Definition page
231      * will be the default template of the site.
232      */

233     public void setDefault (boolean value) {
234         mIsDefault = value;
235     }
236
237 } // end JahiaPageDefinitionTemp
238
Popular Tags