BrightSide Workbench Full Report + Source Code
Attendee.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2017 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.contacts;
20 
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.ManyToOne;
27 import org.turro.action.Contacts;
28 import org.turro.jpa.entity.IDaoEntity;
29 import org.turro.plugin.contacts.IContact;
30 import org.turro.util.CompareUtil;
31 
36 @Entity
37 @org.hibernate.annotations.GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
38 public class Attendee implements java.io.Serializable, IDaoEntity {
39 
40  @Id
41  @GeneratedValue(generator = "hibernate-uuid")
42  @Column(name="IDENTIFIER")
43  private String id;
44 
45  @ManyToOne
46  @JoinColumn(name="CONVOCATION_FK")
47  private Convocation convocation;
48 
49  @ManyToOne
50  @JoinColumn(name="CONTACT_FK")
51  private Contact contact;
52 
53  private boolean attended;
54 
55  public String getId() {
56  return id;
57  }
58 
59  public void setId(String id) {
60  this.id = id;
61  }
62 
64  return convocation;
65  }
66 
67  public void setConvocation(Convocation convocation) {
68  this.convocation = convocation;
69  }
70 
71  public Contact getContact() {
72  return contact;
73  }
74 
75  public void setContact(Contact contact) {
76  this.contact = contact;
77  }
78 
79  public boolean isAttended() {
80  return attended;
81  }
82 
83  public void setAttended(boolean attended) {
84  this.attended = attended;
85  }
86 
87  /* IDaoEntity */
88 
89  @Override
90  public Object entityId() {
91  return id;
92  }
93 
94  @Override
95  public boolean isEmpty() {
96  return contact == null || convocation == null;
97  }
98 
99  /* Helpers */
100 
101  public boolean exists(Contact contact) {
102  if(this.contact != null && contact != null) {
103  return CompareUtil.compare(this.contact.getId(), contact.getId()) == 0;
104  }
105  return false;
106  }
107 
109  return Contacts.getContact(contact);
110  }
111 
112 }
static IContact getContact(Object object)
Definition: Contacts.java:109
void setId(String id)
Definition: Attendee.java:59
void setConvocation(Convocation convocation)
Definition: Attendee.java:67
Convocation getConvocation()
Definition: Attendee.java:63
void setContact(Contact contact)
Definition: Attendee.java:75
boolean exists(Contact contact)
Definition: Attendee.java:101
void setAttended(boolean attended)
Definition: Attendee.java:83