(no commit message)
[cdmlib.git] / cdmlibrary / src / main / java / eu / etaxonomy / cdm / model / common / AnnotatableEntity.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.common;
11
12
13 import org.apache.log4j.Logger;
14
15 import java.util.*;
16
17 import javax.persistence.*;
18
19 /**
20 * @author m.doering
21 * @version 1.0
22 * @created 08-Nov-2007 13:06:10
23 */
24 @MappedSuperclass
25 public abstract class AnnotatableEntity<T extends AnnotatableEntity> extends VersionableEntity<T> {
26 static Logger logger = Logger.getLogger(AnnotatableEntity.class);
27
28 protected Set<Marker> markers = new HashSet();
29 protected Set<Annotation> annotations = new HashSet();
30
31
32 public AnnotatableEntity() {
33 super();
34 // TODO Auto-generated constructor stub
35 }
36
37 @OneToMany //(mappedBy="markedObj")
38 public Set<Marker> getMarkers(){
39 return this.markers;
40 }
41 public void addMarker(Marker marker){
42 marker.setMarkedObj(this);
43 }
44 public void removeMarker(Marker marker){
45 marker.setMarkedObj(null);
46 }
47 protected void setMarkers(Set<Marker> markers) {
48 this.markers = markers;
49 }
50
51
52 @OneToMany //(mappedBy="annotatedObj")
53 public Set<Annotation> getAnnotations(){
54 return this.annotations;
55 }
56 public void addAnnotations(Annotation annotation){
57 annotation.setAnnotatedObj(this);
58 }
59 public void removeAnnotations(Annotation annotation){
60 annotation.setAnnotatedObj(null);
61 }
62 protected void setAnnotations(Set<Annotation> annotations) {
63 this.annotations = annotations;
64 }
65
66 }