| 1 | |
package org.kuali.rice.kim.api.identity.visa; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.Collection; |
| 5 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 6 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 7 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 8 | |
import javax.xml.bind.annotation.XmlElement; |
| 9 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 10 | |
import javax.xml.bind.annotation.XmlType; |
| 11 | |
|
| 12 | |
import org.apache.commons.lang.StringUtils; |
| 13 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
| 14 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
| 15 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
| 16 | |
import org.kuali.rice.core.api.CoreConstants; |
| 17 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 18 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
| 19 | |
import org.w3c.dom.Element; |
| 20 | |
|
| 21 | |
@XmlRootElement(name = EntityVisa.Constants.ROOT_ELEMENT_NAME) |
| 22 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 23 | |
@XmlType(name = EntityVisa.Constants.TYPE_NAME, propOrder = { |
| 24 | |
EntityVisa.Elements.ID, |
| 25 | |
EntityVisa.Elements.ENTITY_ID, |
| 26 | |
EntityVisa.Elements.VISA_TYPE_KEY, |
| 27 | |
EntityVisa.Elements.VISA_ENTRY, |
| 28 | |
EntityVisa.Elements.VISA_ID, |
| 29 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
| 30 | |
CoreConstants.CommonElements.OBJECT_ID, |
| 31 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 32 | |
}) |
| 33 | 6 | public final class EntityVisa |
| 34 | |
implements ModelObjectComplete, EntityVisaContract |
| 35 | |
{ |
| 36 | |
|
| 37 | |
@XmlElement(name = Elements.ENTITY_ID, required = false) |
| 38 | |
private final String entityId; |
| 39 | |
@XmlElement(name = Elements.VISA_TYPE_KEY, required = false) |
| 40 | |
private final String visaTypeKey; |
| 41 | |
@XmlElement(name = Elements.VISA_ENTRY, required = false) |
| 42 | |
private final String visaEntry; |
| 43 | |
@XmlElement(name = Elements.VISA_ID, required = false) |
| 44 | |
private final String visaId; |
| 45 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) |
| 46 | |
private final Long versionNumber; |
| 47 | |
@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) |
| 48 | |
private final String objectId; |
| 49 | |
@XmlElement(name = Elements.ID, required = false) |
| 50 | |
private final String id; |
| 51 | 10 | @SuppressWarnings("unused") |
| 52 | |
@XmlAnyElement |
| 53 | |
private final Collection<Element> _futureElements = null; |
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | 4 | private EntityVisa() { |
| 60 | 4 | this.entityId = null; |
| 61 | 4 | this.visaTypeKey = null; |
| 62 | 4 | this.visaEntry = null; |
| 63 | 4 | this.visaId = null; |
| 64 | 4 | this.versionNumber = null; |
| 65 | 4 | this.objectId = null; |
| 66 | 4 | this.id = null; |
| 67 | 4 | } |
| 68 | |
|
| 69 | 6 | private EntityVisa(Builder builder) { |
| 70 | 6 | this.entityId = builder.getEntityId(); |
| 71 | 6 | this.visaTypeKey = builder.getVisaTypeKey(); |
| 72 | 6 | this.visaEntry = builder.getVisaEntry(); |
| 73 | 6 | this.visaId = builder.getVisaId(); |
| 74 | 6 | this.versionNumber = builder.getVersionNumber(); |
| 75 | 6 | this.objectId = builder.getObjectId(); |
| 76 | 6 | this.id = builder.getId(); |
| 77 | 6 | } |
| 78 | |
|
| 79 | |
@Override |
| 80 | |
public String getEntityId() { |
| 81 | 4 | return this.entityId; |
| 82 | |
} |
| 83 | |
|
| 84 | |
@Override |
| 85 | |
public String getVisaTypeKey() { |
| 86 | 4 | return this.visaTypeKey; |
| 87 | |
} |
| 88 | |
|
| 89 | |
@Override |
| 90 | |
public String getVisaEntry() { |
| 91 | 4 | return this.visaEntry; |
| 92 | |
} |
| 93 | |
|
| 94 | |
@Override |
| 95 | |
public String getVisaId() { |
| 96 | 4 | return this.visaId; |
| 97 | |
} |
| 98 | |
|
| 99 | |
@Override |
| 100 | |
public Long getVersionNumber() { |
| 101 | 4 | return this.versionNumber; |
| 102 | |
} |
| 103 | |
|
| 104 | |
@Override |
| 105 | |
public String getObjectId() { |
| 106 | 4 | return this.objectId; |
| 107 | |
} |
| 108 | |
|
| 109 | |
@Override |
| 110 | |
public String getId() { |
| 111 | 4 | return this.id; |
| 112 | |
} |
| 113 | |
|
| 114 | |
@Override |
| 115 | |
public int hashCode() { |
| 116 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
| 117 | |
} |
| 118 | |
|
| 119 | |
@Override |
| 120 | |
public boolean equals(Object object) { |
| 121 | 5 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
| 122 | |
} |
| 123 | |
|
| 124 | |
@Override |
| 125 | |
public String toString() { |
| 126 | 0 | return ToStringBuilder.reflectionToString(this); |
| 127 | |
} |
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | 4 | public final static class Builder |
| 135 | |
implements Serializable, ModelBuilder, EntityVisaContract |
| 136 | |
{ |
| 137 | |
|
| 138 | |
private String entityId; |
| 139 | |
private String visaTypeKey; |
| 140 | |
private String visaEntry; |
| 141 | |
private String visaId; |
| 142 | |
private Long versionNumber; |
| 143 | |
private String objectId; |
| 144 | |
private String id; |
| 145 | |
|
| 146 | 8 | private Builder() { } |
| 147 | |
|
| 148 | |
public static Builder create() { |
| 149 | 8 | return new Builder(); |
| 150 | |
} |
| 151 | |
|
| 152 | |
public static Builder create(EntityVisaContract contract) { |
| 153 | 5 | if (contract == null) { |
| 154 | 0 | throw new IllegalArgumentException("contract was null"); |
| 155 | |
} |
| 156 | 5 | Builder builder = create(); |
| 157 | 5 | builder.setEntityId(contract.getEntityId()); |
| 158 | 5 | builder.setVisaTypeKey(contract.getVisaTypeKey()); |
| 159 | 5 | builder.setVisaEntry(contract.getVisaEntry()); |
| 160 | 5 | builder.setVisaId(contract.getVisaId()); |
| 161 | 5 | builder.setVersionNumber(contract.getVersionNumber()); |
| 162 | 5 | builder.setObjectId(contract.getObjectId()); |
| 163 | 5 | builder.setId(contract.getId()); |
| 164 | 5 | return builder; |
| 165 | |
} |
| 166 | |
|
| 167 | |
public EntityVisa build() { |
| 168 | 6 | return new EntityVisa(this); |
| 169 | |
} |
| 170 | |
|
| 171 | |
@Override |
| 172 | |
public String getEntityId() { |
| 173 | 6 | return this.entityId; |
| 174 | |
} |
| 175 | |
|
| 176 | |
@Override |
| 177 | |
public String getVisaTypeKey() { |
| 178 | 6 | return this.visaTypeKey; |
| 179 | |
} |
| 180 | |
|
| 181 | |
@Override |
| 182 | |
public String getVisaEntry() { |
| 183 | 6 | return this.visaEntry; |
| 184 | |
} |
| 185 | |
|
| 186 | |
@Override |
| 187 | |
public String getVisaId() { |
| 188 | 6 | return this.visaId; |
| 189 | |
} |
| 190 | |
|
| 191 | |
@Override |
| 192 | |
public Long getVersionNumber() { |
| 193 | 6 | return this.versionNumber; |
| 194 | |
} |
| 195 | |
|
| 196 | |
@Override |
| 197 | |
public String getObjectId() { |
| 198 | 6 | return this.objectId; |
| 199 | |
} |
| 200 | |
|
| 201 | |
@Override |
| 202 | |
public String getId() { |
| 203 | 6 | return this.id; |
| 204 | |
} |
| 205 | |
|
| 206 | |
public void setEntityId(String entityId) { |
| 207 | 5 | this.entityId = entityId; |
| 208 | 5 | } |
| 209 | |
|
| 210 | |
public void setVisaTypeKey(String visaTypeKey) { |
| 211 | 5 | this.visaTypeKey = visaTypeKey; |
| 212 | 5 | } |
| 213 | |
|
| 214 | |
public void setVisaEntry(String visaEntry) { |
| 215 | 5 | this.visaEntry = visaEntry; |
| 216 | 5 | } |
| 217 | |
|
| 218 | |
public void setVisaId(String visaId) { |
| 219 | 5 | this.visaId = visaId; |
| 220 | 5 | } |
| 221 | |
|
| 222 | |
public void setVersionNumber(Long versionNumber) { |
| 223 | 5 | this.versionNumber = versionNumber; |
| 224 | 5 | } |
| 225 | |
|
| 226 | |
public void setObjectId(String objectId) { |
| 227 | 5 | this.objectId = objectId; |
| 228 | 5 | } |
| 229 | |
|
| 230 | |
public void setId(String id) { |
| 231 | 6 | if (StringUtils.isWhitespace(id)) { |
| 232 | 1 | throw new IllegalArgumentException("id is blank"); |
| 233 | |
} |
| 234 | 5 | this.id = id; |
| 235 | 5 | } |
| 236 | |
|
| 237 | |
} |
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
|
| 243 | |
|
| 244 | 0 | static class Constants { |
| 245 | |
|
| 246 | |
final static String ROOT_ELEMENT_NAME = "entityVisa"; |
| 247 | |
final static String TYPE_NAME = "EntityVisaType"; |
| 248 | 1 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] {CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
| 249 | |
|
| 250 | |
} |
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | 0 | static class Elements { |
| 258 | |
|
| 259 | |
final static String ENTITY_ID = "entityId"; |
| 260 | |
final static String VISA_TYPE_KEY = "visaTypeKey"; |
| 261 | |
final static String VISA_ENTRY = "visaEntry"; |
| 262 | |
final static String VISA_ID = "visaId"; |
| 263 | |
final static String ID = "id"; |
| 264 | |
|
| 265 | |
} |
| 266 | |
|
| 267 | |
} |