1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }