diff 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
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java	Tue Feb 09 14:27:55 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java	Tue Feb 09 15:23:07 2010 +0000
@@ -319,7 +319,7 @@
                     Iterator<Result> it = result.iterator();
                     while (it.hasNext()){
                         Result value = it.next();
-                        String fis_id = value.getString(0).trim();
+                        String fisId = value.getString(0).trim();
                         String mapServiceID = value.getString(1).trim();
                        
                         // FIRST LOOK IF ONE MAPSERVICE REPRESENTS ONLY ONE PARAM
@@ -366,7 +366,15 @@
                             }
                             
                         }
-                        resultValue.add(new DefaultFIS(fis_id, parameter));
+                        
+                        FIS fis = this.getFIS(resultValue, fisId);
+                        if (fis != null){
+                            if (parameter != null){
+                                fis.addParameter(parameter);
+                            }
+                        }else{
+                            resultValue.add(new DefaultFIS(fisId, parameter));
+                        }
                     }
                 }
             } catch (QueryException e) {
@@ -379,6 +387,18 @@
     }
     
     
+    private FIS getFIS (Collection<FIS> fis, String fisId){
+        
+        Iterator<FIS> it = fis.iterator();
+        while(it.hasNext()){
+            FIS tmpFIS = it.next();
+            if (tmpFIS.getID().equals(fisId)){
+                return tmpFIS;
+            }
+        }
+        return null;
+    }
+    
     private MapService getMapService(Collection<MapService> mapServices,
                                      String mapServiceID){
         log.debug("MetaDataService.getMapService");

http://dive4elements.wald.intevation.org