View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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.krad.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   * FiscalOfficer
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  	@OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER, mappedBy="fiscalOfficer")
54  	private List<TravelAccount> accounts = new ArrayList<TravelAccount>();
55  	
56  	public FiscalOfficer() {
57  		accounts = new ArrayList<TravelAccount>();
58  	}
59  
60  	/**
61  	 * @return the firstName
62  	 */
63  	public String getFirstName() {
64  		return this.firstName;
65  	}
66  
67  	/**
68  	 * @param firstName the firstName to set
69  	 */
70  	public void setFirstName(String firstName) {
71  		this.firstName = firstName;
72  	}
73  
74  	public void setUserName(String userId) {
75  		userName = userId;
76  	}
77  
78  	public String getUserName() {
79  		return userName;
80  	}
81  
82  	public final boolean equals(Object o) {
83          if (o == null) return false;
84          if (!(o instanceof FiscalOfficer)) return false;
85          FiscalOfficer f = (FiscalOfficer) o;
86          return StringUtils.equals(userName, f.getUserName()) &&
87                 ObjectUtils.equals(id, f.getId());
88  	}
89  
90  	public int hashCode() {
91      	return new HashCodeBuilder().append(id).append(userName).toHashCode();
92  	}
93  
94  	public Long getId() {
95  		return id;
96  	}
97  
98  	public void setId(Long id) {
99  		this.id = id;
100 	}
101 
102     public List<TravelAccount> getAccounts() {
103         return accounts;
104     }
105 
106     public void setAccounts(List<TravelAccount> accounts) {
107         this.accounts = accounts;
108     }
109 }