19 package org.turro.contacts;
21 import java.util.Date;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26 import javax.persistence.ManyToOne;
27 import javax.persistence.Temporal;
28 import org.turro.string.Strings;
29 import org.turro.contacts.organigram.RelationType;
30 import org.turro.contacts.relation.FuzzyRelationTypes;
31 import org.turro.contacts.relation.ValidationStatus;
32 import org.turro.elephant.util.Images;
33 import org.turro.i18n.I_;
34 import org.turro.jpa.entity.IDaoEntity;
35 import org.turro.plugin.contacts.PositionDates;
36 import org.turro.util.CompareUtil;
37 import org.turro.util.PhraseBuilder;
44 @org.hibernate.annotations.GenericGenerator(name =
"hibernate-uuid", strategy =
"uuid")
48 @GeneratedValue(generator =
"hibernate-uuid")
49 @Column(name=
"IDENTIFIER")
52 private String description, relationType;
54 private boolean preferential, validated;
62 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
63 private java.util.Date startDate;
65 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
66 private java.util.Date endDate;
81 this.description = description;
89 this.relationType = relationType;
97 this.preferential = preferential;
105 this.validated = validated;
113 this.contact = contact;
121 this.business = business;
129 this.startDate = startDate;
137 this.endDate = endDate;
149 return (Strings.isEmpty(description) && Strings.isEmpty(relationType)) ||
150 contact ==
null || business ==
null;
160 return !Strings.isBlank(relationType) && relationType.startsWith(
"$");
186 PhraseBuilder pb =
new PhraseBuilder();
187 if(!Strings.isBlank(relationType)) {
188 pb.addWord(
I_.
byKey(relationType.substring(1)));
190 pb.addWord(description);
192 return pb.toString();
203 if(!Strings.isBlank(relationType)) {
204 if(relationType.startsWith(
"$INT")) {
217 private transient String related;
224 this.related = related;
231 int result = CompareUtil.compare(validated, o.validated);
233 result = CompareUtil.compare(preferential, o.preferential);
236 result = CompareUtil.compare(endDate, o.endDate);
239 result = CompareUtil.compare(startDate, o.startDate);
242 result = CompareUtil.compare(description, o.description);
245 result = CompareUtil.compare(
id, o.id);
static String getImage(String image)
static String byKey(String key)