diff backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/InfrastructureSeriesImport.java @ 9659:75bd347147ad

Importer (s/u-info) extensions: infrastructures: detecting, logging, cancelling in case of wrong column titles, detecting, logging and skipping lines with duplicate km+bank
author mschaefer
date Mon, 23 Mar 2020 15:37:37 +0100
parents cedcee24a21a
children
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/InfrastructureSeriesImport.java	Mon Mar 23 15:33:40 2020 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/InfrastructureSeriesImport.java	Mon Mar 23 15:37:37 2020 +0100
@@ -79,17 +79,27 @@
     }
 
     @Override
-    public List<Infrastructure> querySeriesItem(final Session session, final River river) {
+    public List<Infrastructure> querySeriesItem(final Session session, final River river, final boolean doQueryParent) {
         final Query query = session.createQuery("FROM Infrastructure WHERE river=:river AND lower(filename)=:filename");
         query.setParameter("river", river);
         query.setParameter("filename", this.filename.toLowerCase());
         return query.list();
     }
 
-
     @Override
     public Infrastructure createSeriesItem(final River river) {
         return new Infrastructure(river, this.filename, this.kmrange_info, this.notes, this.type.getPeer(), this.group.getPeer(), this.year, this.provider,
                 this.evaluation_by);
     }
+
+    @Override
+    public boolean addValue(final InfrastructureKmLineImport value) {
+        for (final InfrastructureKmLineImport item : this.values) {
+            if (item.getStation() != value.getStation())
+                continue;
+            if (item.getBankAttribute() == value.getBankAttribute())
+                return false;
+        }
+        return super.addValue(value);
+    }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org