View Javadoc
1   /*
2    * JBoss, Home of Professional Open Source
3    * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
4    * contributors by the @authors tag. See the copyright.txt in the
5    * distribution for a full listing of individual contributors.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * http://www.apache.org/licenses/LICENSE-2.0
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.jboss.as.quickstarts.kitchensink.model;
18  
19  import java.io.Serializable;
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.Table;
26  import javax.persistence.UniqueConstraint;
27  import javax.validation.constraints.Digits;
28  import javax.validation.constraints.NotNull;
29  import javax.validation.constraints.Pattern;
30  import javax.validation.constraints.Size;
31  import javax.xml.bind.annotation.XmlRootElement;
32  
33  import org.hibernate.validator.constraints.Email;
34  import org.hibernate.validator.constraints.NotEmpty;
35  
36  @SuppressWarnings("serial")
37  @Entity
38  @XmlRootElement
39  @Table(name = "MemberMl", uniqueConstraints = @UniqueConstraint(columnNames = "email"))
40  public class Member implements Serializable {
41  
42      @Id
43      @GeneratedValue
44      private Long id;
45  
46      @NotNull
47      @Size(min = 1, max = 25)
48      @Pattern(regexp = "[A-Za-z ]*", message = "{name_validation_message}")
49      private String name;
50  
51      @NotNull
52      @NotEmpty
53      @Email
54      private String email;
55  
56      @NotNull
57      @Size(min = 10, max = 12)
58      @Digits(fraction = 0, integer = 12)
59      @Column(name = "phone_number")
60      private String phoneNumber;
61  
62      public Long getId() {
63          return id;
64      }
65  
66      public void setId(Long id) {
67          this.id = id;
68      }
69  
70      public String getName() {
71          return name;
72      }
73  
74      public void setName(String name) {
75          this.name = name;
76      }
77  
78      public String getEmail() {
79          return email;
80      }
81  
82      public void setEmail(String email) {
83          this.email = email;
84      }
85  
86      public String getPhoneNumber() {
87          return phoneNumber;
88      }
89  
90      public void setPhoneNumber(String phoneNumber) {
91          this.phoneNumber = phoneNumber;
92      }
93  }