Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java @ 410:9602f4bffc07
Added statistic to the actions if available.
gnv/trunk@604 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 22 Jan 2010 13:58:30 +0000 |
parents | |
children | d49e8695786c |
comparison
equal
deleted
inserted
replaced
409:df78178e1180 | 410:9602f4bffc07 |
---|---|
1 package de.intevation.gnv.action; | |
2 | |
3 import java.util.Collection; | |
4 | |
5 import javax.servlet.http.HttpServletRequest; | |
6 import javax.servlet.http.HttpServletResponse; | |
7 | |
8 import org.apache.log4j.Logger; | |
9 import org.apache.struts.action.ActionForm; | |
10 import org.apache.struts.action.ActionForward; | |
11 import org.apache.struts.action.ActionMapping; | |
12 | |
13 import de.intevation.gnv.action.sessionmodel.SessionModel; | |
14 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; | |
15 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; | |
16 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; | |
17 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; | |
18 | |
19 /** | |
20 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) | |
21 */ | |
22 public class ShowStatisticAction extends DescribeUIAction { | |
23 | |
24 private static Logger logger = Logger.getLogger(ShowStatisticAction.class); | |
25 | |
26 | |
27 public ShowStatisticAction() { | |
28 super(); | |
29 } | |
30 | |
31 | |
32 @Override | |
33 public ActionForward execute( | |
34 ActionMapping mapping, | |
35 ActionForm form, | |
36 HttpServletRequest request, | |
37 HttpServletResponse response | |
38 ) throws Exception | |
39 { | |
40 logger.info("show statistic"); | |
41 SessionModel sm = SessionModelFactory.getInstance().getSessionModel( | |
42 request); | |
43 | |
44 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance() | |
45 .getArtifactDatabaseClient(getLocale(request)); | |
46 | |
47 try{ | |
48 Collection<ArtifactStatisticsSet> statistics = | |
49 adc.calculateStatistics(sm.getSelectedArtifactFactory(), | |
50 sm.getCurrentArtifact()); | |
51 | |
52 sm.setStatistics(statistics); | |
53 | |
54 request.setAttribute("statistic", true); | |
55 } | |
56 catch (Exception e) { | |
57 logger.error(e, e); | |
58 } | |
59 | |
60 return super.execute(mapping, form, request, response); | |
61 } | |
62 } |