// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
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;
/**
- * <p>AuthorHelper class.</p>
+ * Utility class for handling of authorship related elements.
*
* @author n.hoffmann
* @created Sep 8, 2010
* @version 1.0
*/
public class AuthorHelper {
-
- /**
- * <p>getAuthor</p>
- *
- * @param object a {@link java.lang.Object} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- */
- public static Team getAuthor(Object object){
- if(object == null){
+
+ /**
+ * 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(object);
+ Object deproxiedObject = HibernateProxyHelper.deproxy(teamOrPerson);
if(deproxiedObject instanceof Person){
Person person = (Person) deproxiedObject;
Team team = Team.NewInstance();