001package org.kuali.ole.describe.form; 002 003import org.apache.commons.lang.StringUtils; 004import org.kuali.ole.describe.bo.DocumentTreeNode; 005import org.kuali.ole.describe.bo.OleBibliographicRecordStatus; 006import org.kuali.ole.describe.bo.WorkDublinEditorField; 007import org.kuali.ole.docstore.common.document.Bib; 008import org.kuali.ole.docstore.common.document.BibTree; 009import org.kuali.ole.docstore.indexer.solr.DocumentLocalId; 010import org.kuali.ole.docstore.model.bo.WorkBibDocument; 011import org.kuali.ole.select.bo.OLESerialReceivingDocument; 012import org.kuali.rice.core.api.util.tree.Tree; 013import org.kuali.rice.krad.service.BusinessObjectService; 014import org.kuali.rice.krad.service.KRADServiceLocator; 015import org.kuali.rice.krad.web.form.UifFormBase; 016 017import java.util.ArrayList; 018import java.util.HashMap; 019import java.util.List; 020import java.util.Map; 021 022/** 023 * Created with IntelliJ IDEA. 024 * User: PP7788 025 * Date: 12/6/12 026 * Time: 4:34 PM 027 * To change this template use File | Settings | File Templates. 028 */ 029public class EditorForm extends UifFormBase { 030 031 protected String message; 032 033 private String docCategory; 034 private String docType; 035 private String docFormat; 036 private String uuid; 037 private String docId; 038 private String eResourceId; 039 private String eResourceTitle; 040 private String bibStatus; 041 private OleBibliographicRecordStatus oleBibliographicRecordStatus; 042 private String updatedBy; 043 private String createdBy; 044 private String holdingUpdatedBy; 045 private String holdingCreatedBy; 046 private String itemUpdatedBy; 047 private String itemCreatedBy; 048 private List<WorkDublinEditorField> dublinFieldList = new ArrayList<WorkDublinEditorField>(); 049 private List<WorkDublinEditorField> existingDublinFieldList = new ArrayList<WorkDublinEditorField>(); 050 private String callNumberFlag; 051 private String deleteVerifyResponse; 052 private List<String> uuidList; 053 private String headerText; 054 private String tokenId; 055 private boolean hasLink; 056 private String titleField; 057 private boolean fromDublin; 058 private String recStatus; 059 private boolean select; 060 private boolean showLeftTree = false; 061 private String locationValue; 062 private Tree<DocumentTreeNode, String> DocTree = new Tree<DocumentTreeNode, String>(); 063 private Tree<DocumentTreeNode, String> leftTree = new Tree<DocumentTreeNode, String>(); 064 private boolean staffOnlyFlagForBib; 065 private boolean staffOnlyFlagForHoldings; 066 private boolean staffOnlyFlagForItem; 067 private String holdingLocalIdentifier; 068 private String itemLocalIdentifier; 069 private String issn; 070 private String createdDate; 071 private String updatedDate; 072 private String holdingCreatedDate; 073 private String holdingUpdatedDate; 074 private String itemCreatedDate; 075 private String itemUpdatedDate; 076 private String allowUpdate; 077 078 // Document record pojos 079 private WorkBibMarcForm workBibMarcForm; 080 private EditorForm documentForm; 081 082 083 //Left Pane details 084 private String existing = "false"; 085 private String treeData; 086 private String hdnUuid; 087 private int hdnIndex = 0; 088 private String bibId; 089 private String instanceId; 090 private String holdingsId; 091 private String editable; 092 private String displayField006 = "false"; 093 private String displayField007 = "false"; 094 private String displayField008 = "false"; 095 096 097 private String title; 098 private boolean fromSearch; 099 100 101 private List<WorkBibDocument> workBibDocumentList; 102 private List<Bib> bibList; 103 104 private boolean needToCreateInstance = false; 105 private boolean showLeftPane = true; 106 private boolean showEditorFooter = true; 107 private boolean hideFooter = true; 108 private boolean showClose = false; 109 private boolean isValidInput = true; 110 private String statusUpdatedBy; 111 private String statusUpdatedOn; 112 113 private boolean showDeleteTree = true; 114 private boolean itemStatusNonEditable = false; 115 private boolean holdingsDataInItemReadOnly = false; 116 117 118 private boolean canDelete; 119 private boolean canAdd; 120 private boolean canDeleteEInstance; 121 private String holdingItem = "item"; 122 private String itemStatusSelection = "false"; 123 private String serialReceivingDocId; 124 private BusinessObjectService businessObjectService; 125 private List<BibTree> bibTreeList; 126 127 128 public List<BibTree> getBibTreeList() { 129 return bibTreeList; 130 } 131 132 public void setBibTreeList(List<BibTree> bibTreeList) { 133 this.bibTreeList = bibTreeList; 134 } 135 136 public String getItemStatusSelection() { 137 return itemStatusSelection; 138 } 139 140 public void setItemStatusSelection(String itemStatusSelection) { 141 this.itemStatusSelection = itemStatusSelection; 142 } 143 144 public String getIssn() { 145 return issn; 146 } 147 148 public void setIssn(String issn) { 149 this.issn = issn; 150 } 151 152 public String getHoldingLocalIdentifier() { 153 return holdingLocalIdentifier; 154 } 155 156 public void setHoldingLocalIdentifier(String holdingLocalIdentifier) { 157 if (holdingLocalIdentifier != null && holdingLocalIdentifier.length() > 0) { 158 this.holdingLocalIdentifier = String.valueOf(DocumentLocalId.getDocumentId(holdingLocalIdentifier)); 159 } else { 160 this.holdingLocalIdentifier = holdingLocalIdentifier; 161 } 162 } 163 164 public String getItemLocalIdentifier() { 165 return itemLocalIdentifier; 166 } 167 168 public void setItemLocalIdentifier(String itemLocalIdentifier) { 169 if (itemLocalIdentifier != null && itemLocalIdentifier.length() > 0) { 170 this.itemLocalIdentifier = String.valueOf(DocumentLocalId.getDocumentId(itemLocalIdentifier)); 171 } else { 172 this.itemLocalIdentifier = itemLocalIdentifier; 173 } 174 } 175 176 public boolean isStaffOnlyFlagForBib() { 177 return staffOnlyFlagForBib; 178 } 179 180 public void setStaffOnlyFlagForBib(boolean staffOnlyFlagForBib) { 181 this.staffOnlyFlagForBib = staffOnlyFlagForBib; 182 } 183 184 public String geteResourceTitle() { 185 return eResourceTitle; 186 } 187 188 public void seteResourceTitle(String eResourceTitle) { 189 this.eResourceTitle = eResourceTitle; 190 } 191 192 public boolean isStaffOnlyFlagForHoldings() { 193 return staffOnlyFlagForHoldings; 194 } 195 196 public void setStaffOnlyFlagForHoldings(boolean staffOnlyFlagForHoldings) { 197 this.staffOnlyFlagForHoldings = staffOnlyFlagForHoldings; 198 } 199 200 public boolean isStaffOnlyFlagForItem() { 201 return staffOnlyFlagForItem; 202 } 203 204 public void setStaffOnlyFlagForItem(boolean staffOnlyFlagForItem) { 205 this.staffOnlyFlagForItem = staffOnlyFlagForItem; 206 } 207 208 public List<WorkDublinEditorField> getExistingDublinFieldList() { 209 return existingDublinFieldList; 210 } 211 212 public void setExistingDublinFieldList(List<WorkDublinEditorField> existingDublinFieldList) { 213 this.existingDublinFieldList = existingDublinFieldList; 214 } 215 216 public List<WorkDublinEditorField> getDublinFieldList() { 217 return dublinFieldList; 218 } 219 220 public void setDublinFieldList(List<WorkDublinEditorField> dublinFieldList) { 221 this.dublinFieldList = dublinFieldList; 222 } 223 224 public List<Bib> getBibList() { 225 return bibList; 226 } 227 228 public void setBibList(List<Bib> bibList) { 229 this.bibList = bibList; 230 } 231 232 public String getBibStatus() { 233 return bibStatus; 234 } 235 236 public void setBibStatus(String bibStatus) { 237 this.bibStatus = bibStatus; 238 } 239 240 public String getUpdatedBy() { 241 return updatedBy; 242 } 243 244 public void setUpdatedBy(String updatedBy) { 245 this.updatedBy = updatedBy; 246 } 247 248 public String getCreatedBy() { 249 return createdBy; 250 } 251 252 public void setCreatedBy(String createdBy) { 253 this.createdBy = createdBy; 254 } 255 256 public String getCallNumberFlag() { 257 return callNumberFlag; 258 } 259 260 public void setCallNumberFlag(String callNumberFlag) { 261 this.callNumberFlag = callNumberFlag; 262 } 263 264 public String getCreatedDate() { 265 return createdDate; 266 } 267 268 public void setCreatedDate(String createdDate) { 269 this.createdDate = createdDate; 270 } 271 272 public String getUpdatedDate() { 273 return updatedDate; 274 } 275 276 public void setUpdatedDate(String updatedDate) { 277 this.updatedDate = updatedDate; 278 } 279 280 public boolean isCanDelete() { 281 return canDelete; 282 } 283 284 public void setCanDelete(boolean canDelete) { 285 this.canDelete = canDelete; 286 } 287 288 public boolean isCanAdd() { 289 return canAdd; 290 } 291 292 public void setCanAdd(boolean canAdd) { 293 this.canAdd = canAdd; 294 } 295 296 public boolean isCanDeleteEInstance() { 297 return canDeleteEInstance; 298 } 299 300 public void setCanDeleteEInstance(boolean canDeleteEInstance) { 301 this.canDeleteEInstance = canDeleteEInstance; 302 } 303 304 public EditorForm() { 305 super(); 306 dublinFieldList.add(new WorkDublinEditorField()); 307 existingDublinFieldList.add(new WorkDublinEditorField()); 308 } 309 310 public String getDocType() { 311 return docType; 312 } 313 314 public void setDocType(String docType) { 315 this.docType = docType; 316 } 317 318 public String getDocFormat() { 319 return docFormat; 320 } 321 322 public void setDocFormat(String docFormat) { 323 this.docFormat = docFormat; 324 } 325 326 public String getUuid() { 327 return uuid; 328 } 329 330 public void setUuid(String uuid) { 331 this.uuid = uuid; 332 } 333 334 public String getExisting() { 335 return existing; 336 } 337 338 public void setExisting(String existing) { 339 this.existing = existing; 340 } 341 342 public String getTreeData() { 343 return treeData; 344 } 345 346 public void setTreeData(String treeData) { 347 this.treeData = treeData; 348 } 349 350 public String getHdnUuid() { 351 return hdnUuid; 352 } 353 354 public void setHdnUuid(String hdnUuid) { 355 this.hdnUuid = hdnUuid; 356 } 357 358 public int getHdnIndex() { 359 return hdnIndex; 360 } 361 362 public void setHdnIndex(int hdnIndex) { 363 this.hdnIndex = hdnIndex; 364 } 365 366 public List<WorkBibDocument> getWorkBibDocumentList() { 367 return workBibDocumentList; 368 } 369 370 public void setWorkBibDocumentList(List<WorkBibDocument> workBibDocumentList) { 371 this.workBibDocumentList = workBibDocumentList; 372 } 373 374 public String getDocCategory() { 375 return docCategory; 376 } 377 378 public void setDocCategory(String docCategory) { 379 this.docCategory = docCategory; 380 } 381 382 public String getDocId() { 383 return docId; 384 } 385 386 public void setDocId(String docId) { 387 this.docId = docId; 388 } 389 390 public String geteResourceId() { 391 return eResourceId; 392 } 393 394 public void seteResourceId(String eResourceId) { 395 this.eResourceId = eResourceId; 396 } 397 398 public WorkBibMarcForm getWorkBibMarcForm() { 399 return workBibMarcForm; 400 } 401 402 public void setWorkBibMarcForm(WorkBibMarcForm workBibMarcForm) { 403 this.workBibMarcForm = workBibMarcForm; 404 } 405 406 public String getMessage() { 407 return message; 408 } 409 410 public void setMessage(String message) { 411 this.message = message; 412 } 413 414 public EditorForm getDocumentForm() { 415 return documentForm; 416 } 417 418 public void setDocumentForm(EditorForm documentForm) { 419 this.documentForm = documentForm; 420 } 421 422 public String getBibId() { 423 return bibId; 424 } 425 426 public void setBibId(String bibId) { 427 this.bibId = bibId; 428 } 429 430 public String getInstanceId() { 431 return instanceId; 432 } 433 434 public void setInstanceId(String instanceId) { 435 this.instanceId = instanceId; 436 } 437 438 public String getEditable() { 439 return editable; 440 } 441 442 public void setEditable(String editable) { 443 this.editable = editable; 444 } 445 446 public boolean isNeedToCreateInstance() { 447 return needToCreateInstance; 448 } 449 450 public void setNeedToCreateInstance(boolean needToCreateInstance) { 451 this.needToCreateInstance = needToCreateInstance; 452 } 453 454 public boolean isShowEditorFooter() { 455 return showEditorFooter; 456 } 457 458 public void setShowEditorFooter(boolean showEditorFooter) { 459 this.showEditorFooter = showEditorFooter; 460 } 461 462 public boolean isShowLeftPane() { 463 return showLeftPane; 464 } 465 466 public void setShowLeftPane(boolean showLeftPane) { 467 this.showLeftPane = showLeftPane; 468 } 469 470 public OleBibliographicRecordStatus getOleBibliographicRecordStatus() { 471 return oleBibliographicRecordStatus; 472 } 473 474 public void setOleBibliographicRecordStatus(OleBibliographicRecordStatus oleBibliographicRecordStatus) { 475 this.oleBibliographicRecordStatus = oleBibliographicRecordStatus; 476 } 477 478 public List<String> getUuidList() { 479 return uuidList; 480 } 481 482 public void setUuidList(List<String> uuidList) { 483 this.uuidList = uuidList; 484 } 485 486 public Tree<DocumentTreeNode, String> getDocTree() { 487 return DocTree; 488 } 489 490 public void setDocTree(Tree<DocumentTreeNode, String> docTree) { 491 DocTree = docTree; 492 } 493 494 public String getDeleteVerifyResponse() { 495 return deleteVerifyResponse; 496 } 497 498 public void setDeleteVerifyResponse(String deleteVerifyResponse) { 499 this.deleteVerifyResponse = deleteVerifyResponse; 500 } 501 502 public String getLocationValue() { 503 return ""; 504 } 505 506 public void setLocationValue(String locationValue) { 507 this.locationValue = locationValue; 508 } 509 510 public String getHeaderText() { 511 return headerText; 512 } 513 514 public void setHeaderText(String headerText) { 515 this.headerText = headerText; 516 } 517 518 public String getTokenId() { 519 return tokenId; 520 } 521 522 public void setTokenId(String tokenId) { 523 this.tokenId = tokenId; 524 } 525 526 public boolean isHideFooter() { 527 return hideFooter; 528 } 529 530 public void setHideFooter(boolean hideFooter) { 531 this.hideFooter = hideFooter; 532 } 533 534 public boolean isValidInput() { 535 return isValidInput; 536 } 537 538 public void setValidInput(boolean validInput) { 539 isValidInput = validInput; 540 } 541 542 public String getTitle() { 543 return title; 544 } 545 546 public void setTitle(String title) { 547 this.title = title; 548 } 549 550 public boolean isFromSearch() { 551 return fromSearch; 552 } 553 554 public void setFromSearch(boolean fromSearch) { 555 this.fromSearch = fromSearch; 556 } 557 558 public boolean isHasLink() { 559 return hasLink; 560 } 561 562 public void setHasLink(boolean hasLink) { 563 this.hasLink = hasLink; 564 } 565 566 public String getTitleField() { 567 return titleField; 568 } 569 570 public void setTitleField(String titleField) { 571 this.titleField = titleField; 572 } 573 574 public boolean isFromDublin() { 575 return fromDublin; 576 } 577 578 public void setFromDublin(boolean fromDublin) { 579 this.fromDublin = fromDublin; 580 } 581 582 public String getStatusUpdatedBy() { 583 return statusUpdatedBy; 584 } 585 586 public void setStatusUpdatedBy(String statusUpdatedBy) { 587 this.statusUpdatedBy = statusUpdatedBy; 588 } 589 590 public String getStatusUpdatedOn() { 591 return statusUpdatedOn; 592 } 593 594 public void setStatusUpdatedOn(String statusUpdatedOn) { 595 this.statusUpdatedOn = statusUpdatedOn; 596 } 597 598 public boolean isShowDeleteTree() { 599 return showDeleteTree; 600 } 601 602 public void setShowDeleteTree(boolean showDeleteTree) { 603 this.showDeleteTree = showDeleteTree; 604 } 605 606 public boolean isItemStatusNonEditable() { 607 return itemStatusNonEditable; 608 } 609 610 public void setItemStatusNonEditable(boolean itemStatusNonEditable) { 611 this.itemStatusNonEditable = itemStatusNonEditable; 612 } 613 614 public String getRecStatus() { 615 return recStatus; 616 } 617 618 public void setRecStatus(String recStatus) { 619 this.recStatus = recStatus; 620 } 621 622 public boolean isHoldingsDataInItemReadOnly() { 623 return holdingsDataInItemReadOnly; 624 } 625 626 public void setHoldingsDataInItemReadOnly(boolean holdingsDataInItemReadOnly) { 627 this.holdingsDataInItemReadOnly = holdingsDataInItemReadOnly; 628 } 629 630 public void setLeftTree(Tree<DocumentTreeNode, String> leftTree) { 631 this.leftTree = leftTree; 632 } 633 634 public Tree<DocumentTreeNode, String> getLeftTree() { 635 return leftTree; 636 } 637 638 public boolean isSelect() { 639 return select; 640 } 641 642 public void setSelect(boolean select) { 643 this.select = select; 644 } 645 646 647 public boolean isShowLeftTree() { 648 return showLeftTree; 649 } 650 651 public void setShowLeftTree(boolean showLeftTree) { 652 this.showLeftTree = showLeftTree; 653 } 654 655 public String getDisplayField006() { 656 return displayField006; 657 } 658 659 public void setDisplayField006(String displayField006) { 660 this.displayField006 = displayField006; 661 } 662 663 public String getDisplayField007() { 664 return displayField007; 665 } 666 667 public void setDisplayField007(String displayField007) { 668 this.displayField007 = displayField007; 669 } 670 671 public String getDisplayField008() { 672 return displayField008; 673 } 674 675 public void setDisplayField008(String displayField008) { 676 this.displayField008 = displayField008; 677 } 678 679 public boolean isShowClose() { 680 return showClose; 681 } 682 683 public void setShowClose(boolean showClose) { 684 this.showClose = showClose; 685 } 686 687 public String getHoldingUpdatedBy() { 688 return holdingUpdatedBy; 689 } 690 691 public void setHoldingUpdatedBy(String holdingUpdatedBy) { 692 this.holdingUpdatedBy = holdingUpdatedBy; 693 } 694 695 public String getHoldingCreatedBy() { 696 return holdingCreatedBy; 697 } 698 699 public void setHoldingCreatedBy(String holdingCreatedBy) { 700 this.holdingCreatedBy = holdingCreatedBy; 701 } 702 703 public String getHoldingCreatedDate() { 704 return holdingCreatedDate; 705 } 706 707 public void setHoldingCreatedDate(String holdingCreatedDate) { 708 this.holdingCreatedDate = holdingCreatedDate; 709 } 710 711 public String getHoldingUpdatedDate() { 712 return holdingUpdatedDate; 713 } 714 715 public void setHoldingUpdatedDate(String holdingUpdatedDate) { 716 this.holdingUpdatedDate = holdingUpdatedDate; 717 } 718 719 public String getItemUpdatedBy() { 720 return itemUpdatedBy; 721 } 722 723 public void setItemUpdatedBy(String itemUpdatedBy) { 724 this.itemUpdatedBy = itemUpdatedBy; 725 } 726 727 public String getItemCreatedBy() { 728 return itemCreatedBy; 729 } 730 731 public void setItemCreatedBy(String itemCreatedBy) { 732 this.itemCreatedBy = itemCreatedBy; 733 } 734 735 public String getItemCreatedDate() { 736 return itemCreatedDate; 737 } 738 739 public void setItemCreatedDate(String itemCreatedDate) { 740 this.itemCreatedDate = itemCreatedDate; 741 } 742 743 public String getItemUpdatedDate() { 744 return itemUpdatedDate; 745 } 746 747 public void setItemUpdatedDate(String itemUpdatedDate) { 748 this.itemUpdatedDate = itemUpdatedDate; 749 } 750 751 752 public String getAllowUpdate() { 753 return allowUpdate; 754 } 755 756 public void setAllowUpdate(String allowUpdate) { 757 this.allowUpdate = allowUpdate; 758 } 759 760 public String getHoldingItem() { 761 return holdingItem; 762 } 763 764 public void setHoldingItem(String holdingItem) { 765 this.holdingItem = holdingItem; 766 } 767 768 public String getHoldingsId() { 769 return holdingsId; 770 } 771 772 public void setHoldingsId(String holdingsId) { 773 this.holdingsId = holdingsId; 774 } 775 776 private BusinessObjectService getBusinessObjectService() { 777 if (null == businessObjectService) { 778 businessObjectService = KRADServiceLocator.getBusinessObjectService(); 779 } 780 return businessObjectService; 781 } 782 783 public String getSerialReceivingDocId() { 784 Map docMap = new HashMap<>(); 785 String bibId = this.getBibId(); 786 String instanceId = this.getInstanceId(); 787 if (!StringUtils.isBlank(bibId) && !StringUtils.isBlank(instanceId)) { 788 docMap.put("bibId", bibId); 789 docMap.put("instanceId", this.getInstanceId()); 790 OLESerialReceivingDocument oleSerialReceivingDocument = getBusinessObjectService().findByPrimaryKey(OLESerialReceivingDocument.class, docMap); 791 if (oleSerialReceivingDocument != null) { 792 return oleSerialReceivingDocument.getDocumentNumber(); 793 } 794 } 795 return null; 796 } 797 798 public void setSerialReceivingDocId(String serialReceivingDocId) { 799 this.serialReceivingDocId = serialReceivingDocId; 800 } 801}