PageRenderTime 92ms CodeModel.GetById 2ms RepoModel.GetById 1ms app.codeStats 0ms

/SiorPart1/src/java/entity/Akun.java

http://siorpertama.googlecode.com/
Java | 215 lines | 176 code | 29 blank | 10 comment | 9 complexity | ddd9ec653a3c3f58378aa921bc7f7f71 MD5 | raw file
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package entity;
  6. import java.io.Serializable;
  7. import javax.persistence.Basic;
  8. import javax.persistence.Column;
  9. import javax.persistence.Entity;
  10. import javax.persistence.Id;
  11. import javax.persistence.NamedQueries;
  12. import javax.persistence.NamedQuery;
  13. import javax.persistence.Table;
  14. import javax.validation.constraints.NotNull;
  15. import javax.validation.constraints.Size;
  16. import javax.xml.bind.annotation.XmlRootElement;
  17. /**
  18. *
  19. * @author TYA
  20. */
  21. @Entity
  22. @Table(name = "akun")
  23. @XmlRootElement
  24. @NamedQueries({
  25. @NamedQuery(name = "Akun.findAll", query = "SELECT a FROM Akun a"),
  26. @NamedQuery(name = "Akun.findByUsername", query = "SELECT a FROM Akun a WHERE a.username = :username"),
  27. @NamedQuery(name = "Akun.findByPassword", query = "SELECT a FROM Akun a WHERE a.password = :password"),
  28. @NamedQuery(name = "Akun.findByEmail", query = "SELECT a FROM Akun a WHERE a.email = :email"),
  29. @NamedQuery(name = "Akun.findByNamaakun", query = "SELECT a FROM Akun a WHERE a.namaakun = :namaakun"),
  30. @NamedQuery(name = "Akun.findByRtakun", query = "SELECT a FROM Akun a WHERE a.rtakun = :rtakun"),
  31. @NamedQuery(name = "Akun.findByRwakun", query = "SELECT a FROM Akun a WHERE a.rwakun = :rwakun"),
  32. @NamedQuery(name = "Akun.findByKelurahanakun", query = "SELECT a FROM Akun a WHERE a.kelurahanakun = :kelurahanakun"),
  33. @NamedQuery(name = "Akun.findByKecamatanakun", query = "SELECT a FROM Akun a WHERE a.kecamatanakun = :kecamatanakun"),
  34. @NamedQuery(name = "Akun.findByKotaakun", query = "SELECT a FROM Akun a WHERE a.kotaakun = :kotaakun"),
  35. @NamedQuery(name = "Akun.findByJumlahrumah", query = "SELECT a FROM Akun a WHERE a.jumlahrumah = :jumlahrumah")})
  36. public class Akun implements Serializable {
  37. private static final long serialVersionUID = 1L;
  38. @Id
  39. @Basic(optional = false)
  40. @NotNull
  41. @Size(min = 1, max = 25)
  42. @Column(name = "username")
  43. private String username;
  44. @Basic(optional = false)
  45. @NotNull
  46. @Size(min = 1, max = 25)
  47. @Column(name = "password")
  48. private String password;
  49. // @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
  50. @Basic(optional = false)
  51. @NotNull
  52. @Size(min = 1, max = 30)
  53. @Column(name = "email")
  54. private String email;
  55. @Basic(optional = false)
  56. @NotNull
  57. @Size(min = 1, max = 25)
  58. @Column(name = "namaakun")
  59. private String namaakun;
  60. @Basic(optional = false)
  61. @NotNull
  62. @Column(name = "rtakun")
  63. private int rtakun;
  64. @Basic(optional = false)
  65. @NotNull
  66. @Column(name = "rwakun")
  67. private int rwakun;
  68. @Basic(optional = false)
  69. @NotNull
  70. @Size(min = 1, max = 25)
  71. @Column(name = "kelurahanakun")
  72. private String kelurahanakun;
  73. @Basic(optional = false)
  74. @NotNull
  75. @Size(min = 1, max = 25)
  76. @Column(name = "kecamatanakun")
  77. private String kecamatanakun;
  78. @Basic(optional = false)
  79. @NotNull
  80. @Size(min = 1, max = 25)
  81. @Column(name = "kotaakun")
  82. private String kotaakun;
  83. @Basic(optional = false)
  84. @NotNull
  85. @Column(name = "jumlahrumah")
  86. private int jumlahrumah;
  87. public Akun() {
  88. }
  89. public Akun(String username) {
  90. this.username = username;
  91. }
  92. public Akun(String username, String password, String email, String namaakun, int rtakun, int rwakun, String kelurahanakun, String kecamatanakun, String kotaakun, int jumlahrumah) {
  93. this.username = username;
  94. this.password = password;
  95. this.email = email;
  96. this.namaakun = namaakun;
  97. this.rtakun = rtakun;
  98. this.rwakun = rwakun;
  99. this.kelurahanakun = kelurahanakun;
  100. this.kecamatanakun = kecamatanakun;
  101. this.kotaakun = kotaakun;
  102. this.jumlahrumah = jumlahrumah;
  103. }
  104. public String getUsername() {
  105. return username;
  106. }
  107. public void setUsername(String username) {
  108. this.username = username;
  109. }
  110. public String getPassword() {
  111. return password;
  112. }
  113. public void setPassword(String password) {
  114. this.password = password;
  115. }
  116. public String getEmail() {
  117. return email;
  118. }
  119. public void setEmail(String email) {
  120. this.email = email;
  121. }
  122. public String getNamaakun() {
  123. return namaakun;
  124. }
  125. public void setNamaakun(String namaakun) {
  126. this.namaakun = namaakun;
  127. }
  128. public int getRtakun() {
  129. return rtakun;
  130. }
  131. public void setRtakun(int rtakun) {
  132. this.rtakun = rtakun;
  133. }
  134. public int getRwakun() {
  135. return rwakun;
  136. }
  137. public void setRwakun(int rwakun) {
  138. this.rwakun = rwakun;
  139. }
  140. public String getKelurahanakun() {
  141. return kelurahanakun;
  142. }
  143. public void setKelurahanakun(String kelurahanakun) {
  144. this.kelurahanakun = kelurahanakun;
  145. }
  146. public String getKecamatanakun() {
  147. return kecamatanakun;
  148. }
  149. public void setKecamatanakun(String kecamatanakun) {
  150. this.kecamatanakun = kecamatanakun;
  151. }
  152. public String getKotaakun() {
  153. return kotaakun;
  154. }
  155. public void setKotaakun(String kotaakun) {
  156. this.kotaakun = kotaakun;
  157. }
  158. public int getJumlahrumah() {
  159. return jumlahrumah;
  160. }
  161. public void setJumlahrumah(int jumlahrumah) {
  162. this.jumlahrumah = jumlahrumah;
  163. }
  164. @Override
  165. public int hashCode() {
  166. int hash = 0;
  167. hash += (username != null ? username.hashCode() : 0);
  168. return hash;
  169. }
  170. @Override
  171. public boolean equals(Object object) {
  172. // TODO: Warning - this method won't work in the case the id fields are not set
  173. if (!(object instanceof Akun)) {
  174. return false;
  175. }
  176. Akun other = (Akun) object;
  177. if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
  178. return false;
  179. }
  180. return true;
  181. }
  182. @Override
  183. public String toString() {
  184. return "entity.Akun[ username=" + username + " ]";
  185. }
  186. }