+ String typeLabel = null;
+ if (status != null){
+ Representation typeRepr = status.getPreferredRepresentation(CdmStore.getDefaultLanguage());
+ if (typeRepr != null){
+ typeLabel = typeRepr.getAbbreviatedLabel();
+ }
+ if (StringUtils.isBlank(typeLabel) && typeRepr != null){
+ typeLabel = typeRepr.getLabel();
+ }
+ if (StringUtils.isBlank(typeLabel) ){
+ typeLabel = status.getSymbol();
+ }
+ if (StringUtils.isBlank(typeLabel)){
+ typeLabel = status.getTitleCache();
+ }
+ }
+ if (StringUtils.isBlank(typeLabel)){
+ typeLabel = status.getTitleCache();
+ typeLabel = "->";
+ }
+ String fromString = "";
+ for (TaxonNameBase<?,?> name : from){
+ CdmUtils.concat(",", fromString, name.getTitleCache());
+ }
+ String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString,
+ typeLabel, to == null? null : to.getTitleCache()});
+ return result;
+ }
+
+ private static String getCache(RelationshipBase<?, ?, ?> rel) {
+ rel = CdmBase.deproxy(rel);
+ RelationshipTermBase<?> type = rel.getType();
+ IdentifiableEntity<?> from;
+ IdentifiableEntity<?> to;
+ if (rel.isInstanceOf(SynonymRelationship.class)){
+ from = ((SynonymRelationship)rel).getSynonym();
+ to = ((SynonymRelationship)rel).getAcceptedTaxon();
+ }else if (rel.isInstanceOf(NameRelationship.class)){
+ from = ((NameRelationship)rel).getFromName();
+ to = ((NameRelationship)rel).getToName();
+ }else if (rel.isInstanceOf(HybridRelationship.class)){
+ from = ((HybridRelationship)rel).getParentName();
+ to = ((HybridRelationship)rel).getHybridName();
+ }else if (rel.isInstanceOf(TaxonRelationship.class)){
+ from = ((TaxonRelationship)rel).getFromTaxon();
+ to = ((TaxonRelationship)rel).getToTaxon();
+ }else{
+ try {
+ Method fromMethod = rel.getClass().getMethod("getRelatedFrom");
+ Method toMethod = rel.getClass().getMethod("getRelatedFrom");
+ fromMethod.setAccessible(true);
+ toMethod.setAccessible(true);
+ from = (IdentifiableEntity<?>)fromMethod.invoke(rel);
+ to = (IdentifiableEntity<?>)toMethod.invoke(rel);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (SecurityException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+ String typeLabel = null;
+ if (type != null){
+ Representation typeRepr = type.getPreferredRepresentation(CdmStore.getDefaultLanguage());
+ if (typeRepr != null){
+ typeLabel = typeRepr.getAbbreviatedLabel();
+ }
+ if (StringUtils.isBlank(typeLabel) && typeRepr != null){
+ typeLabel = typeRepr.getLabel();
+ }
+ if (StringUtils.isBlank(typeLabel) ){
+ typeLabel = type.getSymbol();
+ }
+ if (StringUtils.isBlank(typeLabel)){
+ typeLabel = type.getTitleCache();
+ }
+ }
+ if (StringUtils.isBlank(typeLabel)){
+ typeLabel = type.getTitleCache();
+ typeLabel = "->";
+ }
+ 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 = "";
+ for (TaxonNameBase<?,?> tnb : hg.getTypifiedNames()){
+ result = CdmUtils.concat(", ", result, tnb.getTitleCache());
+ }
+ if (StringUtils.isBlank(result)){
+ result = "No typified names";
+ }
+ return result;