BrightSide Workbench Full Report + Source Code
PublicationSubscription.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 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 package org.turro.publication.entity;
19 
20 import java.util.Date;
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 javax.persistence.Temporal;
28 import org.turro.action.Contacts;
29 import org.turro.plugin.contacts.IContact;
30 
36 @Entity
37 @Deprecated
38 public class PublicationSubscription 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  @ManyToOne
51  private PublicationCategory publicationCategory;
52 
53  public Date getCreation() {
54  return creation;
55  }
56 
57  public void setCreation(Date creation) {
58  this.creation = creation;
59  }
60 
61  public Long getId() {
62  return id;
63  }
64 
65  public void setId(Long id) {
66  this.id = id;
67  }
68 
69  public String getIdContact() {
70  return idContact;
71  }
72 
73  public void setIdContact(String idContact) {
74  this.idContact = idContact;
75  resetIContact();
76  }
77 
79  return publicationCategory;
80  }
81 
82  public void setPublicationCategory(PublicationCategory publicationCategory) {
83  this.publicationCategory = publicationCategory;
84  }
85 
88  private transient IContact _contact;
89 
90  public IContact getContact() {
91  if(_contact == null) {
92  _contact = Contacts.getContactById(idContact);
93  }
94  return _contact;
95  }
96 
97  public void setContact(IContact contact) {
98  _contact = contact;
99  idContact = _contact != null ? _contact.getId() : null;
100  }
101 
102  private void resetIContact() {
103  _contact = null;
104  }
105 
106 }
static IContact getContactById(String id)
Definition: Contacts.java:72
void setPublicationCategory(PublicationCategory publicationCategory)