BrightSide Workbench Full Report + Source Code
Worksheet.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 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 javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.ManyToOne;
27 import org.turro.action.Contacts;
28 import org.turro.plugin.contacts.IContact;
29 
34 @Entity
35 public class Worksheet implements java.io.Serializable {
36 
37  @Id
38  @GeneratedValue(strategy=GenerationType.IDENTITY)
39  @Column(name="IDENTIFIER")
40  private Long id;
41 
42  private String idContact;
43 
44  private int sheetOrder;
45 
46  @ManyToOne
47  private Issue issue;
48 
49  public Long getId() {
50  return id;
51  }
52 
53  public void setId(Long id) {
54  this.id = id;
55  }
56 
57  public String getIdContact() {
58  return idContact;
59  }
60 
61  public void setIdContact(String idContact) {
62  this.idContact = idContact;
63  resetIContact();
64  }
65 
66  public int getSheetOrder() {
67  return sheetOrder;
68  }
69 
70  public void setSheetOrder(int sheetOrder) {
71  this.sheetOrder = sheetOrder;
72  }
73 
74  public Issue getIssue() {
75  return issue;
76  }
77 
78  public void setIssue(Issue issue) {
79  this.issue = issue;
80  }
81 
84  private transient IContact _contact;
85 
86  public IContact getIContact() {
87  if(_contact == null) {
88  _contact = Contacts.getContactById(idContact);
89  }
90  return _contact;
91  }
92 
93  public void setIContact(IContact contact) {
94  _contact = contact;
95  idContact = _contact != null ? _contact.getId() : null;
96  }
97 
98  private void resetIContact() {
99  _contact = null;
100  }
101 
102 }
static IContact getContactById(String id)
Definition: Contacts.java:72
void setIContact(IContact contact)
Definition: Worksheet.java:93
void setSheetOrder(int sheetOrder)
Definition: Worksheet.java:70
void setIdContact(String idContact)
Definition: Worksheet.java:61