minor
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / description / Modifier.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 eu.etaxonomy.cdm.model.common.Language;
18 import eu.etaxonomy.cdm.model.common.OrderedTermBase;
19 import eu.etaxonomy.cdm.model.common.TermVocabulary;
20 import eu.etaxonomy.cdm.model.location.NamedArea;
21
22 import org.apache.log4j.Logger;
23 import org.hibernate.envers.Audited;
24 import org.hibernate.search.annotations.Indexed;
25
26 import javax.persistence.*;
27 import javax.xml.bind.annotation.XmlAccessType;
28 import javax.xml.bind.annotation.XmlAccessorType;
29 import javax.xml.bind.annotation.XmlRootElement;
30 import javax.xml.bind.annotation.XmlType;
31
32 /**
33 * This class represents possible modulations for the validity of
34 * information pieces ({@link DescriptionElementBase} description elements).
35 * It can cover probability ("perhaps"), frequency ("often") intensity ("very"),
36 * timing ("spring") and other domains. Its instances can be grouped to build
37 * different controlled {@link TermVocabulary term vocabularies}.
38 * <P>
39 * This class corresponds to GeneralModifierNLDType according to
40 * the SDD schema.
41 *
42 * @author m.doering
43 * @version 1.0
44 * @created 08-Nov-2007 13:06:35
45 */
46 @XmlAccessorType(XmlAccessType.FIELD)
47 @XmlType(name = "Modifier")
48 @XmlRootElement(name = "Modifier")
49 @Entity
50 @Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
51 @Audited
52 public class Modifier extends OrderedTermBase<Modifier> {
53 private static final long serialVersionUID = -2491833848163461951L;
54 @SuppressWarnings("unused")
55 private static final Logger logger = Logger.getLogger(Modifier.class);
56
57 protected static Map<UUID, Modifier> termMap = null;
58
59 /**
60 * Class constructor: creates a new empty modifier instance.
61 *
62 * @see #Modifier(String, String, String)
63 */
64 public Modifier(){
65 }
66
67
68 /**
69 * Class constructor: creates a new modifier with a description
70 * (in the {@link Language#DEFAULT() default language}), a label and a label abbreviation.
71 *
72 * @param term the string (in the default language) describing the
73 * new modifier to be created
74 * @param label the string identifying the new modifier to be created
75 * @param labelAbbrev the string identifying (in abbreviated form) the
76 * new modifier to be created
77 * @see #Modifier()
78 */
79 public Modifier(String term, String label, String labelAbbrev) {
80 super(term, label, labelAbbrev);
81 }
82
83 /**
84 * Creates a new empty modifier instance.
85 *
86 * @see #Modifier(String, String, String)
87 */
88 public static Modifier NewInstance(){
89 return new Modifier();
90 }
91
92
93 @Override
94 protected void setDefaultTerms(TermVocabulary<Modifier> termVocabulary) {
95 termMap = new HashMap<UUID, Modifier>();
96 for (Modifier term : termVocabulary.getTerms()){
97 termMap.put(term.getUuid(), term);
98 }
99 }
100
101 }