* @return a {@link java.lang.String} object.
*/
public static String getObjectDescription(Object element) {
+ String resultString = null;
if (element instanceof IdentifiableEntity) {
try{
- return ((IdentifiableEntity) element).getTitleCache();
+ resultString = ((IdentifiableEntity) element).getTitleCache();
}catch(LazyInitializationException e){
String result = "No Session to initialize title cache for IdentifiableEntity";
MessagingUtils.error(DescriptionHelper.class, result, e);
- return "TODO: " + result;
+ resultString = "TODO: " + result;
}
}else if (element instanceof OriginalSourceBase) {
try{
// throw new IllegalStateException("Unknown ISourceable object for given OriginalSourceBase");
// }
- return CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle});
+ resultString = CdmUtils.concat("; ", new String[]{originalSource.getIdNamespace(), originalSource.getIdInSource(), sourceObjectTitle});
}catch(LazyInitializationException e){
String result = "Error initializing title cache for ISourceable of an OriginalSourceBase";
MessagingUtils.error(DescriptionHelper.class, result, e);
- return "TODO: " + result;
+ resultString = "TODO: " + result;
}
}else if (element instanceof LanguageStringBase) {
- return ((LanguageStringBase) element).getText();
+ resultString = ((LanguageStringBase) element).getText();
}else if (element instanceof DescriptionElementBase) {
- return getCache((DescriptionElementBase) element);
+ resultString = getCache((DescriptionElementBase) element);
}else if (element instanceof RelationshipBase<?, ?, ?>) {
- return getCache((RelationshipBase<?, ?, ?>) element);
+ resultString = getCache((RelationshipBase<?, ?, ?>) element);
}else if (element instanceof TypeDesignationBase<?>) {
- return getCache((TypeDesignationBase<?>) element);
+ resultString = getCache((TypeDesignationBase<?>) element);
}else if (element instanceof HomotypicalGroup) {
- return getCache((HomotypicalGroup) element);
+ resultString = getCache((HomotypicalGroup) element);
}else if (element instanceof TaxonNode) {
- return getCache((TaxonNode) element);
+ resultString = getCache((TaxonNode) element);
}else if (element instanceof DeterminationEvent) {
- return getCache((DeterminationEvent) element);
+ resultString = getCache((DeterminationEvent) element);
}else if (element instanceof Marker) {
Marker marker = (Marker) element;
MarkerType type = marker.getMarkerType();
- return (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")";
+ resultString = (type == null ? "- no marker type -" : marker.getMarkerType().getLabel()) + " (" + marker.getFlag() + ")";
}else if (element instanceof User) {
User user = (User) element;
- return user.getUsername();
+ resultString = user.getUsername();
}else if (element instanceof Group) {
Group group = (Group) element;
- return group.getName();
+ resultString = group.getName();
}else if (element instanceof KeyStatement) {
KeyStatement keyStatement = (KeyStatement) element;
- return getCache(keyStatement);
+ resultString = getCache(keyStatement);
}else{
// TODO write return texts for HomotypicalGroup, etc.
- return element.toString();
+ resultString = element.toString();
+ }
+
+ if (resultString == null){
+ resultString = element.toString();
}
+ return resultString;
}