1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package edu.sampleu.travel.bo; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.persistence.CascadeType; |
22 | |
import javax.persistence.Column; |
23 | |
import javax.persistence.Entity; |
24 | |
import javax.persistence.FetchType; |
25 | |
import javax.persistence.Id; |
26 | |
import javax.persistence.OneToMany; |
27 | |
import javax.persistence.Table; |
28 | |
|
29 | |
import org.apache.commons.lang.ObjectUtils; |
30 | |
import org.apache.commons.lang.StringUtils; |
31 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
32 | |
import org.kuali.rice.core.framework.persistence.jpa.annotations.Sequence; |
33 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; |
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; |
56 | |
|
57 | 0 | public FiscalOfficer() { |
58 | 0 | accounts = new ArrayList<TravelAccount>(); |
59 | 0 | } |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
public String getFirstName() { |
65 | 0 | return this.firstName; |
66 | |
} |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
public void setFirstName(String firstName) { |
72 | 0 | this.firstName = firstName; |
73 | 0 | } |
74 | |
|
75 | |
public void setUserName(String userId) { |
76 | 0 | userName = userId; |
77 | 0 | } |
78 | |
|
79 | |
public String getUserName() { |
80 | 0 | return userName; |
81 | |
} |
82 | |
|
83 | |
public final boolean equals(Object o) { |
84 | 0 | if (o == null) return false; |
85 | 0 | if (!(o instanceof FiscalOfficer)) return false; |
86 | 0 | FiscalOfficer f = (FiscalOfficer) o; |
87 | 0 | return StringUtils.equals(userName, f.getUserName()) && |
88 | |
ObjectUtils.equals(id, f.getId()); |
89 | |
} |
90 | |
|
91 | |
public int hashCode() { |
92 | 0 | return new HashCodeBuilder().append(id).append(userName).toHashCode(); |
93 | |
} |
94 | |
|
95 | |
public Long getId() { |
96 | 0 | return id; |
97 | |
} |
98 | |
|
99 | |
public void setId(Long id) { |
100 | 0 | this.id = id; |
101 | 0 | } |
102 | |
|
103 | |
public List<TravelAccount> getAccounts() { |
104 | 0 | return accounts; |
105 | |
} |
106 | |
|
107 | |
public void setAccounts(List<TravelAccount> accounts) { |
108 | 0 | this.accounts = accounts; |
109 | 0 | } |
110 | |
} |