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