View Javadoc
1   /*
2    * Copyright 2013 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  package org.kuali.student.core.person.dto;
16  
17  import org.kuali.student.core.person.infc.PersonName;
18  import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
19  
20  import javax.xml.bind.annotation.XmlAccessType;
21  import javax.xml.bind.annotation.XmlAccessorType;
22  import javax.xml.bind.annotation.XmlAnyElement;
23  import javax.xml.bind.annotation.XmlElement;
24  import javax.xml.bind.annotation.XmlType;
25  import java.io.Serializable;
26  import java.util.Date;
27  import java.util.List;
28  
29  @XmlAccessorType(XmlAccessType.FIELD)
30  @XmlType(name = "PersonNameInfo", propOrder = {"id",
31      "typeKey",
32      "stateKey",
33      "personId",
34      "namePrefix",
35      "nameTitle",
36      "firstName",
37      "middleName",
38      "lastName",
39      "nameSuffix",
40      "compositeName",
41      "nameChangedDate",
42      "meta",
43      "attributes", "_futureElements"})
44  public class PersonNameInfo extends IdNamelessEntityInfo implements PersonName, Serializable {
45  
46      private static final long serialVersionUID = 1L;
47  
48      @XmlElement
49      private String personId;
50      @XmlElement
51      private String namePrefix;
52      @XmlElement
53      private String firstName;
54      @XmlElement
55      private String middleName;
56      @XmlElement
57      private String lastName;
58      @XmlElement
59      private String nameSuffix;
60      @XmlElement
61      private String nameTitle;
62      @XmlElement
63      private String compositeName;
64      @XmlElement
65      private Date nameChangedDate;
66  
67      @XmlAnyElement
68      private List<Object> _futureElements;
69  
70      public PersonNameInfo() {
71      }
72  
73      public PersonNameInfo(PersonName infc) {
74          super(infc);
75          this.setPersonId(infc.getPersonId());
76          this.setNamePrefix(infc.getNamePrefix());
77          this.setFirstName(infc.getFirstName());
78          this.setMiddleName(infc.getMiddleName());
79          this.setLastName(infc.getLastName());
80          this.setNameSuffix(infc.getNameSuffix());
81          this.setNameTitle(infc.getNameTitle());
82          this.setCompositeName(infc.getCompositeName());
83          if (infc.getNameChangedDate() != null) {
84              this.setNameChangedDate(new Date(infc.getNameChangedDate().getTime()));
85          }
86      }
87  
88      @Override
89      public String getPersonId() {
90          return personId;
91      }
92  
93      @Override
94      public String getNamePrefix() {
95          return namePrefix;
96      }
97  
98      @Override
99      public String getNameTitle() {
100         return nameTitle;
101     }
102 
103     @Override
104     public String getFirstName() {
105         return firstName;
106     }
107 
108     @Override
109     public String getMiddleName() {
110         return middleName;
111     }
112 
113     @Override
114     public String getLastName() {
115         return lastName;
116     }
117 
118     @Override
119     public String getNameSuffix() {
120         return nameSuffix;
121     }
122 
123     @Override
124     public Date getNameChangedDate() {
125         return nameChangedDate;
126     }
127 
128     public void setPersonId(String personId) {
129         this.personId = personId;
130     }
131 
132     public void setNamePrefix(String namePrefix) {
133         this.namePrefix = namePrefix;
134     }
135 
136     public void setNameTitle(String nameTitle) {
137         this.nameTitle = nameTitle;
138     }
139 
140     public void setFirstName(String firstName) {
141         this.firstName = firstName;
142     }
143 
144     public void setMiddleName(String middleName) {
145         this.middleName = middleName;
146     }
147 
148     public void setLastName(String lastName) {
149         this.lastName = lastName;
150     }
151 
152     public void setNameSuffix(String nameSuffix) {
153         this.nameSuffix = nameSuffix;
154     }
155 
156     public void setNameChangedDate(Date nameChangedDate) {
157         this.nameChangedDate = nameChangedDate;
158     }
159 
160     @Override
161     public String getCompositeName() {
162         return compositeName;
163     }
164 
165     public void setCompositeName(String compositeName) {
166         this.compositeName = compositeName;
167     }
168 
169     @Override
170     public String toString() {
171         return "PersonNameInfo{" + super.toString() + ", personId=" + personId + ", namePrefix=" + namePrefix 
172                 + ", firstName=" + firstName + ", middleName=" + middleName + ", lastName=" + lastName 
173                 + ", nameSuffix=" + nameSuffix + ", nameTitle=" + nameTitle + ", compositeName=" + compositeName 
174                 + ", nameChangedDate=" + nameChangedDate + '}';
175     }
176 
177 }