ref #7502 Add property columns for agents, media and references
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 5 Oct 2018 08:38:56 +0000 (10:38 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 5 Oct 2018 10:27:33 +0000 (12:27 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java

index 7ed21fb7314c0a55e94f4934e4eaa832b35a3bdd..f3ecd7c95318ea6382f75187b89d85947b1f665e 100644 (file)
@@ -49,6 +49,9 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
        private static AgentEditorInput instance;
 
        private static final String PROPERTY_NOMENCLATURAL_TITLE = "Nomenclatural Title";
+       private static final String PROPERTY_FAMILY_NAME = "Family Name";
+       private static final String PROPERTY_OTHER_NAME = "Other Name";
+       private static final String PROPERTY_INITIALS = "Initials";
 
        public static String getID() {
                return ID;
@@ -58,6 +61,9 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
        protected List<String> getPropertyKeys_internal() {
            List<String> propertyKeysInternal = new ArrayList<>();
            propertyKeysInternal.add(PROPERTY_NOMENCLATURAL_TITLE);
+           propertyKeysInternal.add(PROPERTY_FAMILY_NAME);
+           propertyKeysInternal.add(PROPERTY_OTHER_NAME);
+           propertyKeysInternal.add(PROPERTY_INITIALS);
            return propertyKeysInternal;
        }
 
@@ -66,6 +72,21 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
            if(property.equals(PROPERTY_NOMENCLATURAL_TITLE)){
                return cdmBase.getNomenclaturalTitle();
            }
+           else if(property.equals(PROPERTY_FAMILY_NAME)){
+               if(cdmBase.isInstanceOf(Person.class)){
+                   return HibernateProxyHelper.deproxy(cdmBase, Person.class).getFamilyName();
+               }
+           }
+           else if(property.equals(PROPERTY_OTHER_NAME)){
+               if(cdmBase.isInstanceOf(Person.class)){
+                   return HibernateProxyHelper.deproxy(cdmBase, Person.class).getGivenName();
+               }
+           }
+           else if(property.equals(PROPERTY_INITIALS)){
+               if(cdmBase.isInstanceOf(Person.class)){
+                   return HibernateProxyHelper.deproxy(cdmBase, Person.class).getInitials();
+               }
+           }
            return super.getPropertyValue(cdmBase, property);
        }
 
index f42a5bf7d01750c560e798747cb63c4526032d9d..44413c93fd84b2c903bb661f95c7bc277f9850d4 100644 (file)
@@ -18,11 +18,13 @@ import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
+import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
 import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.MediaCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -35,6 +37,11 @@ public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
 
     private static MediaEditorInput instance;
 
+    private static final String PROPERTY_TITLE = "Title";
+    private static final String PROPERTY_DESCRIPTION = "Description";
+
+    private Language globalLanguage = PreferencesUtil.getGlobalLanguage();
+
     public static String getID() {
         return ID;
     }
@@ -49,9 +56,22 @@ public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
     @Override
     protected List<String> getPropertyKeys_internal() {
         List<String> propertyKeysInternal = new ArrayList<>();
+        propertyKeysInternal.add(PROPERTY_TITLE);
+        propertyKeysInternal.add(PROPERTY_DESCRIPTION);
         return propertyKeysInternal;
     }
 
+    @Override
+    public Object getPropertyValue(Media cdmBase, String property) {
+        if(property.equals(PROPERTY_TITLE)){
+            return cdmBase.getTitle();
+        }
+        else if(property.equals(PROPERTY_DESCRIPTION)){
+            return cdmBase.getDescription(globalLanguage);
+        }
+        return super.getPropertyValue(cdmBase, property);
+    }
+
     @Override
     public String getName() {
         return BulkEditorInputType.MEDIA.label;
index e12c1a9d6d0de36e633daaf8bfb35880b4f7d289..4a766065135b9e7ba911f317a4d635504bdc5712 100644 (file)
@@ -39,6 +39,8 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
        public static final String ID = "bulkeditor.input.reference";
 
        private static final String PROPERTY_NOMENCLATURAL_CACHE = "Nomencl. Cache";
+       private static final String PROPERTY_TITLE = "Title";
+       private static final String PROPERTY_NOMENCLAT_TITLE = "Nomencl. Title";
 
        private static ReferenceEditorInput instance;
 
@@ -50,6 +52,8 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
     protected List<String> getPropertyKeys_internal() {
         List<String> propertyKeysInternal = new ArrayList<>();
         propertyKeysInternal.add(PROPERTY_NOMENCLATURAL_CACHE);
+        propertyKeysInternal.add(PROPERTY_TITLE);
+        propertyKeysInternal.add(PROPERTY_NOMENCLAT_TITLE);
         return propertyKeysInternal;
     }
 
@@ -58,6 +62,12 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
         if(property.equals(PROPERTY_NOMENCLATURAL_CACHE)){
             return cdmBase.getAbbrevTitleCache();
         }
+        else if(property.equals(PROPERTY_TITLE)){
+            return cdmBase.getTitle();
+        }
+        else if(property.equals(PROPERTY_NOMENCLAT_TITLE)){
+            return cdmBase.getAbbrevTitle();
+        }
         return super.getPropertyValue(cdmBase, property);
     }