(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / location / NamedArea.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.location;
11
12 import eu.etaxonomy.cdm.model.common.Media;
13 import eu.etaxonomy.cdm.model.common.TimePeriod;
14 import eu.etaxonomy.cdm.model.common.MediaInstance;
15 import eu.etaxonomy.cdm.model.common.OrderedTermBase;
16 import org.apache.log4j.Logger;
17 import org.hibernate.annotations.Cascade;
18 import org.hibernate.annotations.CascadeType;
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:36
28 */
29 @Entity
30 public class NamedArea extends OrderedTermBase<NamedArea> {
31 static Logger logger = Logger.getLogger(NamedArea.class);
32 //description of time valid context of this area. e.g. year range
33 private TimePeriod validPeriod;
34 //Binary shape definition for user's defined area as polygon
35 private Media shape;
36 private Point pointApproximation;
37 private Set<WaterbodyOrCountry> waterbodiesOrCountries = new HashSet();
38 private NamedAreaType type;
39 private NamedAreaLevel level;
40
41 public NamedArea() {
42 super();
43 // TODO Auto-generated constructor stub
44 }
45 public NamedArea(String term, String label) {
46 super(term, label);
47 // TODO Auto-generated constructor stub
48 }
49
50
51 @ManyToOne
52 public NamedAreaType getType(){
53 return this.type;
54 }
55 public void setType(NamedAreaType type){
56 this.type = type;
57 }
58
59 @ManyToOne
60 public NamedAreaLevel getLevel(){
61 return this.level;
62 }
63 public void setLevel(NamedAreaLevel level){
64 this.level = level;
65 }
66
67 public TimePeriod getValidPeriod(){
68 return this.validPeriod;
69 }
70 public void setValidPeriod(TimePeriod validPeriod){
71 this.validPeriod = validPeriod;
72 }
73
74 @ManyToOne
75 @Cascade({CascadeType.SAVE_UPDATE})
76 public Media getShape(){
77 return this.shape;
78 }
79 public void setShape(Media shape){
80 this.shape = shape;
81 }
82
83
84 @ManyToMany
85 public Set<WaterbodyOrCountry> getWaterbodiesOrCountries() {
86 return waterbodiesOrCountries;
87 }
88 protected void setWaterbodiesOrCountries(
89 Set<WaterbodyOrCountry> waterbodiesOrCountries) {
90 this.waterbodiesOrCountries = waterbodiesOrCountries;
91 }
92 public void addWaterbodyOrCountry(
93 WaterbodyOrCountry waterbodyOrCountry) {
94 this.waterbodiesOrCountries.add(waterbodyOrCountry);
95 }
96 public void removeWaterbodyOrCountry(
97 WaterbodyOrCountry waterbodyOrCountry) {
98 this.waterbodiesOrCountries.remove(waterbodyOrCountry);
99 }
100 public Point getPointApproximation() {
101 return pointApproximation;
102 }
103 public void setPointApproximation(Point pointApproximation) {
104 this.pointApproximation = pointApproximation;
105 }
106
107 }