View Javadoc

1   /*
2    * Copyright 2007-2008 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.bo.ui;
17  
18  import java.util.ArrayList;
19  import java.util.LinkedHashMap;
20  
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.FetchType;
24  import javax.persistence.Id;
25  import javax.persistence.JoinColumn;
26  import javax.persistence.ManyToOne;
27  import javax.persistence.Table;
28  
29  import org.kuali.rice.kim.bo.reference.EntityNameType;
30  import org.kuali.rice.kim.bo.reference.impl.EntityNameTypeImpl;
31  import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
32  
33  /**
34   * This is a description of what this class does - shyu don't forget to fill this in. 
35   * 
36   * @author Kuali Rice Team (rice.collab@kuali.org)
37   *
38   */
39  @Entity
40  @Table(name = "KRIM_PND_NM_T")
41  public class PersonDocumentName extends PersonDocumentBoDefaultBase {
42  
43  	@Id
44  	@Column(name = "ENTITY_NM_ID")
45  	protected String entityNameId;
46  
47  	@Column(name = "ENTITY_ID")
48  	protected String entityId;
49  
50  	@Column(name = "NM_TYP_CD")
51  	protected String nameTypeCode ;
52  
53  	@Column(name = "FIRST_NM")
54  	protected String firstName;
55  
56  	@Column(name = "MIDDLE_NM")
57  	protected String middleName;
58  
59  	@Column(name = "LAST_NM")
60  	protected String lastName;
61  
62  	@Column(name = "TITLE_NM")
63  	protected String title;
64  
65  	@Column(name = "SUFFIX_NM")
66  	protected String suffix;
67  	
68  	@ManyToOne(targetEntity=EntityNameTypeImpl.class, fetch = FetchType.EAGER, cascade = {})
69  	@JoinColumn(name = "NM_TYP_CD", insertable = false, updatable = false)
70  	protected EntityNameType entityNameType;
71  
72  	public PersonDocumentName() {
73  		this.active = true;
74  	}
75  
76  	/**
77  	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getEntityNameId()
78  	 */
79  	public String getEntityNameId() {
80  		return entityNameId;
81  	}
82  
83  	/**
84  	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getFirstName()
85  	 */
86  	public String getFirstName() {
87  		return firstName;
88  	}
89  
90  	/**
91  	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getLastName()
92  	 */
93  	public String getLastName() {
94  		return lastName;
95  	}
96  
97  	/**
98  	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getMiddleName()
99  	 */
100 	public String getMiddleName() {
101 		return middleName;
102 	}
103 
104 	/**
105 	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getNameTypeCode()
106 	 */
107 	public String getNameTypeCode() {
108 		return nameTypeCode;
109 	}
110 
111 	/**
112 	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getSuffix()
113 	 */
114 	public String getSuffix() {
115 		return suffix;
116 	}
117 
118 	/**
119 	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getTitle()
120 	 */
121 	public String getTitle() {
122 		return title;
123 	}
124 
125 	public void setFirstName(String firstName) {
126 		this.firstName = firstName;
127 	}
128 
129 	public void setLastName(String lastName) {
130 		this.lastName = lastName;
131 	}
132 
133 	public void setMiddleName(String middleName) {
134 		this.middleName = middleName;
135 	}
136 
137 	public void setNameTypeCode(String nameTypeCode) {
138 		this.nameTypeCode = nameTypeCode;
139 	}
140 
141 	public void setSuffix(String suffix) {
142 		this.suffix = suffix;
143 	}
144 
145 	public void setTitle(String title) {
146 		this.title = title;
147 	}
148 
149 	/**
150 	 * This default implementation formats the name as LAST, FIRST MIDDLE.
151 	 * 
152 	 * @see org.kuali.rice.kim.bo.entity.KimEntityName#getFormattedName()
153 	 */
154 	public String getFormattedName() {
155 		return getLastName() + ", " + getFirstName() + " " + getMiddleName();
156 	}
157 	
158 	/**
159 	 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
160 	 */
161 	@SuppressWarnings("unchecked")
162 	@Override
163 	protected LinkedHashMap toStringMapper() {
164 		LinkedHashMap m = super.toStringMapper();
165 		m.put( "entityNameId", entityNameId );
166 		m.put( "firstName", firstName );
167 		m.put( "lastName", lastName );
168 		return m;
169 	}
170 
171 	public String getEntityId() {
172 		return this.entityId;
173 	}
174 
175 	public void setEntityId(String entityId) {
176 		this.entityId = entityId;
177 	}
178 
179 	public EntityNameType getEntityNameType() {
180 		return this.entityNameType;
181 	}
182 
183 	public void setEntityNameType(EntityNameType entityNameType) {
184 		this.entityNameType = entityNameType;
185 	}
186 
187 	public void setEntityNameId(String entityNameId) {
188 		this.entityNameId = entityNameId;
189 	}
190 
191 	@Override
192 	public boolean isActive(){
193 		return this.active;
194 	}
195 }