annotate gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java @ 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. gnv/trunk@599 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 22 Jan 2010 11:28:25 +0000
parents 23a4f196d7d6
children 27f25b9ae9af
rev   line source
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
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 */
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.action;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
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
6 import de.intevation.gnv.action.sessionmodel.SessionModel;
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
7 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
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
8
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
9 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
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
10
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
11 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
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
12
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.util.Collection;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import javax.servlet.http.HttpServletRequest;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import javax.servlet.http.HttpServletResponse;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import org.apache.log4j.Logger;
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
19
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.apache.struts.action.ActionForm;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import org.apache.struts.action.ActionForward;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import org.apache.struts.action.ActionMapping;
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 * @author Tim Englich <tim.englich@intevation.de>
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
26 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
27 *
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 */
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
29 public class FetchArtifactFactoriesAction extends ArtifactDatabaseActionBase {
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * the logger, used to log exceptions and additonaly information
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 */
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
33 private static Logger log = Logger
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
34 .getLogger(FetchArtifactFactoriesAction.class);
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 public FetchArtifactFactoriesAction() {
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 super();
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 }
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 /**
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
41 * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
42 * org.apache.struts.action.ActionForm,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
43 * javax.servlet.http.HttpServletRequest,
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
44 * javax.servlet.http.HttpServletResponse)
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 */
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 @Override
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 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
48 HttpServletRequest request,
fccf90761825 Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents: 36
diff changeset
49 HttpServletResponse response) throws Exception {
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 log.debug("ArtifactDatabaseActionBase.execute");
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 8
diff changeset
51 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
52 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
53 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
54 .getArtifactDatabaseClient(getLocale(request))
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
55 .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
56
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 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
58 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
59
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 8
diff changeset
60 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
61
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 8
diff changeset
62 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
63 }
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
64 catch (Exception e) {
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
65 log.error(e, e);
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
66 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
67 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
68 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
69
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 8
diff changeset
70 return super.getExceptionForward(mapping);
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 8
diff changeset
71 }
8
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 }
65ff6fcfee0c Some Basic Stuff for WebProjects
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 }
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
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org