Revision 233a8fe2
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.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 |
*/ |
... | ... | |
36 | 36 |
public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> { |
37 | 37 |
|
38 | 38 |
/** |
39 |
*
|
|
39 |
* |
|
40 | 40 |
*/ |
41 | 41 |
private static final long serialVersionUID = 3806243517765126749L; |
42 | 42 |
|
43 | 43 |
/** Constant <code>ID="bulkeditor.input.reference"</code> */ |
44 | 44 |
public static final String ID = "bulkeditor.input.reference"; |
45 |
|
|
45 |
|
|
46 | 46 |
private static ReferenceEditorInput instance; |
47 | 47 |
|
48 | 48 |
/** |
... | ... | |
53 | 53 |
public static String getID() { |
54 | 54 |
return ID; |
55 | 55 |
} |
56 |
|
|
56 |
|
|
57 | 57 |
/* (non-Javadoc) |
58 | 58 |
* @see org.eclipse.ui.IEditorInput#getName() |
59 | 59 |
*/ |
... | ... | |
62 | 62 |
* |
63 | 63 |
* @return a {@link java.lang.String} object. |
64 | 64 |
*/ |
65 |
public String getName() { |
|
65 |
@Override |
|
66 |
public String getName() { |
|
66 | 67 |
return BulkEditorInputType.REFERENCE.label; |
67 | 68 |
} |
68 | 69 |
|
... | ... | |
74 | 75 |
* |
75 | 76 |
* @return a {@link java.lang.String} object. |
76 | 77 |
*/ |
77 |
public String getToolTipText() { |
|
78 |
@Override |
|
79 |
public String getToolTipText() { |
|
78 | 80 |
return getName(); |
79 | 81 |
} |
80 | 82 |
|
... | ... | |
98 | 100 |
public boolean isMergingEnabled() { |
99 | 101 |
return true; |
100 | 102 |
} |
101 |
|
|
103 |
|
|
102 | 104 |
/* (non-Javadoc) |
103 | 105 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMarkerTypeEditingEnabled(eu.etaxonomy.cdm.model.common.MarkerType) |
104 | 106 |
*/ |
... | ... | |
111 | 113 |
return super.isMarkerTypeEditingEnabled(markerType); |
112 | 114 |
} |
113 | 115 |
|
114 |
|
|
116 |
|
|
115 | 117 |
/** {@inheritDoc} */ |
116 | 118 |
@Override |
117 | 119 |
public List listEntities(IIdentifiableEntityServiceConfigurator configurator) { |
118 | 120 |
return CdmStore.getSearchManager().findReferences(configurator); |
119 | 121 |
} |
120 |
|
|
122 |
|
|
121 | 123 |
// Entity persistence |
122 |
|
|
124 |
|
|
123 | 125 |
/** {@inheritDoc} */ |
124 | 126 |
@Override |
125 | 127 |
public Reference loadEntity(UUID entityUuid) { |
126 |
List<String> propertyPaths = Arrays.asList(new String[]{"*", "inReference.*", "authorTeam.*"});
|
|
128 |
List<String> propertyPaths = Arrays.asList(new String[]{"*", "inReference.*", "authorTeam.*"}); |
|
127 | 129 |
return CdmStore.getService(IReferenceService.class).load(entityUuid, propertyPaths); |
128 | 130 |
} |
129 | 131 |
|
130 |
/** {@inheritDoc}
|
|
132 |
/** {@inheritDoc} |
|
131 | 133 |
* @throws ReferencedObjectUndeletableException */ |
132 |
public boolean delete(Reference entity) throws ReferencedObjectUndeletableException { |
|
134 |
@Override |
|
135 |
public boolean delete(Reference entity) throws ReferencedObjectUndeletableException { |
|
133 | 136 |
return CdmStore.getService(IReferenceService.class).delete(entity) != null; |
134 | 137 |
} |
135 | 138 |
|
136 | 139 |
/** {@inheritDoc} */ |
137 |
public boolean save(Reference entity) { |
|
138 |
return CdmStore.getService(IReferenceService.class).saveOrUpdate(entity) != null; |
|
140 |
@Override |
|
141 |
public boolean save(Reference entity) { |
|
142 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
143 |
return CdmStore.getService(IReferenceService.class).merge(entity) != null; |
|
144 |
} else { |
|
145 |
return CdmStore.getService(IReferenceService.class).saveOrUpdate(entity) != null; |
|
146 |
} |
|
139 | 147 |
} |
140 | 148 |
|
141 | 149 |
/* (non-Javadoc) |
... | ... | |
145 | 153 |
protected IEntityCreator<Reference> createEntityCreator() { |
146 | 154 |
return new ReferenceCreator(); |
147 | 155 |
} |
148 |
|
|
156 |
|
|
149 | 157 |
/* (non-Javadoc) |
150 | 158 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getSortProviders() |
151 | 159 |
*/ |
152 | 160 |
@Override |
153 | 161 |
public List<IBulkEditorSortProvider<Reference>> getSortProviders() { |
154 | 162 |
List<IBulkEditorSortProvider<Reference>> sortProviders = super.getSortProviders(); |
155 |
|
|
163 |
|
|
156 | 164 |
sortProviders.add(0, new IdentifiableEntitySortProvider<Reference>()); |
157 | 165 |
sortProviders.add(1, new ReferenceSortProvider()); |
158 |
|
|
166 |
|
|
159 | 167 |
return sortProviders; |
160 | 168 |
} |
161 |
|
|
169 |
|
|
162 | 170 |
/* (non-Javadoc) |
163 | 171 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object) |
164 | 172 |
*/ |
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