separate Amplification and AmplificationResult.java #4541
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / molecular / Amplification.java
index ed46d259d7f41cf1399a98b3f114261791e062ce..552a2f6189041ec4398ad1f859ba1dc36f7a3d8f 100644 (file)
@@ -8,21 +8,14 @@
 */\r
 package eu.etaxonomy.cdm.model.molecular;\r
 \r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import javax.persistence.Column;\r
 import javax.persistence.Entity;\r
 import javax.persistence.FetchType;\r
 import javax.persistence.JoinColumn;\r
 import javax.persistence.ManyToOne;\r
-import javax.persistence.OneToMany;\r
 import javax.validation.constraints.Size;\r
 import javax.xml.bind.annotation.XmlAccessType;\r
 import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlAttribute;\r
 import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlElementWrapper;\r
 import javax.xml.bind.annotation.XmlIDREF;\r
 import javax.xml.bind.annotation.XmlRootElement;\r
 import javax.xml.bind.annotation.XmlSchemaType;\r
@@ -41,7 +34,6 @@ import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;\r
 import eu.etaxonomy.cdm.model.common.EventBase;\r
 import eu.etaxonomy.cdm.model.common.TermType;\r
-import eu.etaxonomy.cdm.model.media.Media;\r
 import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;\r
 \r
 /**\r
@@ -70,45 +62,23 @@ import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
  */\r
 @XmlAccessorType(XmlAccessType.FIELD)\r
 @XmlType(name = "Amplification", propOrder = {\r
-       "dnaSample",\r
        "dnaMarker",\r
        "forwardPrimer",\r
        "reversePrimer",\r
        "purification",\r
        "institution",\r
-       "cloning",\r
-       "successful",\r
-       "successText",\r
        "ladderUsed",\r
        "electrophoresisVoltage",\r
        "gelRunningTime",\r
        "gelConcentration",\r
-       "gelPhoto",\r
-       "singleReads"\r
 })\r
 @XmlRootElement(name = "Amplification")\r
 @Entity\r
 @Audited\r
 public class Amplification extends EventBase implements Cloneable{\r
-       private static final long serialVersionUID = -8614860617229484621L;\r
-       private static final Logger logger = Logger.getLogger(Amplification.class);\r
+       private static final long serialVersionUID = -6382383300974316261L;\r
 \r
-\r
-    /** @see #getDnaSample() */\r
-       @XmlElement( name = "DnaSample")\r
-    @XmlIDREF\r
-    @XmlSchemaType(name = "IDREF")\r
-    @ManyToOne(fetch = FetchType.LAZY)\r
-    @IndexedEmbedded\r
-    private DnaSample dnaSample;\r
-\r
-    @XmlElementWrapper(name = "SingleReads")\r
-    @XmlElement(name = "SingleRead")\r
-    @XmlIDREF\r
-    @XmlSchemaType(name = "IDREF")\r
-    @OneToMany(fetch = FetchType.LAZY)\r
-    @Cascade({CascadeType.SAVE_UPDATE})\r
-       private Set<SingleRead> singleReads = new HashSet<SingleRead>();\r
+       private static final Logger logger = Logger.getLogger(Amplification.class);\r
 \r
     /** @see #getDnaMarker()*/\r
     @XmlElement(name = "DnaMarker")\r
@@ -141,14 +111,7 @@ public class Amplification extends EventBase implements Cloneable{
     @ManyToOne(fetch=FetchType.LAZY)\r
     @Cascade({CascadeType.SAVE_UPDATE})\r
     private MaterialOrMethodEvent purification;\r
-\r
-    @XmlElement(name = "Cloning")\r
-    @XmlIDREF\r
-    @XmlSchemaType(name = "IDREF")\r
-    @ManyToOne(fetch=FetchType.LAZY)\r
-    @Cascade({CascadeType.SAVE_UPDATE})\r
-    private Cloning cloning;\r
-    \r
+  \r
        @XmlElement(name = "Institution")\r
        @XmlIDREF\r
        @XmlSchemaType(name = "IDREF")\r
@@ -158,16 +121,6 @@ public class Amplification extends EventBase implements Cloneable{
        @JoinColumn(name="institution_id")\r
        private Institution institution;\r
 \r
-       /** @see #getSuccessful() */\r
-    @XmlAttribute(name = "successful")\r
-    private Boolean successful;\r
-\r
-    /** @see #getSuccessText() */\r
-    @XmlElement(name = "successText")\r
-       @Field\r
-       @Size(max=255)\r
-       private String successText;\r
-\r
     /** @see #getLadderUsed() */\r
     @XmlElement(name = "ladderUsed")\r
        @Field\r
@@ -192,28 +145,9 @@ public class Amplification extends EventBase implements Cloneable{
        @NumericField\r
        private Double gelConcentration;\r
 \r
-    @XmlElement(name = "GelPhoto")\r
-    @XmlIDREF\r
-    @XmlSchemaType(name = "IDREF")\r
-    @ManyToOne(fetch=FetchType.LAZY)\r
-    @Cascade({CascadeType.SAVE_UPDATE})\r
-       private Media gelPhoto;\r
-\r
 \r
 // ********************* FACTORY METHODS ************************/\r
 \r
-       public static Amplification NewInstance(DnaSample dnaSample){\r
-               Amplification result = new Amplification();\r
-               dnaSample.addAmplification(result);\r
-               return result;\r
-       }\r
-\r
-       public static Amplification NewInstance(SingleRead singleRead){\r
-           Amplification result = new Amplification();\r
-           result.addSingleRead(singleRead);\r
-           return result;\r
-       }\r
-\r
        public static Amplification NewInstance(){\r
            return new Amplification();\r
        }\r
@@ -227,52 +161,6 @@ public class Amplification extends EventBase implements Cloneable{
 //********************* GETTER / SETTER ************/\r
 \r
 \r
-       /**\r
-        * The {@link DnaSample dna sample} which is the input for this {@link Amplification amplification}.\r
-        */\r
-       public DnaSample getDnaSample() {\r
-               return dnaSample;\r
-       }\r
-\r
-       /**\r
-        * For use by DnaSample.addAmplification(ampl.) only. For now.\r
-        * @see #getDnaSample()\r
-        */\r
-       protected void setDnaSample(DnaSample dnaSample) {\r
-               this.dnaSample = dnaSample;\r
-       }\r
-\r
-       /**\r
-        * The {@link SingleRead single sequences} created by using this amplification's result (PCR).\r
-        */\r
-       public Set<SingleRead> getSingleReads() {\r
-               return singleReads;\r
-       }\r
-\r
-       public void addSingleRead(SingleRead singleRead){\r
-               if (singleRead.getAmplification() != null){\r
-                       singleRead.getAmplification().singleReads.remove(singleRead);\r
-               }\r
-               this.singleReads.add(singleRead);\r
-               singleRead.setAmplification(this);\r
-       }\r
-\r
-       public void removeSingleRead(SingleRead singleRead){\r
-           if(this.singleReads.contains(singleRead)){\r
-               this.singleReads.remove(singleRead);\r
-               singleRead.setAmplification(null);\r
-           }\r
-       }\r
-\r
-       /**\r
-        * @see #getSingleReads()\r
-        */\r
-       //TODO private until it is clear how bidirectionality is handled\r
-       private void setSingleReads(Set<SingleRead> singleReads) {\r
-               this.singleReads = singleReads;\r
-       }\r
-\r
-\r
        /**\r
         * The {@link TermType#DnaMarker DNA marker} used for this amplification.\r
         * The DNA marker also defines the part (locality) of the DNA/RNA examined.\r
@@ -281,10 +169,7 @@ public class Amplification extends EventBase implements Cloneable{
        public DefinedTerm getDnaMarker() {\r
                return dnaMarker;\r
        }\r
-\r
-       /**\r
-        * @see #getDnaMarker()\r
-        */\r
+       /** @see #getDnaMarker()*/\r
        public void setDnaMarker(DefinedTerm marker) {\r
                this.dnaMarker = marker;\r
        }\r
@@ -296,7 +181,6 @@ public class Amplification extends EventBase implements Cloneable{
        public Primer getForwardPrimer() {\r
                return forwardPrimer;\r
        }\r
-\r
        /**\r
         * @see #getForwardPrimer()\r
         * @see #getReversePrimer()\r
@@ -312,7 +196,6 @@ public class Amplification extends EventBase implements Cloneable{
        public Primer getReversePrimer() {\r
                return reversePrimer;\r
        }\r
-\r
        /**\r
         * @see #getReversePrimer()\r
         * @see #getForwardPrimer()\r
@@ -321,42 +204,6 @@ public class Amplification extends EventBase implements Cloneable{
                this.reversePrimer = reversePrimer;\r
        }\r
 \r
-       /**\r
-        * Information if this amplification was successful or not. Success may be defined\r
-        * by the results of the electrophoresis.\r
-        *\r
-        * @see #getSuccessText()\r
-        */\r
-       public Boolean getSuccessful() {\r
-               return successful;\r
-       }\r
-\r
-       /**\r
-        * @see #getSuccessful()\r
-        * @see #getSuccessText()\r
-        */\r
-       public void setSuccessful(Boolean successful) {\r
-               this.successful = successful;\r
-       }\r
-\r
-       /**\r
-        * Freetext about the success of this amplification explaining\r
-        * in detail why it is concidered to be successful/unsucessful\r
-        *\r
-        * @see #getSuccessful()\r
-        */\r
-       public String getSuccessText() {\r
-               return successText;\r
-       }\r
-\r
-       /**\r
-        * @see #getSuccessText()\r
-        * @see #getSuccessful()\r
-        */\r
-       public void setSuccessText(String successText) {\r
-               this.successText = successText;\r
-       }\r
-\r
 \r
        /**\r
         * The material and/or method used for purification.\r
@@ -364,7 +211,6 @@ public class Amplification extends EventBase implements Cloneable{
        public MaterialOrMethodEvent getPurification() {\r
                return purification;\r
        }\r
-\r
        /**\r
         * @see #getPurification()\r
         */\r
@@ -373,30 +219,20 @@ public class Amplification extends EventBase implements Cloneable{
        }\r
        \r
     /**\r
-     * #4498\r
-     * @return\r
+     * The institution in which the amplification event took place.\r
+     * Usually the {@link Amplification#getActor()} should be a person\r
+     * or team that works for this institution at the given time\r
+     * @return the institution\r
      */\r
+//     #4498\r
     public Institution getInstitution() {\r
                return institution;\r
        }\r
-\r
-       public void setInstitution(Institution institution) {\r
-               this.institution = institution;\r
-       }\r
-\r
-\r
-       /**\r
-        * The {@link Cloning cloning process} involved in this amplification.\r
-        */\r
-       public Cloning getCloning() {\r
-               return cloning;\r
-       }\r
-\r
        /**\r
-        * @see #getCloning()\r
+        * @see #getInstitution()\r
         */\r
-       public void setCloning(Cloning cloning) {\r
-               this.cloning = cloning;\r
+       public void setInstitution(Institution institution) {\r
+               this.institution = institution;\r
        }\r
 \r
        /**\r
@@ -411,7 +247,6 @@ public class Amplification extends EventBase implements Cloneable{
        public Double getElectrophoresisVoltage() {\r
                return electrophoresisVoltage;\r
        }\r
-\r
        /**\r
         * @see #getElectrophoresisVoltage()\r
         */\r
@@ -426,7 +261,6 @@ public class Amplification extends EventBase implements Cloneable{
        public Double getGelRunningTime() {\r
                return gelRunningTime;\r
        }\r
-\r
        /**\r
         * @see #getGelRunningTime()\r
         */\r
@@ -446,7 +280,6 @@ public class Amplification extends EventBase implements Cloneable{
        public Double getGelConcentration() {\r
                return gelConcentration;\r
        }\r
-\r
        /**\r
         * @see #getGelConcentration()\r
         */\r
@@ -464,7 +297,6 @@ public class Amplification extends EventBase implements Cloneable{
        public String getLadderUsed() {\r
                return ladderUsed;\r
        }\r
-\r
        /**\r
         * @see #getLadderUsed()\r
         */\r
@@ -472,28 +304,6 @@ public class Amplification extends EventBase implements Cloneable{
                this.ladderUsed = ladderUsed;\r
        }\r
 \r
-       /**\r
-        * The photo taken from the electrophoresis result showing the quality of the amplification.\r
-        * Gelphotos often do show multiple electrophoresis results. One may either cut or mark\r
-        * the part of the photo that displays <code>this</code> amplification. However, this may make\r
-        * the concrete media file unusable for other amplifications also represented by the same image.\r
-        * @see #getElectrophoresisVoltage()\r
-        * @see #getLadderUsed()\r
-        * @see #getGelConcentration()\r
-        * @see #getGelRunningTime()\r
-        */\r
-       public Media getGelPhoto() {\r
-               return gelPhoto;\r
-       }\r
-\r
-\r
-       /**\r
-        * @param gelPhoto the gelPhoto to set\r
-        */\r
-       public void setGelPhoto(Media gelPhoto) {\r
-               this.gelPhoto = gelPhoto;\r
-       }\r
-\r
 \r
        // ********************** CLONE ***********************************/\r
        /**\r
@@ -510,15 +320,9 @@ public class Amplification extends EventBase implements Cloneable{
                try{\r
                        Amplification result = (Amplification)super.clone();\r
 \r
-                       result.singleReads = new HashSet<SingleRead>();\r
-                       for (SingleRead seq: this.singleReads){\r
-                               result.singleReads.add(seq);\r
-\r
-                       }\r
-\r
-                       //don't change dnaSample, marker, successful, successText, forwardPrimer,\r
-                       //reversePrimer, purifiaction, cloning, ladderUsed, electrophoresisVoltage,\r
-                       //gelRunningTime, gelPhoto, gelConcentration\r
+                       //don't change marker, forwardPrimer, reversePrimer, \r
+                       //purifiaction, ladderUsed, electrophoresisVoltage,\r
+                       //gelRunningTime, gelConcentration\r
                        return result;\r
                }catch (CloneNotSupportedException e) {\r
                        logger.warn("Object does not implement cloneable");\r