annotate gnv/src/main/java/de/intevation/gnv/action/LoadAction.java @ 963:0441e78cd900

Add more Javadocs gnv/trunk@1107 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 18 May 2010 11:09:33 +0000
parents 21735fb8d29b
children 33198e55371c
rev   line source
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.action;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 673
diff changeset
3 import java.io.IOException;
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.io.InputStream;
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
5 import java.util.List;
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.servlet.http.HttpServletRequest;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.servlet.http.HttpServletResponse;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.apache.commons.fileupload.FileItemIterator;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.commons.fileupload.FileItemStream;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.apache.commons.fileupload.servlet.ServletFileUpload;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.apache.struts.action.ActionForm;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.apache.struts.action.ActionForward;
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
16 import org.apache.struts.action.ActionMapping;
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
17 import org.w3c.dom.Document;
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
19 import de.intevation.gnv.action.sessionmodel.SessionModel;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
20 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
21 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
22 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
23 import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
24 import de.intevation.gnv.artifactdatabase.objects.Artifact;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
25 import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
26 import de.intevation.gnv.util.ArtifactNamespaceContext;
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
27 import de.intevation.gnv.util.XMLUtils;
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 /**
690
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
30 * This controller is called for reloading projects from xml files. It waits for
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
31 * an xml document named 'document' and feeds the artifact server with this
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
32 * document. After a successful feed, the artifact description is fetched and
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
33 * displayed in the gui.
699
af22fa5567a6 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 690
diff changeset
34 *
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
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 */
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public class LoadAction extends ArtifactDatabaseActionBase {
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
39 public static final String RESOURCE_UPLOAD_FAILURE = "upload.failure";
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
40 public static final String RESOURCE_INVALID_ARTIFACT = "invalid.artifact";
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
42 /**
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
43 * the logger, used to log exceptions and additonaly information
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
44 */
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 private static Logger logger = Logger.getLogger(LoadAction.class);
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
47 /**
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
48 * Constructor
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
49 */
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 public LoadAction() {
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 super();
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 }
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
963
0441e78cd900 Add more Javadocs
Tim Englich <tim.englich@intevation.de>
parents: 714
diff changeset
54 @Override
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 public ActionForward execute(
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 ActionMapping mapping,
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 ActionForm form,
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 HttpServletRequest request,
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 HttpServletResponse response)
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 throws Exception
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 {
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 logger.info("Import artifact.");
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 ServletFileUpload upload = new ServletFileUpload();
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 Document artifactDocument = null;
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
67 try {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
68 FileItemIterator iter = upload.getItemIterator(request);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
69 while (iter.hasNext()) {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
70 FileItemStream item = (FileItemStream) iter.next();
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
71 String name = item.getFieldName();
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
73 // the file input field of our form is named 'document'
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
74 if (name.equals("document")) {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
75 InputStream stream = item.openStream();
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
76
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
77 if (stream.available() == 0) {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
78 logger.error("No artifact document found.");
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
79 request.setAttribute(
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
80 CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
81 RESOURCE_UPLOAD_FAILURE);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
82
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
83 return super.getExceptionForward(mapping);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
84 }
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
85
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
86 artifactDocument = XMLUtils.readDocument(stream);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
87 if (artifactDocument == null) {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
88 request.setAttribute(
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
89 CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
90 RESOURCE_INVALID_ARTIFACT);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
91
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
92 return super.getExceptionForward(mapping);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
93 }
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
94
714
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
95 try {
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
96 ArtifactDatabaseClientFactory adcf =
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
97 ArtifactDatabaseClientFactory.getInstance();
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
98 ArtifactDatabaseClient adc =
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
99 adcf.getArtifactDatabaseClient(getLocale(request));
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
100 ArtifactFactory factory = (ArtifactFactory)
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
101 (( List)adc.getArtifactFactories()).get(0);
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
102
714
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
103 SessionModelFactory sf =
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
104 SessionModelFactory.getInstance();
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
105 SessionModel sm = sf.getSessionModel(request);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
106 sm.selectArtifactFactory(factory.getId());
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
107
714
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
108 Document describe = adc.doImport(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
109 factory,
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
110 artifactDocument);
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
111
714
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
112 String uuid = XMLUtils.xpathString(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
113 describe,
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
114 "/art:result/art:uuid/@value",
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
115 ArtifactNamespaceContext.INSTANCE);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
116 String hash = XMLUtils.xpathString(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
117 describe,
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
118 "/art:result/art:hash/@value",
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
119 ArtifactNamespaceContext.INSTANCE);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
120
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
121 Artifact artifact = new Artifact(uuid, hash);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
122 sm.setCurrentArtifact(artifact);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
123
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
124 if (logger.isDebugEnabled()) {
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
125 logger.debug(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
126 "Imported artifact UUID: "+artifact.getId());
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
127 logger.debug(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
128 "Imported artifact HASH: "+artifact.getHash());
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
129 }
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
130 }
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
131 catch (ArtifactDatabaseClientException adce) {
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
132 logger.error(adce, adce);
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
133 request.setAttribute(
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
134 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
135 adce.getMessage());
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
136
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
137 // XXX
21735fb8d29b Display an error message if the artifact server is down but the user tried to load an artifat (issue258).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 699
diff changeset
138 return super.getExceptionForward(mapping);
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
139 }
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
140
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
141 return new DescribeUIAction().execute(
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
142 mapping, form, request, response);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
143 }
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 }
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 }
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
146 catch (IOException ioe) {
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
147 logger.error(ioe, ioe);
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 request.setAttribute(
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
150 ioe.getMessage());
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 return super.getExceptionForward(mapping);
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 }
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
673
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
155 // no document found or not valid
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
156 logger.error("Upload failure: No document found or invalid.");
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
157
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
158 request.setAttribute(
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
159 CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
160 RESOURCE_UPLOAD_FAILURE);
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
161
93b4dedc4e37 Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 670
diff changeset
162 return super.getExceptionForward(mapping);
670
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 }
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 }
b89b31293772 Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org