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