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.core.jpa.annotations.Sequence; |
22 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; |
23 | |
|
24 | |
import javax.persistence.*; |
25 | |
import java.util.LinkedHashMap; |
26 | |
import java.util.List; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
@Entity |
33 | |
@Table(name="TRV_ACCT_FO") |
34 | |
@Sequence(name="seq_acct_fo_id", property="id") |
35 | 0 | public class FiscalOfficer extends PersistableBusinessObjectBase { |
36 | |
|
37 | |
private static final long serialVersionUID = -4645124696676896963L; |
38 | |
|
39 | |
@Id |
40 | |
@Column(name="acct_fo_id") |
41 | |
private Long id; |
42 | |
|
43 | |
@Column(name="acct_fo_user_name") |
44 | |
private String userName; |
45 | |
|
46 | |
@Column(name="acct_fo_user_name") |
47 | |
private String firstName; |
48 | |
|
49 | |
@OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER, mappedBy="fiscalOfficer") |
50 | |
private List<TravelAccount> accounts; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
public String getFirstName() { |
56 | 0 | return this.firstName; |
57 | |
} |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
public void setFirstName(String firstName) { |
63 | 0 | this.firstName = firstName; |
64 | 0 | } |
65 | |
|
66 | |
public void setUserName(String userId) { |
67 | 0 | userName = userId; |
68 | 0 | } |
69 | |
|
70 | |
public String getUserName() { |
71 | 0 | return userName; |
72 | |
} |
73 | |
|
74 | |
public final boolean equals(Object o) { |
75 | 0 | if (o == null) return false; |
76 | 0 | if (!(o instanceof FiscalOfficer)) return false; |
77 | 0 | FiscalOfficer f = (FiscalOfficer) o; |
78 | 0 | return StringUtils.equals(userName, f.getUserName()) && |
79 | |
ObjectUtils.equals(id, f.getId()); |
80 | |
} |
81 | |
|
82 | |
public int hashCode() { |
83 | 0 | return new HashCodeBuilder().append(id).append(userName).toHashCode(); |
84 | |
} |
85 | |
|
86 | |
public Long getId() { |
87 | 0 | return id; |
88 | |
} |
89 | |
|
90 | |
public void setId(Long id) { |
91 | 0 | this.id = id; |
92 | 0 | } |
93 | |
|
94 | |
public List<TravelAccount> getAccounts() { |
95 | 0 | return accounts; |
96 | |
} |
97 | |
|
98 | |
public void setAccounts(List<TravelAccount> accounts) { |
99 | 0 | this.accounts = accounts; |
100 | 0 | } |
101 | |
|
102 | |
@Override |
103 | |
protected LinkedHashMap toStringMapper() { |
104 | 0 | LinkedHashMap propMap = new LinkedHashMap(); |
105 | 0 | propMap.put("id", getId()); |
106 | 0 | propMap.put("userName", getUserName()); |
107 | 0 | return propMap; |
108 | |
} |
109 | |
|
110 | |
} |