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