01: /*
02: * Copyright (C) 2007 Erik Swenson - erik@oreports.com
03: *
04: * This program is free software; you can redistribute it and/or modify it
05: * under the terms of the GNU General Public License as published by the Free
06: * Software Foundation; either version 2 of the License, or (at your option)
07: * any later version.
08: *
09: * 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: package org.efs.openreports.actions;
20:
21: import com.opensymphony.xwork2.ActionContext;
22: import com.opensymphony.xwork2.ActionSupport;
23:
24: import java.util.Map;
25: import org.apache.log4j.Logger;
26: import org.efs.openreports.ORStatics;
27: import org.efs.openreports.objects.ORProperty;
28: import org.efs.openreports.objects.Report;
29: import org.efs.openreports.providers.PropertiesProvider;
30: import org.efs.openreports.util.LocalStrings;
31: import org.efs.openreports.util.ORUtil;
32:
33: public class JPivotAction extends ActionSupport {
34: protected static Logger log = Logger.getLogger(JPivotAction.class);
35:
36: private static final long serialVersionUID = 167823208513025513L;
37:
38: private Report report;
39: private String query;
40:
41: private String xmlaUri;
42: private String xmlaDataSource;
43: private String xmlaCatalog;
44:
45: private PropertiesProvider propertiesProvider;
46:
47: public String execute() throws Exception {
48: Map reportParameters = (Map) ActionContext.getContext()
49: .getSession().get(ORStatics.REPORT_PARAMETERS);
50:
51: report = (Report) ActionContext.getContext().getSession().get(
52: ORStatics.REPORT);
53: query = ORUtil.parseStringWithParameters(report.getQuery(),
54: reportParameters);
55:
56: try {
57: xmlaUri = propertiesProvider.getProperty(
58: ORProperty.XMLA_URL).getValue();
59: xmlaDataSource = propertiesProvider.getProperty(
60: ORProperty.XMLA_DATASOURCE).getValue();
61: xmlaCatalog = propertiesProvider.getProperty(
62: ORProperty.XMLA_CATALOG).getValue();
63: } catch (Exception e) {
64: log.error(e);
65: addActionError(getText(LocalStrings.ERROR_XMLA_PROPERTIES_INVALID));
66: return ERROR;
67: }
68:
69: return SUCCESS;
70: }
71:
72: public String getQuery() {
73: return query;
74: }
75:
76: public Report getReport() {
77: return report;
78: }
79:
80: public String getXmlaCatalog() {
81: return xmlaCatalog;
82: }
83:
84: public String getXmlaDataSource() {
85: return xmlaDataSource;
86: }
87:
88: public String getXmlaUri() {
89: return xmlaUri;
90: }
91:
92: public void setPropertiesProvider(
93: PropertiesProvider propertiesProvider) {
94: this.propertiesProvider = propertiesProvider;
95: }
96: }
|