changeset 565:8355d7cacd09

Modified the Create-Artifact-Request-Body that a Geometry will be put into the Parameter if one is given e.g. using the MapViewer-Interface request. gnv/trunk@680 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Feb 2010 09:29:54 +0000
parents 97fa3896f505
children 5aea89b9a350
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java
diffstat 2 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Tue Feb 09 13:16:19 2010 +0000
+++ b/gnv/ChangeLog	Fri Feb 12 09:29:54 2010 +0000
@@ -1,3 +1,9 @@
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+	  Modified the Create-Artifact-Request-Body that a Geometry will be put into 
+	  the Parameter if one is given e.g. using the MapViewer-Interface request.
+
 2010-02-09  Tim Englich  <tim.englich@intevation.de>
 
 	* src/test/ressources/externalinterfacecall_curl.xml,
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Tue Feb 09 13:16:19 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Feb 12 09:29:54 2010 +0000
@@ -112,10 +112,10 @@
                 String url = server + "/factories";
                 Document document = this.doGetRequest(url);
                 if (resultValues == null) {
-                    resultValues = this.getArtifactFactories(document, server);
+                    resultValues = this.getArtifactFactories(document, server,null);
                 } else {
                     resultValues.addAll(this.getArtifactFactories(document,
-                            server));
+                            server,null));
                 }
             }
         } catch (IOException e) {
@@ -126,7 +126,8 @@
     }
 
     private Collection<ArtifactObject> getArtifactFactories(Document document,
-                                                            String server) {
+                                                            String server,
+                                                            String geometry) {
         XMLUtils xmlUtils = new XMLUtils();
         NodeList artifactFactories = xmlUtils.getNodeSetXPath(document,
                 "/art:result/art:factories/art:factory");
@@ -144,8 +145,9 @@
                                                             artifactFactoryNode,
                                                             "art:parameter");
                
-                if (parameterNodeList != null && 
-                    parameterNodeList.getLength() > 0){
+                if ((parameterNodeList != null && 
+                    parameterNodeList.getLength() > 0) || 
+                    geometry != null){
                     Collection<String> parameters = 
                           new ArrayList<String>(parameterNodeList.getLength());
                     for (int j = 0; j < parameterNodeList.getLength(); j++){
@@ -158,6 +160,11 @@
                                                                     server);
                     pao.addParameters("parameter", parameters);
                     resultValues.add(pao);
+                    if (geometry != null){
+                        Collection<String> geometryList = new ArrayList<String>(1);
+                        geometryList.add(geometry);
+                        pao.addParameters("geometry",geometryList);
+                    }
                 }else{
                     ArtifactObject artifactFactory  = new ArtifactFactory(name,
                                                                     description,
@@ -822,7 +829,7 @@
                 log.debug(url);
                 
                 InputStream resultStream = this.doPostRequest(url, requestBody);
-                resultValues = this.parseMetaDataResult(resultStream, server);
+                resultValues = this.parseMetaDataResult(resultStream, server,geometry);
             }
         } catch (IOException e) {
             log.error(e,e);
@@ -832,11 +839,12 @@
     
     private Collection<ArtifactObject> parseMetaDataResult(
               InputStream inputStream, 
-              String server) throws ArtifactDatabaseClientException{
+              String server,
+              String geometry) throws ArtifactDatabaseClientException{
         XMLUtils xmlUtils = new XMLUtils();
         Document document = xmlUtils.readDocument(inputStream);
         this.check4ExceptionReport(document);
-        return this.getArtifactFactories(document, server);
+        return this.getArtifactFactories(document, server,geometry);
     }
     
     private Document createMetaDataRequestBody(Collection<MapService> mapServices,

http://dive4elements.wald.intevation.org