View Javadoc

1   /*
2    * Copyright 2008-2009 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.kim.test.bo;
17  
18  
19  import java.util.LinkedHashMap;
20  
21  import javax.persistence.CascadeType;
22  import javax.persistence.Column;
23  import javax.persistence.FetchType;
24  import javax.persistence.Id;
25  import javax.persistence.ManyToOne;
26  
27  import org.kuali.rice.kim.bo.Person;
28  import org.kuali.rice.kim.service.KIMServiceLocator;
29  import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
30  import org.kuali.rice.kns.service.KNSServiceLocator;
31  
32  /**
33   * This is a description of what this class does - kellerj don't forget to fill this in. 
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   *
37   */
38  public class BOContainingPerson extends PersistableBusinessObjectBase {
39  
40  	@Id
41  	@Column(name="pk")
42  	protected String boPrimaryKey;
43  	
44  	@Column(name="prncpl_id")
45  	protected String principalId;
46  	
47  	protected Person person;
48  	
49  	public String getBoPrimaryKey() {
50  		return this.boPrimaryKey;
51  	}
52  
53  	public void setBoPrimaryKey(String boPrimaryKey) {
54  		this.boPrimaryKey = boPrimaryKey;
55  	}
56  
57  	public String getPrincipalId() {
58  		return this.principalId;
59  	}
60  
61  	public void setPrincipalId(String principalId) {
62  		this.principalId = principalId;
63  	}
64  
65  	public Person getPerson() {
66  		person = KIMServiceLocator.getPersonService().updatePersonIfNecessary( principalId, person );
67  		return this.person;
68  	}
69  
70  	public void setPerson(Person person) {
71  		this.person = person;
72  	}
73  
74  	/**
75  	 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
76  	 */
77  	@SuppressWarnings("unchecked")
78  	@Override
79  	protected LinkedHashMap toStringMapper() {
80  		LinkedHashMap m = new LinkedHashMap();
81  		m.put( "boPrimaryKey", boPrimaryKey );
82  		m.put( "principalId", principalId );
83  		return m;
84  	}
85  
86  }