KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > files > struts > FileForm


1 package com.dotmarketing.portlets.files.struts;
2
3
4 import java.io.File JavaDoc;
5 import java.text.ParseException JavaDoc;
6 import java.text.SimpleDateFormat JavaDoc;
7
8 import javax.servlet.http.HttpServletRequest JavaDoc;
9
10 import org.apache.commons.lang.builder.ToStringBuilder;
11 import org.apache.struts.action.ActionErrors;
12 import org.apache.struts.action.ActionMapping;
13 import org.apache.struts.validator.ValidatorForm;
14
15 import com.dotmarketing.util.Logger;
16 import com.dotmarketing.util.UtilMethods;
17 import com.liferay.portal.util.Constants;
18
19 /** @author Hibernate CodeGenerator */
20 public class FileForm extends ValidatorForm {
21
22     /** identifier field */
23     //private long inode;
24

25     private static final long serialVersionUID = 1L;
26
27     /** identifier field */
28     private long parent;
29
30     /** nullable persistent field */
31     private String JavaDoc fileName;
32
33     /** nullable persistent field */
34     private String JavaDoc _EXT_3_fileName;
35
36     /** nullable persistent field */
37     private int size;
38
39     /** nullable persistent field */
40     private String JavaDoc mimeType;
41
42     /** nullable persistent field */
43     private String JavaDoc author;
44
45     /** nullable persistent field */
46     private java.util.Date JavaDoc publishDate;
47
48     /** nullable persistent field */
49     private String JavaDoc webPublishDate;
50
51     /*** WEB ASSET FIELDS FOR THE FORM ***/
52     /** nullable persistent field */
53     private String JavaDoc title;
54
55     /** nullable persistent field */
56     private String JavaDoc friendlyName;
57
58     /** nullable persistent field */
59     private boolean showOnMenu;
60
61     /** nullable persistent field */
62     private int sortOrder;
63     /*** WEB ASSET FIELDS FOR THE FORM ***/
64
65     /** nullable persistent field */
66     private String JavaDoc selectedparent;
67
68     /** nullable persistent field */
69     private String JavaDoc selectedparentPath;
70
71     /** nullable persistent field */
72     private int maxSize;
73     /** nullable persistent field */
74     private int maxHeight;
75     /** nullable persistent field */
76     private int maxWidth;
77     /** nullable persistent field */
78     private int minHeight;
79     
80     /** nullable persistent field */
81     private String JavaDoc[] categories;
82
83     
84     /** default constructor */
85     public FileForm() {
86     }
87
88     public java.lang.String JavaDoc getFileName() {
89         return this.fileName;
90     }
91
92     public void setFileName(java.lang.String JavaDoc fileName) {
93         if (UtilMethods.isSet(fileName)) {
94             if (fileName.contains("/"))
95                 fileName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
96             if (fileName.contains("\\"))
97                 fileName = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
98             fileName = fileName.replaceAll("'","");
99         }
100         this.fileName = fileName;
101     }
102     public int getSize() {
103         return this.size;
104     }
105
106     public void setSize(int size) {
107         this.size = size;
108     }
109     public String JavaDoc toString() {
110         return ToStringBuilder.reflectionToString(this);
111     }
112
113     /**
114      * Returns the maxHeight.
115      * @return int
116      */

117     public int getMaxHeight() {
118         return maxHeight;
119     }
120
121     /**
122      * Returns the maxSize.
123      * @return int
124      */

125     public int getMaxSize() {
126         return maxSize;
127     }
128
129     /**
130      * Returns the maxWidth.
131      * @return int
132      */

133     public int getMaxWidth() {
134         return maxWidth;
135     }
136
137     /**
138      * Returns the minHeight.
139      * @return int
140      */

141     public int getMinHeight() {
142         return minHeight;
143     }
144
145     /**
146      * Sets the maxHeight.
147      * @param maxHeight The maxHeight to set
148      */

149     public void setMaxHeight(int maxHeight) {
150         this.maxHeight = maxHeight;
151     }
152
153     /**
154      * Sets the maxSize.
155      * @param maxSize The maxSize to set
156      */

157     public void setMaxSize(int maxSize) {
158         this.maxSize = maxSize;
159     }
160
161     /**
162      * Sets the maxWidth.
163      * @param maxWidth The maxWidth to set
164      */

165     public void setMaxWidth(int maxWidth) {
166         this.maxWidth = maxWidth;
167     }
168
169     /**
170      * Sets the minHeight.
171      * @param minHeight The minHeight to set
172      */

173     public void setMinHeight(int minHeight) {
174         this.minHeight = minHeight;
175     }
176
177     /**
178      * Returns the parent.
179      * @return long
180      */

181     public long getParent() {
182         return parent;
183     }
184
185     /**
186      * Sets the parent.
187      * @param parent The parent to set
188      */

189     public void setParent(long parent) {
190         this.parent = parent;
191     }
192
193     /**
194      * Returns the mimeType.
195      * @return String
196      */

197     public String JavaDoc getMimeType() {
198         return mimeType;
199     }
200
201     /**
202      * Sets the mimeType.
203      * @param mimeType The mimeType to set
204      */

205     public void setMimeType(String JavaDoc mimeType) {
206         this.mimeType = mimeType;
207     }
208
209     /**
210      * Returns the title.
211      * @return String
212      */

213     public String JavaDoc getTitle() {
214         return title;
215     }
216
217     /**
218      * Sets the title.
219      * @param title The title to set
220      */

221     public void setTitle(String JavaDoc title) {
222         this.title = title;
223     }
224
225     /**
226      * Returns the showOnMenu.
227      * @return boolean
228      */

229     public boolean isShowOnMenu() {
230         return showOnMenu;
231     }
232
233     /**
234      * Sets the showOnMenu.
235      * @param showOnMenu The showOnMenu to set
236      */

237     public void setShowOnMenu(boolean showOnMenu) {
238         this.showOnMenu = showOnMenu;
239     }
240
241     /**
242      * Returns the sortOrder.
243      * @return int
244      */

245     public int getSortOrder() {
246         return sortOrder;
247     }
248
249     /**
250      * Sets the sortOrder.
251      * @param sortOrder The sortOrder to set
252      */

253     public void setSortOrder(int sortOrder) {
254         this.sortOrder = sortOrder;
255     }
256
257     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
258         if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.ADD)) {
259             return super.validate(mapping, request);
260         }
261         return null;
262     }
263
264     /**
265      * Returns the friendlyName.
266      * @return String
267      */

