Remove AuthorHelper which used to automatically convert Persons to Teams
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 7 Dec 2015 13:23:45 +0000 (14:23 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 7 Dec 2015 13:23:45 +0000 (14:23 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AuthorHelper.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AuthorHelper.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AuthorHelper.java
deleted file mode 100644 (file)
index 6884ba8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* 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.
-*/
-
-package eu.etaxonomy.taxeditor.model;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-
-/**
- * Utility class for handling of authorship related elements.
- *
- * @author n.hoffmann
- * @created Sep 8, 2010
- * @version 1.0
- */
-public class AuthorHelper {
-
-    /**
-     * If the given {@link TeamOrPersonBase} is a {@link Person} this methods
-     * creates a new {@link Team} with this person. If it already a team the
-     * team is returned.
-     * 
-     * @param teamOrPerson
-     *            a team or a person
-     * @return the given team or a newly created team with the given person
-     */
-       public static Team getAuthor(TeamOrPersonBase<?> teamOrPerson){
-               if(teamOrPerson == null){
-                       return null;
-               }
-               Object deproxiedObject = HibernateProxyHelper.deproxy(teamOrPerson);
-               if(deproxiedObject instanceof Person){
-                       Person person = (Person) deproxiedObject;
-                       Team team = Team.NewInstance();
-                       team.addTeamMember(person);
-                       return team;
-               }
-               else if(deproxiedObject instanceof Team){
-                       return (Team) deproxiedObject;
-               }else{
-                       throw new IllegalArgumentException("Given object os of the wrong type");
-               }
-       }
-}
index 346b22cadd7af833ffe6737e1802ccb6e4229e3b..1f26a8bc26669896b9bce47aafa18710e3edc8d8 100644 (file)
@@ -22,7 +22,6 @@ import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
 import eu.etaxonomy.cdm.model.reference.ReferenceType;
-import eu.etaxonomy.taxeditor.model.AuthorHelper;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -127,7 +126,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                selection_authorTeam = formFactory
                                .createSelectionElement(AgentBase.class,
                                                getConversationHolder(), formElement, "Author",
-                                               AuthorHelper.getAuthor(entity.getAuthorship()),
+                                               entity.getAuthorship(),
                                                EntitySelectionElement.ALL, style);
 
                ReferenceType referenceType = entity.getType();
@@ -550,18 +549,18 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                        }
                }
        }
-       
+
        @Override
        protected void handleToggleableCacheField() {
-       
+
                boolean pushedState = toggleable_cache.getState();
         getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
         setIrrelevantReferenceDetail(false);
         updateToggleableCacheField();
     }
-       
+
        protected void setIrrelevantReferenceDetail(boolean abbrev){
-               
+
                List<Object> except = new ArrayList();
            except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished, text_publisher, text_referenceAbstract,  text_uri, selection_institution}));
            boolean pushedState;
@@ -582,7 +581,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                break;
            default:
                break;
-           }   
+           }
            setIrrelevant(pushedState, except);
        }
 }