root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/PreservationMethod.java

Revision 10455, 2.5 kB (checked in by a.mueller, 20 months ago)

reset for defined terms

  • Property svn:keywords set to Id
Line 
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
10package eu.etaxonomy.cdm.model.occurrence;
11
12import java.util.HashMap;
13import java.util.Map;
14import java.util.UUID;
15
16import eu.etaxonomy.cdm.model.common.DefinedTermBase;
17import eu.etaxonomy.cdm.model.common.TermVocabulary;
18
19import org.apache.log4j.Logger;
20import org.hibernate.envers.Audited;
21import org.hibernate.search.annotations.Indexed;
22
23import javax.persistence.*;
24import javax.xml.bind.annotation.XmlAccessType;
25import javax.xml.bind.annotation.XmlAccessorType;
26import javax.xml.bind.annotation.XmlRootElement;
27import javax.xml.bind.annotation.XmlType;
28
29/**
30 * http://rs.tdwg.org/ontology/voc/Collection.rdf#SpecimenPreservationMethodTypeTerm
31 * @author m.doering
32 * @version 1.0
33 * @created 08-Nov-2007 13:06:44
34 */
35@XmlAccessorType(XmlAccessType.FIELD)
36@XmlType(name = "PreservationMethod")
37@XmlRootElement(name = "PreservationMethod")
38@Entity
39@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
40@Audited
41public class PreservationMethod extends DefinedTermBase<PreservationMethod> {
42        private static final long serialVersionUID = -6597303767771121540L;
43        @SuppressWarnings("unused")
44        private static final Logger logger = Logger.getLogger(PreservationMethod.class);
45       
46        protected static Map<UUID, PreservationMethod> termMap = null;
47       
48        /**
49         * Factory method
50         * @return
51         */
52        public static PreservationMethod NewInstance(){
53                return new PreservationMethod();
54        }
55       
56        /**
57         * Constructor
58         */
59        public PreservationMethod() {
60        }
61       
62        /**
63         * Factory method
64         * @return
65         */
66        public static PreservationMethod NewInstance(String term, String label, String labelAbbrev) {
67                return new PreservationMethod(term, label, labelAbbrev);
68        }
69       
70        /**
71         * Constructor
72         */
73        protected PreservationMethod(String term, String label, String labelAbbrev) {
74                super(term, label, labelAbbrev);
75        }
76
77// *************************** METHODS ******************************************************/ 
78       
79        /* (non-Javadoc)
80         * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
81         */
82        @Override
83        public void resetTerms(){
84                termMap = null;
85        }
86
87       
88        @Override
89        protected void setDefaultTerms(TermVocabulary<PreservationMethod> termVocabulary){
90                termMap = new HashMap<UUID, PreservationMethod>();
91                for (PreservationMethod term : termVocabulary.getTerms()){
92                        termMap.put(term.getUuid(), term); 
93                }
94        }
95}
Note: See TracBrowser for help on using the browser.