268     public String JavaDoc getFriendlyName() {
269         return friendlyName;
270     }
271
272     /**
273      * Sets the friendlyName.
274      * @param friendlyName The friendlyName to set
275      */

276     public void setFriendlyName(String JavaDoc friendlyName) {
277         this.friendlyName = friendlyName;
278     }
279
280     /**
281      * Returns the selectedparent.
282      * @return String
283      */

284     public String JavaDoc getSelectedparent() {
285         return selectedparent;
286     }
287
288     /**
289      * Returns the selectedparentPath.
290      * @return String
291      */

292     public String JavaDoc getSelectedparentPath() {
293         return selectedparentPath;
294     }
295
296     /**
297      * Sets the selectedparent.
298      * @param selectedparent The selectedparent to set
299      */

300     public void setSelectedparent(String JavaDoc selectedparent) {
301         this.selectedparent = selectedparent;
302     }
303
304     /**
305      * Sets the selectedparentPath.
306      * @param selectedparentPath The selectedparentPath to set
307      */

308     public void setSelectedparentPath(String JavaDoc selectedparentPath) {
309         this.selectedparentPath = selectedparentPath;
310     }
311
312     /**
313      * Returns the author.
314      * @return String
315      */

316     public String JavaDoc getAuthor() {
317         return author;
318     }
319
320     /**
321      * Returns the publishDate.
322      * @return java.util.Date
323      */

324     public java.util.Date JavaDoc getPublishDate() {
325         return publishDate;
326     }
327
328     /**
329      * Returns the webPublishDate.
330      * @return String
331      */

332     public String JavaDoc getWebPublishDate() {
333         return webPublishDate;
334     }
335
336     /**
337      * Sets the author.
338      * @param author The author to set
339      */

340     public void setAuthor(String JavaDoc author) {
341         this.author = author;
342     }
343
344     /**
345      * Sets the publishDate.
346      * @param publishDate The publishDate to set
347      */

348     public void setPublishDate(java.util.Date JavaDoc publishDate) {
349         this.publishDate = publishDate;
350     }
351
352     /**
353      * Sets the webPublishDate.
354      * @param webPublishDate The webPublishDate to set
355      */

356     public void setWebPublishDate(String JavaDoc webPublishDate) {
357         this.webPublishDate = webPublishDate;
358         try {
359             this.publishDate = new SimpleDateFormat JavaDoc("MM/dd/yyyy").parse(webPublishDate);
360         } catch(ParseException JavaDoc ex) {
361
362         }
363     }
364
365     /**
366      * Returns the categories.
367      * @return String[]
368      */

369     public String JavaDoc[] getCategories() {
370         return categories;
371     }
372
373     /**
374      * Sets the categories.
375      * @param categories The categories to set
376      */

377     public void setCategories(String JavaDoc[] categories) {
378         Logger.debug(this, "\n\nFileForm setCategories=" + categories.length);
379         this.categories = categories;
380     }
381
382     /**
383      * @return
384      */

385     public String JavaDoc get_EXT_3_fileName() {
386         return _EXT_3_fileName;
387     }
388
389     /**
390      * @param string
391      */

392     public void set_EXT_3_fileName(String JavaDoc string) {
393         _EXT_3_fileName = string;
394     }
395
396 }
397
Popular Tags