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