1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.api.identity.type; |
17 | |
|
18 | |
import org.kuali.rice.core.api.CoreConstants; |
19 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
20 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
21 | |
import org.kuali.rice.kim.api.identity.address.EntityAddress; |
22 | |
import org.kuali.rice.kim.api.identity.email.EntityEmail; |
23 | |
import org.kuali.rice.kim.api.identity.phone.EntityPhone; |
24 | |
import org.w3c.dom.Element; |
25 | |
|
26 | |
import javax.xml.bind.annotation.XmlAccessType; |
27 | |
import javax.xml.bind.annotation.XmlAccessorType; |
28 | |
import javax.xml.bind.annotation.XmlAnyElement; |
29 | |
import javax.xml.bind.annotation.XmlElement; |
30 | |
import javax.xml.bind.annotation.XmlRootElement; |
31 | |
import javax.xml.bind.annotation.XmlType; |
32 | |
import java.io.Serializable; |
33 | |
import java.util.Collection; |
34 | |
|
35 | |
@XmlRootElement(name = EntityTypeContactInfoDefault.Constants.ROOT_ELEMENT_NAME) |
36 | |
@XmlAccessorType(XmlAccessType.NONE) |
37 | |
@XmlType(name = EntityTypeContactInfoDefault.Constants.TYPE_NAME, propOrder = { |
38 | |
EntityTypeContactInfoDefault.Elements.ENTITY_TYPE_CODE, |
39 | |
EntityTypeContactInfoDefault.Elements.DEFAULT_ADDRESS, |
40 | |
EntityTypeContactInfoDefault.Elements.DEFAULT_EMAIL_ADDRESS, |
41 | |
EntityTypeContactInfoDefault.Elements.DEFAULT_PHONE_NUMBER, |
42 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
43 | |
}) |
44 | 0 | public final class EntityTypeContactInfoDefault extends AbstractDataTransferObject |
45 | |
{ |
46 | |
@XmlElement(name = Elements.ENTITY_TYPE_CODE, required = true) |
47 | |
private final String entityTypeCode; |
48 | |
@XmlElement(name = Elements.DEFAULT_ADDRESS, required = false) |
49 | |
private final EntityAddress defaultAddress; |
50 | |
@XmlElement(name = Elements.DEFAULT_EMAIL_ADDRESS, required = false) |
51 | |
private final EntityEmail defaultEmailAddress; |
52 | |
@XmlElement(name = Elements.DEFAULT_PHONE_NUMBER, required = false) |
53 | |
private final EntityPhone defaultPhoneNumber; |
54 | 0 | @SuppressWarnings("unused") |
55 | |
@XmlAnyElement |
56 | |
private final Collection<Element> _futureElements = null; |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 0 | private EntityTypeContactInfoDefault() { |
62 | 0 | this.entityTypeCode = null; |
63 | 0 | this.defaultAddress = null; |
64 | 0 | this.defaultEmailAddress = null; |
65 | 0 | this.defaultPhoneNumber = null; |
66 | |
|
67 | 0 | } |
68 | |
|
69 | |
public EntityTypeContactInfoDefault(String entityTypeCode, EntityAddress defaultAddress, |
70 | 0 | EntityEmail defaultEmailAddress, EntityPhone defaultPhoneNumber) { |
71 | 0 | this.entityTypeCode = entityTypeCode; |
72 | 0 | this.defaultAddress = defaultAddress; |
73 | 0 | this.defaultEmailAddress = defaultEmailAddress; |
74 | 0 | this.defaultPhoneNumber = defaultPhoneNumber; |
75 | 0 | } |
76 | |
|
77 | 0 | public EntityTypeContactInfoDefault(Builder builder) { |
78 | 0 | this.entityTypeCode = builder.getEntityTypeCode(); |
79 | 0 | this.defaultAddress = builder.getDefaultAddress() == null ? null : builder.getDefaultAddress().build(); |
80 | 0 | this.defaultEmailAddress = builder.getDefaultEmailAddress() == null ? null : builder.getDefaultEmailAddress().build(); |
81 | 0 | this.defaultPhoneNumber = builder.getDefaultPhoneNumber() == null ? null : builder.getDefaultPhoneNumber().build(); |
82 | |
|
83 | 0 | } |
84 | |
|
85 | |
public String getEntityTypeCode() { |
86 | 0 | return this.entityTypeCode; |
87 | |
} |
88 | |
public EntityAddress getDefaultAddress() { |
89 | 0 | return this.defaultAddress; |
90 | |
} |
91 | |
|
92 | |
public EntityEmail getDefaultEmailAddress() { |
93 | 0 | return this.defaultEmailAddress; |
94 | |
} |
95 | |
|
96 | |
public EntityPhone getDefaultPhoneNumber() { |
97 | 0 | return this.defaultPhoneNumber; |
98 | |
} |
99 | |
|
100 | 0 | public final static class Builder |
101 | |
implements Serializable, ModelBuilder |
102 | |
{ |
103 | |
private String entityTypeCode; |
104 | |
private EntityAddress.Builder defaultAddress; |
105 | |
private EntityEmail.Builder defaultEmailAddress; |
106 | |
private EntityPhone.Builder defaultPhoneNumber; |
107 | |
|
108 | 0 | private Builder() { } |
109 | |
|
110 | |
public static Builder create() { |
111 | 0 | return new Builder(); |
112 | |
} |
113 | |
|
114 | |
public static Builder create(EntityTypeContactInfoDefault immutable) { |
115 | 0 | if (immutable == null) { |
116 | 0 | throw new IllegalArgumentException("EntityTypeDataDefault is null"); |
117 | |
} |
118 | 0 | Builder builder = new Builder(); |
119 | 0 | builder.setEntityTypeCode(immutable.entityTypeCode); |
120 | 0 | if (immutable.getDefaultAddress() != null) { |
121 | 0 | builder.setDefaultAddress(EntityAddress.Builder.create(immutable.getDefaultAddress())); |
122 | |
} |
123 | 0 | if (immutable.getDefaultEmailAddress() != null) { |
124 | 0 | builder.setDefaultEmailAddress(EntityEmail.Builder.create(immutable.getDefaultEmailAddress())); |
125 | |
} |
126 | 0 | if (immutable.getDefaultPhoneNumber() != null) { |
127 | 0 | builder.setDefaultPhoneNumber(EntityPhone.Builder.create(immutable.getDefaultPhoneNumber())); |
128 | |
} |
129 | 0 | return builder; |
130 | |
} |
131 | |
|
132 | |
public static Builder create(EntityTypeContactInfoContract contract) { |
133 | 0 | if (contract == null) { |
134 | 0 | throw new IllegalArgumentException("contract is null"); |
135 | |
} |
136 | 0 | Builder builder = new Builder(); |
137 | 0 | builder.setEntityTypeCode(contract.getEntityTypeCode()); |
138 | 0 | if (contract.getDefaultAddress() != null) { |
139 | 0 | builder.setDefaultAddress(EntityAddress.Builder.create(contract.getDefaultAddress())); |
140 | |
} |
141 | 0 | if (contract.getDefaultEmailAddress() != null) { |
142 | 0 | builder.setDefaultEmailAddress(EntityEmail.Builder.create(contract.getDefaultEmailAddress())); |
143 | |
} |
144 | 0 | if (contract.getDefaultPhoneNumber() != null) { |
145 | 0 | builder.setDefaultPhoneNumber(EntityPhone.Builder.create(contract.getDefaultPhoneNumber())); |
146 | |
} |
147 | 0 | return builder; |
148 | |
} |
149 | |
|
150 | |
public EntityTypeContactInfoDefault build() { |
151 | 0 | return new EntityTypeContactInfoDefault(this); |
152 | |
} |
153 | |
|
154 | |
public String getEntityTypeCode() { |
155 | 0 | return entityTypeCode; |
156 | |
} |
157 | |
|
158 | |
public void setEntityTypeCode(String entityTypeCode) { |
159 | 0 | this.entityTypeCode = entityTypeCode; |
160 | 0 | } |
161 | |
|
162 | |
public EntityAddress.Builder getDefaultAddress() { |
163 | 0 | return defaultAddress; |
164 | |
} |
165 | |
|
166 | |
public void setDefaultAddress(EntityAddress.Builder defaultAddress) { |
167 | 0 | this.defaultAddress = defaultAddress; |
168 | 0 | } |
169 | |
|
170 | |
public EntityEmail.Builder getDefaultEmailAddress() { |
171 | 0 | return defaultEmailAddress; |
172 | |
} |
173 | |
|
174 | |
public void setDefaultEmailAddress(EntityEmail.Builder defaultEmailAddress) { |
175 | 0 | this.defaultEmailAddress = defaultEmailAddress; |
176 | 0 | } |
177 | |
|
178 | |
public EntityPhone.Builder getDefaultPhoneNumber() { |
179 | 0 | return defaultPhoneNumber; |
180 | |
} |
181 | |
|
182 | |
public void setDefaultPhoneNumber(EntityPhone.Builder defaultPhoneNumber) { |
183 | 0 | this.defaultPhoneNumber = defaultPhoneNumber; |
184 | 0 | } |
185 | |
} |
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | 0 | static class Constants { |
194 | |
|
195 | |
final static String ROOT_ELEMENT_NAME = "entityTypeDataDefault"; |
196 | |
final static String TYPE_NAME = "EntityTypeDataDefaultType"; |
197 | |
} |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | 0 | static class Elements { |
205 | |
final static String ENTITY_TYPE_CODE = "entityTypeCode"; |
206 | |
final static String DEFAULT_ADDRESS = "defaultAddress"; |
207 | |
final static String DEFAULT_EMAIL_ADDRESS = "defaultEmailAddress"; |
208 | |
final static String DEFAULT_PHONE_NUMBER = "defaultPhoneNumber"; |
209 | |
|
210 | |
} |
211 | |
|
212 | |
} |