Revision cfddafff
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java | ||
---|---|---|
679 | 679 |
} |
680 | 680 |
else if (element instanceof QuantitativeData) { |
681 | 681 |
String quantitativeDataText = getQuantitativeDataText((QuantitativeData) element); |
682 |
if(quantitativeDataText==null || quantitativeDataText.isEmpty()){
|
|
682 |
if(isBlank(quantitativeDataText)){
|
|
683 | 683 |
quantitativeDataText = NO_LABEL_STRING; |
684 | 684 |
} |
685 | 685 |
return quantitativeDataText; |
... | ... | |
691 | 691 |
return getElementText((TextData) element); |
692 | 692 |
} |
693 | 693 |
else if (element instanceof TemporalData) { |
694 |
return getTemporalDataText((TemporalData) element); |
|
694 |
String lable = getTemporalDataText((TemporalData) element); |
|
695 |
if(isBlank(lable)){ |
|
696 |
lable = NO_LABEL_STRING; |
|
697 |
} |
|
698 |
return lable; |
|
695 | 699 |
} |
696 | 700 |
else{ |
697 | 701 |
return element.toString(); |
... | ... | |
699 | 703 |
} |
700 | 704 |
|
701 | 705 |
private static String getTemporalDataText(TemporalData element) { |
702 |
ExtendedTimePeriod period = element.getPeriod(); |
|
703 |
Partial end = period.getEnd()==null?null:period.getEnd().without(DateTimeFieldType.year()); |
|
704 |
Partial extremeEnd = period.getExtremeEnd()== null? null: period.getExtremeEnd().without(DateTimeFieldType.year()); |
|
706 |
String result = ""; |
|
705 | 707 |
|
706 |
Partial start = period.getStart()==null? null: period.getStart().without(DateTimeFieldType.year()); |
|
707 |
Partial extremeStart = period.getExtremeStart()==null? null : period.getExtremeStart().without(DateTimeFieldType.year()); |
|
708 |
ExtendedTimePeriod period = element.getPeriod(); |
|
708 | 709 |
|
709 |
String result = ""; |
|
710 |
DateTimeFormatter formatter = ExtendedTimePeriodPartialFormatter.NewInstance(); |
|
711 |
if (extremeStart != null){ |
|
712 |
result = "(" + extremeStart.toString(formatter) +"-)"; |
|
713 |
} |
|
714 |
if (start != null){ |
|
715 |
result += start.toString(formatter); |
|
716 |
} |
|
717 |
if (end != null){ |
|
718 |
result += "-" + end.toString(formatter); |
|
710 |
if(period != null){ |
|
711 |
Partial end = period.getEnd()==null? null :period.getEnd().without(DateTimeFieldType.year()); |
|
712 |
Partial extremeEnd = period.getExtremeEnd()== null? null: period.getExtremeEnd().without(DateTimeFieldType.year()); |
|
713 |
|
|
714 |
Partial start = period.getStart()==null? null: period.getStart().without(DateTimeFieldType.year()); |
|
715 |
Partial extremeStart = period.getExtremeStart()==null? null : period.getExtremeStart().without(DateTimeFieldType.year()); |
|
716 |
|
|
717 |
DateTimeFormatter formatter = ExtendedTimePeriodPartialFormatter.NewInstance(); |
|
718 |
if (extremeStart != null){ |
|
719 |
result = "(" + extremeStart.toString(formatter) +"-)"; |
|
720 |
} |
|
721 |
if (start != null){ |
|
722 |
result += start.toString(formatter); |
|
723 |
} |
|
724 |
if (end != null){ |
|
725 |
result += "-" + end.toString(formatter); |
|
726 |
} |
|
727 |
|
|
728 |
if (extremeEnd != null){ |
|
729 |
result += "(-" + extremeEnd.toString(formatter)+")"; |
|
730 |
} |
|
719 | 731 |
} |
720 | 732 |
|
721 |
if (extremeEnd != null){ |
|
722 |
result += "(-" + extremeEnd.toString(formatter)+")"; |
|
723 |
} |
|
724 | 733 |
return result; |
725 | 734 |
|
726 | 735 |
// return element.getPeriod().toString(); |
Also available in: Unified diff
ref #8990 fix NPE in getTemporalDataText (cont.)