2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.description
;
13 import java
.util
.HashMap
;
15 import java
.util
.UUID
;
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
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.search
.annotations
.Indexed
;
27 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
28 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
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.
37 * @created 08-Nov-2007 13:06:50
39 @XmlAccessorType(XmlAccessType
.FIELD
)
40 @XmlType(name
= "Scope")
41 @XmlRootElement(name
= "Scope")
43 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
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);
50 protected static Map
<UUID
, Scope
> termMap
= null;
52 // ************* CONSTRUCTORS *************/
55 * Class constructor: creates a new empty scope instance.
57 * @see #Scope(String, String, String)
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.
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
73 protected Scope(String term
, String label
, String labelAbbrev
) {
74 super(term
, label
, labelAbbrev
);
78 //********* METHODS **************************************/
81 * Creates a new empty scope instance.
83 * @see #NewInstance(String, String, String)
85 public static Scope
NewInstance(){
90 * Creates a new scope instance with a description (in the {@link Language#DEFAULT() default language}),
91 * a label and a label abbreviation.
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
100 public static Scope
NewInstance(String term
, String label
, String labelAbbrev
){
101 return new Scope(term
, label
, labelAbbrev
);
106 //************************** METHODS ********************************
109 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
112 public void resetTerms(){
118 protected void setDefaultTerms(TermVocabulary
<Modifier
> termVocabulary
) {
119 termMap
= new HashMap
<UUID
, Scope
>();
120 for (Modifier term
: termVocabulary
.getTerms()){
121 termMap
.put(term
.getUuid(), (Scope
)term
); //TODO casting