annotate gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java @ 684:57fa8019fbdc

Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>' gnv/trunk@858 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 29 Mar 2010 09:40:35 +0000
parents d49e8695786c
children 902d4de27c37
rev   line source
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.action.mapviewer;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
3 import de.intevation.gnv.action.ArtifactDatabaseActionBase;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
4
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
5 import de.intevation.gnv.action.mapviewer.parser.ExternalCallParser;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
6 import de.intevation.gnv.action.mapviewer.parser.XMLExternalCallParser;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
7
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
8 import de.intevation.gnv.action.sessionmodel.SessionModel;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
9 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
10
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
11 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
12
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
13 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
14
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
15 import de.intevation.gnv.artifactdatabase.objects.map.MapService;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
16
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
17 import java.io.ByteArrayInputStream;
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import java.io.InputStream;
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
19
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
20 import java.util.ArrayList;
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import java.util.Collection;
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
22 import java.util.Iterator;
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 import javax.servlet.http.HttpServletRequest;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import javax.servlet.http.HttpServletResponse;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 import org.apache.log4j.Logger;
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
28
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 import org.apache.struts.action.ActionForm;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 import org.apache.struts.action.ActionForward;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 import org.apache.struts.action.ActionMapping;
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 /**
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
34 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 public class MapViewerCallAction extends ArtifactDatabaseActionBase {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 * the logger, used to log exceptions and additonaly information
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 private static Logger log = Logger.getLogger(MapViewerCallAction.class);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 * Constructor
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 public MapViewerCallAction() {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 super();
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 /**
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 */
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 @Override
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 public ActionForward execute(ActionMapping mapping, ActionForm form,
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 HttpServletRequest request,
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 HttpServletResponse response) throws Exception {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 log.debug("MapViewerCallAction.execute");
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
58 InputStream inputStream = null;
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
59 String documentvalue = request.getParameter("document");
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
60 if (documentvalue != null){
562
4df3347d6d1d Removed trailing and leading Whitespaces from the Parametervalue which
Tim Englich <tim.englich@intevation.de>
parents: 558
diff changeset
61 documentvalue = documentvalue.trim();
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
62 inputStream = new ByteArrayInputStream(documentvalue.getBytes());
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
63 }else{
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
64 inputStream = request.getInputStream();
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
65 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
66
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 if (inputStream != null){
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 try {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 ExternalCallParser ecp = new XMLExternalCallParser(inputStream);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 ecp.parse();
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 String geometry = ecp.getGeometry();
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 String srs = ecp.getSRS();
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 Collection<MapService> mapServices = ecp.getMapServices();
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
74
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
75 Collection<ArtifactObject> availableFactories =
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
76 ArtifactDatabaseClientFactory
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 .getInstance()
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 .getArtifactDatabaseClient(getLocale(request))
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 .getArtifactFactoryMetaInformation(mapServices,
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 geometry,
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 srs);
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
82
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
83 Collection<ArtifactObject> providedFactories =
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
84 ArtifactDatabaseClientFactory
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
85 .getInstance()
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
86 .getArtifactDatabaseClient(getLocale(request))
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
87 .getArtifactFactories();
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
88
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
89 // Sort out which ArtifactFactories should not be used.
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
90 Collection<ArtifactObject> usedFactories =
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
91 new ArrayList<ArtifactObject>(availableFactories.size());
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
92
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
93 Iterator<ArtifactObject> it = availableFactories.iterator();
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
94 while (it.hasNext()){
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
95 ArtifactObject ao = it.next();
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
96 if (providedFactories.contains(ao)){
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
97 usedFactories.add(ao);
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
98 }
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
99 }
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 562
diff changeset
100
558
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
101 SessionModel sm = SessionModelFactory
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
102 .getInstance()
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
103 .getSessionModel(request);
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
104 sm.resetModel();
8032da9e8b70 Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents: 402
diff changeset
105 sm.setArtifacteFactories(usedFactories);
402
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 } catch (Exception e) {
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 log.error(e,e);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 }else{
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 log.error("Kein Anfragedokument übergeben.");
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 return super.execute(mapping, form, request, response);
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 }
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114
b88e881e8e94 Added the first Implementation (not complete and not ready to use) for the Interface from the MapViewer to the GNV
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 }

http://dive4elements.wald.intevation.org