BrightSide Workbench Full Report + Source Code
PublicationBlogger.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.publication.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 PublicationBlogger 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 boolean administrator;
45 
46  @ManyToOne
47  private PublicationCategory publicationCategory;
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 boolean isAdministrator() {
67  return administrator;
68  }
69 
70  public void setAdministrator(boolean administrator) {
71  this.administrator = administrator;
72  }
73 
75  return publicationCategory;
76  }
77 
78  public void setPublicationCategory(PublicationCategory publicationCategory) {
79  this.publicationCategory = publicationCategory;
80  }
81 
84  private transient IContact _contact;
85 
86  public IContact getContact() {
87  if(_contact == null) {
88  _contact = Contacts.getContactById(idContact);
89  }
90  return _contact;
91  }
92 
93  public void setContact(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 setPublicationCategory(PublicationCategory publicationCategory)