18 package org.turro.contacts ;
20 import javax.persistence.*;
21 import org.turro.string.Strings;
22 import org.turro.contacts.organigram.RelationType;
23 import org.turro.elephant.util.Images;
24 import org.turro.i18n.I_;
25 import org.turro.util.Chars;
26 import org.turro.util.PhraseBuilder;
30 @org.hibernate.annotations.GenericGenerator(name =
"hibernate-uuid", strategy =
"uuid")
31 public class Relation implements java.io.Serializable {
34 @GeneratedValue(generator =
"hibernate-uuid")
35 @Column(name=
"IDENTIFIER")
40 private boolean onlyOwner;
42 private String description;
44 private String relationType;
46 private boolean preferential;
48 private transient String related;
51 @JoinColumn(name=
"Contact1_FK")
52 private org.turro.contacts.Contact contact1;
55 @JoinColumn(name=
"Contact2_FK")
56 private org.turro.contacts.Contact contact2;
76 protected void setId(String
id) {
93 this.onlyOwner = onlyOwner;
101 this.description = description;
109 this.contact1 = contact1;
117 this.contact2 = contact2;
125 this.related = related;
133 this.relationType = relationType;
141 this.preferential = preferential;
149 return (Strings.isEmpty(description) && Strings.isEmpty(relationType)) ||
150 contact1 ==
null || contact2 ==
null;
156 return !Strings.isBlank(relationType) && relationType.startsWith(
"$");
160 PhraseBuilder pb =
new PhraseBuilder();
161 if(!Strings.isBlank(relationType)) {
162 pb.addWord(
I_.
byKey(relationType.substring(1)));
164 pb.addWord(description);
166 return pb.toString();
173 if(!Strings.isBlank(relationType)) {
174 if(relationType.startsWith(
"$INT")) {
static String getImage(String image)
static String byKey(String key)