BrightSide Workbench Full Report + Source Code
ParticipantRequest.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2018 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.dossier.entity;
20 
21 import java.util.Date;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.Temporal;
30 import org.turro.action.Contacts;
31 import org.turro.plugin.contacts.IContact;
32 
37 @Entity
38 public class ParticipantRequest implements java.io.Serializable {
39 
40  @Id
41  @GeneratedValue(strategy=GenerationType.IDENTITY)
42  @Column(name="IDENTIFIER")
43  private Long id;
44 
45  @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
46  private java.util.Date creation;
47 
48  private String idContact;
49 
50  private String discriminator;
51 
52  private boolean coordinator, beneficiary, offerer, research, funding, support, consortium;
53 
54  @ManyToOne
55  @JoinColumn(name="DOSSIER_FK")
56  private Dossier dossier;
57 
58  public Dossier getDossier() {
59  return dossier;
60  }
61 
62  public void setDossier(Dossier dossier) {
63  this.dossier = dossier;
64  }
65 
66  public Long getId() {
67  return id;
68  }
69 
70  public void setId(Long id) {
71  this.id = id;
72  }
73 
74  public Date getCreation() {
75  return creation;
76  }
77 
78  public void setCreation(Date creation) {
79  this.creation = creation;
80  }
81 
82  public String getIdContact() {
83  return idContact;
84  }
85 
86  public void setIdContact(String idContact) {
87  this.idContact = idContact;
88  resetIContact();
89  }
90 
91  public String getDiscriminator() {
92  return discriminator;
93  }
94 
95  public void setDiscriminator(String discriminator) {
96  this.discriminator = discriminator;
97  }
98 
99  public boolean isCoordinator() {
100  return coordinator;
101  }
102 
103  public void setCoordinator(boolean coordinator) {
104  this.coordinator = coordinator;
105  }
106 
107  public boolean isBeneficiary() {
108  return beneficiary;
109  }
110 
111  public void setBeneficiary(boolean beneficiary) {
112  this.beneficiary = beneficiary;
113  }
114 
115  public boolean isOfferer() {
116  return offerer;
117  }
118 
119  public void setOfferer(boolean offerer) {
120  this.offerer = offerer;
121  }
122 
123  public boolean isResearch() {
124  return research;
125  }
126 
127  public void setResearch(boolean research) {
128  this.research = research;
129  }
130 
131  public boolean isFunding() {
132  return funding;
133  }
134 
135  public void setFunding(boolean funding) {
136  this.funding = funding;
137  }
138 
139  public boolean isSupport() {
140  return support;
141  }
142 
143  public void setSupport(boolean support) {
144  this.support = support;
145  }
146 
147  public boolean isConsortium() {
148  return consortium;
149  }
150 
151  public void setConsortium(boolean consortium) {
152  this.consortium = consortium;
153  }
154 
155  /* Helpers */
156 
157  public boolean isEmpty() {
158  return !getIContact().isValid();
159  }
160 
163  private transient IContact _contact;
164 
166  if(_contact == null) {
167  _contact = Contacts.getContactById(idContact);
168  }
169  return _contact;
170  }
171 
172  public void setIContact(IContact contact) {
173  _contact = contact;
174  idContact = _contact != null ? _contact.getId() : null;
175  }
176 
177  private void resetIContact() {
178  _contact = null;
179  }
180 
181 }
static IContact getContactById(String id)
Definition: Contacts.java:72