001: /*
002: * Copyright (C) 2006 Erik Swenson - erik@oreports.com
003: *
004: * This program is free software; you can redistribute it and/or modify it
005: * under the terms of the GNU General Public License as published by the Free
006: * Software Foundation; either version 2 of the License, or (at your option)
007: * any later version.
008: *
009: * This program is distributed in the hope that it will be useful, but WITHOUT
010: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
012: * more details.
013: *
014: * You should have received a copy of the GNU General Public License along with
015: * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
016: * Place - Suite 330, Boston, MA 02111-1307, USA.
017: *
018: */
019:
020: package org.efs.openreports.engine.output;
021:
022: import java.io.Serializable;
023:
024: /**
025: * This object contains the report content generated by the ReportEngine as a
026: * btye[] along with additional information decribing the content
027: *
028: * @author Erik Swenson
029: */
030:
031: public class ReportEngineOutput implements Serializable {
032: private static final long serialVersionUID = -1891016289500829002L;
033:
034: public static final String CONTENT_TYPE_PDF = "application/pdf";
035: public static final String CONTENT_TYPE_XLS = "application/vnd.ms-excel";
036: public static final String CONTENT_TYPE_HTML = "text/html";
037: public static final String CONTENT_TYPE_CSV = "text/comma-separated-values";
038: public static final String CONTENT_TYPE_RTF = "application/rtf";
039: public static final String CONTENT_TYPE_TEXT = "text/plain";
040: public static final String CONTENT_TYPE_XML = "application/xml";
041: public static final String CONTENT_TYPE_JPEG = "image/jpeg";
042: public static final String CONTENT_TYPE_PNG = "image/png";
043:
044: private String contentType;
045: private String contentMessage;
046: private byte[] content;
047:
048: public byte[] getContent() {
049: return content;
050: }
051:
052: public void setContent(byte[] content) {
053: this .content = content;
054: }
055:
056: public String getContentType() {
057: return contentType;
058: }
059:
060: public void setContentType(String contentType) {
061: this .contentType = contentType;
062: }
063:
064: public String getContentMessage() {
065: return contentMessage;
066: }
067:
068: public void setContentMessage(String contentMessage) {
069: this .contentMessage = contentMessage;
070: }
071:
072: public String getContentExtension() {
073: if (contentType == null)
074: return "";
075:
076: if (contentType.equals(CONTENT_TYPE_PDF)) {
077: return ".pdf";
078: } else if (contentType.equals(CONTENT_TYPE_XLS)) {
079: return ".xls";
080: } else if (contentType.equals(CONTENT_TYPE_HTML)) {
081: return ".html";
082: } else if (contentType.equals(CONTENT_TYPE_CSV)) {
083: return ".csv";
084: } else if (contentType.equals(CONTENT_TYPE_RTF)) {
085: return ".rtf";
086: } else if (contentType.equals(CONTENT_TYPE_TEXT)) {
087: return ".txt";
088: } else if (contentType.equals(CONTENT_TYPE_XML)) {
089: return ".xml";
090: } else if (contentType.equals(CONTENT_TYPE_JPEG)) {
091: return ".jpg";
092: } else if (contentType.equals(CONTENT_TYPE_PNG)) {
093: return ".png";
094: }
095:
096: return "";
097: }
098:
099: public void setContentExtension(String contentExtension) {
100: // empty setter
101: }
102: }
|