javadoc on deprecated
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / description / State.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.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.OrderedTermBase;
29 import eu.etaxonomy.cdm.model.common.TermVocabulary;
30
31 /**
32 * This class represents terms describing different states (like "oval" or
33 * "triangular") for {@link Feature features} that can be described with
34 * categorical values (like for instance shapes).
35 *
36 * @author m.doering
37 * @version 1.0
38 * @created 08-Nov-2007 13:06:53
39 */
40 @XmlAccessorType(XmlAccessType.FIELD)
41 @XmlType(name = "State")
42 @XmlRootElement(name = "State")
43 @Entity
44 @Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
45 @Audited
46 public class State extends OrderedTermBase<State> {
47 private static final long serialVersionUID = -4816292463790262516L;
48 @SuppressWarnings("unused")
49 private static final Logger logger = Logger.getLogger(State.class);
50
51 protected static Map<UUID, State> termMap = null;
52
53 // ************* CONSTRUCTORS *************/
54 /**
55 * Class constructor: creates a new empty state.
56 *
57 * @see #State(String, String, String)
58 */
59 public State() {
60 }
61
62 /**
63 * Class constructor: creates a new state 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 state to be created
68 * @param label the string identifying the new state to be created
69 * @param labelAbbrev the string identifying (in abbreviated form) the
70 * new state to be created
71 * @see #State()
72 */
73 public State(String term, String label, String labelAbbrev) {
74 super(term, label, labelAbbrev);
75 }
76
77 //********* METHODS **************************************/
78 /**
79 * Creates a new empty state.
80 *
81 * @see #NewInstance(String, String, String)
82 */
83 public static State NewInstance(){
84 return new State();
85 }
86
87 /**
88 * Creates a new state with a description (in the {@link Language#DEFAULT() default language}),
89 * a label and a label abbreviation.
90 *
91 * @param term the string (in the default language) describing the
92 * new state to be created
93 * @param label the string identifying the new state to be created
94 * @param labelAbbrev the string identifying (in abbreviated form) the
95 * new state to be created
96 * @see #NewInstance()
97 */
98 public static State NewInstance(String term, String label, String labelAbbrev){
99 return new State(term, label, labelAbbrev);
100 }
101
102 @Override
103 protected void setDefaultTerms(TermVocabulary<State> termVocabulary){
104 termMap = new HashMap<UUID, State>();
105 for (State term : termVocabulary.getTerms()){
106 termMap.put(term.getUuid(), term);
107 }
108 }
109
110 }