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
;
13 import java
.util
.List
;
16 import eu
.etaxonomy
.cdm
.api
.service
.IGroupService
;
17 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
18 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
19 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
20 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
21 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * @created Mar 9, 2011
29 public class GroupCreator
implements IEntityCreator
<Group
> {
31 public static final String GROUP
= "Group";
34 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
37 public Group
createEntity(String text
) {
38 Group group
= createEntity(null, text
);
43 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
46 public Group
createEntity(Object key
, String text
) {
47 List
<Group
> groupList
=CdmStore
.getService(IGroupService
.class).listByName(text
, MatchMode
.EXACT
, null, 100, 0, null, null);
49 if (groupList
.isEmpty()){
50 Group group
= Group
.NewInstance(text
);
53 MessagingUtils
.messageDialog(Messages
.GROUP_CREATOR_group_exists_title
, text
, Messages
.GROUP_CREATOR_group_exists
);
61 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
64 public Map
<Object
, String
> getKeyLabelPairs() {
65 Map
<Object
, String
> result
= new HashMap
<Object
, String
>();
66 result
.put(Group
.class, GROUP
);
71 public boolean savesEntity() {
72 // TODO Auto-generated method stub