Project

General

Profile

Download (6.79 KB) Statistics
| Branch: | Tag: | Revision:
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.description;
11

    
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.cdm.common.CdmUtils;
19
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
20
import eu.etaxonomy.cdm.model.common.Language;
21
import eu.etaxonomy.cdm.model.location.Continent;
22
import eu.etaxonomy.cdm.model.location.NamedArea;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24

    
25
import javax.persistence.*;
26
import javax.xml.bind.annotation.XmlAccessType;
27
import javax.xml.bind.annotation.XmlAccessorType;
28
import javax.xml.bind.annotation.XmlRootElement;
29
import javax.xml.bind.annotation.XmlType;
30

    
31
/**
32
 * This class represents terms describing different types of presence
33
 * (like "native" or "introduced") of a {@link Taxon taxon} in a {@link NamedArea particular area}.
34
 * 
35
 * @author m.doering
36
 * @version 1.0
37
 * @created 08-Nov-2007 13:06:44
38
 */
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "PresenceTerm")
41
@XmlRootElement(name = "PresenceTerm")
42
@Entity
43
public class PresenceTerm extends PresenceAbsenceTermBase<PresenceTerm> {
44
	private static final Logger logger = Logger.getLogger(PresenceTerm.class);
45

    
46
	//********* METHODS **************************************/
47
	/** 
48
	 * Creates a new empty presence term.
49
	 * 
50
	 * @see #NewInstance(String, String, String)
51
	 */
52
	public static PresenceTerm NewInstance(){
53
		return new PresenceTerm();
54
	}
55

    
56
	/** 
57
	 * Creates a new presence term with a description (in the {@link Language#DEFAULT() default language}),
58
	 * a label and a label abbreviation.
59
	 * 
60
	 * @param	term  		 the string (in the default language) describing the
61
	 * 						 new presence term to be created 
62
	 * @param	label  		 the string identifying the new presence term to be created
63
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
64
	 * 						 new presence term to be created
65
	 * @see 				 #NewInstance()
66
	 */
67
	public static PresenceTerm NewInstance(String term, String label, String labelAbbrev){
68
		return new PresenceTerm(term, label, labelAbbrev);
69
	}
70
	
71
	// ************* CONSTRUCTORS *************/	
72
	/** 
73
	 * Class constructor: creates a new empty presence term.
74
	 * 
75
	 * @see #PresenceTerm(String, String, String)
76
	 */
77
	public PresenceTerm() {
78
		super();
79
	}
80

    
81
	/** 
82
	 * Class constructor: creates a new presence term with a description (in the {@link Language#DEFAULT() default language}),
83
	 * a label and a label abbreviation.
84
	 * 
85
	 * @param	term  		 the string (in the default language) describing the
86
	 * 						 new presence term to be created 
87
	 * @param	label  		 the string identifying the new presence term to be created
88
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
89
	 * 						 new presence term to be created
90
	 * @see 				 #PresenceTerm()
91
	 */
92
	public PresenceTerm(String term, String label, String labelAbbrev) {
93
		super(term, label, labelAbbrev);
94
	}
95

    
96
	private static final UUID uuidP=UUID.fromString("cef81d25-501c-48d8-bbea-542ec50de2c2");
97
	private static final UUID uuidN=UUID.fromString("ddeac4f2-d8fa-43b8-ad7e-ca13abdd32c7");
98
	private static final UUID uuidNQ=UUID.fromString("925662c1-bb10-459a-8c53-da5a738ac770");
99
	private static final UUID uuidNE=UUID.fromString("8ad9e9df-49cd-4b6a-880b-51ec4de4ce32");
100
	private static final UUID uuidND=UUID.fromString("310373bf-7df4-4d02-8cb3-bcc7448805fc");
101
	private static final UUID uuidNF=UUID.fromString("4ba212ef-041e-418d-9d43-2ebb191b61d8");
102
	private static final UUID uuidC=UUID.fromString("9eb99fe6-59e2-4445-8e6a-478365bd0fa9");
103
	private static final UUID uuidCF=UUID.fromString("b47f1679-0d0c-4ea7-a2e4-80709ea791c6");
104
	private static final UUID uuidI=UUID.fromString("643cf9d1-a5f1-4622-9837-82ef961e880b");
105
	private static final UUID uuidIQ=UUID.fromString("83eb0aa0-1a45-495a-a3ca-bf6958b74366");
106
	private static final UUID uuidIE=UUID.fromString("2522c527-e488-45d4-87df-a5a5ef0fdbbd");
107
	private static final UUID uuidID=UUID.fromString("0c54761e-4887-4788-9dfa-7190c88746e3");
108
	private static final UUID uuidIP=UUID.fromString("da159544-b0dd-4599-a9c9-640826af8c17");
109
	private static final UUID uuidIA=UUID.fromString("42946bd6-9c22-45ad-a910-7427e8f60bfd");
110
	private static final UUID uuidIN=UUID.fromString("e191e89a-a751-4b0c-b883-7f1de70915c9");
111
	private static final UUID uuidIF=UUID.fromString("826239f7-45b7-42b5-857c-c1f852cfad6b");
112
	private static final UUID uuidE=UUID.fromString("c3ee7048-15b7-4be1-b687-9ce9c1a669d6");
113

    
114
	
115

    
116
	public static final PresenceTerm getByUuid(UUID uuid){
117
		return (PresenceTerm)findByUuid(uuid);
118
	}
119

    
120
	
121
	//TODO Marc: Kannst du die noch ein bischen sch?ner formatieren, wenn du sie dokumentierst? Danke
122
	public static final PresenceTerm PRESENT(){return getByUuid(uuidP);}
123
	public static final PresenceTerm NATIVE(){return getByUuid(uuidN);}
124
	public static final PresenceTerm NATIVE_PRESENCE_QUESTIONABLE(){return getByUuid(uuidNQ);}
125
	public static final PresenceTerm NATIVE_FORMERLY_NATIVE(){return getByUuid(uuidNE);}
126
	public static final PresenceTerm NATIVE_DOUBTFULLY_NATIVE(){return getByUuid(uuidND);}
127
	public static final PresenceTerm NATIVE_REPORTED_IN_ERROR(){return getByUuid(uuidNF);}
128
	public static final PresenceTerm CULTIVATED(){return getByUuid(uuidC);}
129
	public static final PresenceTerm CULTIVATED_REPORTED_IN_ERROR(){return getByUuid(uuidCF);}
130
	public static final PresenceTerm INTRODUCED(){return getByUuid(uuidI);}
131
	public static final PresenceTerm INTRODUCED_PRESENCE_QUESTIONABLE(){return getByUuid(uuidIQ);}
132
	public static final PresenceTerm INTRODUCED_FORMERLY_INTRODUCED(){return getByUuid(uuidIE);}
133
	public static final PresenceTerm INTRODUCED_DOUBTFULLY_INTRODUCED(){return getByUuid(uuidID);}
134
	public static final PresenceTerm INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION(){return getByUuid(uuidIP);}
135
	public static final PresenceTerm INTRODUCED_ADVENTITIOUS(){return getByUuid(uuidIA);}
136
	public static final PresenceTerm INTRODUCED_NATURALIZED(){return getByUuid(uuidIN);}
137
	public static final PresenceTerm INTRODUCED_REPORTED_IN_ERROR(){return getByUuid(uuidIF);}
138
	public static final PresenceTerm ENDEMIC_FOR_THE_RELEVANT_AREA(){return getByUuid(uuidE);}
139

    
140
//	//preliminary
141
//	private static boolean initMap(){
142
//		map = new HashMap<String, UUID>();
143
//		map.put("p", uuidP);
144
//		map.put("n", uuidN);
145
//		map.put("nq", uuidNQ);
146
//		map.put("ne", uuidNE);
147
//		map.put("nd", uuidND);
148
//		map.put("nf", uuidNF);
149
//		map.put("c", uuidC);
150
//		map.put("cf", uuidCF);
151
//		map.put("i", uuidI);
152
//		map.put("iq", uuidIQ);
153
//		map.put("ie", uuidIE);
154
//		map.put("id", uuidID);
155
//		map.put("ip", uuidIP);
156
//		map.put("ia", uuidIA);
157
//		map.put("in", uuidIN);
158
//		map.put("if", uuidIF);
159
//		map.put("e", uuidE);
160
//		return true;
161
//	}
162
}
(15-15/30)