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
|
import eu.etaxonomy.cdm.model.term.DefinedTerm;
|
28
|
import eu.etaxonomy.cdm.model.term.FeatureNode;
|
29
|
import eu.etaxonomy.cdm.model.term.TermType;
|
30
|
|
31
|
/**
|
32
|
* A subclass of the Feature class that is meant for handling
|
33
|
* Features/Characters for descriptions in the narrow sense of describing
|
34
|
* an object.
|
35
|
*
|
36
|
* @author a.mueller
|
37
|
* @since 04.05.2017
|
38
|
*/
|
39
|
|
40
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
41
|
@XmlType(name="Feature", factoryMethod="NewInstance", propOrder = {
|
42
|
"structure",
|
43
|
"structureModifier",
|
44
|
"property",
|
45
|
"propertyModifier"
|
46
|
})
|
47
|
@XmlRootElement(name = "Character")
|
48
|
@Entity
|
49
|
@Audited
|
50
|
public class Character extends Feature {
|
51
|
|
52
|
private static final long serialVersionUID = -5631282599057455256L;
|
53
|
@SuppressWarnings("unused")
|
54
|
private static final Logger logger = Logger.getLogger(Feature.class);
|
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
|
//#8120
|
65
|
@XmlElement(name = "StructureModifier")
|
66
|
@XmlIDREF
|
67
|
@XmlSchemaType(name = "IDREF")
|
68
|
@ManyToOne(fetch = FetchType.LAZY)
|
69
|
@IndexedEmbedded
|
70
|
private DefinedTerm structureModifier;
|
71
|
|
72
|
@XmlElement(name = "Property")
|
73
|
@XmlIDREF
|
74
|
@XmlSchemaType(name = "IDREF")
|
75
|
@ManyToOne(fetch = FetchType.LAZY)
|
76
|
@IndexedEmbedded
|
77
|
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
|
78
|
private FeatureNode property;
|
79
|
|
80
|
//#8120
|
81
|
/**
|
82
|
* @deprecated experimental, may be removed in future
|
83
|
*/
|
84
|
@Deprecated
|
85
|
@XmlElement(name = "PropertyModifier")
|
86
|
@XmlIDREF
|
87
|
@XmlSchemaType(name = "IDREF")
|
88
|
@ManyToOne(fetch = FetchType.LAZY)
|
89
|
@IndexedEmbedded
|
90
|
private DefinedTerm propertyModifier;
|
91
|
|
92
|
/* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
public static Character NewInstance() {
|
98
|
return new Character();
|
99
|
}
|
100
|
|
101
|
|
102
|
/**
|
103
|
* Class constructor: creates a new character instance associated with
|
104
|
* the given structure and property node
|
105
|
*
|
106
|
* @param structure The structure feature node for this character
|
107
|
* @param property The property feature node for this character
|
108
|
* @see #Feature()
|
109
|
*/
|
110
|
public static Character NewInstance(FeatureNode structure, FeatureNode property){
|
111
|
return new Character(structure, property, null, null, null);
|
112
|
}
|
113
|
|
114
|
|
115
|
/**
|
116
|
* Class constructor: creates a new character instance associated with
|
117
|
* the given structure and property node with a description
|
118
|
* (in the {@link Language#DEFAULT() default language}), a label and a label
|
119
|
* abbreviation.
|
120
|
*
|
121
|
* @param structure The structure feature node for this character
|
122
|
* @param property The property feature node for this character
|
123
|
* @param term
|
124
|
* the string (in the default language) describing the new
|
125
|
* feature to be created
|
126
|
* @param label
|
127
|
* the string identifying the new feature to be created
|
128
|
* @param labelAbbrev
|
129
|
* the string identifying (in abbreviated form) the new feature
|
130
|
* to be created
|
131
|
* @see #Feature()
|
132
|
*/
|
133
|
public static Character NewInstance(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev){
|
134
|
return new Character(structure, property, term, label, labelAbbrev);
|
135
|
}
|
136
|
|
137
|
|
138
|
//for hibernate use only
|
139
|
@Deprecated
|
140
|
protected Character() {
|
141
|
super();
|
142
|
this.setTermType(TermType.Character);
|
143
|
}
|
144
|
|
145
|
|
146
|
/**
|
147
|
* Class constructor: creates a new character instance associated with
|
148
|
* the given structure and property node with a description
|
149
|
* (in the {@link Language#DEFAULT() default language}), a label and a label
|
150
|
* abbreviation.
|
151
|
*
|
152
|
* @param structure The structure feature node for this character
|
153
|
* @param property The property feature node for this character
|
154
|
* @param term
|
155
|
* the string (in the default language) describing the new
|
156
|
* feature to be created
|
157
|
* @param label
|
158
|
* the string identifying the new feature to be created
|
159
|
* @param labelAbbrev
|
160
|
* the string identifying (in abbreviated form) the new feature
|
161
|
* to be created
|
162
|
* @see #Feature()
|
163
|
*/
|
164
|
protected Character(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev) {
|
165
|
super(term, label, labelAbbrev);
|
166
|
this.setTermType(TermType.Character);
|
167
|
this.structure = structure;
|
168
|
this.property = property;
|
169
|
}
|
170
|
|
171
|
// ****************** GETTER / SETTER *********************************************/
|
172
|
|
173
|
public FeatureNode getStructure() {
|
174
|
return structure;
|
175
|
}
|
176
|
public void setStructure(FeatureNode structure) {
|
177
|
this.structure = structure;
|
178
|
}
|
179
|
|
180
|
public FeatureNode getProperty() {
|
181
|
return property;
|
182
|
}
|
183
|
public void setProperty(FeatureNode property) {
|
184
|
this.property = property;
|
185
|
}
|
186
|
|
187
|
public DefinedTerm getStructureModifier() {
|
188
|
return structureModifier;
|
189
|
}
|
190
|
public void setStructureModifier(DefinedTerm structureModifier) {
|
191
|
this.structureModifier = structureModifier;
|
192
|
}
|
193
|
|
194
|
/**
|
195
|
* @return
|
196
|
* @deprecated experimental, may be removed in future
|
197
|
*/
|
198
|
@Deprecated
|
199
|
public DefinedTerm getPropertyModifier() {
|
200
|
return propertyModifier;
|
201
|
}
|
202
|
/**
|
203
|
* @param propertyModifier
|
204
|
* @deprecated experimental, may be removed in future
|
205
|
*/
|
206
|
@Deprecated
|
207
|
public void setPropertyModifier(DefinedTerm propertyModifier) {
|
208
|
this.propertyModifier = propertyModifier;
|
209
|
}
|
210
|
|
211
|
}
|