performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / NameEditorInput.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
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 org.apache.log4j.Logger;
18
19 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
20 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
21 import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
22 import eu.etaxonomy.taxeditor.store.CdmStore;
23
24 /**
25 * <p>NameEditorInput class.</p>
26 *
27 * @author p.ciardelli
28 * @created 20.08.2009
29 * @version 1.0
30 */
31 public class NameEditorInput extends AbstractBulkEditorInput<TaxonNameBase> {
32 private static final Logger logger = Logger
33 .getLogger(NameEditorInput.class);
34
35 private static NameEditorInput instance;
36
37 /**
38 * <p>Constructor for NameEditorInput.</p>
39 */
40 public NameEditorInput() {
41 super(new Object());
42 }
43
44 /** Constant <code>ID="bulkeditor.input.name"</code> */
45 public static final String ID = "bulkeditor.input.name";
46
47 /**
48 * <p>Getter for the field <code>instance</code>.</p>
49 *
50 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
51 */
52 public static AbstractBulkEditorInput getInstance() {
53 if (instance == null) {
54 instance = new NameEditorInput();
55 }
56 return instance;
57 }
58
59 /* (non-Javadoc)
60 * @see org.eclipse.ui.IEditorInput#getName()
61 */
62 /**
63 * <p>getName</p>
64 *
65 * @return a {@link java.lang.String} object.
66 */
67 public String getName() {
68 return BulkEditorInputType.NAME.label;
69 }
70
71 /* (non-Javadoc)
72 * @see org.eclipse.ui.IEditorInput#getToolTipText()
73 */
74 /**
75 * <p>getToolTipText</p>
76 *
77 * @return a {@link java.lang.String} object.
78 */
79 public String getToolTipText() {
80 return getName();
81 }
82
83 /**
84 * <p>getID</p>
85 *
86 * @return a {@link java.lang.Object} object.
87 */
88 public static Object getID() {
89 return ID;
90 }
91
92 /* (non-Javadoc)
93 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
94 */
95 /** {@inheritDoc} */
96 @Override
97 public boolean isMergingEnabled() {
98 return false;
99 }
100
101 /** {@inheritDoc} */
102 @Override
103 public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
104 return CdmStore.findNames(configurator);
105 }
106
107 /** {@inheritDoc} */
108 @Override
109 public TaxonNameBase loadEntity(UUID uuid) {
110 List<String> propertyPaths = Arrays.asList(new String[]{});
111 return CdmStore.getNameService().load(uuid, propertyPaths);
112 }
113
114 /** {@inheritDoc} */
115 public boolean delete(Object entity) {
116 return CdmStore.getNameService().delete((TaxonNameBase) entity) != null;
117 }
118
119 /** {@inheritDoc} */
120 public boolean save(Object entity) {
121 return CdmStore.getNameService().saveOrUpdate((TaxonNameBase) entity) != null;
122 }
123
124 }