3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.entitycreator
;
13 import java
.util
.HashMap
;
16 import org
.springframework
.security
.access
.AccessDeniedException
;
18 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
19 import eu
.etaxonomy
.cdm
.model
.common
.User
;
20 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
21 import eu
.etaxonomy
.taxeditor
.bulkeditor
.BulkEditorUtil
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * @created Mar 9, 2011
29 public class UserCreator
implements IEntityCreator
<User
>{
32 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
35 public User
createEntity(String text
) {
36 return createEntity(null, text
);
40 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
43 public User
createEntity(Object key
, String text
) {
45 User user
= User
.NewInstance(text
, text
);
46 CdmStore
.getService(IUserService
.class).createUser(user
);
48 } catch (AccessDeniedException e
){
49 BulkEditorUtil
.errorDialog("Access denied", getClass(), e
.getMessage(), e
);
55 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
58 public Map
<Object
, String
> getKeyLabelPairs() {
59 Map
<Object
, String
> result
= new HashMap
<Object
, String
>();
60 result
.put(User
.class, "User");
65 public boolean savesEntity() {
66 // TODO Auto-generated method stub