# HG changeset patch # User Tim Englich # Date 1265966994 0 # Node ID 8355d7cacd09b5ddc4dc035c6f9e4d21f2a7eb64 # Parent 97fa3896f505871dcb5a16302e21aece0cff6a1a 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 diff -r 97fa3896f505 -r 8355d7cacd09 gnv/ChangeLog --- 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 + + * 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 * src/test/ressources/externalinterfacecall_curl.xml, diff -r 97fa3896f505 -r 8355d7cacd09 gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java --- 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 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 parameters = new ArrayList(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 geometryList = new ArrayList(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 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 mapServices,