- changed type of BioCaseQuery results from List to Set to filter out duplicates
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 19 Feb 2014 14:32:22 +0000 (14:32 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 19 Feb 2014 14:32:22 +0000 (14:32 +0000)
  - as saveOrUpdate() for the transient services just adds the derived units to the lists this was necessary

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineDocumentProvider.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/DerivedUnitEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientCdmRepository.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientOccurenceService.java

index af7d40c9f9eb56ca838ce40cc67e4dbae0b58da6..391536bcabd426c29096de915324e2a41469991c 100644 (file)
@@ -9,6 +9,8 @@
 */
 package eu.etaxonomy.taxeditor.annotatedlineeditor;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
@@ -25,6 +27,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.texteditor.AbstractDocumentProvider;
 
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.dataimport.DerivedUnitEditorInput;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
@@ -58,7 +61,7 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
 
        private ILineDisplayStrategy lineDisplayStrategy;
 
-       private IEditorInput input;
+       private final IEditorInput input;
 
        /**
         * <p>Constructor for AnnotatedLineDocumentProvider.</p>
@@ -220,7 +223,10 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                        return ((AbstractBulkEditorInput)element).getModel();
                }
                else if(element instanceof DerivedUnitEditorInput){
-                   return ((DerivedUnitEditorInput) element).getResults();
+                   Collection<SpecimenOrObservationBase> results = ((DerivedUnitEditorInput) element).getResults();
+                   if(results!=null){
+                       return new ArrayList<SpecimenOrObservationBase>(results);
+                   }
                }
                return null;
        }
index 1d8951caf08fa2647aa625b8aeaee6a4d5b555f6..04ba594d1eebf581865dae3bd4b0be9a6d627443 100644 (file)
@@ -12,7 +12,7 @@ package eu.etaxonomy.taxeditor.dataimport;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
-import java.util.List;
+import java.util.Collection;
 
 import org.apache.http.client.ClientProtocolException;
 import org.apache.log4j.Logger;
@@ -40,7 +40,7 @@ public class DerivedUnitEditorInput implements IEditorInput {
 
     private final BioCaseQuery query;
 
-    private List<SpecimenOrObservationBase> results;
+    private Collection<SpecimenOrObservationBase> results;
 
     /**
      * @param results
@@ -135,7 +135,7 @@ public class DerivedUnitEditorInput implements IEditorInput {
     /**
      * @return the results
      */
-    public List<SpecimenOrObservationBase> getResults() {
+    public Collection<SpecimenOrObservationBase> getResults() {
         return results;
     }
 
index a438ba4328c49aa8df84f637d5a989618095bfff..79e09f832834a1aca60b7b605c3367998e0dd032 100644 (file)
@@ -9,7 +9,7 @@
 */
 package eu.etaxonomy.taxeditor.dataimport.transientServices;
 
-import java.util.List;
+import java.util.Collection;
 
 import org.springframework.security.authentication.ProviderManager;
 import org.springframework.transaction.PlatformTransactionManager;
@@ -56,7 +56,7 @@ public class TransientCdmRepository implements ICdmApplicationConfiguration {
     private final ICdmApplicationConfiguration defaultApplicationConfiguration;
     private TransientOccurenceService occurenceService;
 
-    public List<SpecimenOrObservationBase> getUnits(){
+    public Collection<SpecimenOrObservationBase> getUnits(){
         return occurenceService.getUnits();
     }
 
index e47802df50d2179bf3fb12cec2c0481e93763dc0..3296365f809ddee799aed1b3b4eea316a55869d8 100644 (file)
@@ -10,8 +10,8 @@
 package eu.etaxonomy.taxeditor.dataimport.transientServices;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -70,15 +70,15 @@ import eu.etaxonomy.cdm.strategy.merge.IMergeStrategy;
  */
 public class TransientOccurenceService implements IOccurrenceService {
 
-    private IOccurrenceService defaultService;
-    private List<SpecimenOrObservationBase> units;
+    private final IOccurrenceService defaultService;
+    private final Collection<SpecimenOrObservationBase> units;
 
     /**
      * @param defaultService
      */
     public TransientOccurenceService(IOccurrenceService defaultService) {
         this.defaultService = defaultService;
-        this.units = new ArrayList<SpecimenOrObservationBase>();
+        this.units = new HashSet<SpecimenOrObservationBase>();
     }
 
     /**
@@ -853,7 +853,7 @@ public class TransientOccurenceService implements IOccurrenceService {
     /**
      * @return
      */
-    public List<SpecimenOrObservationBase> getUnits() {
+    public Collection<SpecimenOrObservationBase> getUnits() {
         return units;
     }