19 package org.turro.contacts;
21 import java.util.Date;
22 import java.util.HashSet;
24 import java.util.TreeSet;
25 import java.util.concurrent.TimeUnit;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Embedded;
29 import javax.persistence.Entity;
30 import javax.persistence.FetchType;
31 import javax.persistence.GeneratedValue;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.Lob;
35 import javax.persistence.ManyToOne;
36 import javax.persistence.OneToMany;
37 import javax.persistence.Temporal;
38 import org.turro.string.Strings;
39 import org.turro.assistant.Assistant;
40 import org.turro.assistant.AssistantConstants;
41 import org.turro.assistant.AssistantSet;
42 import org.turro.assistant.Assistants;
43 import org.turro.auth.Authentication;
44 import org.turro.contacts.db.ContactsPU;
45 import org.turro.elephant.calendar.EventDates;
46 import org.turro.elephant.db.WhereClause;
47 import org.turro.entities.Entities;
48 import org.turro.entities.IElephantEntity;
49 import org.turro.html.HtmlContent;
50 import org.turro.i18n.I_;
51 import org.turro.jpa.entity.IDaoEntity;
52 import org.turro.parser.wiki.WikiCompiler;
53 import org.turro.plugin.contacts.IContact;
54 import org.turro.reflection.MappingSet;
55 import org.turro.util.CompareUtil;
56 import org.turro.ws.embeddables.WsServers;
57 import org.turro.zul.convocation.AttendeeComparator;
64 @org.hibernate.annotations.GenericGenerator(name =
"hibernate-uuid", strategy =
"uuid")
68 @GeneratedValue(generator =
"hibernate-uuid")
69 @Column(name=
"IDENTIFIER")
72 private String entityPath;
74 private boolean online, publishable;
76 private String name, location, onlineUrl;
78 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
79 private java.util.Date callDate, endDate;
90 @JoinColumn(name=
"CONTACT_FK")
93 private String icalIdentifier;
95 @OneToMany(mappedBy =
"convocation", fetch = FetchType.EAGER, cascade=CascadeType.ALL, orphanRemoval=
true)
96 private Set<Attendee> attendees =
new HashSet<>();
99 private WsServers servers;
114 this.entityPath = entityPath;
122 this.online = online;
130 this.publishable = publishable;
150 this.location = location;
158 this.onlineUrl = onlineUrl;
162 this.callDate = callDate;
170 this.endDate = endDate;
183 if(Strings.isEmpty(wiki) && !Strings.isEmpty(text)) {
199 this.organizer = organizer;
203 return icalIdentifier;
207 this.icalIdentifier = icalIdentifier;
215 this.attendees = attendees;
223 this.servers = servers;
229 if(callDate !=
null && endDate !=
null) {
231 }
else if(callDate !=
null) {
233 }
else if(endDate !=
null) {
248 return Strings.isBlank(name) || Strings.isBlank(text) || callDate ==
null ||
249 endDate ==
null || organizer ==
null;
255 return HtmlContent.text(
getText());
271 if(contact !=
null) {
273 if(a.exists(contact))
return;
290 wc.
addClause(
"where a.convocation.id = :id");
303 if(a.isAttended() && a.getIContact().getId().equals(contact.
getId()))
return true;
309 return endDate.before(
new Date());
313 return TimeUnit.DAYS.convert(callDate.getTime() -
new Date().getTime(), TimeUnit.MILLISECONDS);
321 if(contact !=
null && contact.
isValid()) {
328 if(contact !=
null) {
329 if(organizer !=
null) {
330 if(CompareUtil.compare(organizer.getId(), contact.
getId()) == 0) {
335 if(a.exists(contact))
return true;
343 set.addAll(attendees);
350 MappingSet
set =
new MappingSet();
352 new String[] {
"id",
"entityPath",
"name",
"onLine",
"publishable",
353 "callDate",
"endDate",
"organizer" },
354 new String[] {
"text",
"location",
"onLineUrl",
"icalIdentifier",
"attendees" });
356 new String[] {
"id" },
357 new String[] {
"contact" });
358 set.addMapping(
Contact.class, 3,
359 new String[] {
"id" },
static void addAssistants(String role, AssistantSet list, Object data)
static IContact getIContact()
static String eventFormat(Date date)
void addClause(String clause)
void addNamedValue(String name, Object value)
static IElephantEntity getController(String path)
static String get(String msg)
int executeUpdate(String query)