import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
*/
public static String getCache(DescriptionElementBase element,
Language language) {
-
+
String mainElementLabel= null;
DescriptionBase<?> descr = element.getInDescription();
+ descr = CdmBase.deproxy(descr, DescriptionBase.class);
+
if (descr != null){
if (descr.isInstanceOf(TaxonDescription.class)){
Taxon taxon = CdmBase.deproxy(descr, TaxonDescription.class).getTaxon();
}
}
}
-
+
+
String cache = null;
if (element instanceof TextData) {
- cache = ((TextData) element).getText(language);
+ //cache = ((TextData) element).getText(language);
+ cache = "Text Data";
}
if (element instanceof CommonTaxonName) {
cache = ((CommonTaxonName) element).getName();
* @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{
OriginalSourceBase<?> originalSource = (OriginalSourceBase<?>) element;
// ISourceable sourcedObject = originalSource.getSourcedObj();
- //due to #5743 the bidirectionality for sourced object had to be removed
+ //due to #5743 the bidirectionality for sourced object had to be removed
String sourceObjectTitle = "sourced object data not available (#5743)";
// if(sourcedObject instanceof IIdentifiableEntity){
// sourceObjectTitle = ((IdentifiableEntity) sourcedObject).getTitleCache();
// 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();
- }else{
+ resultString = group.getName();
+ }else if (element instanceof KeyStatement) {
+ KeyStatement keyStatement = (KeyStatement) element;
+ 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;
}
if (StringUtils.isBlank(taxonStr)){
taxonStr = "no or unlabled taxon";
}
-
-
+
+
//unit
SpecimenOrObservationBase<?> unit = detEvent.getIdentifiedUnit();
String unitStr;
}else{
unitStr = "no unit";
}
-
+
String result = CdmUtils.concat(" determined as ", unitStr, taxonStr);
return result;
}
}
result = CdmUtils.concat(": ", result, parentStr);
-
+
return result;
}
if (designation.isInstanceOf(SpecimenTypeDesignation.class)){
to = ((SpecimenTypeDesignation)designation).getTypeSpecimen();
}else if (designation.isInstanceOf(NameTypeDesignation.class)){
- to = ((NameTypeDesignation)designation).getTypeName();
+ to = ((NameTypeDesignation)designation).getTypeName();
}else{
throw new RuntimeException("Type Designation class not supported: " + designation.getClass().getName());
}
for (TaxonNameBase<?,?> name : from){
CdmUtils.concat(",", fromString, name.getTitleCache());
}
- String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString,
+ String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString,
typeLabel, to == null? null : to.getTitleCache()});
return result;
}
if (StringUtils.isBlank(typeLabel)){
typeLabel = "->";
}
- String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(),
+ String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(),
typeLabel, to == null? null : to.getTitleCache()});
return result;
}
-
+
private static String getCache(HomotypicalGroup hg) {
String result = "";
return result;
}
+ private static String getCache(KeyStatement ks) {
+ String result = "";
+
+ result = "KeyStatement";
+
+ return result;
+ }
+
/**
* <p>getObjectClassname</p>
*