Advertisement
Guest User

Responder.java

a guest
Apr 30th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. /*
  2. * Created by Divyansh Gupta on 2017.03.22 *
  3. * Copyright © 2017 Divyansh Gupta. All rights reserved. *
  4. */
  5. package com.mycompany.DisasterRecovery;
  6.  
  7. import java.io.Serializable;
  8. import javax.persistence.Basic;
  9. import javax.persistence.Column;
  10. import javax.persistence.Entity;
  11. import javax.persistence.GeneratedValue;
  12. import javax.persistence.GenerationType;
  13. import javax.persistence.Id;
  14. import javax.persistence.JoinColumn;
  15. import javax.persistence.ManyToOne;
  16. import javax.persistence.NamedQueries;
  17. import javax.persistence.NamedQuery;
  18. import javax.persistence.Table;
  19. import javax.validation.constraints.NotNull;
  20. import javax.validation.constraints.Size;
  21. import javax.xml.bind.annotation.XmlRootElement;
  22.  
  23. /**
  24. *
  25. * @author divyansh
  26. */
  27. @Entity
  28. @Table(name = "Responder")
  29. @XmlRootElement
  30. @NamedQueries({
  31. @NamedQuery(name = "Responder.findAll", query = "SELECT r FROM Responder r")
  32. , @NamedQuery(name = "Responder.findById", query = "SELECT r FROM Responder r WHERE r.id = :id")
  33. , @NamedQuery(name = "Responder.findByUsername", query = "SELECT r FROM Responder r WHERE r.username = :username")
  34. , @NamedQuery(name = "Responder.findByResponderName", query = "SELECT r FROM Responder r WHERE r.responderName = :responderName")
  35. , @NamedQuery(name = "Responder.findByImage", query = "SELECT r FROM Responder r WHERE r.image = :image")})
  36. public class Responder implements Serializable {
  37.  
  38. // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
  39. @Basic(optional = false)
  40. @NotNull
  41. @Size(min = 1, max = 100)
  42. @Column(name = "email")
  43. private String email;
  44.  
  45. @Basic(optional = false)
  46. @NotNull
  47. @Size(min = 1, max = 255)
  48. @Column(name = "password")
  49. private String password;
  50.  
  51. private static final long serialVersionUID = 1L;
  52.  
  53. @Id
  54. @GeneratedValue(strategy = GenerationType.IDENTITY)
  55. @Basic(optional = false)
  56. @Column(name = "ID")
  57. private Integer id;
  58.  
  59. @Basic(optional = false)
  60. @NotNull
  61. @Size(min = 1, max = 100)
  62. @Column(name = "username")
  63. private String username;
  64.  
  65. @Basic(optional = false)
  66. @NotNull
  67. @Size(min = 1, max = 100)
  68. @Column(name = "responder_name")
  69. private String responderName;
  70.  
  71. @Basic(optional = false)
  72. @NotNull
  73. @Size(min = 1, max = 100)
  74. @Column(name = "image")
  75. private String image;
  76.  
  77. @JoinColumn(name = "location_id", referencedColumnName = "ID")
  78. @ManyToOne
  79. private Location locationId;
  80.  
  81. public Responder() {
  82. }
  83.  
  84. public Responder(Integer id) {
  85. this.id = id;
  86. }
  87.  
  88. public Responder(Integer id, String username, String responderName, String image) {
  89. this.id = id;
  90. this.username = username;
  91. this.responderName = responderName;
  92. this.image = image;
  93. }
  94.  
  95. public Integer getId() {
  96. return id;
  97. }
  98.  
  99. public void setId(Integer id) {
  100. this.id = id;
  101. }
  102.  
  103. public String getUsername() {
  104. return username;
  105. }
  106.  
  107. public void setUsername(String username) {
  108. this.username = username;
  109. }
  110.  
  111. public String getResponderName() {
  112. return responderName;
  113. }
  114.  
  115. public void setResponderName(String responderName) {
  116. this.responderName = responderName;
  117. }
  118.  
  119. public String getImage() {
  120. return image;
  121. }
  122.  
  123. public void setImage(String image) {
  124. this.image = image;
  125. }
  126.  
  127. public Location getLocationId() {
  128. return locationId;
  129. }
  130.  
  131. public void setLocationId(Location locationId) {
  132. this.locationId = locationId;
  133. }
  134.  
  135. public void setLocationName(String locationName){
  136. String curLocationName = this.locationId.getLocationName();
  137. curLocationName = locationName;
  138. }
  139.  
  140. @Override
  141. public int hashCode() {
  142. int hash = 0;
  143. hash += (id != null ? id.hashCode() : 0);
  144. return hash;
  145. }
  146.  
  147. @Override
  148. public boolean equals(Object object) {
  149. // TODO: Warning - this method won't work in the case the id fields are not set
  150. if (!(object instanceof Responder)) {
  151. return false;
  152. }
  153. Responder other = (Responder) object;
  154. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  155. return false;
  156. }
  157. return true;
  158. }
  159.  
  160. @Override
  161. public String toString() {
  162. return "com.mycompany.DiasasterRecovery.Responder[ id=" + id + " ]";
  163. }
  164.  
  165. public String getEmail() {
  166. return email;
  167. }
  168.  
  169. public void setEmail(String email) {
  170. this.email = email;
  171. }
  172.  
  173. public String getPassword() {
  174. return password;
  175. }
  176.  
  177. public void setPassword(String password) {
  178. this.password = password;
  179. }
  180.  
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement