had to rename the packages to make them compliant with buckminster
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / entitycreator / UserCreator.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 eu.etaxonomy.cdm.api.service.IUserService;
17 import eu.etaxonomy.cdm.model.common.User;
18 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
19 import eu.etaxonomy.taxeditor.store.CdmStore;
20
21 /**
22 * @author n.hoffmann
23 * @created Mar 9, 2011
24 * @version 1.0
25 */
26 public class UserCreator implements IEntityCreator<User>{
27
28 /* (non-Javadoc)
29 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
30 */
31 @Override
32 public User createEntity(String text) {
33 return createEntity(null, text);
34 }
35
36 /* (non-Javadoc)
37 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
38 */
39 @Override
40 public User createEntity(Object key, String text) {
41 User user = User.NewInstance(text, text);
42 CdmStore.getService(IUserService.class).createUser(user);
43 return user;
44 }
45
46 /* (non-Javadoc)
47 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
48 */
49 @Override
50 public Map<Object, String> getKeyLabelPairs() {
51 Map<Object, String> result = new HashMap<Object, String>();
52 result.put(User.class, "User");
53 return result;
54 }
55
56 }