KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > efs > openreports > actions > QueryReportResultAction


1 /*
2  * Copyright (C) 2004 Erik Swenson - erik@oreports.com
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * 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 FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * 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.actions;
21
22 import java.util.HashMap JavaDoc;
23 import java.util.List JavaDoc;
24 import java.util.Map JavaDoc;
25
26 import org.apache.log4j.Logger;
27 import org.efs.openreports.ORStatics;
28 import org.efs.openreports.objects.Report;
29 import org.efs.openreports.objects.ReportUser;
30 import org.efs.openreports.util.DisplayProperty;
31
32 import com.opensymphony.xwork.ActionContext;
33 import com.opensymphony.xwork.ActionSupport;
34
35 public class QueryReportResultAction extends ActionSupport
36 {
37     protected static Logger log = Logger.getLogger(QueryReportResultAction.class);
38
39     private List JavaDoc results;
40     private DisplayProperty[] properties;
41
42     private Report report;
43     private Map JavaDoc reportParameters;
44
45     public String JavaDoc execute()
46     {
47         ReportUser user = (ReportUser) ActionContext.getContext().getSession().get(
48                 ORStatics.REPORT_USER);
49
50         report = (Report) ActionContext.getContext().getSession().get(ORStatics.REPORT);
51         reportParameters = getReportParameterMap(user);
52         
53         results = (List JavaDoc) ActionContext.getContext().getSession().get(ORStatics.QUERY_REPORT_RESULTS);
54         properties = (DisplayProperty[]) ActionContext.getContext().getSession().get(ORStatics.QUERY_REPORT_PROPERTIES);
55
56         return SUCCESS;
57     }
58
59     protected Map JavaDoc getReportParameterMap(ReportUser user)
60     {
61         Map JavaDoc reportParameters = new HashMap JavaDoc();
62
63         if (ActionContext.getContext().getSession().get(ORStatics.REPORT_PARAMETERS) != null)
64         {
65             reportParameters = (Map JavaDoc) ActionContext.getContext().getSession().get(
66                     ORStatics.REPORT_PARAMETERS);
67         }
68
69         // add standard report parameters
70
reportParameters.put(ORStatics.USER_ID, user.getId());
71         reportParameters.put(ORStatics.EXTERNAL_ID, user.getExternalId());
72         reportParameters.put(ORStatics.USER_NAME, user.getName());
73
74         return reportParameters;
75     }
76
77     public List JavaDoc getResults()
78     {
79         return results;
80     }
81
82     public DisplayProperty[] getProperties()
83     {
84         return properties;
85     }
86
87     public Report getReport()
88     {
89         return report;
90     }
91
92     public Map JavaDoc getReportParameters()
93     {
94         return reportParameters;
95     }
96 }
Popular Tags