Project

General

Profile

Download (1.85 KB) Statistics
| Branch: | Tag: | Revision:
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.logging.log4j.LogManager;
16
import org.apache.logging.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
 * @author p.ciardelli
25
 * @created 18.09.2009
26
 */
27
public class AgentCreator implements IEntityCreator<TeamOrPersonBase> {
28

    
29
    private static final Logger logger = LogManager.getLogger();
30

    
31
	@Override
32
    public TeamOrPersonBase createEntity(String text) {
33
		// FIXME
34
		logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
35
		logger.error("We can only create Persons at the moment. See #1820");
36
		logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
37
		return createEntity(Person.class, text);
38
	}
39

    
40
	@Override
41
    public TeamOrPersonBase createEntity(Object key, String text) {
42
		TeamOrPersonBase<?> teamOrPerson = null;
43
		if (Team.class.equals((key))) {
44
			teamOrPerson = Team.NewInstance();
45
		}
46
		if (Person.class.equals((key))) {
47
			teamOrPerson = Person.NewInstance();
48
		}
49
		if (teamOrPerson != null) {
50
			teamOrPerson.setTitleCache(text, true);
51
		}
52
		return teamOrPerson;
53
	}
54

    
55
	@Override
56
    public Map<Object, String> getKeyLabelPairs() {
57
		Map<Object, String> result = new HashMap<>();
58
		result.put(Team.class, "Team");
59
		result.put(Person.class, "Person");
60
		return result;
61
	}
62

    
63
	@Override
64
	public boolean savesEntity() {
65
		// TODO Auto-generated method stub
66
		return false;
67
	}
68
}
(1-1/8)