View Javadoc
1   package org.kuali.ole.select.document;
2   
3   import org.kuali.ole.select.businessobject.OlePurchaseOrderItem;
4   import org.kuali.ole.sys.OLEConstants;
5   import org.kuali.rice.core.api.config.property.ConfigContext;
6   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
7   import org.kuali.rice.krad.service.BusinessObjectService;
8   import org.kuali.rice.krad.service.KRADServiceLocator;
9   import java.util.HashMap;
10  import java.util.List;
11  import java.util.Map;
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * User: arjuns
16   * Date: 6/24/13
17   * Time: 8:17 PM
18   * To change this template use File | Settings | File Templates.
19   */
20  public class OLEEResourcePO extends PersistableBusinessObjectBase {
21      private String oleEResPOId;
22      private String oleERSIdentifier;
23      private Integer olePOItemId;
24      private String redirectUrl;
25      private String instanceId;
26      private String title;
27      private Integer paidAmountCurrentFY;
28      private Integer paidAmountPreviousFY;
29      private Integer paidAmountTwoYearsPreviousFY;
30      private String purpose;
31      private String poItemId;
32      private String poStatus;
33      private OLEEResourceRecordDocument oleERSDocument;
34  
35      private BusinessObjectService businessObjectService;
36      public BusinessObjectService getBusinessObjectService() {
37          if (null == businessObjectService) {
38              businessObjectService = KRADServiceLocator.getBusinessObjectService();
39          }
40          return businessObjectService;
41      }
42  
43      public String getPoItemId() {
44          return poItemId;
45      }
46  
47      public void setPoItemId(String poItemId) {
48          this.poItemId = poItemId;
49      }
50  
51      public String getOleEResPOId() {
52          return oleEResPOId;
53      }
54  
55      public void setOleEResPOId(String oleEResPOId) {
56          this.oleEResPOId = oleEResPOId;
57      }
58  
59      public String getOleERSIdentifier() {
60          return oleERSIdentifier;
61      }
62  
63      public void setOleERSIdentifier(String oleERSIdentifier) {
64          this.oleERSIdentifier = oleERSIdentifier;
65      }
66  
67      public String getTitle() {
68          return title;
69      }
70  
71      public void setTitle(String title) {
72          this.title = title;
73      }
74  
75      public Integer getOlePOItemId() {
76          return olePOItemId;
77      }
78  
79      public void setOlePOItemId(Integer olePOItemId) {
80          this.olePOItemId = olePOItemId;
81      }
82  
83      public String getRedirectUrl() {
84          String purchaseOrderLineItemIdentifier = this.getOlePOItemId().toString();
85          if (purchaseOrderLineItemIdentifier != null && !"".equals(purchaseOrderLineItemIdentifier)) {
86              Map poNumber = new HashMap();
87              poNumber.put(OLEConstants.PUR_DOC_IDENTIFIER, purchaseOrderLineItemIdentifier);
88              List<OlePurchaseOrderDocument> olePurchaseOrderDocumentList = (List) getBusinessObjectService().findMatching(OlePurchaseOrderDocument.class, poNumber);
89              for (OlePurchaseOrderDocument olePurchaseOrderDocument : olePurchaseOrderDocumentList) {
90                  if (olePurchaseOrderDocument != null) {
91                      boolean validPO = olePurchaseOrderDocument != null ? olePurchaseOrderDocument.getPurchaseOrderCurrentIndicatorForSearching() : false;
92                      if (validPO) {
93                          redirectUrl = ConfigContext.getCurrentContextConfig().getProperty("kew.url") + OLEConstants.PO_LINE_ITEM_URL + olePurchaseOrderDocument.getDocumentNumber();
94                      }
95                  }
96              }
97          }
98          return redirectUrl;
99      }
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 }