| ServletContextReportDesignRetriever.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.kernel.bi.reporting.servlet;
16
17 import com.liferay.portal.kernel.bi.reporting.ReportDesignRetriever;
18
19 import java.io.InputStream;
20
21 import java.util.Date;
22
23 import javax.servlet.ServletContext;
24
25 /**
26 * <a href="ServletContextReportDesignRetriever.java.html"><b><i>View Source</i>
27 * </b></a>
28 *
29 * @author Michael C. Han
30 */
31 public class ServletContextReportDesignRetriever
32 implements ReportDesignRetriever {
33
34 public ServletContextReportDesignRetriever(
35 ServletContext servletContext, String reportName, String prefix,
36 String postfix) {
37
38 _servletContext = servletContext;
39 _reportName = reportName;
40 _prefix = prefix;
41 _postfix = postfix;
42 }
43
44 public InputStream getInputStream() {
45 return _servletContext.getResourceAsStream(
46 _prefix + _reportName + _postfix);
47 }
48
49 public Date getModifiedDate() {
50 return new Date();
51 }
52
53 public String getReportName() {
54 return _reportName;
55 }
56
57 private String _postfix;
58 private String _prefix;
59 private String _reportName;
60 private ServletContext _servletContext;
61
62 }