BrightSide Workbench Full Report + Source Code
Syndication.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.contacts;
19 
20 import java.io.Serializable;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.ManyToOne;
27 import org.hibernate.annotations.ColumnDefault;
28 import org.turro.jpa.entity.IDaoEntity;
29 import org.turro.security.SecurityGroup;
30 import org.turro.security.SecurityGroups;
31 import org.zkoss.lang.Strings;
32 
37 @Entity
38 @org.hibernate.annotations.GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
39 public class Syndication implements Serializable, IDaoEntity {
40 
41  @Id
42  @GeneratedValue(generator = "hibernate-uuid")
43  @Column(name="IDENTIFIER")
44  private String id;
45 
46  @Column(name="SYNDICATION_NAME")
47  private String name;
48 
49  @Column(name="IS_DYNAMIC")
50  @ColumnDefault("false")
51  private boolean dynamic;
52 
53  @ManyToOne
54  @JoinColumn(name="CONTACT_FK")
55  private org.turro.contacts.Contact contact;
56 
57  public String getId() {
58  return id;
59  }
60 
61  protected void setId(String id) {
62  this.id = id;
63  }
64 
65  public String getName() {
66  return name;
67  }
68 
69  public void setName(String name) {
70  this.name = name;
71  }
72 
73  public boolean isDynamic() {
74  return dynamic;
75  }
76 
77  public void setDynamic(boolean dynamic) {
78  this.dynamic = dynamic;
79  }
80 
81  public org.turro.contacts.Contact getContact() {
82  return contact;
83  }
84 
85  public void setContact(org.turro.contacts.Contact contact) {
86  this.contact = contact;
87  }
88 
89  /* Utils */
90 
92  return SecurityGroups.get(name);
93  }
94 
95  /* IDaoEntity */
96 
97  @Override
98  public Object entityId() {
99  return id;
100  }
101 
102  @Override
103  public boolean isEmpty() {
104  return Strings.isEmpty(name);
105  }
106 
107 }
void setDynamic(boolean dynamic)
void setContact(org.turro.contacts.Contact contact)
org.turro.contacts.Contact getContact()
static SecurityGroup get(String id)