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 org.kuali.rice.kim.bo.ui;
17  
18  import org.kuali.rice.kim.impl.identity.name.EntityNameTypeBo;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.FetchType;
23  import javax.persistence.GeneratedValue;
24  import javax.persistence.Id;
25  import javax.persistence.IdClass;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.ManyToOne;
28  import javax.persistence.Table;
29  import javax.persistence.Transient;
30  import java.sql.Timestamp;
31  
32  /**
33   * This is a description of what this class does - shyu don't forget to fill this in. 
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   *
37   */
38  @IdClass(PersonDocumentNameId.class)
39  @Entity
40  @Table(name = "KRIM_PND_NM_MT")
41  public class PersonDocumentName extends PersonDocumentBoDefaultBase {
42  
43  	@Id
44  	@GeneratedValue(generator="KRIM_ENTITY_NM_ID_S")
45  	@Column(name = "ENTITY_NM_ID")
46  	protected String entityNameId;
47  
48  	//@Column(name = "ENTITY_ID")
49  	@Transient
50  	protected String entityId;
51  
52  	@Column(name = "NM_TYP_CD")
53  	protected String nameCode;
54  
55  	@Column(name = "FIRST_NM")
56  	protected String firstName;
57  
58  	@Column(name = "MIDDLE_NM")
59  	protected String middleName;
60  
61  	@Column(name = "LAST_NM")
62  	protected String lastName;
63  
64  	@Column(name = "PREFIX_NM")
65  	protected String namePrefix;
66  
67      @Column(name = "TITLE_NM")
68      protected String nameTitle;
69  
70  	@Column(name = "SUFFIX_NM")
71  	protected String nameSuffix;
72  
73      @Column(name = "NOTE_MSG")
74  	protected String noteMessage;
75  
76      @Column(name = "NM_CHNG_DT")
77      protected Timestamp nameChangedDate;
78  	
79  	@ManyToOne(targetEntity=EntityNameTypeBo.class, fetch = FetchType.EAGER, cascade = {})
80  	@JoinColumn(name = "NM_TYP_CD", insertable = false, updatable = false)
81  	protected EntityNameTypeBo entityNameType;
82  
83  	public PersonDocumentName() {
84  		this.active = true;
85  	}
86  
87  	/**
88  	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getEntityNameId()
89  	 */
90  	public String getEntityNameId() {
91  		return entityNameId;
92  	}
93  
94  	/**
95  	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getFirstName()
96  	 */
97  	public String getFirstName() {
98  		return firstName;
99  	}
100 
101 	/**
102 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getLastName()
103 	 */
104 	public String getLastName() {
105 		return lastName;
106 	}
107 
108 	/**
109 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getMiddleName()
110 	 */
111 	public String getMiddleName() {
112 		return middleName;
113 	}
114 
115 	/**
116 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getNameTypeCode()
117 	 */
118 	public String getNameCode() {
119 		return nameCode;
120 	}
121 
122 	/**
123 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getNameSuffix()
124 	 */
125 	public String getNameSuffix() {
126 		return nameSuffix;
127 	}
128 
129 	/**
130 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getNamePrefix()
131 	 */
132 	public String getNamePrefix() {
133 		return namePrefix;
134 	}
135 
136     public String getNameTitle() {
137 		return nameTitle;
138 	}
139 
140     public String getNoteMessage() {
141         return noteMessage;
142     }
143 
144     public Timestamp getNameChangedDate() {
145         return nameChangedDate;
146     }
147 
148 	public void setFirstName(String firstName) {
149 		this.firstName = firstName;
150 	}
151 
152 	public void setLastName(String lastName) {
153 		this.lastName = lastName;
154 	}
155 
156 	public void setMiddleName(String middleName) {
157 		this.middleName = middleName;
158 	}
159 
160 	public void setNameCode(String nameCode) {
161 		this.nameCode = nameCode;
162 	}
163 
164 	public void setNameSuffix(String nameSuffix) {
165 		this.nameSuffix = nameSuffix;
166 	}
167 
168 	public void setNamePrefix(String namePrefix) {
169 		this.namePrefix = namePrefix;
170 	}
171 
172     public void setNameTitle(String nameTitle) {
173 		this.nameTitle = nameTitle;
174 	}
175 
176     public void setNoteMessage(String noteMessage) {
177 		this.noteMessage = noteMessage;
178 	}
179 
180     public void setNameChangedDate(Timestamp timestamp) {
181         this.nameChangedDate = timestamp;
182     }
183 
184 	/**
185 	 * This default implementation formats the name as LAST, FIRST MIDDLE.
186 	 * 
187 	 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getCompositeName()
188 	 */
189 	public String getCompositeName() {
190 		return getLastName() + ", " + getFirstName() + " " + getMiddleName();
191 	}
192 
193 	public String getEntityId() {
194 		return this.entityId;
195 	}
196 
197 	public void setEntityId(String entityId) {
198 		this.entityId = entityId;
199 	}
200 
201 	public EntityNameTypeBo getEntityNameType() {
202 		return this.entityNameType;
203 	}
204 
205 	public void setEntityNameType(EntityNameTypeBo entityNameType) {
206 		this.entityNameType = entityNameType;
207 	}
208 
209 	public void setEntityNameId(String entityNameId) {
210 		this.entityNameId = entityNameId;
211 	}
212 }