Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/action/LoadAction.java @ 706:2659a5b1fa1e
Added a link (and a controller) to toggle between german and english language (issue254).
gnv/trunk@970 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 23 Apr 2010 07:55:05 +0000 |
parents | af22fa5567a6 |
children | 21735fb8d29b |
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 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
3 import de.intevation.gnv.action.sessionmodel.SessionModel; |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
4 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
5 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
6 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
7 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
8 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
9 import de.intevation.gnv.artifactdatabase.objects.Artifact; |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
10 import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory; |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
11 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
12 import de.intevation.gnv.util.ArtifactNamespaceContext; |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.gnv.util.XMLUtils; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
15 import java.io.IOException; |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.io.InputStream; |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
17 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
18 import java.util.List; |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import javax.servlet.http.HttpServletRequest; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import javax.servlet.http.HttpServletResponse; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import org.apache.commons.fileupload.FileItemIterator; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import org.apache.commons.fileupload.FileItemStream; |
683
d49e8695786c
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
673
diff
changeset
|
25 |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import org.apache.commons.fileupload.servlet.ServletFileUpload; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import org.apache.log4j.Logger; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import org.apache.struts.action.ActionForm; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 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
|
32 import org.apache.struts.action.ActionMapping; |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 import org.w3c.dom.Document; |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 /** |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
37 * 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
|
38 * 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
|
39 * document. After a successful feed, the artifact description is fetched and |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
40 * displayed in the gui. |
699
af22fa5567a6
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
690
diff
changeset
|
41 * |
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
|
42 * @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
|
43 */ |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public class LoadAction extends ArtifactDatabaseActionBase { |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
46 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
|
47 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
|
48 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 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
|
50 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public LoadAction() { |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 super(); |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 } |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
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 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
95 ArtifactDatabaseClientFactory adcf = |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
96 ArtifactDatabaseClientFactory.getInstance(); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
97 ArtifactDatabaseClient adc = |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
98 adcf.getArtifactDatabaseClient(getLocale(request)); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
99 ArtifactFactory factory = (ArtifactFactory) |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
100 (( List)adc.getArtifactFactories()).get(0); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
101 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
102 SessionModelFactory sf = SessionModelFactory.getInstance(); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
103 SessionModel sm = sf.getSessionModel(request); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
104 sm.selectArtifactFactory(factory.getId()); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
105 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
106 Document describe = adc.doImport( |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
107 factory, |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
108 artifactDocument); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
109 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
110 String uuid = XMLUtils.xpathString( |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
111 describe, |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
112 "/art:result/art:uuid/@value", |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
113 ArtifactNamespaceContext.INSTANCE); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
114 String hash = XMLUtils.xpathString( |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
115 describe, |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
116 "/art:result/art:hash/@value", |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
117 ArtifactNamespaceContext.INSTANCE); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
118 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
119 Artifact artifact = new Artifact(uuid, hash); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
120 sm.setCurrentArtifact(artifact); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
121 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
122 if (logger.isDebugEnabled()) { |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
123 logger.debug("Imported artifact UUID: "+artifact.getId()); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
124 logger.debug("Imported artifact HASH: "+artifact.getHash()); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
125 } |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
126 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
127 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
|
128 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
|
129 } |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 } |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 } |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
132 catch (IOException ioe) { |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
133 logger.error(ioe, ioe); |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 request.setAttribute( |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 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
|
136 ioe.getMessage()); |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 return super.getExceptionForward(mapping); |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
673
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
141 // 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
|
142 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
|
143 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
144 request.setAttribute( |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
145 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
|
146 RESOURCE_UPLOAD_FAILURE); |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
147 |
93b4dedc4e37
Implemented a mechanism to import artifacts from xml structured documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
670
diff
changeset
|
148 return super.getExceptionForward(mapping); |
670
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 } |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 } |
b89b31293772
Implemented first things to store/load projects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |