Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java @ 1022:28a0628b11b0
Added license file and license header.
gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Nov 2010 17:15:08 +0000 |
parents | 33198e55371c |
children |
rev | line source |
---|---|
1022
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
1 /* |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
3 * |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
7 */ |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
991
diff
changeset
|
8 |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.action; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.util.Collection; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import javax.servlet.http.HttpServletRequest; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import javax.servlet.http.HttpServletResponse; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.apache.struts.action.ActionForm; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.apache.struts.action.ActionForward; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import org.apache.struts.action.ActionMapping; |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
963 | 21 import de.intevation.gnv.action.sessionmodel.SessionModel; |
22 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; | |
23 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; | |
24 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; | |
25 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; | |
26 | |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 /** |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
28 * This controller is used to display to statistic of the current |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
29 * parameterization. |
699
af22fa5567a6
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
690
diff
changeset
|
30 * |
684
57fa8019fbdc
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
683
diff
changeset
|
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public class ShowStatisticAction extends DescribeUIAction { |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
963 | 35 /** |
36 * the logger, used to log exceptions and additonaly information | |
37 */ | |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 private static Logger logger = Logger.getLogger(ShowStatisticAction.class); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
963 | 41 /** |
42 * Constructor | |
43 */ | |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public ShowStatisticAction() { |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 super(); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 @Override |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 public ActionForward execute( |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 ActionMapping mapping, |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 ActionForm form, |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 HttpServletRequest request, |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 HttpServletResponse response |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 ) throws Exception |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 { |
991
33198e55371c
Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
963
diff
changeset
|
57 if (isSessionExhausted(request)) { |
33198e55371c
Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
963
diff
changeset
|
58 return sessionExhaustedForward(mapping, form, request, response); |
33198e55371c
Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
963
diff
changeset
|
59 } |
33198e55371c
Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
963
diff
changeset
|
60 |
410
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 logger.info("show statistic"); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 SessionModel sm = SessionModelFactory.getInstance().getSessionModel( |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 request); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance() |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 .getArtifactDatabaseClient(getLocale(request)); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 try{ |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 Collection<ArtifactStatisticsSet> statistics = |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 adc.calculateStatistics(sm.getSelectedArtifactFactory(), |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 sm.getCurrentArtifact()); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 sm.setStatistics(statistics); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 request.setAttribute("statistic", true); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 } |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 catch (Exception e) { |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 logger.error(e, e); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 return super.execute(mapping, form, request, response); |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
9602f4bffc07
Added statistic to the actions if available.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 } |
700
89ade245ca7a
Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
699
diff
changeset
|
84 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |