Project

General

Profile

Download (4.51 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.model.molecular;
10

    
11
import javax.persistence.Column;
12
import javax.persistence.Entity;
13
import javax.persistence.FetchType;
14
import javax.persistence.ManyToOne;
15
import javax.xml.bind.annotation.XmlAccessType;
16
import javax.xml.bind.annotation.XmlAccessorType;
17
import javax.xml.bind.annotation.XmlElement;
18
import javax.xml.bind.annotation.XmlIDREF;
19
import javax.xml.bind.annotation.XmlRootElement;
20
import javax.xml.bind.annotation.XmlSchemaType;
21
import javax.xml.bind.annotation.XmlType;
22

    
23
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
24
import org.hibernate.envers.Audited;
25
import org.hibernate.search.annotations.Field;
26

    
27
import eu.etaxonomy.cdm.model.common.EventBase;
28
import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
29
import eu.etaxonomy.cdm.model.term.DefinedTerm;
30

    
31
/**
32
 * Cloning is a method used in {@link Amplification DNA amplification} for multiplying the base
33
 * material. Various cloning methods exist. Classical cloning methods use bacteria for cloning
34
 * while the latest approaches use other techniques.
35
 *
36
 * @author a.mueller
37
 * @since 2013-07-11
38
 *
39
 */
40
@XmlAccessorType(XmlAccessType.FIELD)
41
@XmlType(name = "Cloning", propOrder = {
42
	"strain",
43
	"forwardPrimer",
44
	"reversePrimer"
45
})
46
@XmlRootElement(name = "Cloning")
47
@Entity
48
@Audited
49
public class Cloning extends MaterialOrMethodEvent implements Cloneable{
50
	private static final long serialVersionUID = 6179007910988646989L;
51
	@SuppressWarnings("unused")
52
	private static final Logger logger = LogManager.getLogger(Cloning.class);
53

    
54
	/** @see #getStrain() */
55
    @XmlElement(name = "strain")
56
	@Field
57
    @Column(length=100)
58
	private String strain;
59

    
60
    /** @see #getForwardPrimer() */
61
    @XmlElement(name = "ForwardPrimer")
62
    @XmlIDREF
63
    @XmlSchemaType(name = "IDREF")
64
    @ManyToOne(fetch=FetchType.LAZY)
65
    private Primer forwardPrimer;
66

    
67
    /** @see #getReversePrimer()*/
68
    @XmlElement(name = "ReversePrimer")
69
    @XmlIDREF
70
    @XmlSchemaType(name = "IDREF")
71
    @ManyToOne(fetch=FetchType.LAZY)
72
    private Primer reversePrimer;
73

    
74

    
75
// ******************** FACTORY METHOD ******************/
76

    
77
    public static Cloning NewInstance(){
78
    	return new Cloning();
79
    }
80

    
81
    public static Cloning NewInstance(DefinedTerm definedMaterialOrMethod, String methodText, String strain, Primer forwardPrimer, Primer reversePrimer){
82
    	return new Cloning(definedMaterialOrMethod, methodText, strain, forwardPrimer, reversePrimer);
83
    }
84

    
85
// ********************* CONSTRUCTOR ********************/
86

    
87

    
88
    //made protected to fix a java.lang.InstantiationException which occurred while loading
89
    //see https://stackoverflow.com/questions/7273125/hibernate-envers-and-javassist-enhancement-failed-exception
90
    protected Cloning(){}
91
    protected Cloning(DefinedTerm definedMaterialOrMethod, String methodText, String strain, Primer forwardPrimer, Primer reversePrimer){
92
    	super(definedMaterialOrMethod, methodText);
93
    	this.strain = strain;
94
    	this.forwardPrimer = forwardPrimer;
95
    	this.reversePrimer = reversePrimer;
96
    }
97

    
98
// ********************* GETTER / SETTER ********************/
99

    
100

    
101
	/**
102
	 * The primer used for forward cloning.
103
	 * @see #getReversePrimer()
104
	 */
105
	public Primer getForwardPrimer() {
106
		return forwardPrimer;
107
	}
108

    
109
	/**
110
	 * @see #getForwardPrimer()
111
	 * @see #getReversePrimer()
112
	 */
113
	public void setForwardPrimer(Primer forwardPrimer) {
114
		this.forwardPrimer = forwardPrimer;
115
	}
116

    
117
	/**
118
	 * The primer used for reverse cloning.
119
	 * @see #getForwardPrimer()
120
	 */
121
	public Primer getReversePrimer() {
122
		return reversePrimer;
123
	}
124

    
125
	/**
126
	 * @see #getReversePrimer()
127
	 * @see #getForwardPrimer()
128
	 */
129
	public void setReversePrimer(Primer reversePrimer) {
130
		this.reversePrimer = reversePrimer;
131
	}
132

    
133
	public String getStrain() {
134
		return strain;
135
	}
136

    
137
	public void setStrain(String strain) {
138
		this.strain = strain;
139
	}
140

    
141
// ********************* CLONE ********************/
142
	/**
143
	 * Clones <i>this</i> {@link Cloning}. This is a shortcut that enables to create
144
	 * a new instance that differs only slightly from <i>this</i> cloning by
145
	 * modifying only some of the attributes.<BR><BR>
146
	 *
147
	 *
148
	 * @see EventBase#clone()
149
	 * @see java.lang.Object#clone()
150
	 */
151
	@Override
152
	public Cloning clone()  {
153
		Cloning result = (Cloning)super.clone();
154

    
155
		//don't change strain, forwardPrimer, backwardPrimer
156
		return result;
157
	}
158
}
(3-3/14)