19 package org.turro.contacts;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Date;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.Lob;
30 import javax.persistence.ManyToOne;
31 import javax.persistence.Temporal;
32 import org.turro.string.Strings;
33 import org.turro.contacts.db.ContactsPU;
34 import org.turro.elephant.calendar.EventDates;
35 import org.turro.elephant.calendar.Periodicity;
36 import org.turro.fieldit.FieldItSet;
37 import org.turro.fieldit.FieldItUtil;
38 import org.turro.fieldit.IValueItEntity;
39 import org.turro.fieldit.ValueItSet;
40 import org.turro.file.util.FileAttach;
41 import org.turro.groupit.GroupItUtil;
42 import org.turro.html.HtmlContent;
43 import org.turro.i18n.I_;
44 import org.turro.jpa.entity.IDaoEntity;
45 import org.turro.plugin.contacts.IContact;
46 import org.turro.reflection.MappingSet;
53 @org.hibernate.annotations.GenericGenerator(name =
"hibernate-uuid", strategy =
"uuid")
57 @GeneratedValue(generator =
"hibernate-uuid")
58 @Column(name=
"IDENTIFIER")
67 private String thematic;
69 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
70 private java.util.Date creation, startDate, endDate;
81 @JoinColumn(name=
"CONTACT_FK")
82 private org.turro.contacts.Contact contact;
85 @JoinColumn(name=
"RESPONSIBLE_FK")
86 private org.turro.contacts.Contact responsible;
88 private int timesSent;
90 private double price, tax;
94 private String relatedURL;
133 this.thematic = thematic;
141 this.creation = creation;
149 this.startDate = startDate;
157 this.endDate = endDate;
181 this.periodicity = periodicity;
189 this.relatedURL = relatedURL;
202 if(Strings.isEmpty(wiki) && !Strings.isEmpty(text)) {
217 this.contact = contact;
225 this.responsible = responsible;
233 this.timesSent = timesSent;
245 return Strings.isBlank(title) || Strings.isBlank(text) || role ==
null ||
246 Strings.isBlank(type) || Strings.isBlank(thematic) || Strings.isBlank(relatedURL) ||
247 contact ==
null || responsible ==
null;
253 return HtmlContent.text(
getText());
263 return contact !=
null ? contact.
getIContact() :
null;
271 return responsible !=
null ? responsible.
getIContact() :
null;
275 this.responsible = responsible !=
null ? (
Contact) responsible.
getContact() :
null;
282 String faceFile = fileAttach.
getPublicFile(
"/profile/face.png",
false);
283 return !Strings.isBlank(faceFile) ? faceFile :
null;
289 if(startDate !=
null && endDate !=
null) {
291 }
else if(startDate !=
null) {
293 }
else if(endDate !=
null) {
319 return new ArrayList<>();
325 MappingSet
set =
new MappingSet();
327 new String[] {
"title",
"creation",
"startDate",
"endDate",
"role",
"type" },
328 new String[] {
"thematic",
"text",
"contact",
"responsible",
"relatedURL",
"timesSent",
329 "price",
"tax",
"periodicity" });
330 set.addMapping(
Contact.class, 2,
331 new String[] {
"id",
"name" },
static String eventFormat(Date date)
static Collection< String > related(String path)
static Object getFieldValue(String label, String entityPath)
String getPublicFile(String file)
static ValueItSet getValues(String entityPath)
static FieldItSet getFields(String entityPath)
static String get(String msg)