001package org.kuali.ole.select.document; 002 003import org.kuali.ole.select.businessobject.OlePurchaseOrderItem; 004import org.kuali.ole.sys.OLEConstants; 005import org.kuali.rice.core.api.config.property.ConfigContext; 006import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 007import org.kuali.rice.krad.service.BusinessObjectService; 008import org.kuali.rice.krad.service.KRADServiceLocator; 009import java.util.HashMap; 010import java.util.List; 011import java.util.Map; 012 013/** 014 * Created with IntelliJ IDEA. 015 * User: arjuns 016 * Date: 6/24/13 017 * Time: 8:17 PM 018 * To change this template use File | Settings | File Templates. 019 */ 020public class OLEEResourcePO extends PersistableBusinessObjectBase { 021 private String oleEResPOId; 022 private String oleERSIdentifier; 023 private Integer olePOItemId; 024 private String redirectUrl; 025 private String instanceId; 026 private String title; 027 private Integer paidAmountCurrentFY; 028 private Integer paidAmountPreviousFY; 029 private Integer paidAmountTwoYearsPreviousFY; 030 private String purpose; 031 private String poItemId; 032 private String poStatus; 033 private OLEEResourceRecordDocument oleERSDocument; 034 035 private BusinessObjectService businessObjectService; 036 public BusinessObjectService getBusinessObjectService() { 037 if (null == businessObjectService) { 038 businessObjectService = KRADServiceLocator.getBusinessObjectService(); 039 } 040 return businessObjectService; 041 } 042 043 public String getPoItemId() { 044 return poItemId; 045 } 046 047 public void setPoItemId(String poItemId) { 048 this.poItemId = poItemId; 049 } 050 051 public String getOleEResPOId() { 052 return oleEResPOId; 053 } 054 055 public void setOleEResPOId(String oleEResPOId) { 056 this.oleEResPOId = oleEResPOId; 057 } 058 059 public String getOleERSIdentifier() { 060 return oleERSIdentifier; 061 } 062 063 public void setOleERSIdentifier(String oleERSIdentifier) { 064 this.oleERSIdentifier = oleERSIdentifier; 065 } 066 067 public String getTitle() { 068 return title; 069 } 070 071 public void setTitle(String title) { 072 this.title = title; 073 } 074 075 public Integer getOlePOItemId() { 076 return olePOItemId; 077 } 078 079 public void setOlePOItemId(Integer olePOItemId) { 080 this.olePOItemId = olePOItemId; 081 } 082 083 public String getRedirectUrl() { 084 String purchaseOrderLineItemIdentifier = this.getOlePOItemId().toString(); 085 if (purchaseOrderLineItemIdentifier != null && !"".equals(purchaseOrderLineItemIdentifier)) { 086 Map poNumber = new HashMap(); 087 poNumber.put(OLEConstants.PUR_DOC_IDENTIFIER, purchaseOrderLineItemIdentifier); 088 List<OlePurchaseOrderDocument> olePurchaseOrderDocumentList = (List) getBusinessObjectService().findMatching(OlePurchaseOrderDocument.class, poNumber); 089 for (OlePurchaseOrderDocument olePurchaseOrderDocument : olePurchaseOrderDocumentList) { 090 if (olePurchaseOrderDocument != null) { 091 boolean validPO = olePurchaseOrderDocument != null ? olePurchaseOrderDocument.getPurchaseOrderCurrentIndicatorForSearching() : false; 092 if (validPO) { 093 redirectUrl = ConfigContext.getCurrentContextConfig().getProperty("kew.url") + OLEConstants.PO_LINE_ITEM_URL + olePurchaseOrderDocument.getDocumentNumber(); 094 } 095 } 096 } 097 } 098 return redirectUrl; 099 } 100 101 public void setRedirectUrl(String redirectUrl) { 102 this.redirectUrl = redirectUrl; 103 } 104 105 public Integer getPaidAmountCurrentFY() { 106 return paidAmountCurrentFY; 107 } 108 109 public void setPaidAmountCurrentFY(Integer paidAmountCurrentFY) { 110 this.paidAmountCurrentFY = paidAmountCurrentFY; 111 } 112 113 public Integer getPaidAmountPreviousFY() { 114 return paidAmountPreviousFY; 115 } 116 117 public void setPaidAmountPreviousFY(Integer paidAmountPreviousFY) { 118 this.paidAmountPreviousFY = paidAmountPreviousFY; 119 } 120 121 public Integer getPaidAmountTwoYearsPreviousFY() { 122 return paidAmountTwoYearsPreviousFY; 123 } 124 125 public void setPaidAmountTwoYearsPreviousFY(Integer paidAmountTwoYearsPreviousFY) { 126 this.paidAmountTwoYearsPreviousFY = paidAmountTwoYearsPreviousFY; 127 } 128 129 public String getPurpose() { 130 return purpose; 131 } 132 133 public void setPurpose(String purpose) { 134 this.purpose = purpose; 135 } 136 137 public String getInstanceId() { 138 return instanceId; 139 } 140 141 public void setInstanceId(String instanceId) { 142 this.instanceId = instanceId; 143 } 144 145 public String getPoStatus() { 146 return poStatus; 147 } 148 149 public void setPoStatus(String poStatus) { 150 this.poStatus = poStatus; 151 } 152 153 public OLEEResourceRecordDocument getOleERSDocument() { 154 return oleERSDocument; 155 } 156 157 public void setOleERSDocument(OLEEResourceRecordDocument oleERSDocument) { 158 this.oleERSDocument = oleERSDocument; 159 } 160}