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

Quick Search    Search Deep

Source code: com/obinary/cms/beans/File.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 com.obinary.cms.core.Atom;
22  import com.obinary.cms.core.Content;
23  
24  import javax.jcr.RepositoryException;
25  import java.io.InputStream;
26  
27  
28  /**
29   * User: sameercharles
30   * Date: Apr 28, 2003
31   * Time: 11:20:59 AM
32   * @author Sameer Charles
33   * @version 1.0
34   */
35  
36  
37  public class File {
38  
39  
40      private Atom atom;
41      private Content properties;
42      private String extension;
43      private String fileName;
44      private String contentType;
45      private String atomTemplate;
46      private int size;
47  
48  
49  
50      public Content getProperties() {
51          return properties;
52      }
53  
54      public void setProperties(Content properties) {
55          this.properties = properties;
56          this.setAtomTemplate(this.properties.getAtom("atomTemplate").getString());
57          this.setExtension(this.properties.getAtom("extension").getString());
58          this.setFileName(this.properties.getAtom("fileName").getString());
59          this.setContentType(this.properties.getAtom("contentType").getString());
60          Integer size = new Integer(this.properties.getAtom("size").getString());
61          this.setSize(size.intValue());
62      }
63  
64      public String getExtension() {
65          return extension;
66      }
67  
68      public void setExtension(String extension) {
69          this.extension = extension;
70      }
71  
72      public String getFileName() {
73          return fileName;
74      }
75  
76      public void setFileName(String fileName) {
77          this.fileName = fileName;
78      }
79  
80      public String getContentType() {
81          return contentType;
82      }
83  
84      public void setContentType(String contentType) {
85          this.contentType = contentType;
86      }
87  
88      public String getAtomTemplate() {
89          return atomTemplate;
90      }
91  
92      public void setAtomTemplate(String atomTemplate) {
93          this.atomTemplate = atomTemplate;
94      }
95  
96      public int getSize() {
97          return size;
98      }
99  
100     public void setSize(int size) {
101         this.size = size;
102     }
103 
104 
105     public Atom getAtom() {
106         return this.atom;
107     }
108 
109     public void setAtom(Atom atom) {
110         this.atom = atom;
111     }
112 
113 
114     public InputStream getStream() {
115         try {
116             return this.atom.getValue().getStream();
117         } catch (RepositoryException re) {return null;}
118     }
119 
120 
121 
122 }