cleanup
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / format / taxon / TaxonRelationshipFormatter.java
index 986ed9987a9c44f7e516fcdeeef306e49dc51a52..d4671949f5da5eb71e71401eab75ffc52303b4bb 100644 (file)
@@ -51,6 +51,7 @@ public class TaxonRelationshipFormatter {
     private static final String AUCT = "auct.";
     private static final String SENSU_SEPARATOR = " sensu ";
     private static final String SEC_SEPARATOR = " sec. ";
+    private static final String PRO_PARTE_SEPARATOR = ", ";
     private static final String DETAIL_SEPARATOR = ": ";
     private static final String INVERT_SYMBOL = "<-"; //TODO
     private static final String UNDEFINED_SYMBOL = "??";  //TODO
@@ -163,6 +164,20 @@ public class TaxonRelationshipFormatter {
             }
         }
 
+        //p.p.
+        if (isMisapplied) {
+            if (isProParteMAN(type, inverse)) {
+                builder.addSeparator(PRO_PARTE_SEPARATOR);
+                symbol = "p.p.";
+                builder.add(TagEnum.symbol, symbol);
+            } else if (isPartialMAN(type, inverse)) {
+                builder.addSeparator(PRO_PARTE_SEPARATOR);
+                symbol = "part.";
+                builder.add(TagEnum.symbol, symbol);
+            }
+        }
+
+        //rel sec
         List<TaggedText> relSecTags = getReferenceTags(taxonRelationship.getCitation(),
                 taxonRelationship.getCitationMicroReference(),true);
         if (!relSecTags.isEmpty()){
@@ -239,6 +254,10 @@ public class TaxonRelationshipFormatter {
         //symbol
         String symbol = inverse? type.getInverseSymbol():type.getSymbol();
         if (isNotBlank(symbol)){
+            //handle p.p. MAN specific #10082
+            if (isProParteMAN(type, inverse) || isPartialMAN(type, inverse)) {
+                return TaxonRelationshipType.MISAPPLIED_NAME_FOR().getInverseSymbol();
+            }
             return symbol;
         }
 
@@ -276,6 +295,14 @@ public class TaxonRelationshipFormatter {
         return UNDEFINED_SYMBOL;
     }
 
+    private boolean isPartialMAN(TaxonRelationshipType type, boolean inverse) {
+        return inverse && type.getUuid().equals(TaxonRelationshipType.uuidPartialMisappliedNameFor);
+    }
+
+    private boolean isProParteMAN(TaxonRelationshipType type, boolean inverse) {
+        return inverse && type.getUuid().equals(TaxonRelationshipType.uuidProParteMisappliedNameFor);
+    }
+
     private boolean isNotBlank(String str) {
         return StringUtils.isNotBlank(str);
     }