1 package com.dotmarketing.portlets.files.struts; 2 3 4 import java.io.File ; 5 import java.text.ParseException ; 6 import java.text.SimpleDateFormat ; 7 8 import javax.servlet.http.HttpServletRequest ; 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 20 public class FileForm extends ValidatorForm { 21 22 23 25 private static final long serialVersionUID = 1L; 26 27 28 private long parent; 29 30 31 private String fileName; 32 33 34 private String _EXT_3_fileName; 35 36 37 private int size; 38 39 40 private String mimeType; 41 42 43 private String author; 44 45 46 private java.util.Date publishDate; 47 48 49 private String webPublishDate; 50 51 52 53 private String title; 54 55 56 private String friendlyName; 57 58 59 private boolean showOnMenu; 60 61 62 private int sortOrder; 63 64 65 66 private String selectedparent; 67 68 69 private String selectedparentPath; 70 71 72 private int maxSize; 73 74 private int maxHeight; 75 76 private int maxWidth; 77 78 private int minHeight; 79 80 81 private String [] categories; 82 83 84 85 public FileForm() { 86 } 87 88 public java.lang.String getFileName() { 89 return this.fileName; 90 } 91 92 public void setFileName(java.lang.String 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 toString() { 110 return ToStringBuilder.reflectionToString(this); 111 } 112 113 117 public int getMaxHeight() { 118 return maxHeight; 119 } 120 121 125 public int getMaxSize() { 126 return maxSize; 127 } 128 129 133 public int getMaxWidth() { 134 return maxWidth; 135 } 136 137 141 public int getMinHeight() { 142 return minHeight; 143 } 144 145 149 public void setMaxHeight(int maxHeight) { 150 this.maxHeight = maxHeight; 151 } 152 153 157 public void setMaxSize(int maxSize) { 158 this.maxSize = maxSize; 159 } 160 161 165 public void setMaxWidth(int maxWidth) { 166 this.maxWidth = maxWidth; 167 } 168 169 173 public void setMinHeight(int minHeight) { 174 this.minHeight = minHeight; 175 } 176 177 181 public long getParent() { 182 return parent; 183 } 184 185 189 public void setParent(long parent) { 190 this.parent = parent; 191 } 192 193 197 public String getMimeType() { 198 return mimeType; 199 } 200 201 205 public void setMimeType(String mimeType) { 206 this.mimeType = mimeType; 207 } 208 209 213 public String getTitle() { 214 return title; 215 } 216 217 221 public void setTitle(String title) { 222 this.title = title; 223 } 224 225 229 public boolean isShowOnMenu() { 230 return showOnMenu; 231 } 232 233 237 public void setShowOnMenu(boolean showOnMenu) { 238 this.showOnMenu = showOnMenu; 239 } 240 241 245 public int getSortOrder() { 246 return sortOrder; 247 } 248 249 253 public void setSortOrder(int sortOrder) { 254 this.sortOrder = sortOrder; 255 } 256 257 public ActionErrors validate(ActionMapping mapping, HttpServletRequest 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 268 public String getFriendlyName() { 269 return friendlyName; 270 } 271 272 276 public void setFriendlyName(String friendlyName) { 277 this.friendlyName = friendlyName; 278 } 279 280 284 public String getSelectedparent() { 285 return selectedparent; 286 } 287 288 292 public String getSelectedparentPath() { 293 return selectedparentPath; 294 } 295 296 300 public void setSelectedparent(String selectedparent) { 301 this.selectedparent = selectedparent; 302 } 303 304 308 public void setSelectedparentPath(String selectedparentPath) { 309 this.selectedparentPath = selectedparentPath; 310 } 311 312 316 public String getAuthor() { 317 return author; 318 } 319 320 324 public java.util.Date getPublishDate() { 325 return publishDate; 326 } 327 328 332 public String getWebPublishDate() { 333 return webPublishDate; 334 } 335 336 340 public void setAuthor(String author) { 341 this.author = author; 342 } 343 344 348 public void setPublishDate(java.util.Date publishDate) { 349 this.publishDate = publishDate; 350 } 351 352 356 public void setWebPublishDate(String webPublishDate) { 357 this.webPublishDate = webPublishDate; 358 try { 359 this.publishDate = new SimpleDateFormat ("MM/dd/yyyy").parse(webPublishDate); 360 } catch(ParseException ex) { 361 362 } 363 } 364 365 369 public String [] getCategories() { 370 return categories; 371 } 372 373 377 public void setCategories(String [] categories) { 378 Logger.debug(this, "\n\nFileForm setCategories=" + categories.length); 379 this.categories = categories; 380 } 381 382 385 public String get_EXT_3_fileName() { 386 return _EXT_3_fileName; 387 } 388 389 392 public void set_EXT_3_fileName(String string) { 393 _EXT_3_fileName = string; 394 } 395 396 } 397 | Popular Tags |