commit e37a7b9633db3db83aadc0d7ef09663ea8b45448
Author: a.babadshanjan <a.babadshanjan@localhost>
Date:   Thu Sep 4 07:05:17 2008 +0000

diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/DataSet.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/DataSet.java
index af790c89d2..7f9e02f195 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/DataSet.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/DataSet.java
@@ -24,6 +24,7 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.Keyword;
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.common.MultilanguageSet;
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
 import eu.etaxonomy.cdm.model.common.RelationshipBase;
 import eu.etaxonomy.cdm.model.common.TermBase;
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipBase.java
index 0885a46f92..8a14788188 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipBase.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipBase.java
@@ -43,13 +43,11 @@ public abstract class RelationshipBase<FROM extends IRelated, TO extends IRelate
 	static Logger logger = Logger.getLogger(RelationshipBase.class);
 
 //  FIXME: TaxonBase.class does not cover TaxonNameBase which also implements IRelated.
-//	@XmlElement(name = "RelatedFrom", type = Taxon.class)
 	@XmlElement(name = "RelatedFrom", type = TaxonBase.class)
     @XmlIDREF
     @XmlSchemaType(name = "IDREF")
 	private FROM relatedFrom;
 
-//	@XmlElement(name = "RelatedFrom", type = Taxon.class)
 	@XmlElement(name = "RelatedTo", type = TaxonBase.class)
     @XmlIDREF
     @XmlSchemaType(name = "IDREF")
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermBase.java
index ec07de11b1..acaf63bb82 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermBase.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermBase.java
@@ -37,8 +37,8 @@ public abstract class TermBase extends VersionableEntity {
 	
 	@XmlElementWrapper(name = "Representations")
 	@XmlElement(name = "Representation")
-//    @XmlIDREF
-//    @XmlSchemaType(name = "IDREF")
+    @XmlIDREF
+    @XmlSchemaType(name = "IDREF")
 	private Set<Representation> representations = new HashSet<Representation>();
 	
 	public TermBase(){
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TextData.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TextData.java
index 5f51f085b7..978ab5b6dc 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TextData.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TextData.java
@@ -10,6 +10,7 @@
 package eu.etaxonomy.cdm.model.description;
 
 
+import java.util.HashMap;
 import java.util.Map;
 
 import eu.etaxonomy.cdm.jaxb.MultilanguageSetAdapter;
@@ -38,7 +39,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "TextData", propOrder = {
-    "multilanguageStringMap",
+    "multiLanguageText",
     "format"
 })
 @XmlRootElement(name = "TextData")
@@ -47,9 +48,10 @@ public class TextData extends DescriptionElementBase {
 	
 	static Logger logger = Logger.getLogger(TextData.class);
 
-	@XmlElement(name = "MultilanguageStringMap")
+	//@XmlElement(name = "MultiLanguageText", type = MultilanguageSet.class)
+	@XmlElement(name = "MultiLanguageText")
     @XmlJavaTypeAdapter(MultilanguageSetAdapter.class)
-	private Map<Language, LanguageString> multilanguageStringMap;
+	private Map<Language, LanguageString> multiLanguageText;
 	
 	@XmlElement(name = "Format")
 	@XmlIDREF
@@ -91,15 +93,15 @@ public class TextData extends DescriptionElementBase {
     @Cascade({CascadeType.SAVE_UPDATE})
 	public Map<Language, LanguageString> getMultilanguageText() {
 		initTextSet();
-		return multilanguageStringMap;
+		return multiLanguageText;
 	}
 	protected void setMultilanguageText(Map<Language, LanguageString> texts) {
-		this.multilanguageStringMap = texts;
+		this.multiLanguageText = texts;
 	}
 	@Transient 
 	public String getText(Language language) {
 		initTextSet();
-		LanguageString languageString = multilanguageStringMap.get(language);
+		LanguageString languageString = multiLanguageText.get(language);
 		if (languageString == null){
 			return null;
 		}else{
@@ -107,15 +109,10 @@ public class TextData extends DescriptionElementBase {
 		}
 	}
 	
-	@Transient
-	public MultilanguageSet getMultilanguageSet() {
-		return null;  //TODO
-	}
-
 	@Transient
 	public LanguageString putText(String text, Language language) {
 		initTextSet();
-		LanguageString result = this.multilanguageStringMap.put(language , LanguageString.NewInstance(text, language));
+		LanguageString result = this.multiLanguageText.put(language , LanguageString.NewInstance(text, language));
 		return (result == null ? null : result);
 	}
 	@Transient
@@ -126,23 +123,23 @@ public class TextData extends DescriptionElementBase {
 			return null;
 		}else{
 			Language language = languageString.getLanguage();
-			return this.multilanguageStringMap.put(language, languageString);
+			return this.multiLanguageText.put(language, languageString);
 		}
 	}
 	public LanguageString removeText(Language language) {
 		initTextSet();
-		return this.multilanguageStringMap.remove(language);
+		return this.multiLanguageText.remove(language);
 	}
 	
 	private void initTextSet(){
-		if (multilanguageStringMap == null){
-			multilanguageStringMap = MultilanguageSet.NewInstance();
+		if (multiLanguageText == null){
+			multiLanguageText = MultilanguageSet.NewInstance();
 		}
 	}
 	
 	public int countLanguages(){
 		initTextSet();
-		return multilanguageStringMap.size();
+		return multiLanguageText.size();
 	}
 	
 
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Media.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Media.java
index 0fe179921b..69236f8bf8 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Media.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Media.java
@@ -10,6 +10,7 @@
 package eu.etaxonomy.cdm.model.media;
 
 
+import eu.etaxonomy.cdm.jaxb.MultilanguageSetAdapter;
 import eu.etaxonomy.cdm.model.agent.Agent;
 import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
 import eu.etaxonomy.cdm.model.common.Language;
@@ -22,28 +23,47 @@ import org.hibernate.annotations.CascadeType;
 
 import java.util.*;
 import javax.persistence.*;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlIDREF;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 /**
  * @author m.doering
  * @version 1.0
  * @created 08-Nov-2007 13:06:34
  */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Media", propOrder = {
+    "title",
+    "mediaCreated",
+    "description",
+    "representations",
+    "rights",
+    "artist"
+})
+@XmlRootElement(name = "Media")
 @Entity
 @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
 public class Media extends AnnotatableEntity {
 	
 	private static final Logger logger = Logger.getLogger(Media.class);
 
-	@XmlElement(name = "Title")
+	@XmlElement(name = "MediaTitle")
+    @XmlJavaTypeAdapter(MultilanguageSetAdapter.class)
 	private MultilanguageSet title = new MultilanguageSet();
 	
 	//creation date of the media (not of the record)
 	@XmlElement(name = "MediaCreated")
 	private Calendar mediaCreated;
 	
-	@XmlElement(name = "Description")
+	@XmlElement(name = "MediaDescription")
+    @XmlJavaTypeAdapter(MultilanguageSetAdapter.class)
 	private MultilanguageSet description = new MultilanguageSet();
 	
 	//A single medium such as a picture can have multiple representations in files. 
@@ -56,6 +76,9 @@ public class Media extends AnnotatableEntity {
 	@XmlElement(name = "Right")
 	private Set<Rights> rights = new HashSet<Rights>();
 	
+	@XmlElement(name = "Artist")
+	@XmlIDREF
+	@XmlSchemaType(name = "IDREF")
 	private Agent artist;
 
 	/**
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentation.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentation.java
index 36e5154b2b..e61dec77e4 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentation.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentation.java
@@ -12,18 +12,12 @@ package eu.etaxonomy.cdm.model.media;
 
 import java.util.ArrayList;
 import java.util.List;
+
 import org.apache.log4j.Logger;
 import org.hibernate.annotations.Cascade;
 import org.hibernate.annotations.CascadeType;
 import org.hibernate.annotations.IndexColumn;
 import eu.etaxonomy.cdm.model.common.VersionableEntity;
-import eu.etaxonomy.cdm.model.description.CategoricalData;
-import eu.etaxonomy.cdm.model.description.CommonTaxonName;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.cdm.model.description.QuantitativeData;
-import eu.etaxonomy.cdm.model.description.TaxonInteraction;
-import eu.etaxonomy.cdm.model.description.TextData;
 
 import javax.persistence.*;
 import javax.xml.bind.annotation.XmlAccessType;
@@ -67,14 +61,16 @@ public class MediaRepresentation extends VersionableEntity {
     @XmlTransient
     //FIXME: ArrayIndexOutOfBoundException during marshalling
 //	@XmlElementWrapper(name = "MediaRepresentationParts")
-//	@XmlElement(name = "MediaRepresentationPart")
+//	@XmlElement(name = "MediaRepresentationPart", type = ArrayList.class)
 //    @XmlElements({
 //        @XmlElement(name = "AudioFile", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = CategoricalData.class),
 //        @XmlElement(name = "ImageFile", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = CommonTaxonName.class),
 //        @XmlElement(name = "MovieFile", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = Distribution.class),
 //    })
 	private List<MediaRepresentationPart> mediaRepresentationParts = new ArrayList<MediaRepresentationPart>();
-		
+
+	// Defining mediaRepresentationParts as ArrayList gives hibernate.AnnotationException		
+
 	/**
 	 * Factory method
 	 * @return
diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentationPart.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentationPart.java
index 8d2792d803..9dbc9efae4 100644
--- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentationPart.java
+++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentationPart.java
@@ -49,7 +49,7 @@ public class MediaRepresentationPart extends VersionableEntity{
 	@XmlElement(name = "Size")
 	private Integer size;
 	
-	//the MEdiaRepresentation this MediaRepresentation
+	//the MediaRepresentation of this MediaRepresentationPart
 	@XmlTransient
 	private MediaRepresentation mediaRepresentation;
 
