BrightSide Workbench Full Report + Source Code
SignUp.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2014 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.contacts;
20 
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.Id;
25 import javax.persistence.Lob;
26 import org.turro.collections.parser.ParserException;
27 import org.turro.collections.KeyValueMap;
28 import org.zkoss.lang.Strings;
29 
34 @Entity
35 @org.hibernate.annotations.GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
36 public class SignUp implements java.io.Serializable {
37 
38  @Id
39  @GeneratedValue(generator = "hibernate-uuid")
40  @Column(name="IDENTIFIER")
41  private String id;
42 
43  private String name;
44  private String email;
45 
46  private String comment;
47 
48  private boolean confirmed;
49 
50  @Lob
51  @Column(length=4096)
52  private String valueMap;
53 
54  public String getId() {
55  return id;
56  }
57 
58  public void setId(String id) {
59  this.id = id;
60  }
61 
62  public String getName() {
63  return name;
64  }
65 
66  public void setName(String name) {
67  this.name = name;
68  }
69 
70  public String getEmail() {
71  return email;
72  }
73 
74  public void setEmail(String email) {
75  this.email = email == null ? null : email.toLowerCase();
76  }
77 
78  public String getComment() {
79  return comment;
80  }
81 
82  public void setComment(String comment) {
83  this.comment = comment;
84  }
85 
86  public boolean isConfirmed() {
87  return confirmed;
88  }
89 
90  public void setConfirmed(boolean confirmed) {
91  this.confirmed = confirmed;
92  }
93 
94  public String getValueMap() {
95  return valueMap;
96  }
97 
98  public void setValueMap(String valueMap) {
99  this.valueMap = valueMap;
100  }
101 
102  /* Helpers */
103 
104  public boolean isValid() {
105  return !Strings.isBlank(name) &&
106  !Strings.isBlank(email);
107  }
108 
109  public KeyValueMap getValues() throws ParserException {
110  return new KeyValueMap(valueMap);
111  }
112 
113 }
KeyValueMap getValues()
Definition: SignUp.java:109
void setComment(String comment)
Definition: SignUp.java:82
void setId(String id)
Definition: SignUp.java:58
void setEmail(String email)
Definition: SignUp.java:74
void setConfirmed(boolean confirmed)
Definition: SignUp.java:90
void setName(String name)
Definition: SignUp.java:66
void setValueMap(String valueMap)
Definition: SignUp.java:98