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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
18 import eu
.etaxonomy
.cdm
.api
.service
.IAgentService
;
19 import eu
.etaxonomy
.cdm
.api
.service
.config
.IIdentifiableEntityServiceConfigurator
;
20 import eu
.etaxonomy
.cdm
.api
.service
.exception
.DataChangeNoRollbackException
;
21 import eu
.etaxonomy
.cdm
.api
.service
.exception
.ReferencedObjectUndeletableException
;
22 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
23 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
24 import eu
.etaxonomy
.taxeditor
.bulkeditor
.IBulkEditorSortProvider
;
25 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.entitycreator
.AgentCreator
;
26 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.sortprovider
.IdentifiableEntitySortProvider
;
27 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
31 * <p>AgentEditorInput class.</p>
37 public class AgentEditorInput
extends AbstractBulkEditorInput
<AgentBase
> {
42 private static final long serialVersionUID
= 3387950621617078479L;
44 /** Constant <code>ID="bulkeditor.input.author"</code> */
45 public static final String ID
= "bulkeditor.input.author";
47 private static AgentEditorInput instance
;
54 public static String
getID() {
59 * @see org.eclipse.ui.IEditorInput#getName()
64 * @return a {@link java.lang.String} object.
66 public String
getName() {
67 return BulkEditorInputType
.AGENT
.label
;
71 * @see org.eclipse.ui.IEditorInput#getToolTipText()
74 * <p>getToolTipText</p>
76 * @return a {@link java.lang.String} object.
78 public String
getToolTipText() {
83 * <p>Getter for the field <code>instance</code>.</p>
85 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
87 public static AbstractBulkEditorInput
getInstance() {
88 if (instance
== null) {
89 instance
= new AgentEditorInput();
95 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
99 public boolean isMergingEnabled() {
105 public List
<AgentBase
> listEntities(IIdentifiableEntityServiceConfigurator configurator
) {
106 return CdmStore
.getSearchManager().findTeamOrPersons(configurator
);
111 public AgentBase loadEntity(UUID uuid) {
112 List<String> propertyPaths = Arrays.asList(new String[]{});
113 return CdmStore.getService(IAgentService.class).load(uuid, propertyPaths);
117 public boolean delete(AgentBase entity
) throws ReferencedObjectUndeletableException
{
119 return CdmStore
.getService(IAgentService
.class).delete(entity
) != null;
124 public boolean save(AgentBase entity
) {
126 return CdmStore
.getService(IAgentService
.class).saveOrUpdate(entity
) != null;
130 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getSortProviders()
133 public List
<IBulkEditorSortProvider
<AgentBase
>> getSortProviders() {
134 List
<IBulkEditorSortProvider
<AgentBase
>> sortProviders
= super.getSortProviders();
136 sortProviders
.add(0, new IdentifiableEntitySortProvider
<AgentBase
>());
138 return sortProviders
;
142 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
145 protected IEntityCreator
<AgentBase
> createEntityCreator() {
146 return new AgentCreator();