001package org.kuali.ole.deliver.api; 002 003import org.apache.commons.collections.CollectionUtils; 004import org.apache.commons.lang.StringUtils; 005import org.kuali.api.jaxb.DateAdapter; 006import org.kuali.rice.core.api.CoreConstants; 007import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 008import org.kuali.rice.core.api.mo.ModelBuilder; 009import org.kuali.rice.kim.api.KimConstants; 010import org.kuali.rice.kim.api.identity.address.EntityAddress; 011import org.kuali.rice.kim.api.identity.address.EntityAddressContract; 012import org.kuali.rice.kim.api.identity.email.EntityEmail; 013import org.kuali.rice.kim.api.identity.email.EntityEmailContract; 014import org.kuali.rice.kim.api.identity.entity.Entity; 015import org.kuali.rice.kim.api.identity.name.EntityName; 016import org.kuali.rice.kim.api.identity.phone.EntityPhone; 017import org.kuali.rice.kim.api.identity.phone.EntityPhoneContract; 018import org.w3c.dom.Element; 019 020import javax.xml.bind.annotation.*; 021import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 022import java.io.Serializable; 023import java.util.ArrayList; 024import java.util.Collection; 025import java.util.Date; 026import java.util.List; 027 028/** 029 * Created with IntelliJ IDEA. 030 * User: ? 031 * Date: 5/24/12 032 * Time: 8:26 PM 033 * To change this template use File | Settings | File Templates. 034 */ 035@XmlRootElement(name = OlePatronDefinition.Constants.ROOT_ELEMENT_NAME) 036@XmlAccessorType(XmlAccessType.NONE) 037@XmlType(name = OlePatronDefinition.Constants.TYPE_NAME, propOrder = { 038 OlePatronDefinition.Elements.PATRON_ID, 039 OlePatronDefinition.Elements.BARCODE, 040 OlePatronDefinition.Elements.BORROWER_TYPE, 041 OlePatronDefinition.Elements.ACITVE_INICATOR, 042 OlePatronDefinition.Elements.GENERAL_BLOCK, 043 OlePatronDefinition.Elements.PAGING_PRIVILEGE, 044 OlePatronDefinition.Elements.COURTESY_NOTICE, 045 OlePatronDefinition.Elements.DELIVERYPRIVILEGE, 046 OlePatronDefinition.Elements.EXPIRATION_DATE, 047 OlePatronDefinition.Elements.ACTIVATION_DATE, 048 OlePatronDefinition.Elements.OLE_BORROWER_TYPE, 049 OlePatronDefinition.Elements.PHONES, 050 OlePatronDefinition.Elements.ADDRESSES, 051 OlePatronDefinition.Elements.NAME, 052 OlePatronDefinition.Elements.EMAILS, 053 OlePatronDefinition.Elements.NOTES, 054 OlePatronDefinition.Elements.LOST_BARCODES, 055 OlePatronDefinition.Elements.OLE_ENTITY_ADDRESSES, 056 OlePatronDefinition.Elements.GENERAL_BLOCK_NOTES, 057 OlePatronDefinition.Elements.PATRON_AFFILIATIONS, 058 OlePatronDefinition.Elements.OLE_PROXY_PATRON_DOCS, 059 // OlePatronDefinition.Elements.OLE_PATRON_DOCS, 060 OlePatronDefinition.Elements.OLE_SOURCE, 061 OlePatronDefinition.Elements.OLE_STATISTICAL_CAT, 062 OlePatronDefinition.Elements.OLE_ADDRESSES, 063 OlePatronDefinition.Elements.OLE_PATRON_LOCAL_IDS, 064 CoreConstants.CommonElements.VERSION_NUMBER, 065 //CoreConstants.CommonElements.OBJECT_ID, 066 CoreConstants.CommonElements.FUTURE_ELEMENTS 067}) 068public final class OlePatronDefinition extends AbstractDataTransferObject implements OlePatronContract { 069 070 private static final long serialVersionUID = 1L; 071 072 @XmlElement(name = Elements.PATRON_ID, required = false) 073 private final String olePatronId; 074 075 @XmlElement(name = Elements.BARCODE, required = false) 076 private final String barcode; 077 078 @XmlElement(name = Elements.BORROWER_TYPE, required = false) 079 private final String borrowerType; 080 081 @XmlElement(name = Elements.ACITVE_INICATOR, required = false) 082 private final boolean activeIndicator; 083 084 @XmlElement(name = Elements.GENERAL_BLOCK, required = false) 085 private final boolean generalBlock; 086 087 @XmlElement(name = Elements.PAGING_PRIVILEGE, required = false) 088 private final boolean pagingPrivilege; 089 090 @XmlElement(name = Elements.COURTESY_NOTICE, required = false) 091 private final boolean courtesyNotice; 092 093 @XmlElement(name = Elements.DELIVERYPRIVILEGE, required = false) 094 private final boolean deliveryPrivilege; 095 096 @XmlElement(name = Elements.EXPIRATION_DATE, required = false) 097 @XmlJavaTypeAdapter(value = DateAdapter.class, type = Date.class) 098 private final Date expirationDate; 099 100 @XmlElement(name = Elements.ACTIVATION_DATE, required = false) 101 @XmlJavaTypeAdapter(value = DateAdapter.class, type = Date.class) 102 private final Date activationDate; 103 104 @XmlElementWrapper(name = Elements.PHONES, required = false) 105 @XmlElement(name = Elements.PHONE, required = false) 106 private final List<EntityPhone> phones; 107 108 @XmlElementWrapper(name = Elements.ADDRESSES, required = false) 109 @XmlElement(name = Elements.ADDRESS, required = false) 110 private final List<EntityAddress> addresses; 111 112 @XmlElement(name = Elements.NAME, required = false) 113 private final EntityName name; 114 115 @XmlElementWrapper(name = Elements.EMAILS, required = false) 116 @XmlElement(name = Elements.EMAIL, required = false) 117 private final List<EntityEmail> emails; 118 119 @XmlElementWrapper(name = Elements.NOTES, required = false) 120 @XmlElement(name = Elements.NOTE, required = false) 121 private final List<OlePatronNotesDefinition> notes; 122 123 @XmlElementWrapper(name = Elements.LOST_BARCODES, required = false) 124 @XmlElement(name = Elements.LOST_BARCODE, required = false) 125 private final List<OlePatronLostBarcodeDefinition> lostBarcodes; 126 127 @XmlElementWrapper(name = Elements.OLE_ENTITY_ADDRESSES, required = false) 128 @XmlElement(name = Elements.OLE_ENTITY_ADDRESS, required = false) 129 private final List<OleEntityAddressDefinition> oleEntityAddressBo; 130 131 @XmlElementWrapper(name = Elements.PATRON_AFFILIATIONS, required = false) 132 @XmlElement(name = Elements.PATRON_AFFILIATION, required = false) 133 private final List<OlePatronAffiliationDefinition> patronAffiliations; 134 135 @XmlElementWrapper(name = Elements.OLE_PROXY_PATRON_DOCS, required = false) 136 @XmlElement(name = Elements.OLE_PROXY_PATRON_DOC, required = false) 137 private final List<OleProxyPatronDefinition> oleProxyPatronDocuments; 138 139 @XmlElementWrapper(name = Elements.OLE_ADDRESSES, required = false) 140 @XmlElement(name = Elements.OLE_ADDRESS, required = false) 141 private final List<OleAddressDefinition> oleAddresses; 142 143 @XmlElement(name = Elements.GENERAL_BLOCK_NOTES, required = false) 144 private final String generalBlockNotes; 145 146 @XmlElement(name = Elements.OLE_SOURCE, required = false) 147 private final String source; 148 149 150 @XmlElement(name = Elements.OLE_STATISTICAL_CAT, required = false) 151 private final String statisticalCategory; 152 153 @XmlElementWrapper(name = Elements.OLE_PATRON_LOCAL_IDS, required = false) 154 @XmlElement(name = Elements.OLE_PATRON_LOCAL_ID, required = false) 155 private final List<OlePatronLocalIdentificationDefinition> olePatronLocalIds; 156 157 @XmlElement(name = Elements.OLE_BORROWER_TYPE, required = false) 158 private final OleBorrowerTypeDefinition oleBorrowerType; 159 160 //@XmlElement(name = Elements.ENTITY, required = false) 161 private final Entity entity; 162 163 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) 164 private final Long versionNumber; 165 166 /*@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) 167 private final String objectId;*/ 168 @SuppressWarnings("unused") 169 @XmlAnyElement 170 private final Collection<Element> _futureElements = null; 171 172 public OlePatronDefinition() { 173 this.olePatronId = null; 174 this.barcode = null; 175 this.borrowerType = null; 176 this.activeIndicator = false; 177 this.generalBlock = false; 178 this.pagingPrivilege = false; 179 this.courtesyNotice = false; 180 this.deliveryPrivilege = false; 181 this.expirationDate = null; 182 this.activationDate = null; 183 184 this.phones = null; 185 this.addresses = null; 186 this.name = null; 187 this.emails = null; 188 this.notes = null; 189 this.lostBarcodes = null; 190 this.oleEntityAddressBo = null; 191 this.patronAffiliations = null; 192 this.oleBorrowerType = null; 193 this.entity = null; 194 this.generalBlockNotes = null; 195 this.oleProxyPatronDocuments = null; 196 //this.olePatronDocuments = null; 197 this.source = null; 198 this.statisticalCategory = null; 199 this.oleAddresses = null; 200 this.olePatronLocalIds = null; 201 this.versionNumber = null; 202 //this.objectId = null; 203 } 204 205 206 private OlePatronDefinition(Builder builder) { 207 this.olePatronId = builder.getOlePatronId(); 208 this.barcode = builder.getBarcode(); 209 this.borrowerType = builder.getBorrowerType(); 210 this.activeIndicator = builder.isActiveIndicator(); 211 this.generalBlock = builder.isGeneralBlock(); 212 this.pagingPrivilege = builder.isPagingPrivilege(); 213 this.courtesyNotice = builder.isCourtesyNotice(); 214 this.deliveryPrivilege = builder.isDeliveryPrivilege(); 215 this.expirationDate = builder.getExpirationDate(); 216 this.activationDate = builder.getActivationDate(); 217 this.generalBlockNotes = builder.getGeneralBlockNotes(); 218 this.source = builder.getSource(); 219 this.statisticalCategory = builder.getStatisticalCategory(); 220 this.oleBorrowerType = builder.getOleBorrowerType().build(); 221 222 this.addresses = new ArrayList<EntityAddress>(); 223 if (!CollectionUtils.isEmpty(builder.getAddresses())) { 224 for (EntityAddress.Builder address : builder.getAddresses()) { 225 this.addresses.add(address.build()); 226 } 227 } 228 229 this.emails = new ArrayList<EntityEmail>(); 230 if (!CollectionUtils.isEmpty(builder.getEmails())) { 231 for (EntityEmail.Builder email : builder.getEmails()) { 232 this.emails.add(email.build()); 233 } 234 } 235 this.phones = new ArrayList<EntityPhone>(); 236 if (!CollectionUtils.isEmpty(builder.getPhones())) { 237 for (EntityPhone.Builder phoneNumber : builder.getPhones()) { 238 this.phones.add(phoneNumber.build()); 239 } 240 } 241 this.name = builder.getName().build(); 242 243 this.notes = new ArrayList<OlePatronNotesDefinition>(); 244 if (!CollectionUtils.isEmpty(builder.getNotes())) { 245 for (OlePatronNotesDefinition.Builder note : builder.getNotes()) { 246 this.notes.add(note.build()); 247 } 248 } 249 250 this.lostBarcodes = new ArrayList<OlePatronLostBarcodeDefinition>(); 251 if (!CollectionUtils.isEmpty(builder.getLostBarcodes())) { 252 for (OlePatronLostBarcodeDefinition.Builder lostBarcode : builder.getLostBarcodes()) { 253 this.lostBarcodes.add(lostBarcode.build()); 254 } 255 } 256 257 this.oleEntityAddressBo = new ArrayList<OleEntityAddressDefinition>(); 258 if (!CollectionUtils.isEmpty(builder.getOleEntityAddressBo())) { 259 for (OleEntityAddressDefinition.Builder oleEntityAddress : builder.getOleEntityAddressBo()) { 260 this.oleEntityAddressBo.add(oleEntityAddress.build()); 261 } 262 } 263 264 this.patronAffiliations = new ArrayList<OlePatronAffiliationDefinition>(); 265 if (!CollectionUtils.isEmpty(builder.getPatronAffiliations())) { 266 for (OlePatronAffiliationDefinition.Builder oleAffiliation : builder.getPatronAffiliations()) { 267 this.patronAffiliations.add(oleAffiliation.build()); 268 } 269 } 270 271 this.oleProxyPatronDocuments = new ArrayList<OleProxyPatronDefinition>(); 272 if (!CollectionUtils.isEmpty(builder.getOleProxyPatronDocuments())) { 273 for (OleProxyPatronDefinition.Builder oleProxyPatron : builder.getOleProxyPatronDocuments()) { 274 this.oleProxyPatronDocuments.add(oleProxyPatron.build()); 275 } 276 } 277 278 this.oleAddresses = new ArrayList<OleAddressDefinition>(); 279 if (!CollectionUtils.isEmpty(builder.getOleAddresses())) { 280 for (OleAddressDefinition.Builder oleAddress : builder.getOleAddresses()) { 281 this.oleAddresses.add(oleAddress.build()); 282 } 283 } 284 285 this.olePatronLocalIds = new ArrayList<OlePatronLocalIdentificationDefinition>(); 286 if (!CollectionUtils.isEmpty(builder.getOlePatronLocalIds())) { 287 for (OlePatronLocalIdentificationDefinition.Builder olePatronLocalIds : builder.getOlePatronLocalIds()) { 288 this.olePatronLocalIds.add(olePatronLocalIds.build()); 289 } 290 } 291 292 this.entity = builder.getEntity().build(); 293 294 this.versionNumber = builder.getVersionNumber(); 295 //this.objectId = builder.getObjectId(); 296 } 297 298 @Override 299 public String getOlePatronId() { 300 return this.olePatronId; 301 } 302 303 @Override 304 public String getBarcode() { 305 return this.barcode; 306 } 307 308 @Override 309 public String getBorrowerType() { 310 return this.borrowerType; 311 } 312 313 @Override 314 public boolean isActiveIndicator() { 315 return this.activeIndicator; 316 } 317 318 @Override 319 public boolean isGeneralBlock() { 320 return this.generalBlock; 321 } 322 323 @Override 324 public boolean isPagingPrivilege() { 325 return this.pagingPrivilege; 326 } 327 328 @Override 329 public boolean isCourtesyNotice() { 330 return this.courtesyNotice; 331 } 332 333 @Override 334 public boolean isDeliveryPrivilege() { 335 return this.deliveryPrivilege; 336 } 337 338 @Override 339 public Date getExpirationDate() { 340 return this.expirationDate; 341 } 342 343 @Override 344 public Date getActivationDate() { 345 return this.activationDate; 346 } 347 348 @Override 349 public List<EntityAddress> getAddresses() { 350 return this.addresses; 351 } 352 353 @Override 354 public List<EntityEmail> getEmails() { 355 return this.emails; 356 } 357 358 @Override 359 public EntityName getName() { 360 return this.name; 361 } 362 363 @Override 364 public List<EntityPhone> getPhones() { 365 return this.phones; 366 } 367 368 @Override 369 public List<OleEntityAddressDefinition> getOleEntityAddressBo() { 370 return this.oleEntityAddressBo; 371 } 372 373 @Override 374 public List<OlePatronAffiliationDefinition> getPatronAffiliations() { 375 return this.patronAffiliations; 376 } 377 378 @Override 379 public List<OleProxyPatronDefinition> getOleProxyPatronDocuments() { 380 return this.oleProxyPatronDocuments; 381 } 382 383 @Override 384 public List<OleAddressDefinition> getOleAddresses() { 385 return this.oleAddresses; 386 } 387 388 @Override 389 public List<OlePatronLocalIdentificationDefinition> getOlePatronLocalIds() { 390 return this.olePatronLocalIds; 391 } 392 393 @Override 394 public String getGeneralBlockNotes() { 395 return this.generalBlockNotes; 396 } 397 398 @Override 399 public String getSource() { 400 return this.source; 401 } 402 403 @Override 404 public String getStatisticalCategory() { 405 return this.statisticalCategory; 406 } 407 408 @Override 409 public Entity getEntity() { 410 return this.entity; 411 } 412 413 @Override 414 public String getId() { 415 return this.olePatronId; 416 } 417 418 /* @Override 419 public boolean isActive() { 420 return this.activeIndicator; 421 }*/ 422 423 @Override 424 public Long getVersionNumber() { 425 return this.versionNumber; 426 } 427 428 @Override 429 public List<OlePatronNotesDefinition> getNotes() { 430 return this.notes; 431 } 432 433 @Override 434 public List<OlePatronLostBarcodeDefinition> getLostBarcodes() { 435 return this.lostBarcodes; 436 } 437 438 //@Override 439 public OleBorrowerTypeDefinition getOleBorrowerType() { 440 return this.oleBorrowerType; 441 } 442 443 public static class Builder 444 implements Serializable, ModelBuilder, OlePatronContract { 445 private String olePatronId; 446 private String barcode; 447 private String borrowerType; 448 private boolean activeIndicator; 449 private boolean generalBlock; 450 private boolean pagingPrivilege; 451 private boolean courtesyNotice; 452 private boolean deliveryPrivilege; 453 private Date expirationDate; 454 private Date activationDate; 455 private Date invalidBarcodeNumEffDate; 456 private String generalBlockNotes; 457 private String source; 458 private String statisticalCategory; 459 private String addressSource; 460 461 private List<EntityPhone.Builder> phones; 462 private List<EntityAddress.Builder> addresses; 463 private EntityName.Builder name; 464 private List<EntityEmail.Builder> emails; 465 private List<OlePatronNotesDefinition.Builder> notes; 466 private List<OlePatronLostBarcodeDefinition.Builder> lostBarcodes; 467 private OleBorrowerTypeDefinition.Builder oleBorrowerType; 468 private OleSourceDefinition.Builder sourceBo; 469 private OleStatisticalCategoryDefinition.Builder statisticalCategoryBo; 470 private Entity.Builder entity; 471 private List<OleEntityAddressDefinition.Builder> oleEntityAddressBo; 472 private List<OlePatronAffiliationDefinition.Builder> patronAffiliations; 473 private List<OleProxyPatronDefinition.Builder> oleProxyPatronDocuments; 474 private List<Builder> olePatronDocuments; 475 private List<OlePatronLocalIdentificationDefinition.Builder> olePatronLocalIds; 476 private List<OleAddressDefinition.Builder> oleAddresses; 477 478 private Long versionNumber; 479 private String objectId; 480 481 private Builder() { 482 } 483 484 public static Builder create() { 485 return new Builder(); 486 } 487 488 public static Builder create(OlePatronContract contract) { 489 if (contract == null) { 490 throw new IllegalArgumentException("contract was null"); 491 } 492 Builder builder = create(); 493 if (contract.getOlePatronId() != null) { 494 builder.setOlePatronId(contract.getOlePatronId()); 495 } 496 if (contract.getBarcode() != null) { 497 builder.setBarcode(contract.getBarcode()); 498 } 499 if (contract.getBorrowerType() != null) { 500 builder.setBorrowerType(contract.getBorrowerType()); 501 } 502 if (contract.isActiveIndicator()) { 503 builder.setActiveIndicator(contract.isActiveIndicator()); 504 builder.setActive(contract.isActiveIndicator()); 505 } 506 if (contract.isGeneralBlock()) { 507 builder.setGeneralBlock(contract.isGeneralBlock()); 508 } 509 if (contract.isDeliveryPrivilege()) { 510 builder.setDeliveryPrivilege(contract.isDeliveryPrivilege()); 511 } 512 if (contract.isPagingPrivilege()) { 513 builder.setPagingPrivilege(contract.isPagingPrivilege()); 514 } 515 if (contract.isCourtesyNotice()) { 516 builder.setCourtesyNotice(contract.isCourtesyNotice()); 517 } 518 if (contract.getExpirationDate() != null) { 519 builder.setExpirationDate(contract.getExpirationDate()); 520 } 521 if (contract.getActivationDate() != null) { 522 builder.setActivationDate(contract.getActivationDate()); 523 } 524 if (contract.getGeneralBlockNotes() != null) { 525 builder.setGeneralBlockNotes(contract.getGeneralBlockNotes()); 526 } 527 if (contract.getSource() != null) { 528 builder.setSource(contract.getSource()); 529 } 530 if (contract.getStatisticalCategory() != null) { 531 builder.setStatisticalCategory(contract.getStatisticalCategory()); 532 } 533 if (contract.getEntity() != null) { 534 builder.setEntity(Entity.Builder.create(contract.getEntity())); 535 } 536 builder.addresses = new ArrayList<EntityAddress.Builder>(); 537 if (!CollectionUtils.isEmpty(contract.getAddresses())) { 538 for (EntityAddressContract addressContract : contract.getAddresses()) { 539 builder.addresses.add(EntityAddress.Builder.create(addressContract)); 540 } 541 } else if (contract.getEntity() != null) { 542 if (!CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos()) && 543 !CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos().get(0).getAddresses())) { 544 for (EntityAddressContract addressContract : contract.getEntity().getEntityTypeContactInfos().get(0).getAddresses()) { 545 builder.addresses.add(EntityAddress.Builder.create(addressContract)); 546 } 547 } 548 549 } 550 builder.emails = new ArrayList<EntityEmail.Builder>(); 551 if (!CollectionUtils.isEmpty(contract.getEmails())) { 552 for (EntityEmailContract emailContract : contract.getEmails()) { 553 builder.emails.add(EntityEmail.Builder.create(emailContract)); 554 } 555 } else if (contract.getEntity() != null) { 556 if (!CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos()) && 557 !CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos().get(0).getEmailAddresses())) { 558 for (EntityEmailContract emailContract : contract.getEntity().getEntityTypeContactInfos().get(0).getEmailAddresses()) { 559 builder.emails.add(EntityEmail.Builder.create(emailContract)); 560 } 561 } 562 563 } 564 builder.phones = new ArrayList<EntityPhone.Builder>(); 565 if (!CollectionUtils.isEmpty(contract.getPhones())) { 566 for (EntityPhoneContract phoneContract : contract.getPhones()) { 567 builder.phones.add(EntityPhone.Builder.create(phoneContract)); 568 } 569 } else if (contract.getEntity() != null) { 570 if (!CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos()) && 571 !CollectionUtils.isEmpty(contract.getEntity().getEntityTypeContactInfos().get(0).getPhoneNumbers())) { 572 for (EntityPhoneContract phoneContract : contract.getEntity().getEntityTypeContactInfos().get(0).getPhoneNumbers()) { 573 builder.phones.add(EntityPhone.Builder.create(phoneContract)); 574 } 575 } 576 577 } 578 builder.oleEntityAddressBo = new ArrayList<OleEntityAddressDefinition.Builder>(); 579 if (!CollectionUtils.isEmpty(contract.getOleEntityAddressBo())) { 580 for (OleEntityAddressContract oleEntityAddressContract : contract.getOleEntityAddressBo()) { 581 builder.oleEntityAddressBo.add(OleEntityAddressDefinition.Builder.create(oleEntityAddressContract)); 582 } 583 } 584 builder.oleAddresses = new ArrayList<OleAddressDefinition.Builder>(); 585 if (!CollectionUtils.isEmpty(contract.getOleAddresses())) { 586 for (OleAddressContract oleAddressContract : contract.getOleAddresses()) { 587 builder.oleAddresses.add(OleAddressDefinition.Builder.create(oleAddressContract)); 588 } 589 } 590 if (contract.getName() != null && contract.getName().getFirstName() != null) { 591 builder.setName(EntityName.Builder.create(contract.getName())); 592 } else if (contract.getEntity() != null) { 593 if (!CollectionUtils.isEmpty(contract.getEntity().getNames())) { 594 builder.setName(EntityName.Builder.create(contract.getEntity().getNames().get(0))); 595 } 596 597 } 598 if (contract.getOleBorrowerType() != null) { 599 builder.setOleBorrowerType(OleBorrowerTypeDefinition.Builder.create(contract.getOleBorrowerType())); 600 } 601 builder.notes = new ArrayList<OlePatronNotesDefinition.Builder>(); 602 if (!CollectionUtils.isEmpty(contract.getNotes())) { 603 for (OlePatronNotesContract noteContract : contract.getNotes()) { 604 builder.notes.add(OlePatronNotesDefinition.Builder.create(noteContract)); 605 } 606 } 607 builder.lostBarcodes = new ArrayList<OlePatronLostBarcodeDefinition.Builder>(); 608 if (!CollectionUtils.isEmpty(contract.getLostBarcodes())) { 609 for (OlePatronLostBarcodeContract lostBarcodeContract : contract.getLostBarcodes()) { 610 builder.lostBarcodes.add(OlePatronLostBarcodeDefinition.Builder.create(lostBarcodeContract)); 611 } 612 } 613 builder.patronAffiliations = new ArrayList<OlePatronAffiliationDefinition.Builder>(); 614 if (!CollectionUtils.isEmpty(contract.getPatronAffiliations())) { 615 for (OlePatronAffiliationContract affiliationContract : contract.getPatronAffiliations()) { 616 builder.patronAffiliations.add(OlePatronAffiliationDefinition.Builder.create(affiliationContract)); 617 } 618 } 619 620 builder.oleProxyPatronDocuments = new ArrayList<OleProxyPatronDefinition.Builder>(); 621 if (!CollectionUtils.isEmpty(contract.getOleProxyPatronDocuments())) { 622 for (OleProxyPatronContract proxyContract : contract.getOleProxyPatronDocuments()) { 623 builder.oleProxyPatronDocuments.add(OleProxyPatronDefinition.Builder.create(proxyContract)); 624 } 625 } 626 builder.olePatronLocalIds = new ArrayList<OlePatronLocalIdentificationDefinition.Builder>(); 627 if (!CollectionUtils.isEmpty(contract.getOlePatronLocalIds())) { 628 for (OlePatronLocalIdentificationContract patornLocalIdContract : contract.getOlePatronLocalIds()) { 629 builder.olePatronLocalIds.add(OlePatronLocalIdentificationDefinition.Builder.create(patornLocalIdContract)); 630 } 631 } 632 builder.setVersionNumber(contract.getVersionNumber()); 633 /*builder.setObjectId(contract.getObjectId()); 634 builder.setActive(contract.isActive());*/ 635 builder.setId(contract.getId()); 636 return builder; 637 } 638 639 640 public OlePatronDefinition build() { 641 return new OlePatronDefinition(this); 642 } 643 644 @Override 645 public String getOlePatronId() { 646 return olePatronId; 647 } 648 649 public void setOlePatronId(String olePatronId) { 650 this.olePatronId = olePatronId; 651 } 652 653 @Override 654 public String getBarcode() { 655 return barcode; 656 } 657 658 public void setBarcode(String barcode) { 659 this.barcode = barcode; 660 } 661 662 @Override 663 public String getBorrowerType() { 664 return borrowerType; 665 } 666 667 668 public void setBorrowerType(String borrowerType) { 669 this.borrowerType = borrowerType; 670 } 671 672 @Override 673 public boolean isActiveIndicator() { 674 return activeIndicator; 675 } 676 677 public void setActiveIndicator(boolean activeIndicator) { 678 this.activeIndicator = activeIndicator; 679 } 680 681 @Override 682 public boolean isGeneralBlock() { 683 return generalBlock; 684 } 685 686 public void setGeneralBlock(boolean generalBlock) { 687 this.generalBlock = generalBlock; 688 } 689 690 @Override 691 public boolean isPagingPrivilege() { 692 return pagingPrivilege; 693 } 694 695 public void setPagingPrivilege(boolean pagingPrivilege) { 696 this.pagingPrivilege = pagingPrivilege; 697 } 698 699 @Override 700 public boolean isCourtesyNotice() { 701 return courtesyNotice; 702 } 703 704 public void setCourtesyNotice(boolean courtesyNotice) { 705 this.courtesyNotice = courtesyNotice; 706 } 707 708 @Override 709 public boolean isDeliveryPrivilege() { 710 return deliveryPrivilege; 711 } 712 713 public void setDeliveryPrivilege(boolean deliveryPrivilege) { 714 this.deliveryPrivilege = deliveryPrivilege; 715 } 716 717 @Override 718 public Date getExpirationDate() { 719 return expirationDate; 720 } 721 722 public void setExpirationDate(Date expirationDate) { 723 this.expirationDate = expirationDate; 724 } 725 726 @Override 727 public Date getActivationDate() { 728 return activationDate; 729 } 730 731 public void setActivationDate(Date activationDate) { 732 this.activationDate = activationDate; 733 } 734 735 @Override 736 public List<EntityPhone.Builder> getPhones() { 737 return phones; 738 } 739 740 public void setPhones(List<EntityPhone.Builder> phones) { 741 this.phones = phones; 742 } 743 744 @Override 745 public List<EntityAddress.Builder> getAddresses() { 746 return addresses; 747 } 748 749 public void setAddresses(List<EntityAddress.Builder> addresses) { 750 this.addresses = addresses; 751 } 752 753 public List<OleProxyPatronDefinition.Builder> getOleProxyPatronDocuments() { 754 return oleProxyPatronDocuments; 755 } 756 757 public void setOleProxyPatronDocuments(List<OleProxyPatronDefinition.Builder> oleProxyPatronDocuments) { 758 this.oleProxyPatronDocuments = oleProxyPatronDocuments; 759 } 760 761 @Override 762 public EntityName.Builder getName() { 763 return name; 764 } 765 766 public void setName(EntityName.Builder name) { 767 this.name = name; 768 } 769 770 @Override 771 public List<EntityEmail.Builder> getEmails() { 772 return emails; 773 } 774 775 public void setEmails(List<EntityEmail.Builder> emails) { 776 this.emails = emails; 777 } 778 779 780 public List<OlePatronNotesDefinition.Builder> getNotes() { 781 return notes; 782 } 783 784 public void setNotes(List<OlePatronNotesDefinition.Builder> notes) { 785 this.notes = notes; 786 } 787 788 public List<OlePatronLostBarcodeDefinition.Builder> getLostBarcodes() { 789 return lostBarcodes; 790 } 791 792 public void setLostBarcodes(List<OlePatronLostBarcodeDefinition.Builder> lostBarcodes) { 793 this.lostBarcodes = lostBarcodes; 794 } 795 796 public OleBorrowerTypeDefinition.Builder getOleBorrowerType() { 797 return oleBorrowerType; 798 } 799 800 public void setOleBorrowerType(OleBorrowerTypeDefinition.Builder oleBorrowerType) { 801 this.oleBorrowerType = oleBorrowerType; 802 } 803 804 public Date getInvalidBarcodeNumEffDate() { 805 return invalidBarcodeNumEffDate; 806 } 807 808 public void setInvalidBarcodeNumEffDate(Date invalidBarcodeNumEffDate) { 809 this.invalidBarcodeNumEffDate = invalidBarcodeNumEffDate; 810 } 811 812 public String getGeneralBlockNotes() { 813 return generalBlockNotes; 814 } 815 816 public void setGeneralBlockNotes(String generalBlockNotes) { 817 this.generalBlockNotes = generalBlockNotes; 818 } 819 820 @Override 821 public Entity.Builder getEntity() { 822 return entity; 823 } 824 825 public void setEntity(Entity.Builder entity) { 826 this.entity = entity; 827 } 828 829 public List<OleEntityAddressDefinition.Builder> getOleEntityAddressBo() { 830 return oleEntityAddressBo; 831 } 832 833 public void setOleEntityAddressBo(List<OleEntityAddressDefinition.Builder> oleEntityAddressBo) { 834 this.oleEntityAddressBo = oleEntityAddressBo; 835 } 836 837 public List<OlePatronAffiliationDefinition.Builder> getPatronAffiliations() { 838 return patronAffiliations; 839 } 840 841 public void setPatronAffiliations(List<OlePatronAffiliationDefinition.Builder> patronAffiliations) { 842 this.patronAffiliations = patronAffiliations; 843 } 844 845 public List<OlePatronLocalIdentificationDefinition.Builder> getOlePatronLocalIds() { 846 return olePatronLocalIds; 847 } 848 849 public void setOlePatronLocalIds(List<OlePatronLocalIdentificationDefinition.Builder> olePatronLocalIds) { 850 this.olePatronLocalIds = olePatronLocalIds; 851 } 852 853 public List<Builder> getOlePatronDocuments() { 854 return olePatronDocuments; 855 } 856 857 public void setOlePatronDocuments(List<Builder> olePatronDocuments) { 858 this.olePatronDocuments = olePatronDocuments; 859 } 860 861 public String getSource() { 862 return source; 863 } 864 865 public void setSource(String source) { 866 this.source = source; 867 } 868 869 public String getStatisticalCategory() { 870 return statisticalCategory; 871 } 872 873 public void setStatisticalCategory(String statisticalCategory) { 874 this.statisticalCategory = statisticalCategory; 875 } 876 877 public OleSourceDefinition.Builder getSourceBo() { 878 return sourceBo; 879 } 880 881 public void setSourceBo(OleSourceDefinition.Builder sourceBo) { 882 this.sourceBo = sourceBo; 883 } 884 885 public OleStatisticalCategoryDefinition.Builder getStatisticalCategoryBo() { 886 return statisticalCategoryBo; 887 } 888 889 public void setStatisticalCategoryBo(OleStatisticalCategoryDefinition.Builder statisticalCategoryBo) { 890 this.statisticalCategoryBo = statisticalCategoryBo; 891 } 892 893 public String getAddressSource() { 894 return addressSource; 895 } 896 897 public void setAddressSource(String addressSource) { 898 this.addressSource = addressSource; 899 } 900 901 public List<OleAddressDefinition.Builder> getOleAddresses() { 902 return oleAddresses; 903 } 904 905 public void setOleAddresses(List<OleAddressDefinition.Builder> oleAddresses) { 906 this.oleAddresses = oleAddresses; 907 } 908 909 @Override 910 public Long getVersionNumber() { 911 return versionNumber; 912 } 913 914 public void setVersionNumber(Long versionNumber) { 915 this.versionNumber = versionNumber; 916 } 917 918 /*@Override 919 public String getObjectId() { 920 return objectId; 921 }*/ 922 923 public void setObjectId(String objectId) { 924 this.objectId = objectId; 925 } 926 927 @Override 928 public String getId() { 929 return this.olePatronId; 930 } 931 932 public boolean isActive() { 933 return this.activeIndicator; 934 } 935 936 public void setActive(boolean active) { 937 this.activeIndicator = active; 938 } 939 940 public void setId(String id) { 941 if (StringUtils.isWhitespace(id)) { 942 throw new IllegalArgumentException("id is blank"); 943 } 944 this.olePatronId = id; 945 } 946 } 947 948 static class Constants { 949 950 final static String ROOT_ELEMENT_NAME = "olePatron"; 951 final static String TYPE_NAME = "OlePatronType"; 952 final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS}; 953 } 954 955 static class Elements { 956 final static String PATRON_ID = "olePatronId"; 957 //final static String ENTITY_ID = "entityId"; 958 final static String BARCODE = "barcode"; 959 final static String BORROWER_TYPE = "borrowerType"; 960 final static String ACITVE_INICATOR = "activeIndicator"; 961 final static String GENERAL_BLOCK = "generalBlock"; 962 final static String PAGING_PRIVILEGE = "pagingPrivilege"; 963 final static String COURTESY_NOTICE = "courtesyNotice"; 964 final static String DELIVERYPRIVILEGE = "deliveryPrivilege"; 965 final static String EXPIRATION_DATE = "expirationDate"; 966 final static String ACTIVATION_DATE = "activationDate"; 967 968 final static String PHONES = "phones"; 969 final static String PHONE = "phone"; 970 final static String ADDRESSES = "addresses"; 971 final static String ADDRESS = "address"; 972 final static String NAME = "name"; 973 final static String EMAILS = "emails"; 974 final static String EMAIL = "email"; 975 final static String NOTES = "notes"; 976 final static String NOTE = "note"; 977 final static String LOST_BARCODES = "lostBarcodes"; 978 final static String LOST_BARCODE = "lostBarcode"; 979 final static String OLE_BORROWER_TYPE = "oleBorrowerType"; 980 final static String ENTITY = "entity"; 981 final static String OLE_ENTITY_ADDRESSES = "oleEntityAddressBo"; 982 final static String OLE_ENTITY_ADDRESS = "oleEntityAddress"; 983 final static String GENERAL_BLOCK_NOTES = "generalBlockNotes"; 984 final static String PATRON_AFFILIATIONS = "patronAffiliations"; 985 final static String PATRON_AFFILIATION = "patronAffiliation"; 986 final static String OLE_PROXY_PATRON_DOCS = "oleProxyPatronDocuments"; 987 final static String OLE_PROXY_PATRON_DOC = "oleProxyPatronDocument"; 988 //final static String OLE_PATRON_DOCS = "olePatronDocuments"; 989 //final static String OLE_PATRON_DOC = "olePatronDocument"; 990 final static String OLE_SOURCE = "source"; 991 final static String OLE_STATISTICAL_CAT = "statisticalCategory"; 992 final static String OLE_ADDRESSES = "oleAddresses"; 993 final static String OLE_ADDRESS = "oleAddress"; 994 final static String OLE_PATRON_LOCAL_IDS = "olePatronLocalIds"; 995 final static String OLE_PATRON_LOCAL_ID = "olePatronLocalId"; 996 997 } 998 999 public static class Cache { 1000 public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME; 1001 } 1002}