Revision ce5bca3b
Added by Andreas Müller almost 3 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/agent/PersonDefaultCacheStrategy.java | ||
---|---|---|
76 | 76 |
public String getTitleCache(Person person) { |
77 | 77 |
String result = ""; |
78 | 78 |
if (isNotBlank(person.getFamilyName() ) ){ |
79 |
result = person.getFamilyName(); |
|
79 |
result = person.getFamilyName().trim();
|
|
80 | 80 |
result = addInitials(result, person); |
81 | 81 |
return result; |
82 | 82 |
}else{ |
83 | 83 |
result = person.getNomenclaturalTitle(); |
84 | 84 |
if (isNotBlank(result)){ |
85 |
return result; |
|
86 |
} |
|
87 |
result = addInitials("", person); |
|
88 |
if (isNotBlank(result)){ |
|
89 |
return result; |
|
85 |
return result.trim(); |
|
86 |
}else{ |
|
87 |
result = addInitials("", person); |
|
88 |
if (isNotBlank(result)){ |
|
89 |
return result.trim(); |
|
90 |
} |
|
90 | 91 |
} |
91 | 92 |
} |
92 | 93 |
return person.toString(); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/agent/PersonDefaultCacheStrategyTest.java | ||
---|---|---|
108 | 108 |
@Test |
109 | 109 |
public final void testGetTitleCache(){ |
110 | 110 |
Person pers = Person.NewInstance(); |
111 |
pers.setFamilyName("Last");
|
|
111 |
pers.setFamilyName("Last "); //family should be trimmed during titleCache generation
|
|
112 | 112 |
pers.setInitials("E.M."); |
113 | 113 |
|
114 | 114 |
String expected = "Last, E.M."; |
Also available in: Unified diff
trim family name for titleCache