Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java @ 967:c7f8a9b4b006
Improved parsing i18n values of chart/histogram options (issue289).
gnv/trunk@1129 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 26 May 2010 17:03:29 +0000 |
parents | 0441e78cd900 |
children | 28a0628b11b0 |
rev | line source |
---|---|
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.action; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 import java.util.Collection; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 import javax.servlet.http.HttpServletRequest; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import javax.servlet.http.HttpServletResponse; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import org.apache.struts.action.ActionForm; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 import org.apache.struts.action.ActionForward; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 import org.apache.struts.action.ActionMapping; |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 |
963 | 13 import de.intevation.gnv.action.sessionmodel.SessionModel; |
14 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; | |
15 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; | |
16 import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException; | |
17 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; | |
18 | |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 /** |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
20 * This controller fetches artifact factories from artifact server and stores |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
21 * them on a <code>SessionModel</code> object. |
699
af22fa5567a6
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
690
diff
changeset
|
22 * |
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
|
23 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
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
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 */ |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
26 public class FetchArtifactFactoriesAction extends ArtifactDatabaseActionBase { |
963 | 27 |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 /** |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 * the logger, used to log exceptions and additonaly information |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 */ |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
31 private static Logger log = Logger |
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
32 .getLogger(FetchArtifactFactoriesAction.class); |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 |
963 | 34 /** |
35 * Constructor | |
36 */ | |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 public FetchArtifactFactoriesAction() { |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 super(); |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 } |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
41 |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 @Override |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 public ActionForward execute(ActionMapping mapping, ActionForm form, |
38
fccf90761825
Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
44 HttpServletRequest request, |
fccf90761825
Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
45 HttpServletResponse response) throws Exception { |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 log.debug("ArtifactDatabaseActionBase.execute"); |
34
25fdec8b4c69
Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents:
8
diff
changeset
|
47 try { |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
48 Collection<ArtifactObject> artifactFactories = |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
49 ArtifactDatabaseClientFactory.getInstance() |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
50 .getArtifactDatabaseClient(getLocale(request)) |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
51 .getArtifactFactories(); |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
52 |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
53 SessionModel sm = SessionModelFactory.getInstance().getSessionModel( |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
54 request); |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
55 |
34
25fdec8b4c69
Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents:
8
diff
changeset
|
56 sm.setArtifacteFactories(artifactFactories); |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
57 |
34
25fdec8b4c69
Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents:
8
diff
changeset
|
58 return super.execute(mapping, form, request, response); |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
59 } |
665
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
60 catch (ArtifactDatabaseClientException e) { |
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
61 log.error(e, e); |
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
62 request.setAttribute( |
715
0aeac0fe5db2
Fixed broken error messages that are displayed if the artifact server is down (issue236, issue242).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
699
diff
changeset
|
63 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, |
665
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
64 e.getMessage()); |
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
65 |
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
66 return super.getExceptionForward(mapping); |
27f25b9ae9af
Improved exception handling. Display error messages after invalid user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
409
diff
changeset
|
67 } |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
68 catch (Exception e) { |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
69 log.error(e, e); |
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
34
diff
changeset
|
70 request.setAttribute( |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
71 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
72 e.getMessage()); |
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
73 |
34
25fdec8b4c69
Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents:
8
diff
changeset
|
74 return super.getExceptionForward(mapping); |
25fdec8b4c69
Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents:
8
diff
changeset
|
75 } |
8
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 } |
65ff6fcfee0c
Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 } |
409
df78178e1180
Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
40
diff
changeset
|
78 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |