1 package eu
.etaxonomy
.cdm
.model
.common
;
5 import javax
.persistence
.Entity
;
6 import javax
.persistence
.Inheritance
;
7 import javax
.persistence
.InheritanceType
;
8 import javax
.persistence
.OneToMany
;
9 import javax
.persistence
.Transient
;
11 import org
.apache
.log4j
.Logger
;
14 @Inheritance(strategy
=InheritanceType
.SINGLE_TABLE
)
15 public abstract class RelationshipTermBase
extends EnumeratedTermBase
{
16 static Logger logger
= Logger
.getLogger(RelationshipTermBase
.class);
18 private boolean symmetric
;
19 private boolean transitive
;
20 private Set
<Representation
> inverseRepresentations
;
22 public RelationshipTermBase(String term
, String label
, Enumeration enumeration
, boolean symmetric
, boolean transitive
) {
23 super(term
, label
, enumeration
);
24 setSymmetric(symmetric
);
25 setTransitive(transitive
);
29 public boolean isSymmetric() {
32 public void setSymmetric(boolean symmetric
) {
33 this.symmetric
= symmetric
;
36 public boolean isTransitive() {
39 public void setTransitive(boolean transitive
) {
40 this.transitive
= transitive
;
45 public Set
<Representation
> getInverseRepresentations() {
46 return inverseRepresentations
;
48 protected void setInverseRepresentations(
49 Set
<Representation
> inverseRepresentations
) {
50 this.inverseRepresentations
= inverseRepresentations
;
52 public void addRepresentation(Representation representation
) {
53 this.inverseRepresentations
.add(representation
);
55 public void removeRepresentation(Representation representation
) {
56 this.inverseRepresentations
.remove(representation
);
60 public Representation
getInverseRepresentation(Language lang
) {
61 Representation result
= null;
62 if (this.isSymmetric()){
63 for (Representation repr
: this.getRepresentations()){
64 if (repr
.getLanguage() == lang
){
69 for (Representation repr
: this.getInverseRepresentations()){
70 if (repr
.getLanguage() == lang
){