Revision 233a8fe2
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.bulkeditor.input; |
12 | 12 |
|
13 |
import java.util.Arrays; |
|
14 | 13 |
import java.util.List; |
15 |
import java.util.UUID; |
|
16 | 14 |
|
17 | 15 |
import eu.etaxonomy.cdm.api.service.INameService; |
18 | 16 |
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator; |
19 |
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException; |
|
20 | 17 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
21 | 18 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
22 | 19 |
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider; |
... | ... | |
34 | 31 |
public class NameEditorInput extends AbstractBulkEditorInput<TaxonNameBase> { |
35 | 32 |
|
36 | 33 |
/** |
37 |
*
|
|
34 |
* |
|
38 | 35 |
*/ |
39 | 36 |
private static final long serialVersionUID = -3085029575759626823L; |
40 | 37 |
private static NameEditorInput instance; |
41 | 38 |
|
42 | 39 |
/** Constant <code>ID="bulkeditor.input.name"</code> */ |
43 | 40 |
public static final String ID = "bulkeditor.input.name"; |
44 |
|
|
41 |
|
|
45 | 42 |
/** |
46 | 43 |
* <p>Getter for the field <code>instance</code>.</p> |
47 | 44 |
* |
... | ... | |
53 | 50 |
} |
54 | 51 |
return instance; |
55 | 52 |
} |
56 |
|
|
53 |
|
|
57 | 54 |
/* (non-Javadoc) |
58 | 55 |
* @see org.eclipse.ui.IEditorInput#getName() |
59 | 56 |
*/ |
... | ... | |
62 | 59 |
* |
63 | 60 |
* @return a {@link java.lang.String} object. |
64 | 61 |
*/ |
65 |
public String getName() { |
|
62 |
@Override |
|
63 |
public String getName() { |
|
66 | 64 |
return BulkEditorInputType.NAME.label; |
67 | 65 |
} |
68 | 66 |
|
... | ... | |
74 | 72 |
* |
75 | 73 |
* @return a {@link java.lang.String} object. |
76 | 74 |
*/ |
77 |
public String getToolTipText() { |
|
75 |
@Override |
|
76 |
public String getToolTipText() { |
|
78 | 77 |
return getName(); |
79 | 78 |
} |
80 | 79 |
|
... | ... | |
102 | 101 |
return CdmStore.getSearchManager().findNames(configurator); |
103 | 102 |
} |
104 | 103 |
|
105 |
/** {@inheritDoc}
|
|
104 |
/** {@inheritDoc} |
|
106 | 105 |
@Override |
107 | 106 |
public TaxonNameBase loadEntity(UUID uuid) { |
108 |
List<String> propertyPaths = Arrays.asList(new String[]{});
|
|
107 |
List<String> propertyPaths = Arrays.asList(new String[]{}); |
|
109 | 108 |
return CdmStore.getService(INameService.class).load(uuid, propertyPaths); |
110 | 109 |
} |
111 | 110 |
*/ |
112 |
/** {@inheritDoc}
|
|
111 |
/** {@inheritDoc} |
|
113 | 112 |
**/ |
114 |
public boolean delete(TaxonNameBase entity) { |
|
113 |
@Override |
|
114 |
public boolean delete(TaxonNameBase entity) { |
|
115 | 115 |
return CdmStore.getService(INameService.class).delete(entity) != null; |
116 | 116 |
} |
117 | 117 |
|
118 | 118 |
/** {@inheritDoc} */ |
119 |
public boolean save(TaxonNameBase entity) { |
|
120 |
return CdmStore.getService(INameService.class).saveOrUpdate(entity) != null; |
|
119 |
@Override |
|
120 |
public boolean save(TaxonNameBase entity) { |
|
121 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
122 |
return CdmStore.getService(INameService.class).merge(entity) != null; |
|
123 |
} else { |
|
124 |
return CdmStore.getService(INameService.class).saveOrUpdate(entity) != null; |
|
125 |
} |
|
121 | 126 |
} |
122 | 127 |
|
123 | 128 |
/* (non-Javadoc) |
... | ... | |
134 | 139 |
@Override |
135 | 140 |
public List<IBulkEditorSortProvider<TaxonNameBase>> getSortProviders() { |
136 | 141 |
List<IBulkEditorSortProvider<TaxonNameBase>> sortProviders = super.getSortProviders(); |
137 |
|
|
142 |
|
|
138 | 143 |
sortProviders.add(0, new IdentifiableEntitySortProvider<TaxonNameBase>()); |
139 |
|
|
144 |
|
|
140 | 145 |
return sortProviders; |
141 | 146 |
} |
142 |
|
|
147 |
|
|
143 | 148 |
/* (non-Javadoc) |
144 | 149 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object) |
145 | 150 |
*/ |
... | ... | |
150 | 155 |
} |
151 | 156 |
return super.getTypeText(entity); |
152 | 157 |
} |
153 |
|
|
158 |
|
|
154 | 159 |
/* (non-Javadoc) |
155 | 160 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase) |
156 | 161 |
*/ |
Also available in: Unified diff
#5012 Adding remoting session and updating save methods for Bulk Editor
Replace properties file with xml file
#5012 updates for making Bulk Editor remoting capable