Merge branch 'develop' into LibrAlign
[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 * @version 1.0
28 */
29 public class AgentCreator implements IEntityCreator<TeamOrPersonBase> {
30 private static final Logger logger = Logger.getLogger(AgentCreator.class);
31
32
33 /** {@inheritDoc} */
34 public TeamOrPersonBase createEntity(String text) {
35 // FIXME
36 logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
37 logger.error("We can only create Persons at the moment. See #1820");
38 logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
39 return createEntity(Person.class, text);
40 }
41
42 /** {@inheritDoc} */
43 public TeamOrPersonBase createEntity(Object key, String text) {
44 TeamOrPersonBase teamOrPerson = null;
45 if (Team.class.equals((key))) {
46 teamOrPerson = Team.NewInstance();
47 }
48 if (Person.class.equals((key))) {
49 teamOrPerson = Person.NewInstance();
50 }
51 if (teamOrPerson != null) {
52 teamOrPerson.setTitleCache(text, true);
53 }
54 return teamOrPerson;
55 }
56
57 /**
58 * <p>getKeyLabelPairs</p>
59 *
60 * @return a {@link java.util.Map} object.
61 */
62 public Map<Object, String> getKeyLabelPairs() {
63 Map<Object, String> result = new HashMap<Object, String>();
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 }