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