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