Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/obinary/cms/beans/MultipartForm.java


1   /**
2    *
3    * Magnolia and its source-code is licensed under the LGPL.
4    * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5    * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6    * you are required to provide proper attribution to obinary.
7    * If you reproduce or distribute the document without making any substantive modifications to its content,
8    * please use the following attribution line:
9    *
10   * Copyright 1993-2003 obinary Ltd. (http://www.obinary.com) All rights reserved.
11   *
12   * */
13  
14  
15  
16  
17  
18  package com.obinary.cms.beans;
19  
20  
21  import java.util.Hashtable;
22  import java.io.File;
23  
24  
25  /**
26   * User: sameercharles
27   * Date: Apr 28, 2003
28   * Time: 11:20:59 AM
29   * @author Sameer Charles
30   * @version 1.0
31   */
32  
33  
34  public class MultipartForm {
35  
36  
37      private Hashtable parameters;
38      private Hashtable documents;
39  
40  
41  
42  
43      public MultipartForm() {
44          this.parameters = new Hashtable();
45          this.documents = new Hashtable();
46      }
47  
48  
49  
50      public void addParameter(String name, Object value) {
51          this.parameters.put(name,value);
52      }
53  
54  
55  
56      public void removeParameter(String name) {
57          this.parameters.remove(name);
58      }
59  
60  
61  
62      public Hashtable getParameters() {
63          return this.parameters;
64      }
65  
66  
67  
68      public String getParameter(String name) {
69          try {
70              return (String)this.parameters.get(name);
71          } catch (Exception e) {return "";}
72      }
73  
74  
75  
76      public void addDocument(String atomName,String fileName,String type,File file) {
77          if ((fileName == null) || (fileName.equals("")))
78              return;
79          Document document = new Document();
80          document.setAtomName(atomName);
81          document.setFileName(fileName);
82          document.setType(type);
83          document.setFile(file);
84          document.setExtention(fileName.substring(fileName.indexOf(".")+1));
85          this.documents.put(atomName,document);
86      }
87  
88  
89  
90      public Document getDocument(String name) {
91          return (Document)this.documents.get(name);
92      }
93  
94  
95  
96  }