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