View Javadoc

1   /**
2    * Copyright 2005-2011 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 org.kuali.rice.krad.test.document.bo;
17  
18  import org.apache.commons.lang.ObjectUtils;
19  import org.apache.commons.lang.StringUtils;
20  import org.hibernate.annotations.GenericGenerator;
21  import org.hibernate.annotations.Parameter;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  
24  import javax.persistence.*;
25  import java.util.List;
26  
27  
28  /**
29   * FiscalOfficer
30   */
31  @Entity
32  @Table(name="TRV_ACCT_FO")
33  public class AccountManager extends PersistableBusinessObjectBase {
34  	
35  	@Column(name="acct_fo_user_name")
36  	private String userName;
37  	@Id
38  	@GeneratedValue(generator="TRV_FO_ID_S")
39  	@GenericGenerator(name="TRV_FO_ID_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
40  			@Parameter(name="sequence_name",value="TRV_FO_ID_S"),
41  			@Parameter(name="value_column",value="id")
42  	})
43  	@Column(name="acct_fo_id")
44  	private Long amId;
45  	@Transient
46  	private String defaultType;
47  	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE})
48  	@JoinColumn(name="acct_fo_id",insertable=false,updatable=false)
49  	private List<Account> accounts;
50  
51  	public void setUserName(String userId) {
52  		userName = userId;
53  	}
54  
55  	public String getUserName() {
56  		return userName;
57  	}
58  
59  	public String getDefaultType() {
60          return this.defaultType;
61      }
62  
63      public void setDefaultType(String defaultType) {
64          this.defaultType = defaultType;
65      }
66  
67      public final boolean equals(Object o) {
68          if (o == null) return false;
69          if (!(o instanceof AccountManager)) return false;
70          AccountManager am = (AccountManager) o;
71          return StringUtils.equals(userName, am.getUserName()) &&
72                 ObjectUtils.equals(amId, am.getAmId());
73  	}
74  
75  	/**
76  	 * Returns the hashcode of the docHeaderId, which is supposed to be the
77  	 * primary key for the document
78  	 * 
79  	 * @see java.lang.Object#hashCode()
80  	 */
81  	/*public int hashCode() {
82  		return (accountNum == null) ? 0 : accountNum.hashCode();
83  	}*/
84  
85  	public Long getAmId() {
86  		return amId;
87  	}
88  
89  	public void setAmId(Long id) {
90  		this.amId = id;
91  	}
92  
93      public List<Account> getAccounts() {
94          return accounts;
95      }
96  
97      public void setAccounts(List<Account> accounts) {
98          this.accounts = accounts;
99      }
100 }