View Javadoc
1   /**
2    * Copyright 2005-2014 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 java.util.List;
19  
20  import javax.persistence.CascadeType;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.FetchType;
24  import javax.persistence.GeneratedValue;
25  import javax.persistence.Id;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.OneToMany;
28  import javax.persistence.Table;
29  import javax.persistence.Transient;
30  
31  import org.apache.commons.lang.ObjectUtils;
32  import org.apache.commons.lang.StringUtils;
33  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
34  
35  
36  /**
37   * FiscalOfficer
38   */
39  @Entity
40  @Table(name="TRV_ACCT_FO")
41  public class AccountManager extends PersistableBusinessObjectBase {
42  	private static final long serialVersionUID = 1555425302284842267L;
43  
44      @Column(name="acct_fo_user_name")
45  	private String userName;
46  	@Id
47  	@GeneratedValue(generator="TRV_FO_ID_S")
48  	@Column(name="acct_fo_id")
49  	private Long amId;
50  	@Transient
51  	private String defaultType;
52  	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE})
53  	@JoinColumn(name="acct_fo_id",referencedColumnName="acct_fo_id",insertable=false,updatable=false)
54  	private List<Account> accounts;
55  
56      public AccountManager() {}
57  
58  
59  
60  	public AccountManager(Long amId, String userName) {
61          super();
62          this.amId = amId;
63          this.userName = userName;
64      }
65  
66      public void setUserName(String userId) {
67  		userName = userId;
68  	}
69  
70  	public String getUserName() {
71  		return userName;
72  	}
73  
74  	public String getDefaultType() {
75          return this.defaultType;
76      }
77  
78      public void setDefaultType(String defaultType) {
79          this.defaultType = defaultType;
80      }
81  
82      @Override
83      public final boolean equals(Object o) {
84          if (o == null) return false;
85          if (!(o instanceof AccountManager)) return false;
86          AccountManager am = (AccountManager) o;
87          return StringUtils.equals(userName, am.getUserName()) &&
88                 ObjectUtils.equals(amId, am.getAmId());
89  	}
90  
91  	public Long getAmId() {
92  		return amId;
93  	}
94  
95  	public void setAmId(Long id) {
96  		this.amId = id;
97  	}
98  
99      public List<Account> getAccounts() {
100         return accounts;
101     }
102 
103     public void setAccounts(List<Account> accounts) {
104         this.accounts = accounts;
105     }
106 }