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;
|
12
|
|
13
|
import java.util.Arrays;
|
14
|
import java.util.List;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.IGroupService;
|
18
|
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
|
19
|
import eu.etaxonomy.cdm.model.common.Group;
|
20
|
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
|
21
|
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues.BulkEditorInputType;
|
22
|
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
|
23
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
24
|
|
25
|
/**
|
26
|
* @author n.hoffmann
|
27
|
* @created Mar 9, 2011
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
|
31
|
|
32
|
public static final String ID = "bulkeditor.input.group";
|
33
|
|
34
|
private static GroupEditorInput instance;
|
35
|
|
36
|
/**
|
37
|
* @return the instance
|
38
|
*/
|
39
|
public static GroupEditorInput getInstance() {
|
40
|
if(instance == null){
|
41
|
instance = new GroupEditorInput();
|
42
|
}
|
43
|
return instance;
|
44
|
}
|
45
|
|
46
|
/* (non-Javadoc)
|
47
|
* @see org.eclipse.ui.IEditorInput#getName()
|
48
|
*/
|
49
|
@Override
|
50
|
public String getName() {
|
51
|
return BulkEditorInputType.GROUP.label;
|
52
|
}
|
53
|
|
54
|
/* (non-Javadoc)
|
55
|
* @see org.eclipse.ui.IEditorInput#getToolTipText()
|
56
|
*/
|
57
|
@Override
|
58
|
public String getToolTipText() {
|
59
|
return getName();
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
|
64
|
*/
|
65
|
@Override
|
66
|
public boolean save(Group entity) {
|
67
|
return CdmStore.getService(IGroupService.class).saveOrUpdate(entity) != null;
|
68
|
}
|
69
|
|
70
|
/* (non-Javadoc)
|
71
|
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
|
72
|
*/
|
73
|
@Override
|
74
|
public boolean delete(Group entity) {
|
75
|
return CdmStore.getService(IGroupService.class).delete(entity) != null;
|
76
|
}
|
77
|
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
|
80
|
*/
|
81
|
@Override
|
82
|
protected List<Group> listEntities(
|
83
|
IIdentifiableEntityServiceConfigurator configurator) {
|
84
|
return CdmStore.getSearchManager().findGroups(configurator);
|
85
|
}
|
86
|
|
87
|
/* (non-Javadoc)
|
88
|
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
|
89
|
*/
|
90
|
@Override
|
91
|
protected Group loadEntity(UUID entityUuid) {
|
92
|
List<String> propertyPaths = Arrays.asList(new String[]{});
|
93
|
return CdmStore.getService(IGroupService.class).load(entityUuid, propertyPaths);
|
94
|
}
|
95
|
|
96
|
/* (non-Javadoc)
|
97
|
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
|
98
|
*/
|
99
|
@Override
|
100
|
protected IEntityCreator<Group> createEntityCreator() {
|
101
|
return new GroupCreator();
|
102
|
}
|
103
|
|
104
|
/* (non-Javadoc)
|
105
|
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
|
106
|
*/
|
107
|
@Override
|
108
|
public String getText(Group entity) {
|
109
|
return entity.getName();
|
110
|
}
|
111
|
|
112
|
|
113
|
|
114
|
}
|