Project

General

Profile

« Previous | Next » 

Revision 3be6ef3e

Added by Niels Hoffmann over 13 years ago

performed javacscript:fix and worked on documentation

View differences:

taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
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
 * @author p.ciardelli
24
 * @created 25.06.2009
25
 * @version 1.0
26
 */
27
public class AgentEditorInput extends AbstractBulkEditorInput<AgentBase> {
28

  
29
	public static final String ID = "bulkeditor.input.author";
30
	
31
	private static AgentEditorInput instance;
32

  
33
	/**
34
	 * @param sourceBean
35
	 */
36
	public AgentEditorInput() {
37
		super(new Object());
38
	}
39

  
40
	/**
41
	 * @return the iD
42
	 */
43
	public static String getID() {
44
		return ID;
45
	}
46
	
47
	/* (non-Javadoc)
48
	 * @see org.eclipse.ui.IEditorInput#getName()
49
	 */
50
	public String getName() {
51
		return BulkEditorInputType.AGENT.label;
52
	}
53

  
54
	/* (non-Javadoc)
55
	 * @see org.eclipse.ui.IEditorInput#getToolTipText()
56
	 */
57
	public String getToolTipText() {
58
		return getName();
59
	}
60

  
61
	/**
62
	 * @return
63
	 */
64
	public static AbstractBulkEditorInput getInstance() {
65
		if (instance == null) {
66
			instance = new AgentEditorInput();
67
		}
68
		return instance;
69
	}
70

  
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
73
	 */
74
	@Override
75
	public boolean isMergingEnabled() {
76
		return false;
77
	}
78

  
79
	@Override
80
	public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
81
		return CdmStore.findTeamOrPersons(configurator);
82
	}
83

  
84
	@Override
85
	public AgentBase loadEntity(UUID uuid) {
86
		List<String> propertyPaths = Arrays.asList(new String[]{}); 
87
		return CdmStore.getAgentService().load(uuid, propertyPaths);
88
	}
89

  
90
	public boolean delete(Object entity) {
91
		return CdmStore.getAgentService().delete((AgentBase) entity) != null;			
92
	}
93

  
94
	public boolean save(Object entity) {
95
		return CdmStore.getAgentService().saveOrUpdate((AgentBase) entity) != null;
96
	}
97
}
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
}

Also available in: Unified diff