Revision 3a5a8583
Added by Katja Luther about 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java | ||
---|---|---|
210 | 210 |
* @return a {@link java.lang.String} object. |
211 | 211 |
*/ |
212 | 212 |
public static String getObjectDescription(Object element) { |
213 |
String resultString = null; |
|
213 | 214 |
if (element instanceof IdentifiableEntity) { |
214 | 215 |
try{ |
215 |
return ((IdentifiableEntity) element).getTitleCache();
|
|
216 |
resultString = ((IdentifiableEntity) element).getTitleCache();
|
|
216 | 217 |
}catch(LazyInitializationException e){ |
217 | 218 |
String result = "No Session to initialize title cache for IdentifiableEntity"; |
218 | 219 |
MessagingUtils.error(DescriptionHelper.class, result, e); |
219 |
return "TODO: " + result;
|
|
220 |
resultString = "TODO: " + result;
|
|
220 | 221 |
} |
221 | 222 |
}else if (element instanceof OriginalSourceBase) { |
222 | 223 |
try{ |
... | ... | |
232 | 233 |
// throw new IllegalStateException("Unknown ISourceable object for given OriginalSourceBase"); |
233 | 234 |
// } |
234 | 235 |
|
235 |
return CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle});
|
|
236 |
resultString = CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle});
|
|
236 | 237 |
}catch(LazyInitializationException e){ |
237 | 238 |
String result = "Error initializing title cache for ISourceable of an OriginalSourceBase"; |
238 | 239 |
MessagingUtils.error(DescriptionHelper.class, result, e); |
239 |
return "TODO: " + result;
|
|
240 |
resultString = "TODO: " + result;
|
|
240 | 241 |
} |
241 | 242 |
}else if (element instanceof LanguageStringBase) { |
242 |
return ((LanguageStringBase) element).getText();
|
|
243 |
resultString = ((LanguageStringBase) element).getText();
|
|
243 | 244 |
}else if (element instanceof DescriptionElementBase) { |
244 |
return getCache((DescriptionElementBase) element);
|
|
245 |
resultString = getCache((DescriptionElementBase) element);
|
|
245 | 246 |
}else if (element instanceof RelationshipBase<?, ?, ?>) { |
246 |
return getCache((RelationshipBase<?, ?, ?>) element);
|
|
247 |
resultString = getCache((RelationshipBase<?, ?, ?>) element);
|
|
247 | 248 |
}else if (element instanceof TypeDesignationBase<?>) { |
248 |
return getCache((TypeDesignationBase<?>) element);
|
|
249 |
resultString = getCache((TypeDesignationBase<?>) element);
|
|
249 | 250 |
}else if (element instanceof HomotypicalGroup) { |
250 |
return getCache((HomotypicalGroup) element);
|
|
251 |
resultString = getCache((HomotypicalGroup) element);
|
|
251 | 252 |
}else if (element instanceof TaxonNode) { |
252 |
return getCache((TaxonNode) element);
|
|
253 |
resultString = getCache((TaxonNode) element);
|
|
253 | 254 |
}else if (element instanceof DeterminationEvent) { |
254 |
return getCache((DeterminationEvent) element);
|
|
255 |
resultString = getCache((DeterminationEvent) element);
|
|
255 | 256 |
}else if (element instanceof Marker) { |
256 | 257 |
Marker marker = (Marker) element; |
257 | 258 |
MarkerType type = marker.getMarkerType(); |
258 |
return (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")";
|
|
259 |
resultString = (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")";
|
|
259 | 260 |
}else if (element instanceof User) { |
260 | 261 |
User user = (User) element; |
261 |
return user.getUsername();
|
|
262 |
resultString = user.getUsername();
|
|
262 | 263 |
}else if (element instanceof Group) { |
263 | 264 |
Group group = (Group) element; |
264 |
return group.getName();
|
|
265 |
resultString = group.getName();
|
|
265 | 266 |
}else if (element instanceof KeyStatement) { |
266 | 267 |
KeyStatement keyStatement = (KeyStatement) element; |
267 |
return getCache(keyStatement);
|
|
268 |
resultString = getCache(keyStatement);
|
|
268 | 269 |
}else{ |
269 | 270 |
// TODO write return texts for HomotypicalGroup, etc. |
270 |
return element.toString(); |
|
271 |
resultString = element.toString(); |
|
272 |
} |
|
273 |
|
|
274 |
if (resultString == null){ |
|
275 |
resultString = element.toString(); |
|
271 | 276 |
} |
277 |
return resultString; |
|
272 | 278 |
} |
273 | 279 |
|
274 | 280 |
|
Also available in: Unified diff
avoid empty lables in referencing objects view