Project

General

Profile

Download (2.39 KB) Statistics
| Branch: | Tag: | Revision:
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.AgentBase;
19
import eu.etaxonomy.cdm.model.agent.Person;
20
import eu.etaxonomy.cdm.model.agent.Team;
21
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
22
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
23

    
24
/**
25
 * <p>TeamOrPersonCreator class.</p>
26
 *
27
 * @author p.ciardelli
28
 * @created 18.09.2009
29
 * @version 1.0
30
 */
31
public class AgentCreator implements IEntityCreator<TeamOrPersonBase> {
32
	private static final Logger logger = Logger.getLogger(AgentCreator.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
		// FIXME
40
		logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
41
		logger.error("We can only create Persons at the moment. See #1820");
42
		logger.error("FIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXMEFIXME");
43
		return createEntity(Person.class, text);
44
	}
45

    
46
	/* (non-Javadoc)
47
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String)
48
	 */
49
	/** {@inheritDoc} */
50
	public TeamOrPersonBase createEntity(Object key, String text) {
51
		TeamOrPersonBase teamOrPerson = null;
52
		if (Team.class.equals((key))) {
53
			teamOrPerson = Team.NewInstance();
54
		}
55
		if (Person.class.equals((key))) {
56
			teamOrPerson = Person.NewInstance();
57
		}		
58
		if (teamOrPerson != null) {
59
			teamOrPerson.setTitleCache(text, true);
60
		}
61
		return teamOrPerson;
62
	}
63

    
64
	/* (non-Javadoc)
65
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs()
66
	 */
67
	/**
68
	 * <p>getKeyLabelPairs</p>
69
	 *
70
	 * @return a {@link java.util.Map} object.
71
	 */
72
	public Map<Object, String> getKeyLabelPairs() {
73
		Map<Object, String> result = new HashMap<Object, String>();
74
		result.put(Team.class, "Author Team");
75
		result.put(Person.class, "Author");
76
		return result;
77
	}
78

    
79
	@Override
80
	public boolean savesEntity() {
81
		// TODO Auto-generated method stub
82
		return false;
83
	}
84
}
(1-1/7)