Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java @ 606:9efc1c256dbb
Added the support of the usecase that one FIS can be identified by different MapServices. In that case the parameters will be merged into the existing FIS.
gnv-artifacts/trunk@672 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 09 Feb 2010 15:23:07 +0000 |
parents | 938ce81a6bd0 |
children | 9a828e5a2390 |
comparison
equal
deleted
inserted
replaced
605:e8ebdbc7f1e3 | 606:9efc1c256dbb |
---|---|
317 if (result != null){ | 317 if (result != null){ |
318 resultValue = new ArrayList<FIS>(result.size()); | 318 resultValue = new ArrayList<FIS>(result.size()); |
319 Iterator<Result> it = result.iterator(); | 319 Iterator<Result> it = result.iterator(); |
320 while (it.hasNext()){ | 320 while (it.hasNext()){ |
321 Result value = it.next(); | 321 Result value = it.next(); |
322 String fis_id = value.getString(0).trim(); | 322 String fisId = value.getString(0).trim(); |
323 String mapServiceID = value.getString(1).trim(); | 323 String mapServiceID = value.getString(1).trim(); |
324 | 324 |
325 // FIRST LOOK IF ONE MAPSERVICE REPRESENTS ONLY ONE PARAM | 325 // FIRST LOOK IF ONE MAPSERVICE REPRESENTS ONLY ONE PARAM |
326 Collection<Result> result2 = queryExecutor.executeQuery( | 326 Collection<Result> result2 = queryExecutor.executeQuery( |
327 MAPSERVICES_HAS_PARAMETER_QUERY_ID, | 327 MAPSERVICES_HAS_PARAMETER_QUERY_ID, |
364 } | 364 } |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 } | 368 } |
369 resultValue.add(new DefaultFIS(fis_id, parameter)); | 369 |
370 FIS fis = this.getFIS(resultValue, fisId); | |
371 if (fis != null){ | |
372 if (parameter != null){ | |
373 fis.addParameter(parameter); | |
374 } | |
375 }else{ | |
376 resultValue.add(new DefaultFIS(fisId, parameter)); | |
377 } | |
370 } | 378 } |
371 } | 379 } |
372 } catch (QueryException e) { | 380 } catch (QueryException e) { |
373 log.error(e,e); | 381 log.error(e,e); |
374 throw new MetaDataServiceException("Cannot Query FIS from DB."); | 382 throw new MetaDataServiceException("Cannot Query FIS from DB."); |
376 | 384 |
377 } | 385 } |
378 return resultValue; | 386 return resultValue; |
379 } | 387 } |
380 | 388 |
389 | |
390 private FIS getFIS (Collection<FIS> fis, String fisId){ | |
391 | |
392 Iterator<FIS> it = fis.iterator(); | |
393 while(it.hasNext()){ | |
394 FIS tmpFIS = it.next(); | |
395 if (tmpFIS.getID().equals(fisId)){ | |
396 return tmpFIS; | |
397 } | |
398 } | |
399 return null; | |
400 } | |
381 | 401 |
382 private MapService getMapService(Collection<MapService> mapServices, | 402 private MapService getMapService(Collection<MapService> mapServices, |
383 String mapServiceID){ | 403 String mapServiceID){ |
384 log.debug("MetaDataService.getMapService"); | 404 log.debug("MetaDataService.getMapService"); |
385 Iterator<MapService> it = mapServices.iterator(); | 405 Iterator<MapService> it = mapServices.iterator(); |