Revision f29baa52
Added by Patrick Plitzner over 10 years ago
- derivates now show the correct type (record basis) in the bulk editor
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.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 |
*/ |
... | ... | |
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
18 | 18 |
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator; |
19 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
19 | 20 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
20 | 21 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
21 | 22 |
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider; |
... | ... | |
31 | 32 |
* @version 1.0 |
32 | 33 |
*/ |
33 | 34 |
public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObservationBase> { |
34 |
|
|
35 |
|
|
35 | 36 |
/** |
36 |
*
|
|
37 |
* |
|
37 | 38 |
*/ |
38 | 39 |
private static final long serialVersionUID = 1014860873939989973L; |
39 | 40 |
|
... | ... | |
41 | 42 |
public static final String ID = "bulkeditor.input.occurrence"; |
42 | 43 |
|
43 | 44 |
private static OccurrenceEditorInput instance; |
44 |
|
|
45 |
|
|
45 | 46 |
/** |
46 | 47 |
* <p>Getter for the field <code>instance</code>.</p> |
47 | 48 |
* |
... | ... | |
53 | 54 |
} |
54 | 55 |
return instance; |
55 | 56 |
} |
56 |
|
|
57 |
|
|
57 | 58 |
/* (non-Javadoc) |
58 | 59 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator) |
59 | 60 |
*/ |
... | ... | |
70 | 71 |
/** {@inheritDoc} */ |
71 | 72 |
@Override |
72 | 73 |
protected SpecimenOrObservationBase loadEntity(UUID entityUuid) { |
73 |
List<String> propertyPaths = Arrays.asList(new String[]{});
|
|
74 |
List<String> propertyPaths = Arrays.asList(new String[]{}); |
|
74 | 75 |
return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths); |
75 | 76 |
} |
76 | 77 |
|
... | ... | |
82 | 83 |
* |
83 | 84 |
* @return a {@link java.lang.String} object. |
84 | 85 |
*/ |
85 |
public String getName() { |
|
86 |
@Override |
|
87 |
public String getName() { |
|
86 | 88 |
return BulkEditorInputType.OCCURRENCE.label; |
87 | 89 |
} |
88 | 90 |
|
... | ... | |
94 | 96 |
* |
95 | 97 |
* @return a {@link java.lang.String} object. |
96 | 98 |
*/ |
97 |
public String getToolTipText() { |
|
99 |
@Override |
|
100 |
public String getToolTipText() { |
|
98 | 101 |
return getName(); |
99 | 102 |
} |
100 |
|
|
103 |
|
|
104 |
/* (non-Javadoc) |
|
105 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object) |
|
106 |
*/ |
|
107 |
@Override |
|
108 |
public String getTypeText(Object entity) { |
|
109 |
if(HibernateProxyHelper.isInstanceOf(entity, SpecimenOrObservationBase.class)){ |
|
110 |
return ((SpecimenOrObservationBase) entity).getRecordBasis().getMessage(); |
|
111 |
} |
|
112 |
return super.getTypeText(entity); |
|
113 |
} |
|
114 |
|
|
101 | 115 |
/** |
102 | 116 |
* <p>getId</p> |
103 | 117 |
* |
... | ... | |
111 | 125 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object) |
112 | 126 |
*/ |
113 | 127 |
/** {@inheritDoc} */ |
114 |
public boolean delete(SpecimenOrObservationBase entity) { |
|
128 |
@Override |
|
129 |
public boolean delete(SpecimenOrObservationBase entity) { |
|
115 | 130 |
return CdmStore.getService(IOccurrenceService.class).delete(entity) != null; |
116 | 131 |
} |
117 | 132 |
|
... | ... | |
119 | 134 |
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object) |
120 | 135 |
*/ |
121 | 136 |
/** {@inheritDoc} */ |
122 |
public boolean save(SpecimenOrObservationBase entity) { |
|
137 |
@Override |
|
138 |
public boolean save(SpecimenOrObservationBase entity) { |
|
123 | 139 |
return CdmStore.getService(IOccurrenceService.class).save(entity) != null; |
124 | 140 |
} |
125 |
|
|
141 |
|
|
126 | 142 |
|
127 | 143 |
/* (non-Javadoc) |
128 | 144 |
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator() |
... | ... | |
138 | 154 |
@Override |
139 | 155 |
public List<IBulkEditorSortProvider<SpecimenOrObservationBase>> getSortProviders() { |
140 | 156 |
List<IBulkEditorSortProvider<SpecimenOrObservationBase>> sortProviders = super.getSortProviders(); |
141 |
|
|
157 |
|
|
142 | 158 |
sortProviders.add(0, new IdentifiableEntitySortProvider<SpecimenOrObservationBase>()); |
143 |
|
|
159 |
|
|
144 | 160 |
return sortProviders; |
145 | 161 |
} |
146 | 162 |
} |
Also available in: Unified diff