- derivates now show the correct type (record basis) in the bulk editor
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 20 Nov 2013 08:13:03 +0000 (08:13 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 20 Nov 2013 08:13:03 +0000 (08:13 +0000)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java

index 6c7fc05d23d55c25f49de07491bc1db905cafb27..3f9858869e2122aae96a64f0b947fca3f85008f9 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -16,6 +16,7 @@ import java.util.UUID;
 
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
@@ -31,9 +32,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObservationBase> {
  * @version 1.0
  */
 public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObservationBase> {
-       
+
        /**
        /**
-        * 
+        *
         */
        private static final long serialVersionUID = 1014860873939989973L;
 
         */
        private static final long serialVersionUID = 1014860873939989973L;
 
@@ -41,7 +42,7 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
        public static final String ID = "bulkeditor.input.occurrence";
 
        private static OccurrenceEditorInput instance;
        public static final String ID = "bulkeditor.input.occurrence";
 
        private static OccurrenceEditorInput instance;
-       
+
        /**
         * <p>Getter for the field <code>instance</code>.</p>
         *
        /**
         * <p>Getter for the field <code>instance</code>.</p>
         *
@@ -53,7 +54,7 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
                }
                return instance;
        }
                }
                return instance;
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
         */
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
         */
@@ -70,7 +71,7 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
        /** {@inheritDoc} */
        @Override
        protected SpecimenOrObservationBase loadEntity(UUID entityUuid) {
        /** {@inheritDoc} */
        @Override
        protected SpecimenOrObservationBase loadEntity(UUID entityUuid) {
-               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               List<String> propertyPaths = Arrays.asList(new String[]{});
                return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths);
        }
 
                return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths);
        }
 
@@ -82,7 +83,8 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
         *
         * @return a {@link java.lang.String} object.
         */
         *
         * @return a {@link java.lang.String} object.
         */
-       public String getName() {
+       @Override
+    public String getName() {
                return BulkEditorInputType.OCCURRENCE.label;
        }
 
                return BulkEditorInputType.OCCURRENCE.label;
        }
 
@@ -94,10 +96,22 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
         *
         * @return a {@link java.lang.String} object.
         */
         *
         * @return a {@link java.lang.String} object.
         */
-       public String getToolTipText() {
+       @Override
+    public String getToolTipText() {
                return getName();
        }
                return getName();
        }
-       
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
+        */
+       @Override
+       public String getTypeText(Object entity) {
+        if(HibernateProxyHelper.isInstanceOf(entity, SpecimenOrObservationBase.class)){
+            return ((SpecimenOrObservationBase) entity).getRecordBasis().getMessage();
+         }
+           return super.getTypeText(entity);
+       }
+
        /**
         * <p>getId</p>
         *
        /**
         * <p>getId</p>
         *
@@ -111,7 +125,8 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
         */
        /** {@inheritDoc} */
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
         */
        /** {@inheritDoc} */
-       public boolean delete(SpecimenOrObservationBase entity) {
+       @Override
+    public boolean delete(SpecimenOrObservationBase entity) {
                return CdmStore.getService(IOccurrenceService.class).delete(entity) != null;
        }
 
                return CdmStore.getService(IOccurrenceService.class).delete(entity) != null;
        }
 
@@ -119,10 +134,11 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
         */
        /** {@inheritDoc} */
         * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
         */
        /** {@inheritDoc} */
-       public boolean save(SpecimenOrObservationBase entity) {
+       @Override
+    public boolean save(SpecimenOrObservationBase entity) {
                return CdmStore.getService(IOccurrenceService.class).save(entity) != null;
        }
                return CdmStore.getService(IOccurrenceService.class).save(entity) != null;
        }
-       
+
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
@@ -138,9 +154,9 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
        @Override
        public List<IBulkEditorSortProvider<SpecimenOrObservationBase>> getSortProviders() {
                List<IBulkEditorSortProvider<SpecimenOrObservationBase>> sortProviders = super.getSortProviders();
        @Override
        public List<IBulkEditorSortProvider<SpecimenOrObservationBase>> getSortProviders() {
                List<IBulkEditorSortProvider<SpecimenOrObservationBase>> sortProviders = super.getSortProviders();
-               
+
                sortProviders.add(0, new IdentifiableEntitySortProvider<SpecimenOrObservationBase>());
                sortProviders.add(0, new IdentifiableEntitySortProvider<SpecimenOrObservationBase>());
-               
+
                return sortProviders;
        }
 }
                return sortProviders;
        }
 }