BrightSide Workbench Full Report + Source Code
PushSubscription.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 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.elephant.entities.db;
20 
21 import java.io.Serializable;
22 import javax.persistence.Entity;
23 import javax.persistence.Id;
24 import javax.persistence.IdClass;
25 import org.turro.action.Contacts;
26 import org.turro.plugin.contacts.IContact;
27 
32 @Entity
33 @IdClass(PushSubscriptionPK.class)
34 public class PushSubscription implements Serializable {
35 
36  @Id private String contactId;
37 
38  @Id private String endpoint;
39 
40  private String publicKey;
41  private String privateKey;
42 
43  public String getContactId() {
44  return contactId;
45  }
46 
47  public void setContactId(String contactId) {
48  this.contactId = contactId;
49  }
50 
51  public String getEndpoint() {
52  return endpoint;
53  }
54 
55  public void setEndpoint(String endpoint) {
56  this.endpoint = endpoint;
57  }
58 
59  public String getPublicKey() {
60  return publicKey;
61  }
62 
63  public void setPublicKey(String publicKey) {
64  this.publicKey = publicKey;
65  }
66 
67  public String getPrivateKey() {
68  return privateKey;
69  }
70 
71  public void setPrivateKey(String privateKey) {
72  this.privateKey = privateKey;
73  }
74 
75  /* IContact */
76 
77  private transient IContact _contact;
78 
79  public IContact getIContact() {
80  if(_contact == null) {
81  _contact = Contacts.getContactById(contactId);
82  }
83  return _contact;
84  }
85 
86 }
static IContact getContactById(String id)
Definition: Contacts.java:72