1
|
/**
|
2
|
* Copyright (C) 2017 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
|
package eu.etaxonomy.cdm.model.description;
|
10
|
|
11
|
import javax.persistence.Entity;
|
12
|
import javax.persistence.FetchType;
|
13
|
import javax.persistence.ManyToOne;
|
14
|
import javax.xml.bind.annotation.XmlAccessType;
|
15
|
import javax.xml.bind.annotation.XmlAccessorType;
|
16
|
import javax.xml.bind.annotation.XmlElement;
|
17
|
import javax.xml.bind.annotation.XmlIDREF;
|
18
|
import javax.xml.bind.annotation.XmlRootElement;
|
19
|
import javax.xml.bind.annotation.XmlSchemaType;
|
20
|
import javax.xml.bind.annotation.XmlType;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
import org.hibernate.envers.Audited;
|
24
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
25
|
|
26
|
import eu.etaxonomy.cdm.model.common.Language;
|
27
|
|
28
|
/**
|
29
|
* A subclass of the Feature class that is meant for handling
|
30
|
* Features/Characters for desriptions in the narrow sense of describing
|
31
|
* an object.
|
32
|
*
|
33
|
* @author a.mueller
|
34
|
* @date 04.05.2017
|
35
|
*
|
36
|
* @deprecated This class is still experimental. It may be changed
|
37
|
* or even deleted in future without notice.
|
38
|
*/
|
39
|
|
40
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
41
|
@XmlType(name="Feature", factoryMethod="NewInstance", propOrder = {
|
42
|
"structure",
|
43
|
"property"
|
44
|
})
|
45
|
@XmlRootElement(name = "Feature")
|
46
|
@Entity
|
47
|
@Audited
|
48
|
@Deprecated
|
49
|
public class Character extends Feature {
|
50
|
|
51
|
private static final long serialVersionUID = -5631282599057455256L;
|
52
|
@SuppressWarnings("unused")
|
53
|
private static final Logger logger = Logger.getLogger(Feature.class);
|
54
|
|
55
|
|
56
|
@XmlElement(name = "Structure")
|
57
|
@XmlIDREF
|
58
|
@XmlSchemaType(name = "IDREF")
|
59
|
@ManyToOne(fetch = FetchType.LAZY)
|
60
|
@IndexedEmbedded
|
61
|
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
|
62
|
private FeatureNode structure;
|
63
|
|
64
|
@XmlElement(name = "Property")
|
65
|
@XmlIDREF
|
66
|
@XmlSchemaType(name = "IDREF")
|
67
|
@ManyToOne(fetch = FetchType.LAZY)
|
68
|
@IndexedEmbedded
|
69
|
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
|
70
|
private FeatureNode property;
|
71
|
|
72
|
/* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/
|
73
|
|
74
|
|
75
|
public static Character NewInstance() {
|
76
|
return new Character();
|
77
|
}
|
78
|
|
79
|
|
80
|
/**
|
81
|
* Class constructor: creates a new character instance associated with
|
82
|
* the given structure and property node
|
83
|
*
|
84
|
* @param structure The structure feature node for this character
|
85
|
* @param property The property feature node for this character
|
86
|
* @see #Feature()
|
87
|
*/
|
88
|
public static Character NewInstance(FeatureNode structure, FeatureNode property){
|
89
|
return new Character(structure, property, null, null, null);
|
90
|
}
|
91
|
|
92
|
|
93
|
/**
|
94
|
* Class constructor: creates a new character instance associated with
|
95
|
* the given structure and property node with a description
|
96
|
* (in the {@link Language#DEFAULT() default language}), a label and a label
|
97
|
* abbreviation.
|
98
|
*
|
99
|
* @param structure The structure feature node for this character
|
100
|
* @param property The property feature node for this character
|
101
|
* @param term
|
102
|
* the string (in the default language) describing the new
|
103
|
* feature to be created
|
104
|
* @param label
|
105
|
* the string identifying the new feature to be created
|
106
|
* @param labelAbbrev
|
107
|
* the string identifying (in abbreviated form) the new feature
|
108
|
* to be created
|
109
|
* @see #Feature()
|
110
|
*/
|
111
|
public static Character NewInstance(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev){
|
112
|
return new Character(structure, property, term, label, labelAbbrev);
|
113
|
}
|
114
|
|
115
|
|
116
|
//for hibernate use only
|
117
|
@Deprecated
|
118
|
protected Character() {
|
119
|
super();
|
120
|
}
|
121
|
|
122
|
|
123
|
/**
|
124
|
* Class constructor: creates a new character instance associated with
|
125
|
* the given structure and property node with a description
|
126
|
* (in the {@link Language#DEFAULT() default language}), a label and a label
|
127
|
* abbreviation.
|
128
|
*
|
129
|
* @param structure The structure feature node for this character
|
130
|
* @param property The property feature node for this character
|
131
|
* @param term
|
132
|
* the string (in the default language) describing the new
|
133
|
* feature to be created
|
134
|
* @param label
|
135
|
* the string identifying the new feature to be created
|
136
|
* @param labelAbbrev
|
137
|
* the string identifying (in abbreviated form) the new feature
|
138
|
* to be created
|
139
|
* @see #Feature()
|
140
|
*/
|
141
|
protected Character(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev) {
|
142
|
super(term, label, labelAbbrev);
|
143
|
this.structure = structure;
|
144
|
this.property = property;
|
145
|
}
|
146
|
|
147
|
// ****************** GETTER / SETTER *********************************************/
|
148
|
|
149
|
public FeatureNode getStructure() {
|
150
|
return structure;
|
151
|
}
|
152
|
|
153
|
public FeatureNode getProperty() {
|
154
|
return property;
|
155
|
}
|
156
|
}
|