Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/rest/CreateResource.java @ 75:d4c4c23847f5
Extended the Artifact-Interface-Method setup to be able to put the XML-Document which can contain further Data
to the Artifact-Implementation.
artifacts/trunk@649 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 01 Feb 2010 13:54:05 +0000 |
parents | 82f62ef25a8f |
children | 48d1a9a082c2 |
comparison
equal
deleted
inserted
replaced
74:66f43d1e69eb | 75:d4c4c23847f5 |
---|---|
1 package de.intevation.artifactdatabase.rest; | 1 package de.intevation.artifactdatabase.rest; |
2 | |
3 import org.w3c.dom.Document; | |
4 | |
5 import org.restlet.ext.xml.DomRepresentation; | |
6 | |
7 import org.restlet.resource.ResourceException; | |
8 | |
9 import org.restlet.data.Response; | |
10 import org.restlet.data.Status; | |
11 | |
12 import org.restlet.data.MediaType; | |
13 | |
14 import org.apache.log4j.Logger; | |
15 | |
16 import de.intevation.artifactdatabase.XMLUtils; | |
17 | |
18 import org.restlet.representation.Representation; | |
19 import org.restlet.representation.EmptyRepresentation; | |
20 | 2 |
21 import java.io.IOException; | 3 import java.io.IOException; |
22 | 4 |
5 import org.apache.log4j.Logger; | |
6 import org.restlet.data.MediaType; | |
7 import org.restlet.data.Response; | |
8 import org.restlet.data.Status; | |
9 import org.restlet.ext.xml.DomRepresentation; | |
10 import org.restlet.representation.EmptyRepresentation; | |
11 import org.restlet.representation.Representation; | |
12 import org.restlet.resource.ResourceException; | |
13 import org.w3c.dom.Document; | |
14 | |
15 import de.intevation.artifactdatabase.XMLUtils; | |
16 import de.intevation.artifacts.ArtifactDatabase; | |
17 import de.intevation.artifacts.ArtifactDatabaseException; | |
23 import de.intevation.artifacts.ArtifactNamespaceContext; | 18 import de.intevation.artifacts.ArtifactNamespaceContext; |
24 import de.intevation.artifacts.ArtifactDatabaseException; | |
25 import de.intevation.artifacts.ArtifactDatabase; | |
26 | 19 |
27 /** | 20 /** |
28 * @author Sascha L. Teichmann (sascha.teichmann@intevation) | 21 * @author Sascha L. Teichmann (sascha.teichmann@intevation) |
29 */ | 22 */ |
30 public class CreateResource | 23 public class CreateResource |
76 .getAttributes().get("database"); | 69 .getAttributes().get("database"); |
77 | 70 |
78 try { | 71 try { |
79 return new DomRepresentation( | 72 return new DomRepresentation( |
80 MediaType.APPLICATION_XML, | 73 MediaType.APPLICATION_XML, |
81 db.createArtifactWithFactory(factory, getCallMeta())); | 74 db.createArtifactWithFactory(factory, |
75 getCallMeta(), | |
76 inputDocument)); | |
82 } | 77 } |
83 catch (ArtifactDatabaseException adbe) { | 78 catch (ArtifactDatabaseException adbe) { |
84 Response response = getResponse(); | 79 Response response = getResponse(); |
85 response.setStatus( | 80 response.setStatus( |
86 Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, adbe.getMessage()); | 81 Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, adbe.getMessage()); |