001package org.kuali.ole.select.bo; 002 003import org.kuali.ole.coa.businessobject.OLECretePOAccountingLine; 004import org.kuali.ole.coa.businessobject.OleFundCode; 005import org.kuali.ole.select.document.OlePurchaseOrderDocument; 006import org.kuali.ole.sys.OLEConstants; 007import org.kuali.rice.core.api.config.property.ConfigContext; 008import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 009import org.kuali.rice.krad.service.KRADServiceLocator; 010import org.kuali.rice.krad.service.KRADServiceLocatorWeb; 011 012import java.util.ArrayList; 013import java.util.HashMap; 014import java.util.List; 015import java.util.Map; 016 017/** 018 * Created by sambasivam on 19/9/14. 019 * 020 * This class is used for displaying the results for create POs for eResource and instance. 021 */ 022public class OLECreatePO extends PersistableBusinessObjectBase implements Cloneable { 023 024 025 private String createPOId; 026 private boolean selectFlag; 027 private String poId; 028 private String gokbId; 029 private String title; 030 private String isbnNIssn; 031 private String price; 032 private String vendorId; 033 private String purposeId; 034 private String orderTypeId; 035 private String instanceId; 036 private String instanceFlag; 037 private String bibId; 038 private String redirectUrl; 039 private String oleERSIdentifier; 040 private String fundCode; 041 private List<OLECretePOAccountingLine> accountingLines = new ArrayList<>(); 042 private List<OleFundCode> fundCodes = new ArrayList<>(); 043 044 public String getCreatePOId() { 045 return createPOId; 046 } 047 048 public void setCreatePOId(String createPOId) { 049 this.createPOId = createPOId; 050 } 051 052 public boolean isSelectFlag() { 053 return selectFlag; 054 } 055 056 public void setSelectFlag(boolean selectFlag) { 057 this.selectFlag = selectFlag; 058 } 059 060 public String getPoId() { 061 return poId; 062 } 063 064 public void setPoId(String poId) { 065 this.poId = poId; 066 } 067 068 public String getGokbId() { 069 return gokbId; 070 } 071 072 public void setGokbId(String gokbId) { 073 this.gokbId = gokbId; 074 } 075 076 public String getTitle() { 077 return title; 078 } 079 080 public void setTitle(String title) { 081 this.title = title; 082 } 083 084 public String getIsbnNIssn() { 085 return isbnNIssn; 086 } 087 088 public void setIsbnNIssn(String isbnNIssn) { 089 this.isbnNIssn = isbnNIssn; 090 } 091 092 public String getPrice() { 093 return price; 094 } 095 096 public void setPrice(String price) { 097 this.price = price; 098 } 099 100 public String getVendorId() { 101 return vendorId; 102 } 103 104 public void setVendorId(String vendorId) { 105 this.vendorId = vendorId; 106 } 107 108 public String getPurposeId() { 109 return purposeId; 110 } 111 112 public void setPurposeId(String purposeId) { 113 this.purposeId = purposeId; 114 } 115 116 public String getOrderTypeId() { 117 return orderTypeId; 118 } 119 120 public void setOrderTypeId(String orderTypeId) { 121 this.orderTypeId = orderTypeId; 122 } 123 124 @Override 125 public Object clone() throws CloneNotSupportedException { 126 return super.clone(); 127 } 128 129 public String getInstanceId() { 130 return instanceId; 131 } 132 133 public void setInstanceId(String instanceId) { 134 this.instanceId = instanceId; 135 } 136 137 public String getInstanceFlag() { 138 return instanceFlag; 139 } 140 141 public void setInstanceFlag(String instanceFlag) { 142 this.instanceFlag = instanceFlag; 143 } 144 145 public String getBibId() { 146 return bibId; 147 } 148 149 public void setBibId(String bibId) { 150 this.bibId = bibId; 151 } 152 153 public String getRedirectUrl() { 154 String purchaseOrderLineItemIdentifier = this.getPoId().toString(); 155 if (purchaseOrderLineItemIdentifier != null && !"".equals(purchaseOrderLineItemIdentifier)) { 156 Map poNumber = new HashMap(); 157 poNumber.put(OLEConstants.PUR_DOC_IDENTIFIER, purchaseOrderLineItemIdentifier); 158 List<OlePurchaseOrderDocument> olePurchaseOrderDocumentList = (List) KRADServiceLocator.getBusinessObjectService().findMatching(OlePurchaseOrderDocument.class, poNumber); 159 for (OlePurchaseOrderDocument olePurchaseOrderDocument : olePurchaseOrderDocumentList) { 160 if (olePurchaseOrderDocument != null) { 161 boolean validPO = olePurchaseOrderDocument != null ? olePurchaseOrderDocument.getPurchaseOrderCurrentIndicatorForSearching() : false; 162 if (validPO) { 163 redirectUrl = ConfigContext.getCurrentContextConfig().getProperty("kew.url") + OLEConstants.PO_LINE_ITEM_URL + olePurchaseOrderDocument.getDocumentNumber(); 164 } 165 } 166 } 167 } 168 return redirectUrl; 169 } 170 171 public void setRedirectUrl(String redirectUrl) { 172 this.redirectUrl = redirectUrl; 173 } 174 175 public String getOleERSIdentifier() { 176 return oleERSIdentifier; 177 } 178 179 public void setOleERSIdentifier(String oleERSIdentifier) { 180 this.oleERSIdentifier = oleERSIdentifier; 181 } 182 183 public String getFundCode() { 184 return fundCode; 185 } 186 187 public void setFundCode(String fundCode) { 188 this.fundCode = fundCode; 189 } 190 191 public List<OLECretePOAccountingLine> getAccountingLines() { 192 return accountingLines; 193 } 194 195 public void setAccountingLines(List<OLECretePOAccountingLine> accountingLines) { 196 this.accountingLines = accountingLines; 197 } 198 199 public List<OleFundCode> getFundCodes() { 200 return fundCodes; 201 } 202 203 public void setFundCodes(List<OleFundCode> fundCodes) { 204 this.fundCodes = fundCodes; 205 } 206}