001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.cam.businessobject; 017 018 import java.sql.Date; 019 import java.util.ArrayList; 020 import java.util.LinkedHashMap; 021 import java.util.List; 022 023 import org.kuali.kfs.coa.businessobject.Account; 024 import org.kuali.kfs.coa.businessobject.Chart; 025 import org.kuali.kfs.integration.cg.ContractsAndGrantsAgency; 026 import org.kuali.kfs.module.cam.document.service.AssetGlobalService; 027 import org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader; 028 import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry; 029 import org.kuali.kfs.sys.context.SpringContext; 030 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; 031 import org.kuali.rice.kew.routeheader.service.RouteHeaderService; 032 import org.kuali.rice.kim.bo.Person; 033 import org.kuali.rice.kns.bo.GlobalBusinessObject; 034 import org.kuali.rice.kns.bo.GlobalBusinessObjectDetail; 035 import org.kuali.rice.kns.bo.PersistableBusinessObject; 036 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 037 import org.kuali.rice.kns.service.DateTimeService; 038 import org.kuali.rice.kns.service.KualiModuleService; 039 import org.kuali.rice.kns.util.KualiDecimal; 040 import org.kuali.rice.kns.util.TypedArrayList; 041 042 /** 043 * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu) 044 */ 045 public class AssetGlobal extends PersistableBusinessObjectBase implements GlobalBusinessObject { 046 047 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AssetGlobal.class); 048 049 private String documentNumber; 050 private String acquisitionTypeCode; 051 private String capitalAssetDescription; 052 private String inventoryStatusCode; 053 private String conditionCode; 054 private String capitalAssetTypeCode; 055 private String manufacturerName; 056 private String manufacturerModelNumber; 057 private KualiDecimal totalCostAmount; 058 private String landCountyName; 059 private Integer landAcreageSize; 060 private String landParcelNumber; 061 private String vendorName; 062 private String organizationText; 063 private Date createDate; 064 private Date capitalAssetInServiceDate; 065 private Date capitalAssetDepreciationDate; 066 private String representativeUniversalIdentifier; 067 private String organizationOwnerChartOfAccountsCode; 068 private String organizationOwnerAccountNumber; 069 private String agencyNumber; 070 private Integer financialDocumentNextLineNumber; 071 private Asset separateSourceCapitalAsset; 072 private Integer separateSourcePaymentSequenceNumber; 073 private boolean capitalAssetBuilderOriginIndicator; 074 075 // Not Persisted 076 private Date lastInventoryDate; 077 private ContractsAndGrantsAgency agency; 078 private Person assetRepresentative; 079 private AssetType capitalAssetType; 080 private AssetCondition assetCondition; 081 private AssetStatus inventoryStatus; 082 private List<AssetGlobalDetail> assetGlobalDetails; 083 private List<AssetGlobalDetail> assetSharedDetails; 084 private List<AssetPaymentDetail> assetPaymentDetails; 085 private AssetAcquisitionType acquisitionType; 086 private Chart organizationOwnerChartOfAccounts; 087 private Account organizationOwnerAccount; 088 089 // field is here so that AssetLookupableHelperServiceImpl can pass action information 090 private String financialDocumentTypeCode; 091 private Long separateSourceCapitalAssetNumber; 092 093 // Calculate Equal Source Amounts button 094 private String calculateEqualSourceAmountsButton; 095 096 // calculate remaining source amount 097 private KualiDecimal separateSourceRemainingAmount; 098 private KualiDecimal separateSourceTotalAmount; 099 private String calculateSeparateSourceRemainingAmountButton; 100 101 private List<GeneralLedgerPendingEntry> generalLedgerPendingEntries; 102 private FinancialSystemDocumentHeader documentHeader; 103 private KualiDecimal totalAssetPaymentAmount; 104 105 // 106 private KualiDecimal minAssetTotalAmount; 107 private KualiDecimal maxAssetTotalAmount; 108 109 /** 110 * Default constructor. 111 */ 112 public AssetGlobal() { 113 assetGlobalDetails = new TypedArrayList(AssetGlobalDetail.class); 114 assetSharedDetails = new TypedArrayList(AssetGlobalDetail.class); 115 assetPaymentDetails = new TypedArrayList(AssetPaymentDetail.class); 116 this.generalLedgerPendingEntries = new TypedArrayList(GeneralLedgerPendingEntry.class); 117 } 118 119 /** 120 * Gets the documentNumber attribute. 121 * 122 * @return Returns the documentNumber 123 */ 124 public String getDocumentNumber() { 125 return documentNumber; 126 } 127 128 /** 129 * Sets the documentNumber attribute. 130 * 131 * @param documentNumber The documentNumber to set. 132 */ 133 public void setDocumentNumber(String documentNumber) { 134 this.documentNumber = documentNumber; 135 } 136 137 138 /** 139 * Gets the acquisitionTypeCode attribute. 140 * 141 * @return Returns the acquisitionTypeCode 142 */ 143 public String getAcquisitionTypeCode() { 144 return acquisitionTypeCode; 145 } 146 147 /** 148 * Sets the acquisitionTypeCode attribute. 149 * 150 * @param acquisitionTypeCode The acquisitionTypeCode to set. 151 */ 152 public void setAcquisitionTypeCode(String acquisitionTypeCode) { 153 this.acquisitionTypeCode = acquisitionTypeCode; 154 } 155 156 157 /** 158 * Gets the capitalAssetDescription attribute. 159 * 160 * @return Returns the capitalAssetDescription 161 */ 162 public String getCapitalAssetDescription() { 163 return capitalAssetDescription; 164 } 165 166 /** 167 * Sets the capitalAssetDescription attribute. 168 * 169 * @param capitalAssetDescription The capitalAssetDescription to set. 170 */ 171 public void setCapitalAssetDescription(String capitalAssetDescription) { 172 this.capitalAssetDescription = capitalAssetDescription; 173 } 174 175 176 /** 177 * Gets the inventoryStatusCode attribute. 178 * 179 * @return Returns the inventoryStatusCode 180 */ 181 public String getInventoryStatusCode() { 182 return inventoryStatusCode; 183 } 184 185 /** 186 * Sets the inventoryStatusCode attribute. 187 * 188 * @param inventoryStatusCode The inventoryStatusCode to set. 189 */ 190 public void setInventoryStatusCode(String inventoryStatusCode) { 191 this.inventoryStatusCode = inventoryStatusCode; 192 } 193 194 195 /** 196 * Gets the conditionCode attribute. 197 * 198 * @return Returns the conditionCode 199 */ 200 public String getConditionCode() { 201 return conditionCode; 202 } 203 204 /** 205 * Sets the conditionCode attribute. 206 * 207 * @param conditionCode The conditionCode to set. 208 */ 209 public void setConditionCode(String conditionCode) { 210 this.conditionCode = conditionCode; 211 } 212 213 214 /** 215 * Gets the capitalAssetTypeCode attribute. 216 * 217 * @return Returns the capitalAssetTypeCode 218 */ 219 public String getCapitalAssetTypeCode() { 220 return capitalAssetTypeCode; 221 } 222 223 /** 224 * Sets the capitalAssetTypeCode attribute. 225 * 226 * @param capitalAssetTypeCode The capitalAssetTypeCode to set. 227 */ 228 public void setCapitalAssetTypeCode(String capitalAssetTypeCode) { 229 this.capitalAssetTypeCode = capitalAssetTypeCode; 230 } 231 232 233 /** 234 * Gets the manufacturerName attribute. 235 * 236 * @return Returns the manufacturerName 237 */ 238 public String getManufacturerName() { 239 return manufacturerName; 240 } 241 242 /** 243 * Sets the manufacturerName attribute. 244 * 245 * @param manufacturerName The manufacturerName to set. 246 */ 247 public void setManufacturerName(String manufacturerName) { 248 this.manufacturerName = manufacturerName; 249 } 250 251 252 /** 253 * Gets the manufacturerModelNumber attribute. 254 * 255 * @return Returns the manufacturerModelNumber 256 */ 257 public String getManufacturerModelNumber() { 258 return manufacturerModelNumber; 259 } 260 261 /** 262 * Sets the manufacturerModelNumber attribute. 263 * 264 * @param manufacturerModelNumber The manufacturerModelNumber to set. 265 */ 266 public void setManufacturerModelNumber(String manufacturerModelNumber) { 267 this.manufacturerModelNumber = manufacturerModelNumber; 268 } 269 270 271 /** 272 * Gets the totalCostAmount attribute. 273 * 274 * @return Returns the totalCostAmount 275 */ 276 public KualiDecimal getTotalCostAmount() { 277 return totalCostAmount; 278 } 279 280 /** 281 * Sets the totalCostAmount attribute. 282 * 283 * @param totalCostAmount The totalCostAmount to set. 284 */ 285 public void setTotalCostAmount(KualiDecimal totalCostAmount) { 286 this.totalCostAmount = totalCostAmount; 287 } 288 289 290 /** 291 * Gets the landCountyName attribute. 292 * 293 * @return Returns the landCountyName 294 */ 295 public String getLandCountyName() { 296 return landCountyName; 297 } 298 299 /** 300 * Sets the landCountyName attribute. 301 * 302 * @param landCountyName The landCountyName to set. 303 */ 304 public void setLandCountyName(String landCountyName) { 305 this.landCountyName = landCountyName; 306 } 307 308 309 /** 310 * Gets the landAcreageSize attribute. 311 * 312 * @return Returns the landAcreageSize 313 */ 314 public Integer getLandAcreageSize() { 315 return landAcreageSize; 316 } 317 318 /** 319 * Sets the landAcreageSize attribute. 320 * 321 * @param landAcreageSize The landAcreageSize to set. 322 */ 323 public void setLandAcreageSize(Integer landAcreageSize) { 324 this.landAcreageSize = landAcreageSize; 325 } 326 327 328 /** 329 * Gets the landParcelNumber attribute. 330 * 331 * @return Returns the landParcelNumber 332 */ 333 public String getLandParcelNumber() { 334 return landParcelNumber; 335 } 336 337 /** 338 * Sets the landParcelNumber attribute. 339 * 340 * @param landParcelNumber The landParcelNumber to set. 341 */ 342 public void setLandParcelNumber(String landParcelNumber) { 343 this.landParcelNumber = landParcelNumber; 344 } 345 346 347 /** 348 * Gets the vendorName attribute. 349 * 350 * @return Returns the vendorName 351 */ 352 public String getVendorName() { 353 return vendorName; 354 } 355 356 /** 357 * Sets the vendorName attribute. 358 * 359 * @param vendorName The vendorName to set. 360 */ 361 public void setVendorName(String vendorName) { 362 this.vendorName = vendorName; 363 } 364 365 366 /** 367 * Gets the organizationText attribute. 368 * 369 * @return Returns the organizationText 370 */ 371 public String getOrganizationText() { 372 return organizationText; 373 } 374 375 /** 376 * Sets the organizationText attribute. 377 * 378 * @param organizationText The organizationText to set. 379 */ 380 public void setOrganizationText(String organizationText) { 381 this.organizationText = organizationText; 382 } 383 384 385 /** 386 * Gets the createDate attribute. 387 * 388 * @return Returns the createDate 389 */ 390 public Date getCreateDate() { 391 if (createDate != null) { 392 return createDate; 393 } 394 else { 395 return SpringContext.getBean(DateTimeService.class).getCurrentSqlDate(); 396 } 397 } 398 399 /** 400 * Sets the createDate attribute. 401 * 402 * @param createDate The createDate to set. 403 */ 404 public void setCreateDate(Date createDate) { 405 this.createDate = createDate; 406 } 407 408 409 /** 410 * Gets the capitalAssetInServiceDate attribute. 411 * 412 * @return Returns the capitalAssetInServiceDate 413 */ 414 public Date getCapitalAssetInServiceDate() { 415 return capitalAssetInServiceDate; 416 } 417 418 /** 419 * Sets the capitalAssetInServiceDate attribute. 420 * 421 * @param capitalAssetInServiceDate The capitalAssetInServiceDate to set. 422 */ 423 public void setCapitalAssetInServiceDate(Date capitalAssetInServiceDate) { 424 this.capitalAssetInServiceDate = capitalAssetInServiceDate; 425 } 426 427 428 /** 429 * Gets the capitalAssetDepreciationDate attribute. 430 * 431 * @return Returns the capitalAssetDepreciationDate 432 */ 433 public Date getCapitalAssetDepreciationDate() { 434 return capitalAssetDepreciationDate; 435 } 436 437 /** 438 * Sets the capitalAssetDepreciationDate attribute. 439 * 440 * @param capitalAssetDepreciationDate The capitalAssetDepreciationDate to set. 441 */ 442 public void setCapitalAssetDepreciationDate(Date capitalAssetDepreciationDate) { 443 this.capitalAssetDepreciationDate = capitalAssetDepreciationDate; 444 } 445 446 /** 447 * Gets the agencyNumber attribute. 448 * 449 * @return Returns the agencyNumber. 450 */ 451 public String getAgencyNumber() { 452 return agencyNumber; 453 } 454 455 /** 456 * Sets the agencyNumber attribute value. 457 * 458 * @param agencyNumber The agencyNumber to set. 459 */ 460 public void setAgencyNumber(String agencyNumber) { 461 this.agencyNumber = agencyNumber; 462 } 463 464 /** 465 * Gets the organizationOwnerAccountNumber attribute. 466 * 467 * @return Returns the organizationOwnerAccountNumber. 468 */ 469 public String getOrganizationOwnerAccountNumber() { 470 return organizationOwnerAccountNumber; 471 } 472 473 /** 474 * Sets the organizationOwnerAccountNumber attribute value. 475 * 476 * @param organizationOwnerAccountNumber The organizationOwnerAccountNumber to set. 477 */ 478 public void setOrganizationOwnerAccountNumber(String organizationOwnerAccountNumber) { 479 this.organizationOwnerAccountNumber = organizationOwnerAccountNumber; 480 } 481 482 /** 483 * Gets the organizationOwnerChartOfAccountsCode attribute. 484 * 485 * @return Returns the organizationOwnerChartOfAccountsCode. 486 */ 487 public String getOrganizationOwnerChartOfAccountsCode() { 488 return organizationOwnerChartOfAccountsCode; 489 } 490 491 /** 492 * Sets the organizationOwnerChartOfAccountsCode attribute value. 493 * 494 * @param organizationOwnerChartOfAccountsCode The organizationOwnerChartOfAccountsCode to set. 495 */ 496 public void setOrganizationOwnerChartOfAccountsCode(String organizationOwnerChartOfAccountsCode) { 497 this.organizationOwnerChartOfAccountsCode = organizationOwnerChartOfAccountsCode; 498 } 499 500 /** 501 * Gets the representativeUniversalIdentifier attribute. 502 * 503 * @return Returns the representativeUniversalIdentifier. 504 */ 505 public String getRepresentativeUniversalIdentifier() { 506 return representativeUniversalIdentifier; 507 } 508 509 /** 510 * Sets the representativeUniversalIdentifier attribute value. 511 * 512 * @param representativeUniversalIdentifier The representativeUniversalIdentifier to set. 513 */ 514 public void setRepresentativeUniversalIdentifier(String representativeUniversalIdentifier) { 515 this.representativeUniversalIdentifier = representativeUniversalIdentifier; 516 } 517 518 /** 519 * Gets the assetCondition attribute. 520 * 521 * @return Returns the assetCondition. 522 */ 523 public AssetCondition getAssetCondition() { 524 return assetCondition; 525 } 526 527 /** 528 * Sets the assetCondition attribute value. 529 * 530 * @param assetCondition The assetCondition to set. 531 * @deprecated 532 */ 533 public void setAssetCondition(AssetCondition assetCondition) { 534 this.assetCondition = assetCondition; 535 } 536 537 /** 538 * Gets the capitalAssetType attribute. 539 * 540 * @return Returns the capitalAssetType. 541 */ 542 public AssetType getCapitalAssetType() { 543 return capitalAssetType; 544 } 545 546 /** 547 * Sets the capitalAssetType attribute value. 548 * 549 * @param capitalAssetType The capitalAssetType to set. 550 * @deprecated 551 */ 552 public void setCapitalAssetType(AssetType capitalAssetType) { 553 this.capitalAssetType = capitalAssetType; 554 } 555 556 /** 557 * Gets the inventoryStatus attribute. 558 * 559 * @return Returns the inventoryStatus. 560 */ 561 public AssetStatus getInventoryStatus() { 562 return inventoryStatus; 563 } 564 565 /** 566 * Sets the inventoryStatus attribute value. 567 * 568 * @param inventoryStatus The inventoryStatus to set. 569 * @deprecated 570 */ 571 public void setInventoryStatus(AssetStatus inventoryStatus) { 572 this.inventoryStatus = inventoryStatus; 573 } 574 575 /** 576 * Gets the organizationOwnerAccount attribute. 577 * 578 * @return Returns the organizationOwnerAccount. 579 */ 580 public Account getOrganizationOwnerAccount() { 581 return organizationOwnerAccount; 582 } 583 584 /** 585 * Sets the organizationOwnerAccount attribute value. 586 * 587 * @param organizationOwnerAccount The organizationOwnerAccount to set. 588 * @deprecated 589 */ 590 public void setOrganizationOwnerAccount(Account organizationOwnerAccount) { 591 this.organizationOwnerAccount = organizationOwnerAccount; 592 } 593 594 /** 595 * Gets the organizationOwnerChartOfAccounts attribute. 596 * 597 * @return Returns the organizationOwnerChartOfAccounts. 598 */ 599 public Chart getOrganizationOwnerChartOfAccounts() { 600 return organizationOwnerChartOfAccounts; 601 } 602 603 /** 604 * Sets the organizationOwnerChartOfAccounts attribute value. 605 * 606 * @param organizationOwnerChartOfAccounts The organizationOwnerChartOfAccounts to set. 607 * @deprecated 608 */ 609 public void setOrganizationOwnerChartOfAccounts(Chart organizationOwnerChartOfAccounts) { 610 this.organizationOwnerChartOfAccounts = organizationOwnerChartOfAccounts; 611 } 612 613 /** 614 * Gets the assetGlobalDetails attribute. 615 * 616 * @return Returns the assetGlobalDetails. 617 */ 618 public List<AssetGlobalDetail> getAssetGlobalDetails() { 619 return assetGlobalDetails; 620 } 621 622 /** 623 * Sets the assetGlobalDetails attribute value. 624 * 625 * @param assetGlobalDetails The assetGlobalDetails to set. 626 */ 627 public void setAssetGlobalDetails(List<AssetGlobalDetail> assetGlobalDetails) { 628 this.assetGlobalDetails = assetGlobalDetails; 629 } 630 631 /** 632 * Gets the assetPaymentDetails attribute. 633 * 634 * @return Returns the assetPaymentDetails. 635 */ 636 public List<AssetPaymentDetail> getAssetPaymentDetails() { 637 return assetPaymentDetails; 638 } 639 640 /** 641 * Sets the assetPaymentDetails attribute value. 642 * 643 * @param assetPaymentDetails The assetPaymentDetails to set. 644 */ 645 public void setAssetPaymentDetails(List<AssetPaymentDetail> assetPaymentDetails) { 646 this.assetPaymentDetails = assetPaymentDetails; 647 } 648 649 /** 650 * @see org.kuali.rice.kns.document.GlobalBusinessObject#getGlobalChangesToDelete() 651 */ 652 public List<PersistableBusinessObject> generateDeactivationsToPersist() { 653 return null; 654 } 655 656 /** 657 * This returns a list of Assets to Update and/or Add. Applicable to both create new and separate. 658 * 659 * @see org.kuali.rice.kns.bo.GlobalBusinessObject#generateGlobalChangesToPersist() 660 */ 661 public List<PersistableBusinessObject> generateGlobalChangesToPersist() { 662 List<PersistableBusinessObject> persistables = new ArrayList<PersistableBusinessObject>(); 663 664 AssetGlobalService assetGlobalService = SpringContext.getBean(AssetGlobalService.class); 665 666 if (assetGlobalService.isAssetSeparate(this)) { 667 persistables = assetGlobalService.getSeparateAssets(this); 668 } 669 else { 670 persistables = assetGlobalService.getCreateNewAssets(this); 671 } 672 673 return persistables; 674 } 675 676 public boolean isPersistable() { 677 return true; 678 } 679 680 681 public List<? extends GlobalBusinessObjectDetail> getAllDetailObjects() { 682 return getAssetGlobalDetails(); 683 } 684 685 /** 686 * Gets the lastInventoryDate attribute. 687 * 688 * @return Returns the lastInventoryDate. 689 */ 690 public Date getLastInventoryDate() { 691 return lastInventoryDate; 692 } 693 694 /** 695 * Sets the lastInventoryDate attribute value. 696 * 697 * @param lastInventoryDate The lastInventoryDate to set. 698 */ 699 public void setLastInventoryDate(Date lastInventoryDate) { 700 this.lastInventoryDate = lastInventoryDate; 701 } 702 703 /** 704 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 705 */ 706 protected LinkedHashMap<String, String> toStringMapper() { 707 LinkedHashMap<String, String> m = new LinkedHashMap<String, String>(); 708 m.put("documentNumber", this.documentNumber); 709 return m; 710 } 711 712 /** 713 * Gets the financialDocumentNextLineNumber attribute. 714 * 715 * @return Returns the financialDocumentNextLineNumber. 716 */ 717 public Integer getFinancialDocumentNextLineNumber() { 718 return financialDocumentNextLineNumber; 719 } 720 721 /** 722 * Sets the financialDocumentNextLineNumber attribute value. 723 * 724 * @param financialDocumentNextLineNumber The financialDocumentNextLineNumber to set. 725 */ 726 public void setFinancialDocumentNextLineNumber(Integer financialDocumentNextLineNumber) { 727 this.financialDocumentNextLineNumber = financialDocumentNextLineNumber; 728 } 729 730 public Integer incrementFinancialDocumentLineNumber() { 731 if (this.financialDocumentNextLineNumber == null) { 732 this.financialDocumentNextLineNumber = 0; 733 } 734 this.financialDocumentNextLineNumber += 1; 735 return financialDocumentNextLineNumber; 736 } 737 738 public List<AssetGlobalDetail> getAssetSharedDetails() { 739 return assetSharedDetails; 740 } 741 742 public void setAssetSharedDetails(List<AssetGlobalDetail> assetSharedDetails) { 743 this.assetSharedDetails = assetSharedDetails; 744 } 745 746 public AssetAcquisitionType getAcquisitionType() { 747 return acquisitionType; 748 } 749 750 public void setAcquisitionType(AssetAcquisitionType acquisitionType) { 751 this.acquisitionType = acquisitionType; 752 } 753 754 /** 755 * Gets the financialDocumentTypeCode attribute. 756 * 757 * @return Returns the financialDocumentTypeCode. 758 */ 759 public String getFinancialDocumentTypeCode() { 760 return financialDocumentTypeCode; 761 } 762 763 /** 764 * Sets the financialDocumentTypeCode attribute value. 765 * 766 * @param financialDocumentTypeCode The financialDocumentTypeCode to set. 767 */ 768 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) { 769 this.financialDocumentTypeCode = financialDocumentTypeCode; 770 } 771 772 /** 773 * Gets the assetRepresentative attribute. 774 * 775 * @return Returns the assetRepresentative. 776 */ 777 public Person getAssetRepresentative() { 778 assetRepresentative = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(representativeUniversalIdentifier, assetRepresentative); 779 return assetRepresentative; 780 } 781 782 /** 783 * Sets the assetRepresentative attribute value. 784 * 785 * @param assetRepresentative The assetRepresentative to set. 786 */ 787 public void setAssetRepresentative(Person assetRepresentative) { 788 this.assetRepresentative = assetRepresentative; 789 } 790 791 /** 792 * Gets the agency attribute. 793 * 794 * @return Returns the agency. 795 */ 796 public ContractsAndGrantsAgency getAgency() { 797 return agency = (ContractsAndGrantsAgency) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(ContractsAndGrantsAgency.class).retrieveExternalizableBusinessObjectIfNecessary(this, agency, "agency"); 798 } 799 800 /** 801 * Technically this is obsolete but necessary because MaintenanceDocumentBase.populateXmlDocumentContentsFromMaintainables has 802 * the following hack:<br> 803 * ObjectUtils.materializeAllSubObjects(oldBo); // hack to resolve XStream not dealing well with Proxies<br> 804 * so as long as that is there we need this setter otherwise a NoSuchMethodException occurs. 805 * 806 * @deprecated 807 */ 808 public void setAgency(ContractsAndGrantsAgency agency) { 809 this.agency = agency; 810 } 811 812 /** 813 * Gets the generalLedgerPendingEntries attribute. 814 * 815 * @return Returns the generalLedgerPendingEntries. 816 */ 817 public List<GeneralLedgerPendingEntry> getGeneralLedgerPendingEntries() { 818 return generalLedgerPendingEntries; 819 } 820 821 /** 822 * Sets the generalLedgerPendingEntries attribute value. 823 * 824 * @param generalLedgerPendingEntries The generalLedgerPendingEntries to set. 825 */ 826 public void setGeneralLedgerPendingEntries(List<GeneralLedgerPendingEntry> generalLedgerPendingEntries) { 827 this.generalLedgerPendingEntries = generalLedgerPendingEntries; 828 } 829 830 /** 831 * Gets the separateSourceCapitalAsset attribute. 832 * 833 * @return Returns the separateSourceCapitalAsset. 834 */ 835 public Asset getSeparateSourceCapitalAsset() { 836 return separateSourceCapitalAsset; 837 } 838 839 /** 840 * Sets the separateSourceCapitalAsset attribute value. 841 * 842 * @param separateSourceCapitalAsset The separateSourceCapitalAsset to set. 843 */ 844 public void setSeparateSourceCapitalAsset(Asset separateSourceCapitalAsset) { 845 this.separateSourceCapitalAsset = separateSourceCapitalAsset; 846 } 847 848 /** 849 * Gets the separateSourceCapitalAssetNumber attribute. 850 * 851 * @return Returns the separateSourceCapitalAssetNumber. 852 */ 853 public Long getSeparateSourceCapitalAssetNumber() { 854 return separateSourceCapitalAssetNumber; 855 } 856 857 /** 858 * Sets the separateSourceCapitalAssetNumber attribute value. 859 * 860 * @param separateSourceCapitalAssetNumber The separateSourceCapitalAssetNumber to set. 861 */ 862 public void setSeparateSourceCapitalAssetNumber(Long separateSourceCapitalAssetNumber) { 863 this.separateSourceCapitalAssetNumber = separateSourceCapitalAssetNumber; 864 } 865 866 public Integer getSeparateSourcePaymentSequenceNumber() { 867 return separateSourcePaymentSequenceNumber; 868 } 869 870 public void setSeparateSourcePaymentSequenceNumber(Integer separateSourcePaymentSequenceNumber) { 871 this.separateSourcePaymentSequenceNumber = separateSourcePaymentSequenceNumber; 872 } 873 874 public FinancialSystemDocumentHeader getDocumentHeader() { 875 return documentHeader; 876 } 877 878 public void setDocumentHeader(FinancialSystemDocumentHeader documentHeader) { 879 this.documentHeader = documentHeader; 880 } 881 882 /** 883 * Small workaround to avoid KualiInquirableImpl.getInquiryUrl having think it needs to construct an inquiry url for this date. 884 * This only returns a date if this is a separate. 885 * 886 * @return 887 */ 888 public Date getSeparateDocumentHeaderFinalDate() { 889 if (this.documentNumber == null || !SpringContext.getBean(AssetGlobalService.class).isAssetSeparate(this)) { 890 return null; 891 } 892 DocumentRouteHeaderValue routeHeader = SpringContext.getBean(RouteHeaderService.class).getRouteHeader(Long.valueOf(this.documentNumber)); 893 if (routeHeader != null && routeHeader.getApprovedDate() != null) { 894 return new Date(routeHeader.getApprovedDate().getTime()); 895 } 896 return null; 897 } 898 899 public boolean isCapitalAssetBuilderOriginIndicator() { 900 return capitalAssetBuilderOriginIndicator; 901 } 902 903 public void setCapitalAssetBuilderOriginIndicator(boolean capitalAssetBuilderOriginIndicator) { 904 this.capitalAssetBuilderOriginIndicator = capitalAssetBuilderOriginIndicator; 905 } 906 907 /** 908 * Gets the calculate equal source amounts button 909 * 910 * @return 911 */ 912 public String getCalculateEqualSourceAmountsButton() { 913 return calculateEqualSourceAmountsButton; 914 } 915 916 /** 917 * Gets the calculate equal source amounts button 918 * 919 * @param calculateEqualSourceAmountsButton 920 */ 921 public void setCalculateEqualSourceAmountsButton(String calculateEqualSourceAmountsButton) { 922 this.calculateEqualSourceAmountsButton = calculateEqualSourceAmountsButton; 923 } 924 925 public String getCalculateSeparateSourceRemainingAmountButton() { 926 return calculateSeparateSourceRemainingAmountButton; 927 } 928 929 public void setCalculateSeparateSourceRemainingAmountButton(String calculateSeparateSourceRemainingAmountButton) { 930 this.calculateSeparateSourceRemainingAmountButton = calculateSeparateSourceRemainingAmountButton; 931 } 932 933 public KualiDecimal getSeparateSourceRemainingAmount() { 934 if (separateSourceRemainingAmount == null && getTotalCostAmount() != null) { 935 return getTotalCostAmount().subtract(getSeparateSourceTotalAmount()); 936 } 937 return separateSourceRemainingAmount; 938 } 939 940 public void setSeparateSourceRemainingAmount(KualiDecimal separateSourceRemainingAmount) { 941 this.separateSourceRemainingAmount = separateSourceRemainingAmount; 942 } 943 944 @Override 945 public List buildListOfDeletionAwareLists() { 946 List<List> managedLists = super.buildListOfDeletionAwareLists(); 947 managedLists.add(getAssetGlobalDetails()); 948 managedLists.add(getAssetPaymentDetails()); 949 return managedLists; 950 } 951 952 /** 953 * Gets the totalAssetPaymentAmount attribute. 954 * 955 * @return Returns the totalAssetPaymentAmount. 956 */ 957 public KualiDecimal getTotalAssetPaymentAmount() { 958 KualiDecimal totalAmount = KualiDecimal.ZERO; 959 List<AssetPaymentDetail> assetPaymentList = getAssetPaymentDetails(); 960 if (assetPaymentList != null && !assetPaymentList.isEmpty()) { 961 for (AssetPaymentDetail assetPaymentDetail : assetPaymentList) { 962 totalAmount = totalAmount.add(assetPaymentDetail.getAmount()); 963 } 964 } 965 return totalAmount; 966 } 967 968 /** 969 * Sets the totalAssetPaymentAmount attribute value. 970 * 971 * @param totalAssetPaymentAmount The totalAssetPaymentAmount to set. 972 */ 973 public void setTotalAssetPaymentAmount(KualiDecimal totalAssetPaymentAmount) { 974 this.totalAssetPaymentAmount = totalAssetPaymentAmount; 975 } 976 977 /** 978 * Gets the separateSourceTotalAmount attribute value. 979 * 980 * @return separateSourceTotalAmount 981 */ 982 public KualiDecimal getSeparateSourceTotalAmount() { 983 if (separateSourceTotalAmount == null) { 984 this.separateSourceTotalAmount = KualiDecimal.ZERO; 985 for (AssetGlobalDetail detail : this.assetGlobalDetails) { 986 KualiDecimal separateSourceAmount = detail.getSeparateSourceAmount(); 987 if (separateSourceAmount != null) { 988 this.separateSourceTotalAmount = this.separateSourceTotalAmount.add(separateSourceAmount); 989 } 990 } 991 } 992 return separateSourceTotalAmount; 993 } 994 995 /** 996 * Sets the separateSourceTotalAmount attribute value. 997 * 998 * @param separateSourceTotalAmount 999 */ 1000 public void setSeparateSourceTotalAmount(KualiDecimal separateSourceTotalAmount) { 1001 this.separateSourceTotalAmount = separateSourceTotalAmount; 1002 } 1003 1004 /** 1005 * Gets the minAssetTotalAmount attribute. 1006 * 1007 * @return Returns the minAssetTotalAmount. 1008 */ 1009 public KualiDecimal getMinAssetTotalAmount() { 1010 return minAssetTotalAmount; 1011 } 1012 1013 /** 1014 * Sets the minAssetTotalAmount attribute value. 1015 * 1016 * @param minAssetTotalAmount The minAssetTotalAmount to set. 1017 */ 1018 public void setMinAssetTotalAmount(KualiDecimal minAssetTotalAmount) { 1019 this.minAssetTotalAmount = minAssetTotalAmount; 1020 } 1021 1022 /** 1023 * Gets the maxAssetTotalAmount attribute. 1024 * 1025 * @return Returns the maxAssetTotalAmount. 1026 */ 1027 public KualiDecimal getMaxAssetTotalAmount() { 1028 return maxAssetTotalAmount; 1029 } 1030 1031 /** 1032 * Sets the maxAssetTotalAmount attribute value. 1033 * 1034 * @param maxAssetTotalAmount The maxAssetTotalAmount to set. 1035 */ 1036 public void setMaxAssetTotalAmount(KualiDecimal maxAssetTotalAmount) { 1037 this.maxAssetTotalAmount = maxAssetTotalAmount; 1038 } 1039 1040 }