Project

General

Profile

Download (4.46 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;
24
import org.apache.logging.log4j.Logger;
25
import org.hibernate.envers.Audited;
26
import org.hibernate.search.annotations.Field;
27

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

    
32
/**
33
 * Cloning is a method used in {@link Amplification DNA amplification} for multiplying the base
34
 * material. Various cloning methods exist. Classical cloning methods use bacteria for cloning
35
 * while the latest approaches use other techniques.
36
 *
37
 * @author a.mueller
38
 * @since 2013-07-11
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 {
50

    
51
	private static final long serialVersionUID = 6179007910988646989L;
52
	@SuppressWarnings("unused")
53
	private static final Logger logger = LogManager.getLogger(Cloning.class);
54

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

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

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

    
75

    
76
// ******************** FACTORY METHOD ******************/
77

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

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

    
86
// ********************* CONSTRUCTOR ********************/
87

    
88

    
89
    //for hibernate use only, *packet* private required by bytebuddy
90
    //see https://stackoverflow.com/questions/7273125/hibernate-envers-and-javassist-enhancement-failed-exception
91
    Cloning(){}
92

    
93
    private Cloning(DefinedTerm definedMaterialOrMethod, String methodText, String strain, Primer forwardPrimer, Primer reversePrimer){
94
    	super(definedMaterialOrMethod, methodText);
95
    	this.strain = strain;
96
    	this.forwardPrimer = forwardPrimer;
97
    	this.reversePrimer = reversePrimer;
98
    }
99

    
100
// ********************* GETTER / SETTER ********************/
101

    
102

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

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

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

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

    
135
	public String getStrain() {
136
		return strain;
137
	}
138

    
139
	public void setStrain(String strain) {
140
		this.strain = strain;
141
	}
142

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

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