856da5f38bed3fd5d78929b1464fc8fd31369ba3
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / molecular / PhylogeneticTree.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.ReferencedMedia;
14
15 import org.apache.log4j.Logger;
16 import org.hibernate.envers.Audited;
17 import org.hibernate.search.annotations.Indexed;
18
19 import java.util.*;
20
21 import javax.persistence.*;
22 import javax.xml.bind.annotation.XmlAccessType;
23 import javax.xml.bind.annotation.XmlAccessorType;
24 import javax.xml.bind.annotation.XmlElement;
25 import javax.xml.bind.annotation.XmlElementWrapper;
26 import javax.xml.bind.annotation.XmlIDREF;
27 import javax.xml.bind.annotation.XmlRootElement;
28 import javax.xml.bind.annotation.XmlSchemaType;
29 import javax.xml.bind.annotation.XmlType;
30
31 /**
32 * @author m.doering
33 * @version 1.0
34 * @created 08-Nov-2007 13:06:43
35 */
36 @XmlAccessorType(XmlAccessType.FIELD)
37 @XmlType(name = "PhylogeneticTree", propOrder = {
38 "usedSequences"
39 })
40 @XmlRootElement(name = "PhylogeneticTree")
41 @Entity
42 @Indexed(index = "eu.etaxonomy.cdm.model.media.Media")
43 @Audited
44 public class PhylogeneticTree extends ReferencedMedia {
45 private static final long serialVersionUID = -7020182117362324067L;
46 private static final Logger logger = Logger.getLogger(PhylogeneticTree.class);
47
48 @XmlElementWrapper(name = "UsedSequences")
49 @XmlElement(name = "UsedSequence")
50 @XmlIDREF
51 @XmlSchemaType(name = "IDREF")
52 @OneToMany(fetch = FetchType.LAZY)
53 private Set<Sequence> usedSequences = new HashSet<Sequence>();
54
55 public Set<Sequence> getUsedSequences() {
56 logger.debug("getUsedSequences");
57 return usedSequences;
58 }
59
60 public void addUsedSequences(Sequence usedSequence) {
61 this.usedSequences.add(usedSequence);
62 }
63
64 public void removeUsedSequences(Sequence usedSequence) {
65 this.usedSequences.remove(usedSequence);
66 }
67 }