PageRenderTime 53ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/data/jpa/src/test/java/org/appfuse/dao/jpa/mock/MockRoleBadGetter.java

http://github.com/myabc/appfuse
Java | 84 lines | 58 code | 20 blank | 6 comment | 6 complexity | 778a13050aca899cf82cc4dc9958104d MD5 | raw file
  1. package org.appfuse.dao.jpa.mock;
  2. import javax.persistence.Column;
  3. import javax.persistence.GeneratedValue;
  4. import javax.persistence.GenerationType;
  5. import javax.persistence.Id;
  6. import javax.persistence.Transient;
  7. import org.apache.commons.lang.builder.ToStringBuilder;
  8. import org.apache.commons.lang.builder.ToStringStyle;
  9. /**
  10. * @author <a href="mailto:bwnoll@gmail.com">Bryan Noll</a>
  11. */
  12. public class MockRoleBadGetter {
  13. private static final long serialVersionUID = 3690197650654049848L;
  14. @Id @GeneratedValue(strategy=GenerationType.AUTO)
  15. private Long id;
  16. private String name;
  17. private String description;
  18. public MockRoleBadGetter() {
  19. }
  20. public MockRoleBadGetter(String name) {
  21. this.name = name;
  22. }
  23. public Long getPersistentId() {
  24. return id;
  25. }
  26. /**
  27. * @see org.springframework.security.GrantedAuthority#getAuthority()
  28. */
  29. @Transient
  30. public String getAuthority() {
  31. return getName();
  32. }
  33. @Column(length=20)
  34. public String getName() {
  35. return this.name;
  36. }
  37. @Column(length=64)
  38. public String getDescription() {
  39. return this.description;
  40. }
  41. public void setPersistentId(Long id) {
  42. this.id = id;
  43. }
  44. public void setName(String name) {
  45. this.name = name;
  46. }
  47. public void setDescription(String description) {
  48. this.description = description;
  49. }
  50. public boolean equals(Object o) {
  51. if (this == o) return true;
  52. if (!(o instanceof MockRoleBadGetter)) return false;
  53. final MockRoleBadGetter role = (MockRoleBadGetter) o;
  54. return !(name != null ? !name.equals(role.name) : role.name != null);
  55. }
  56. public int hashCode() {
  57. return (name != null ? name.hashCode() : 0);
  58. }
  59. public String toString() {
  60. return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
  61. .append(this.name)
  62. .toString();
  63. }
  64. }