0abba8e900b681add629bf6d1148863859394996
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.entitycreator
;
12 import java
.util
.HashMap
;
15 import org
.springframework
.security
.access
.AccessDeniedException
;
17 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
18 import eu
.etaxonomy
.cdm
.model
.common
.User
;
19 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
20 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 * @created Mar 9, 2011
28 public class UserCreator
implements IEntityCreator
<User
>{
31 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
34 public User
createEntity(String text
) {
35 return createEntity(null, text
);
39 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
42 public User
createEntity(Object key
, String text
) {
44 User user
= User
.NewInstance(text
, text
);
45 CdmStore
.getService(IUserService
.class).createUser(user
);
46 user
= CdmStore
.getService(IUserService
.class).loadWithUpdate(user
.getUuid());
48 } catch (AccessDeniedException e
){
49 MessagingUtils
.messageDialog("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