minor
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / entitycreator / AgentCreator.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.input.entitycreator;
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 AgentCreator implements IEntityCreator<TeamOrPersonBase> {
31 private static final Logger logger = Logger.getLogger(AgentCreator.class);
32
33
34 /** {@inheritDoc} */
35 public TeamOrPersonBase createEntity(String text) {
36 // FIXME
37 logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
38 logger.error("We can only create Persons at the moment. See #1820");
39 logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
40 return createEntity(Person.class, text);
41 }
42
43 /** {@inheritDoc} */
44 public TeamOrPersonBase createEntity(Object key, String text) {
45 TeamOrPersonBase teamOrPerson = null;
46 if (Team.class.equals((key))) {
47 teamOrPerson = Team.NewInstance();
48 }
49 if (Person.class.equals((key))) {
50 teamOrPerson = Person.NewInstance();
51 }
52 if (teamOrPerson != null) {
53 teamOrPerson.setTitleCache(text, true);
54 }
55 return teamOrPerson;
56 }
57
58 /**
59 * <p>getKeyLabelPairs</p>
60 *
61 * @return a {@link java.util.Map} object.
62 */
63 public Map<Object, String> getKeyLabelPairs() {
64 Map<Object, String> result = new HashMap<Object, String>();
65 result.put(Team.class, "Team");
66 result.put(Person.class, "Person");
67 return result;
68 }
69
70 @Override
71 public boolean savesEntity() {
72 // TODO Auto-generated method stub
73 return false;
74 }
75 }