001 /** 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kim.bo.ui; 017 018 import org.hibernate.annotations.GenericGenerator; 019 import org.hibernate.annotations.Parameter; 020 import org.kuali.rice.kim.impl.identity.name.EntityNameTypeBo; 021 022 import javax.persistence.Column; 023 import javax.persistence.Entity; 024 import javax.persistence.FetchType; 025 import javax.persistence.GeneratedValue; 026 import javax.persistence.Id; 027 import javax.persistence.IdClass; 028 import javax.persistence.JoinColumn; 029 import javax.persistence.ManyToOne; 030 import javax.persistence.Table; 031 import javax.persistence.Transient; 032 import java.sql.Timestamp; 033 034 /** 035 * This is a description of what this class does - shyu don't forget to fill this in. 036 * 037 * @author Kuali Rice Team (rice.collab@kuali.org) 038 * 039 */ 040 @IdClass(PersonDocumentNameId.class) 041 @Entity 042 @Table(name = "KRIM_PND_NM_MT") 043 public class PersonDocumentName extends PersonDocumentBoDefaultBase { 044 045 @Id 046 @GeneratedValue(generator="KRIM_ENTITY_NM_ID_S") 047 @GenericGenerator(name="KRIM_ENTITY_NM_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={ 048 @Parameter(name="sequence_name",value="KRIM_ENTITY_NM_ID_S"), 049 @Parameter(name="value_column",value="id") 050 }) 051 @Column(name = "ENTITY_NM_ID") 052 protected String entityNameId; 053 054 //@Column(name = "ENTITY_ID") 055 @Transient 056 protected String entityId; 057 058 @Column(name = "NM_TYP_CD") 059 protected String nameCode; 060 061 @Column(name = "FIRST_NM") 062 protected String firstName; 063 064 @Column(name = "MIDDLE_NM") 065 protected String middleName; 066 067 @Column(name = "LAST_NM") 068 protected String lastName; 069 070 @Column(name = "PREFIX_NM") 071 protected String namePrefix; 072 073 @Column(name = "TITLE_NM") 074 protected String nameTitle; 075 076 @Column(name = "SUFFIX_NM") 077 protected String nameSuffix; 078 079 @Column(name = "NOTE_MSG") 080 protected String noteMessage; 081 082 @Column(name = "NM_CHNG_DT") 083 protected Timestamp nameChangedDate; 084 085 @ManyToOne(targetEntity=EntityNameTypeBo.class, fetch = FetchType.EAGER, cascade = {}) 086 @JoinColumn(name = "NM_TYP_CD", insertable = false, updatable = false) 087 protected EntityNameTypeBo entityNameType; 088 089 public PersonDocumentName() { 090 this.active = true; 091 } 092 093 /** 094 * @see org.kuali.rice.kim.api.identity.name.EntityNameContract#getEntityNameId() 095 */ 096 public String getEntityNameId() { 097 return entityNameId; 098 } 099 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 }