Project

General

Profile

Download (2.77 KB) Statistics
| Branch: | Tag: | Revision:
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
package eu.etaxonomy.taxeditor.bulkeditor.input;
11

    
12
import java.util.Arrays;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
17
import eu.etaxonomy.cdm.model.agent.AgentBase;
18
import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
19
import eu.etaxonomy.taxeditor.store.CdmStore;
20

    
21

    
22
/**
23
 * <p>AgentEditorInput class.</p>
24
 *
25
 * @author p.ciardelli
26
 * @created 25.06.2009
27
 * @version 1.0
28
 */
29
public class AgentEditorInput extends AbstractBulkEditorInput<AgentBase> {
30

    
31
	/** Constant <code>ID="bulkeditor.input.author"</code> */
32
	public static final String ID = "bulkeditor.input.author";
33
	
34
	private static AgentEditorInput instance;
35

    
36
	/**
37
	 * <p>Constructor for AgentEditorInput.</p>
38
	 */
39
	public AgentEditorInput() {
40
		super(new Object());
41
	}
42

    
43
	/**
44
	 * <p>getID</p>
45
	 *
46
	 * @return the iD
47
	 */
48
	public static String getID() {
49
		return ID;
50
	}
51
	
52
	/* (non-Javadoc)
53
	 * @see org.eclipse.ui.IEditorInput#getName()
54
	 */
55
	/**
56
	 * <p>getName</p>
57
	 *
58
	 * @return a {@link java.lang.String} object.
59
	 */
60
	public String getName() {
61
		return BulkEditorInputType.AGENT.label;
62
	}
63

    
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.ui.IEditorInput#getToolTipText()
66
	 */
67
	/**
68
	 * <p>getToolTipText</p>
69
	 *
70
	 * @return a {@link java.lang.String} object.
71
	 */
72
	public String getToolTipText() {
73
		return getName();
74
	}
75

    
76
	/**
77
	 * <p>Getter for the field <code>instance</code>.</p>
78
	 *
79
	 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
80
	 */
81
	public static AbstractBulkEditorInput getInstance() {
82
		if (instance == null) {
83
			instance = new AgentEditorInput();
84
		}
85
		return instance;
86
	}
87

    
88
	/* (non-Javadoc)
89
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
90
	 */
91
	/** {@inheritDoc} */
92
	@Override
93
	public boolean isMergingEnabled() {
94
		return false;
95
	}
96

    
97
	/** {@inheritDoc} */
98
	@Override
99
	public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
100
		return CdmStore.findTeamOrPersons(configurator);
101
	}
102

    
103
	/** {@inheritDoc} */
104
	@Override
105
	public AgentBase loadEntity(UUID uuid) {
106
		List<String> propertyPaths = Arrays.asList(new String[]{}); 
107
		return CdmStore.getAgentService().load(uuid, propertyPaths);
108
	}
109

    
110
	/** {@inheritDoc} */
111
	public boolean delete(Object entity) {
112
		return CdmStore.getAgentService().delete((AgentBase) entity) != null;			
113
	}
114

    
115
	/** {@inheritDoc} */
116
	public boolean save(Object entity) {
117
		return CdmStore.getAgentService().saveOrUpdate((AgentBase) entity) != null;
118
	}
119
}
(2-2/6)