(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / molecular / Sequence.java
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
10 package eu.etaxonomy.cdm.model.molecular;
11
12
13 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
14 import eu.etaxonomy.cdm.model.common.IMediaDocumented;
15 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
16 import eu.etaxonomy.cdm.model.common.Media;
17 import eu.etaxonomy.cdm.model.common.IReferencedEntity;
18 import org.apache.log4j.Logger;
19
20 import java.util.*;
21
22 import javax.persistence.*;
23
24 /**
25 * @author m.doering
26 * @version 1.0
27 * @created 08-Nov-2007 13:06:51
28 */
29 @Entity
30 public class Sequence extends IdentifiableEntity implements IReferencedEntity, IMediaDocumented{
31 static Logger logger = Logger.getLogger(Sequence.class);
32 //the sequence as a string of base pairs. 5'->3'
33 private String sequence;
34 //should be calculated in case sequence is set
35 private Integer length;
36 //should be calculated in case sequence is set
37 private Calendar dateSequenced;
38 //should be calculated in case sequence is set
39 private boolean isBarcode;
40 //the sequence as a string of base pairs. 5'->3'
41 private String citationMicroReference;
42 private ReferenceBase publishedIn;
43 private Set<ReferenceBase> citations = new HashSet();
44 private Set<GenBankAccession> genBankAccession = new HashSet();
45 private Locus locus;
46 private Set<Media> chromatograms = new HashSet();
47
48 @ManyToOne
49 public Locus getLocus(){
50 return this.locus;
51 }
52 public void setLocus(Locus locus){
53 this.locus = locus;
54 }
55
56 @ManyToOne
57 public ReferenceBase getPublishedIn(){
58 return this.publishedIn;
59 }
60 public void setPublishedIn(ReferenceBase publishedIn){
61 this.publishedIn = publishedIn;
62 }
63
64
65
66 @OneToMany
67 public Set<ReferenceBase> getCitations() {
68 return citations;
69 }
70 protected void setCitations(Set<ReferenceBase> citations) {
71 this.citations = citations;
72 }
73 public void addCitation(ReferenceBase citation) {
74 this.citations.add(citation);
75 }
76 public void removeCitation(ReferenceBase citation) {
77 this.citations.remove(citation);
78 }
79
80
81 @OneToMany
82 public Set<GenBankAccession> getGenBankAccession() {
83 return genBankAccession;
84 }
85
86 protected void setGenBankAccession(Set<GenBankAccession> genBankAccession) {
87 this.genBankAccession = genBankAccession;
88 }
89 public void addGenBankAccession(GenBankAccession genBankAccession) {
90 this.genBankAccession.add(genBankAccession);
91 }
92 public void removeGenBankAccession(GenBankAccession genBankAccession) {
93 this.genBankAccession.remove(genBankAccession);
94 }
95
96
97 @OneToMany
98 public Set<Media> getChromatograms() {
99 return chromatograms;
100 }
101
102 protected void setChromatograms(Set<Media> chromatograms) {
103 this.chromatograms = chromatograms;
104 }
105 public void addChromatogram(Media chromatogram) {
106 this.chromatograms.add(chromatogram);
107 }
108 public void removeChromatogram(Media chromatogram) {
109 this.chromatograms.remove(chromatogram);
110 }
111
112 @Transient
113 public Set<Media> getMedia() {
114 return getChromatograms();
115 }
116
117
118 public String getSequence(){
119 return this.sequence;
120 }
121
122 /**
123 *
124 * @param sequence sequence
125 */
126 public void setSequence(String sequence){
127 this.sequence = sequence;
128 }
129
130 public Integer getLength(){
131 return this.length;
132 }
133
134 /**
135 *
136 * @param length length
137 */
138 public void setLength(Integer length){
139 this.length = length;
140 }
141
142 @Temporal(TemporalType.DATE)
143 public Calendar getDateSequenced(){
144 return this.dateSequenced;
145 }
146
147 /**
148 *
149 * @param dateSequenced dateSequenced
150 */
151 public void setDateSequenced(Calendar dateSequenced){
152 this.dateSequenced = dateSequenced;
153 }
154
155 public boolean isBarcode(){
156 return this.isBarcode;
157 }
158
159 /**
160 *
161 * @param isBarcode isBarcode
162 */
163 public void setBarcode(boolean isBarcode){
164 this.isBarcode = isBarcode;
165 }
166
167 public String getCitationMicroReference(){
168 return this.citationMicroReference;
169 }
170
171 /**
172 *
173 * @param citationMicroReference citationMicroReference
174 */
175 public void setCitationMicroReference(String citationMicroReference){
176 this.citationMicroReference = citationMicroReference;
177 }
178
179 public String generateTitle(){
180 return "";
181 }
182
183 @Transient
184 public ReferenceBase getCitation(){
185 return null;
186 }
187
188 }