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