KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > efs > openreports > engine > output > ReportEngineOutput


1 /*
2  * Copyright (C) 2006 Erik Swenson - erik@oreports.com
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */

19
20 package org.efs.openreports.engine.output;
21
22 import java.io.Serializable JavaDoc;
23
24 /**
25  * This object contains the report content generated by the ReportEngine as a
26  * btye[] along with additional information decribing the content
27  *
28  * @author Erik Swenson
29  */

30
31 public class ReportEngineOutput implements Serializable JavaDoc
32 {
33     private static final long serialVersionUID = -1891016289500829002L;
34     
35     public static final String JavaDoc CONTENT_TYPE_PDF = "application/pdf";
36     public static final String JavaDoc CONTENT_TYPE_XLS = "application/vnd.ms-excel";
37     public static final String JavaDoc CONTENT_TYPE_HTML = "text/html";
38     public static final String JavaDoc CONTENT_TYPE_CSV = "text/comma-separated-values";
39     public static final String JavaDoc CONTENT_TYPE_RTF = "application/rtf";
40     public static final String JavaDoc CONTENT_TYPE_TEXT = "text/plain";
41     public static final String JavaDoc CONTENT_TYPE_XML = "application/xml";
42     public static final String JavaDoc CONTENT_TYPE_JPEG = "image/jpeg";
43     public static final String JavaDoc CONTENT_TYPE_PNG = "image/png";
44     
45     private String JavaDoc contentType;
46     private String JavaDoc contentMessage;
47     private byte[] content;
48     
49     public byte[] getContent()
50     {
51         return content;
52     }
53
54     public void setContent(byte[] content)
55     {
56         this.content = content;
57     }
58
59     public String JavaDoc getContentType()
60     {
61         return contentType;
62     }
63
64     public void setContentType(String JavaDoc contentType)
65     {
66         this.contentType = contentType;
67     }
68     
69     public String JavaDoc getContentMessage()
70     {
71         return contentMessage;
72     }
73
74     public void setContentMessage(String JavaDoc contentMessage)
75     {
76         this.contentMessage = contentMessage;
77     }
78
79     public String JavaDoc getContentExtension()
80     {
81         if (contentType == null) return "";
82         
83         if (contentType.equals(CONTENT_TYPE_PDF))
84         {
85             return ".pdf";
86         }
87         else if (contentType.equals(CONTENT_TYPE_XLS))
88         {
89             return ".xls";
90         }
91         else if (contentType.equals(CONTENT_TYPE_HTML))
92         {
93             return ".html";
94         }
95         else if (contentType.equals(CONTENT_TYPE_CSV))
96         {
97             return ".csv";
98         }
99         else if (contentType.equals(CONTENT_TYPE_RTF))
100         {
101             return ".rtf";
102         }
103         else if (contentType.equals(CONTENT_TYPE_TEXT))
104         {
105             return ".txt";
106         }
107         else if (contentType.equals(CONTENT_TYPE_XML))
108         {
109             return ".xml";
110         }
111         else if (contentType.equals(CONTENT_TYPE_JPEG))
112         {
113             return ".jpg";
114         }
115         else if (contentType.equals(CONTENT_TYPE_PNG))
116         {
117             return ".png";
118         }
119         
120         return "";
121     }
122     
123     public void setContentExtension(String JavaDoc contentExtension)
124     {
125         // empty setter
126
}
127 }
128
Popular Tags