commit d0b0c36beac38ff14b15807067b3bb93d1f83d93
Author: Andreas Müller <a.mueller@bgbm.org>
Date:   Thu Apr 28 14:40:39 2016 +0200

    Add getter/setter/termloader for (inverse)symbol, fix update script
    #5734

diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
index 03a69c11b0..e7e95da086 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
@@ -179,9 +179,7 @@ public abstract class DefinedTermBase<T extends DefinedTermBase> extends TermBas
 
 //***************************** CONSTRUCTOR *******************************************/
 
-
-
-	//for javassit only
+    //for javassit only
     @Deprecated
     protected DefinedTermBase(){};
 
@@ -328,6 +326,14 @@ public abstract class DefinedTermBase<T extends DefinedTermBase> extends TermBas
           this.vocabulary = newVocabulary;
     }
 
+
+    public String getSymbol() {
+        return symbol;
+    }
+    public void setSymbol(String symbol) {
+        this.symbol = symbol;
+    }
+
 //******************************* METHODS ******************************************************/
 
 
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipTermBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipTermBase.java
index 5aca2c8949..52665145a0 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipTermBase.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipTermBase.java
@@ -168,7 +168,7 @@ public abstract class RelationshipTermBase<T extends RelationshipTermBase> exten
 	 * @param languages
 	 * @return
 	 */
-	public Representation getPreferredInverseRepresentation(List<Language> languages) {
+    public Representation getPreferredInverseRepresentation(List<Language> languages) {
 		Representation repr = null;
 		if(languages != null){
 			for(Language language : languages) {
@@ -224,6 +224,15 @@ public abstract class RelationshipTermBase<T extends RelationshipTermBase> exten
 		return this.getInverseRepresentation(lang).getDescription();
 	}
 
+    public String getInverseSymbol() {
+        return inverseSymbol;
+    }
+    public void setInverseSymbol(String inverseSymbol) {
+        this.inverseSymbol = inverseSymbol;
+    }
+
+//**************** CSV *************************/
+
 	@Override
 	public T readCsvLine(Class<T> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {
 		T newInstance = super.readCsvLine(termClass, csvLine, terms, abbrevAsId);
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PresenceAbsenceTerm.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PresenceAbsenceTerm.java
index 0f211f3c70..1908407159 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PresenceAbsenceTerm.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PresenceAbsenceTerm.java
@@ -329,6 +329,7 @@ public class PresenceAbsenceTerm extends OrderedTermBase<PresenceAbsenceTerm> {
         newInstance.setAbsenceTerm(isAbsence);
 
         newInstance.getRepresentation(Language.DEFAULT()).setAbbreviatedLabel(abbreviatedLabel);
+        newInstance.setSymbol(abbreviatedLabel);
         return newInstance;
     }
 
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationshipType.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationshipType.java
index 6ce8a0cc46..cf187d9f05 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationshipType.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationshipType.java
@@ -10,6 +10,7 @@
 package eu.etaxonomy.cdm.model.taxon;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -22,6 +23,7 @@ import javax.xml.bind.annotation.XmlType;
 import org.apache.log4j.Logger;
 import org.hibernate.envers.Audited;
 
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
@@ -426,8 +428,13 @@ public class TaxonRelationshipType extends RelationshipTermBase<TaxonRelationshi
 		return getTermByUuid(uuidAllRelationships);
 	}
 
-//	@Override
-//	public TaxonRelationshipType readCsvLine(Class<TaxonRelationshipType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms) {
-//		return super.readCsvLine(termClass, csvLine, terms);
-//	}
+    @Override
+    public TaxonRelationshipType readCsvLine(Class<TaxonRelationshipType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {
+        TaxonRelationshipType newInstance = super.readCsvLine(termClass, csvLine, terms, abbrevAsId);
+
+        String inverseLabelAbbrev = csvLine.get(7).trim();
+        newInstance.setSymbol(newInstance.getIdInVocabulary());
+        newInstance.setInverseSymbol(inverseLabelAbbrev);
+        return newInstance;
+    }
 }
\ No newline at end of file
diff --git a/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java b/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java
index 8ce2e22b39..028b972daa 100644
--- a/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java
+++ b/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java
@@ -98,7 +98,7 @@ public class SchemaUpdater_36_40 extends SchemaUpdaterBase {
         stepList.add(step);
 
         stepName = "Update symbols for terms";
-        query = "UPDATE @@DefinedTermBase@@ SET symbol = idInVocabulary WHERE idInVocabulary <> ''";
+        query = "UPDATE @@DefinedTermBase@@ SET symbol = idInVocabulary WHERE idInVocabulary <> '' AND termType IN ('PAT','TRT')";
         step = SimpleSchemaUpdaterStep.NewNonAuditedInstance(stepName, query, -99);
         stepList.add(step);
 
@@ -111,11 +111,13 @@ public class SchemaUpdater_36_40 extends SchemaUpdaterBase {
         stepList.add(step);
 
         stepName = "Update symbols for terms";
-        query = "UPDATE DefinedTermBase dtb SET inverseSymbol = ( " +
-            " SELECT  r.abbreviatedlabel " +
-            " FROM RelationshipTermBase_inverseRepresentation MN " +
-                " INNER JOIN Representation r ON r.id = MN.inverserepresentations_id " +
-            " WHERE dtb.id = MN.DefinedTermBase_id AND r.abbreviatedlabel <> '' ) ";
+        query = "UPDATE DefinedTermBase dtb "
+            + "SET inverseSymbol = ( " +
+                " SELECT  r.abbreviatedlabel " +
+                " FROM RelationshipTermBase_inverseRepresentation MN " +
+                    " INNER JOIN Representation r ON r.id = MN.inverserepresentations_id " +
+                " WHERE dtb.id = MN.DefinedTermBase_id AND r.abbreviatedlabel <> '' ) "
+            + " WHERE termType IN ('PAT','TRT') ";
         step = SimpleSchemaUpdaterStep.NewNonAuditedInstance(stepName, query, -99);
         stepList.add(step);
 
