1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.bo;
17
18 import org.apache.commons.lang.ObjectUtils;
19 import org.apache.commons.lang.StringUtils;
20 import org.apache.commons.lang.builder.HashCodeBuilder;
21 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
22 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
23
24 import javax.persistence.CascadeType;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.Id;
30 import javax.persistence.OneToMany;
31 import javax.persistence.Table;
32 import java.util.ArrayList;
33 import java.util.List;
34
35
36
37
38 @Entity
39 @Table(name="TRV_ACCT_FO")
40 public class FiscalOfficer extends PersistableBusinessObjectBase {
41 private static final long serialVersionUID = -4645124696676896963L;
42
43 @Id
44 @GeneratedValue(generator = "SEQ_ACCT_FO_ID")
45 @PortableSequenceGenerator(name = "SEQ_ACCT_FO_ID")
46 @Column(name="acct_fo_id")
47 private Long id;
48
49 @Column(name="acct_fo_user_name")
50 private String userName;
51
52 @Column(name="acct_fo_user_name")
53 private String firstName;
54
55 @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER, mappedBy="fiscalOfficer")
56 private List<TravelAccount> accounts = new ArrayList<TravelAccount>();
57
58 public FiscalOfficer() {
59 accounts = new ArrayList<TravelAccount>();
60 }
61
62
63
64
65 public String getFirstName() {
66 return this.firstName;
67 }
68
69
70
71
72 public void setFirstName(String firstName) {
73 this.firstName = firstName;
74 }
75
76 public void setUserName(String userId) {
77 userName = userId;
78 }
79
80 public String getUserName() {
81 return userName;
82 }
83
84 public final boolean equals(Object o) {
85 if (o == null) return false;
86 if (!(o instanceof FiscalOfficer)) return false;
87 FiscalOfficer f = (FiscalOfficer) o;
88 return StringUtils.equals(userName, f.getUserName()) &&
89 ObjectUtils.equals(id, f.getId());
90 }
91
92 public int hashCode() {
93 return new HashCodeBuilder().append(id).append(userName).toHashCode();
94 }
95
96 public Long getId() {
97 return id;
98 }
99
100 public void setId(Long id) {
101 this.id = id;
102 }
103
104 public List<TravelAccount> getAccounts() {
105 return accounts;
106 }
107
108 public void setAccounts(List<TravelAccount> accounts) {
109 this.accounts = accounts;
110 }
111 }