Project

General

Profile

Download (3.37 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

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

    
17
import javax.persistence.Entity;
18
import javax.xml.bind.annotation.XmlAccessType;
19
import javax.xml.bind.annotation.XmlAccessorType;
20
import javax.xml.bind.annotation.XmlRootElement;
21
import javax.xml.bind.annotation.XmlType;
22

    
23
import org.apache.log4j.Logger;
24
import org.hibernate.envers.Audited;
25
import org.hibernate.search.annotations.Indexed;
26

    
27
import eu.etaxonomy.cdm.model.common.Language;
28
import eu.etaxonomy.cdm.model.common.TermVocabulary;
29

    
30
/**
31
 * The class representing restrictions for the validity of
32
 * {@link TaxonDescription taxon descriptions}. This could include not only {@link Stage life stage}
33
 * or {@link Sex sex} but also for instance particular organism parts or seasons.
34
 * 
35
 * @author m.doering
36
 * @version 1.0
37
 * @created 08-Nov-2007 13:06:50
38
 */
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "Scope")
41
@XmlRootElement(name = "Scope")
42
@Entity
43
@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
44
@Audited
45
public class Scope extends Modifier {
46
	private static final long serialVersionUID = 4479960075363470677L;
47
	@SuppressWarnings("unused")
48
	private static final Logger logger = Logger.getLogger(Scope.class);
49
	
50
	protected static Map<UUID, Scope> termMap = null;
51
	
52
	// ************* CONSTRUCTORS *************/	
53

    
54
	/** 
55
	 * Class constructor: creates a new empty scope instance.
56
	 * 
57
	 * @see #Scope(String, String, String)
58
	 */
59
	public Scope() {
60
	}
61

    
62
	/** 
63
	 * Class constructor: creates a new scope instance with a description (in the {@link Language#DEFAULT() default language}),
64
	 * a label and a label abbreviation.
65
	 * 
66
	 * @param	term  		 the string (in the default language) describing the
67
	 * 						 new scope to be created 
68
	 * @param	label  		 the string identifying the new scope to be created
69
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
70
	 * 						 new scope to be created
71
	 * @see 				 #Scope()
72
	 */
73
	protected Scope(String term, String label, String labelAbbrev) {
74
		super(term, label, labelAbbrev);
75
	}
76

    
77
	
78
	//********* METHODS **************************************/
79

    
80
	/** 
81
	 * Creates a new empty scope instance.
82
	 * 
83
	 * @see #NewInstance(String, String, String)
84
	 */
85
	public static Scope NewInstance(){
86
		return new Scope();
87
	}
88
	
89
	/** 
90
	 * Creates a new scope instance with a description (in the {@link Language#DEFAULT() default language}),
91
	 * a label and a label abbreviation.
92
	 * 
93
	 * @param	term  		 the string (in the default language) describing the
94
	 * 						 new scope to be created 
95
	 * @param	label  		 the string identifying the new scope to be created
96
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
97
	 * 						 new scope to be created
98
	 * @see 				 #NewInstance()
99
	 */
100
	public static Scope NewInstance(String term, String label, String labelAbbrev){
101
		return new Scope(term, label, labelAbbrev);
102
	}
103
	
104
	@Override
105
	protected void setDefaultTerms(TermVocabulary<Modifier> termVocabulary) {
106
		termMap = new HashMap<UUID, Scope>();
107
		for (Modifier term : termVocabulary.getTerms()){
108
			termMap.put(term.getUuid(), (Scope)term);  //TODO casting
109
		}
110
	}
111
}
(21-21/36)