performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / TeamOrPersonCreator.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.bulkeditor;
12
13 import java.util.HashMap;
14 import java.util.Map;
15
16 import org.apache.log4j.Logger;
17
18 import eu.etaxonomy.cdm.model.agent.Person;
19 import eu.etaxonomy.cdm.model.agent.Team;
20 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
21 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
22
23 /**
24 * <p>TeamOrPersonCreator class.</p>
25 *
26 * @author p.ciardelli
27 * @created 18.09.2009
28 * @version 1.0
29 */
30 public class TeamOrPersonCreator implements IEntityCreator<TeamOrPersonBase> {
31 private static final Logger logger = Logger
32 .getLogger(TeamOrPersonCreator.class);
33
34 /* (non-Javadoc)
35 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
36 */
37 /** {@inheritDoc} */
38 public TeamOrPersonBase createEntity(String text) {
39 return createEntity(Person.class, text);
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String)
44 */
45 /** {@inheritDoc} */
46 public TeamOrPersonBase createEntity(Object key, String text) {
47 TeamOrPersonBase teamOrPerson = null;
48 if (Team.class.equals(((Class) key))) {
49 teamOrPerson = Team.NewInstance();
50 }
51 if (Person.class.equals(((Class) key))) {
52 teamOrPerson = Person.NewInstance();
53 }
54 if (teamOrPerson != null) {
55 teamOrPerson.setTitleCache(text);
56 }
57 return teamOrPerson;
58 }
59
60 /* (non-Javadoc)
61 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs()
62 */
63 /**
64 * <p>getKeyLabelPairs</p>
65 *
66 * @return a {@link java.util.Map} object.
67 */
68 public Map<Object, String> getKeyLabelPairs() {
69 Map<Object, String> result = new HashMap<Object, String>();
70 result.put(Team.class, "Author Team");
71 result.put(Person.class, "Author");
72 return result;
73 }
74 }