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.cab.businessobject;
017
018 import java.util.ArrayList;
019 import java.util.Collection;
020 import java.util.HashMap;
021 import java.util.LinkedHashMap;
022 import java.util.List;
023 import java.util.Map;
024 import java.util.Properties;
025
026 import org.apache.commons.lang.StringUtils;
027 import org.apache.log4j.Logger;
028 import org.kuali.kfs.integration.purap.ItemCapitalAsset;
029 import org.kuali.kfs.module.cab.CabConstants;
030 import org.kuali.kfs.module.cab.CabPropertyConstants;
031 import org.kuali.kfs.module.cab.document.service.PurApLineService;
032 import org.kuali.kfs.module.cam.CamsPropertyConstants;
033 import org.kuali.kfs.module.cam.businessobject.AssetGlobalDetail;
034 import org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail;
035 import org.kuali.kfs.module.purap.businessobject.PurchaseOrderItemCapitalAsset;
036 import org.kuali.kfs.sys.KFSConstants;
037 import org.kuali.kfs.sys.context.SpringContext;
038 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
039 import org.kuali.rice.kns.service.BusinessObjectService;
040 import org.kuali.rice.kns.service.DataDictionaryService;
041 import org.kuali.rice.kns.util.KualiDecimal;
042 import org.kuali.rice.kns.util.ObjectUtils;
043 import org.kuali.rice.kns.util.TypedArrayList;
044 import org.kuali.rice.kns.util.UrlFactory;
045
046 /**
047 * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu)
048 */
049 public class PurchasingAccountsPayableItemAsset extends PersistableBusinessObjectBase implements Comparable<PurchasingAccountsPayableItemAsset> {
050 private static final Logger LOG = Logger.getLogger(PurchasingAccountsPayableItemAsset.class);
051
052 private String documentNumber;
053 private Integer accountsPayableLineItemIdentifier;
054 private Integer capitalAssetBuilderLineNumber;
055 private String accountsPayableLineItemDescription;
056 private KualiDecimal accountsPayableItemQuantity;
057 private String capitalAssetManagementDocumentNumber;
058 private String activityStatusCode;
059
060 private PurchasingAccountsPayableDocument purchasingAccountsPayableDocument;
061 private List<PurchasingAccountsPayableLineAssetAccount> purchasingAccountsPayableLineAssetAccounts;
062
063 // non persistent fields
064 private boolean active;
065 private Integer itemLineNumber;
066 private boolean additionalChargeNonTradeInIndicator;
067 private boolean tradeInAllowance;
068 private boolean itemAssignedToTradeInIndicator;
069 private KualiDecimal unitCost;
070 private KualiDecimal totalCost;
071 private String firstFincialObjectCode;
072 private KualiDecimal splitQty;
073 private boolean selectedValue;
074 private String itemTypeCode;
075 private String lockingInformation;
076 // used for Capital Asset Transaction
077 private String capitalAssetTransactionTypeCode;
078 private List<ItemCapitalAsset> purApItemAssets;
079 private Integer capitalAssetSystemIdentifier;
080
081 private Integer purchaseOrderItemIdentifier;
082 // used to control "create asset" and "apply payment" button display
083 private boolean createAssetIndicator;
084 private boolean applyPaymentIndicator;
085
086 private String preTagInquiryUrl;
087 private List<Long> approvedAssetNumbers;
088
089 private Integer paymentRequestIdentifier;
090
091 public PurchasingAccountsPayableItemAsset() {
092 this.purchasingAccountsPayableLineAssetAccounts = new TypedArrayList(PurchasingAccountsPayableLineAssetAccount.class);
093 this.selectedValue = false;
094 this.createAssetIndicator = false;
095 this.applyPaymentIndicator = false;
096 this.purApItemAssets = new ArrayList<ItemCapitalAsset>();
097 }
098
099 // constructor used for split
100 public PurchasingAccountsPayableItemAsset(PurchasingAccountsPayableItemAsset initialItemAsset) {
101 this.documentNumber = initialItemAsset.documentNumber;
102 this.accountsPayableLineItemIdentifier = initialItemAsset.getAccountsPayableLineItemIdentifier();
103 this.accountsPayableLineItemDescription = initialItemAsset.getAccountsPayableLineItemDescription();
104 this.itemLineNumber = initialItemAsset.getItemLineNumber();
105 this.firstFincialObjectCode = initialItemAsset.getFirstFincialObjectCode();
106 this.activityStatusCode = initialItemAsset.getActivityStatusCode();
107 this.tradeInAllowance = initialItemAsset.isTradeInAllowance();
108 this.itemAssignedToTradeInIndicator = initialItemAsset.isItemAssignedToTradeInIndicator();
109 this.additionalChargeNonTradeInIndicator = initialItemAsset.isAdditionalChargeNonTradeInIndicator();
110 this.purchasingAccountsPayableLineAssetAccounts = new TypedArrayList(PurchasingAccountsPayableLineAssetAccount.class);
111 this.selectedValue = false;
112 this.createAssetIndicator = initialItemAsset.isCreateAssetIndicator();
113 this.applyPaymentIndicator = initialItemAsset.isApplyPaymentIndicator();
114 this.purchaseOrderItemIdentifier = initialItemAsset.getPurchaseOrderItemIdentifier();
115 this.capitalAssetTransactionTypeCode = initialItemAsset.getCapitalAssetTransactionTypeCode();
116 this.purApItemAssets = new ArrayList<ItemCapitalAsset>(initialItemAsset.getPurApItemAssets());
117 this.capitalAssetSystemIdentifier = initialItemAsset.getCapitalAssetSystemIdentifier();
118 this.purchasingAccountsPayableDocument = initialItemAsset.getPurchasingAccountsPayableDocument();
119 this.lockingInformation = initialItemAsset.getLockingInformation();
120 }
121
122
123 /**
124 * Gets the lockingInformation attribute.
125 * @return Returns the lockingInformation.
126 */
127 public String getLockingInformation() {
128 return lockingInformation;
129 }
130
131 /**
132 * Sets the lockingInformation attribute value.
133 * @param lockingInformation The lockingInformation to set.
134 */
135 public void setLockingInformation(String lockingInformation) {
136 this.lockingInformation = lockingInformation;
137 }
138
139 /**
140 * Gets the capitalAssetSystemIdentifier attribute.
141 *
142 * @return Returns the capitalAssetSystemIdentifier.
143 */
144 public Integer getCapitalAssetSystemIdentifier() {
145 return capitalAssetSystemIdentifier;
146 }
147
148 /**
149 * Sets the capitalAssetSystemIdentifier attribute value.
150 *
151 * @param capitalAssetSystemIdentifier The capitalAssetSystemIdentifier to set.
152 */
153 public void setCapitalAssetSystemIdentifier(Integer capitalAssetSystemIdentifier) {
154 this.capitalAssetSystemIdentifier = capitalAssetSystemIdentifier;
155 }
156
157 /**
158 * Gets the purchaseOrderItemIdentifier attribute.
159 *
160 * @return Returns the purchaseOrderItemIdentifier.
161 */
162 public Integer getPurchaseOrderItemIdentifier() {
163 return purchaseOrderItemIdentifier;
164 }
165
166 /**
167 * Sets the purchaseOrderItemIdentifier attribute value.
168 *
169 * @param purchaseOrderItemIdentifier The purchaseOrderItemIdentifier to set.
170 */
171 public void setPurchaseOrderItemIdentifier(Integer purchaseOrderItemIdentifier) {
172 this.purchaseOrderItemIdentifier = purchaseOrderItemIdentifier;
173 }
174
175
176 /**
177 * Gets the capitalAssetNumbers attribute.
178 *
179 * @return Returns the capitalAssetNumbers.
180 */
181 public List<ItemCapitalAsset> getPurApItemAssets() {
182 return purApItemAssets;
183 }
184
185 /**
186 * Sets the capitalAssetNumbers attribute value.
187 *
188 * @param capitalAssetNumbers The capitalAssetNumbers to set.
189 */
190 public void setPurApItemAssets(List<ItemCapitalAsset> capitalAssetNumbers) {
191 this.purApItemAssets = capitalAssetNumbers;
192 }
193
194 /**
195 * Gets the capitalAssetNumbers attribute.
196 *
197 * @return Returns the capitalAssetNumbers.
198 */
199 public ItemCapitalAsset getPurApItemAsset(int index) {
200 while (getPurApItemAssets().size() <= index) {
201 getPurApItemAssets().add(new PurchaseOrderItemCapitalAsset());
202 }
203 return (ItemCapitalAsset) getPurApItemAssets().get(index);
204 }
205
206
207 /**
208 * Gets the createAssetIndicator attribute.
209 *
210 * @return Returns the createAssetIndicator.
211 */
212 public boolean isCreateAssetIndicator() {
213 return createAssetIndicator;
214 }
215
216 /**
217 * Sets the createAssetIndicator attribute value.
218 *
219 * @param createAssetIndicator The createAssetIndicator to set.
220 */
221 public void setCreateAssetIndicator(boolean createAssetIndicator) {
222 this.createAssetIndicator = createAssetIndicator;
223 }
224
225 /**
226 * Gets the applyPaymentIndicator attribute.
227 *
228 * @return Returns the applyPaymentIndicator.
229 */
230 public boolean isApplyPaymentIndicator() {
231 return applyPaymentIndicator;
232 }
233
234 /**
235 * Sets the applyPaymentIndicator attribute value.
236 *
237 * @param applyPaymentIndicator The applyPaymentIndicator to set.
238 */
239 public void setApplyPaymentIndicator(boolean applyPaymentIndicator) {
240 this.applyPaymentIndicator = applyPaymentIndicator;
241 }
242
243 /**
244 * Gets the selectedValue attribute.
245 *
246 * @return Returns the selectedValue.
247 */
248 public boolean isSelectedValue() {
249 return selectedValue;
250 }
251
252 /**
253 * Sets the selectedValue attribute value.
254 *
255 * @param selectedValue The selectedValue to set.
256 */
257 public void setSelectedValue(boolean selectedValue) {
258 this.selectedValue = selectedValue;
259 }
260
261 /**
262 * Gets the itemTypeCode attribute.
263 *
264 * @return Returns the itemTypeCode.
265 */
266 public String getItemTypeCode() {
267 return itemTypeCode;
268 }
269
270 /**
271 * Sets the itemTypeCode attribute value.
272 *
273 * @param itemTypeCode The itemTypeCode to set.
274 */
275 public void setItemTypeCode(String itemTypeCode) {
276 this.itemTypeCode = itemTypeCode;
277 }
278
279 /**
280 * Gets the capitalAssetTransactionTypeCode attribute.
281 *
282 * @return Returns the capitalAssetTransactionTypeCode.
283 */
284 public String getCapitalAssetTransactionTypeCode() {
285 return capitalAssetTransactionTypeCode;
286 }
287
288 /**
289 * Sets the capitalAssetTransactionTypeCode attribute value.
290 *
291 * @param capitalAssetTransactionTypeCode The capitalAssetTransactionTypeCode to set.
292 */
293 public void setCapitalAssetTransactionTypeCode(String capitalAssetTransactionTypeCode) {
294 this.capitalAssetTransactionTypeCode = capitalAssetTransactionTypeCode;
295 }
296
297 /**
298 * Gets the additionalChargeNonTradeInIndicator attribute.
299 *
300 * @return Returns the additionalChargeNonTradeInIndicator.
301 */
302 public boolean isAdditionalChargeNonTradeInIndicator() {
303 return additionalChargeNonTradeInIndicator;
304 }
305
306 /**
307 * Sets the additionalChargeNonTradeInIndicator attribute value.
308 *
309 * @param additionalChargeNonTradeInIndicator The additionalChargeNonTradeInIndicator to set.
310 */
311 public void setAdditionalChargeNonTradeInIndicator(boolean additionalChargeNonTradeInIndicator) {
312 this.additionalChargeNonTradeInIndicator = additionalChargeNonTradeInIndicator;
313 }
314
315 /**
316 * Gets the tradeInAllowance attribute.
317 *
318 * @return Returns the tradeInAllowance.
319 */
320 public boolean isTradeInAllowance() {
321 return tradeInAllowance;
322 }
323
324 /**
325 * Sets the tradeInAllowance attribute value.
326 *
327 * @param tradeInAllowance The tradeInAllowance to set.
328 */
329 public void setTradeInAllowance(boolean tradeInAllowance) {
330 this.tradeInAllowance = tradeInAllowance;
331 }
332
333 /**
334 * Gets the splitQty attribute.
335 *
336 * @return Returns the splitQty.
337 */
338 public KualiDecimal getSplitQty() {
339 return splitQty;
340 }
341
342 /**
343 * Sets the splitQty attribute value.
344 *
345 * @param splitQty The splitQty to set.
346 */
347 public void setSplitQty(KualiDecimal splitQty) {
348 this.splitQty = splitQty;
349 }
350
351
352 /**
353 * Gets the purchasingAccountsPayableLineAssetAccounts attribute.
354 *
355 * @return Returns the purchasingAccountsPayableLineAssetAccounts.
356 */
357 public List<PurchasingAccountsPayableLineAssetAccount> getPurchasingAccountsPayableLineAssetAccounts() {
358 return purchasingAccountsPayableLineAssetAccounts;
359 }
360
361 /**
362 * Sets the purchasingAccountsPayableLineAssetAccounts attribute value.
363 *
364 * @param purchasingAccountsPayableLineAssetAccounts The purchasingAccountsPayableLineAssetAccounts to set.
365 */
366 public void setPurchasingAccountsPayableLineAssetAccounts(List<PurchasingAccountsPayableLineAssetAccount> purchasingAccountsPayableLineAssetAccounts) {
367 this.purchasingAccountsPayableLineAssetAccounts = purchasingAccountsPayableLineAssetAccounts;
368 }
369
370 /**
371 * Gets the documentNumber attribute.
372 *
373 * @return Returns the documentNumber.
374 */
375 public String getDocumentNumber() {
376 return documentNumber;
377 }
378
379 /**
380 * Sets the documentNumber attribute value.
381 *
382 * @param documentNumber The documentNumber to set.
383 */
384 public void setDocumentNumber(String documentNumber) {
385 this.documentNumber = documentNumber;
386 }
387
388 /**
389 * Gets the accountsPayableLineItemIdentifier attribute.
390 *
391 * @return Returns the accountsPayableLineItemIdentifier.
392 */
393 public Integer getAccountsPayableLineItemIdentifier() {
394 return accountsPayableLineItemIdentifier;
395 }
396
397 /**
398 * Sets the accountsPayableLineItemIdentifier attribute value.
399 *
400 * @param accountsPayableLineItemIdentifier The accountsPayableLineItemIdentifier to set.
401 */
402 public void setAccountsPayableLineItemIdentifier(Integer accountsPayableLineItemIdentifier) {
403 this.accountsPayableLineItemIdentifier = accountsPayableLineItemIdentifier;
404 }
405
406 /**
407 * Gets the accountsPayableLineItemDescription attribute.
408 *
409 * @return Returns the accountsPayableLineItemDescription.
410 */
411 public String getAccountsPayableLineItemDescription() {
412 return accountsPayableLineItemDescription;
413 }
414
415 /**
416 * Sets the accountsPayableLineItemDescription attribute value.
417 *
418 * @param accountsPayableLineItemDescription The accountsPayableLineItemDescription to set.
419 */
420 public void setAccountsPayableLineItemDescription(String accountsPayableLineItemDescription) {
421 this.accountsPayableLineItemDescription = accountsPayableLineItemDescription;
422 }
423
424 /**
425 * Gets the accountsPayableItemQuantity attribute.
426 *
427 * @return Returns the accountsPayableItemQuantity.
428 */
429 public KualiDecimal getAccountsPayableItemQuantity() {
430 return accountsPayableItemQuantity;
431 }
432
433 /**
434 * Sets the accountsPayableItemQuantity attribute value.
435 *
436 * @param accountsPayableItemQuantity The accountsPayableItemQuantity to set.
437 */
438 public void setAccountsPayableItemQuantity(KualiDecimal accountsPayableItemQuantity) {
439 this.accountsPayableItemQuantity = accountsPayableItemQuantity;
440 }
441
442 /**
443 * Gets the capitalAssetBuilderLineNumber attribute.
444 *
445 * @return Returns the capitalAssetBuilderLineNumber
446 */
447 public Integer getCapitalAssetBuilderLineNumber() {
448 return capitalAssetBuilderLineNumber;
449 }
450
451 /**
452 * Sets the capitalAssetBuilderLineNumber attribute.
453 *
454 * @param capitalAssetBuilderLineNumber The capitalAssetBuilderLineNumber to set.
455 */
456 public void setCapitalAssetBuilderLineNumber(Integer capitalAssetBuilderLineNumber) {
457 this.capitalAssetBuilderLineNumber = capitalAssetBuilderLineNumber;
458 }
459
460
461 /**
462 * Gets the capitalAssetManagementDocumentNumber attribute.
463 *
464 * @return Returns the capitalAssetManagementDocumentNumber
465 */
466 public String getCapitalAssetManagementDocumentNumber() {
467 return capitalAssetManagementDocumentNumber;
468 }
469
470 /**
471 * Sets the capitalAssetManagementDocumentNumber attribute.
472 *
473 * @param capitalAssetManagementDocumentNumber The capitalAssetManagementDocumentNumber to set.
474 */
475 public void setCapitalAssetManagementDocumentNumber(String capitalAssetManagementDocumentNumber) {
476 this.capitalAssetManagementDocumentNumber = capitalAssetManagementDocumentNumber;
477 }
478
479 public Integer getItemLineNumber() {
480 return itemLineNumber;
481 }
482
483 public void setItemLineNumber(Integer itemLineNumber) {
484 this.itemLineNumber = itemLineNumber;
485 }
486
487 /**
488 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
489 */
490 protected LinkedHashMap toStringMapper() {
491 LinkedHashMap m = new LinkedHashMap();
492 m.put("documentNumber", this.documentNumber);
493 m.put("accountsPayableLineItemIdentifier", this.accountsPayableLineItemIdentifier);
494 m.put("capitalAssetBuilderLineNumber", this.capitalAssetBuilderLineNumber);
495 return m;
496 }
497
498 /**
499 * Gets the active attribute.
500 *
501 * @return Returns the active.
502 */
503 public boolean isActive() {
504 return CabConstants.ActivityStatusCode.NEW.equalsIgnoreCase(this.getActivityStatusCode()) || CabConstants.ActivityStatusCode.MODIFIED.equalsIgnoreCase(this.getActivityStatusCode());
505 }
506
507 /**
508 * Gets the activityStatusCode attribute.
509 *
510 * @return Returns the activityStatusCode.
511 */
512 public String getActivityStatusCode() {
513 return activityStatusCode;
514 }
515
516 /**
517 * Sets the activityStatusCode attribute value.
518 *
519 * @param activityStatusCode The activityStatusCode to set.
520 */
521 public void setActivityStatusCode(String activityStatusCode) {
522 this.activityStatusCode = activityStatusCode;
523 }
524
525 /**
526 * Gets the purchasingAccountsPayableDocument attribute.
527 *
528 * @return Returns the purchasingAccountsPayableDocument.
529 */
530 public PurchasingAccountsPayableDocument getPurchasingAccountsPayableDocument() {
531 return purchasingAccountsPayableDocument;
532 }
533
534 /**
535 * Sets the purchasingAccountsPayableDocument attribute value.
536 *
537 * @param purchasingAccountsPayableDocument The purchasingAccountsPayableDocument to set.
538 */
539 public void setPurchasingAccountsPayableDocument(PurchasingAccountsPayableDocument purchasingAccountsPayableDocument) {
540 this.purchasingAccountsPayableDocument = purchasingAccountsPayableDocument;
541 }
542
543 /**
544 * Gets the itemAssignedToTradeInIndicator attribute.
545 *
546 * @return Returns the itemAssignedToTradeInIndicator.
547 */
548 public boolean isItemAssignedToTradeInIndicator() {
549 return itemAssignedToTradeInIndicator;
550 }
551
552 /**
553 * Sets the itemAssignedToTradeInIndicator attribute value.
554 *
555 * @param itemAssignedToTradeInIndicator The itemAssignedToTradeInIndicator to set.
556 */
557 public void setItemAssignedToTradeInIndicator(boolean itemAssignedToTradeInIndicator) {
558 this.itemAssignedToTradeInIndicator = itemAssignedToTradeInIndicator;
559 }
560
561 /**
562 * Gets the unitCost attribute.
563 *
564 * @return Returns the unitCost.
565 */
566 public KualiDecimal getUnitCost() {
567 return unitCost;
568 }
569
570 /**
571 * Sets the unitCost attribute value.
572 *
573 * @param unitCost The unitCost to set.
574 */
575 public void setUnitCost(KualiDecimal unitCost) {
576 this.unitCost = unitCost;
577 }
578
579 /**
580 * Gets the totalCost attribute.
581 *
582 * @return Returns the totalCost.
583 */
584 public KualiDecimal getTotalCost() {
585 return totalCost;
586 }
587
588 /**
589 * Sets the totalCost attribute value.
590 *
591 * @param totalCost The totalCost to set.
592 */
593 public void setTotalCost(KualiDecimal totalCost) {
594 this.totalCost = totalCost;
595 }
596
597 /**
598 * Gets the firstFincialObjectCode attribute.
599 *
600 * @return Returns the firstFincialObjectCode.
601 */
602 public String getFirstFincialObjectCode() {
603 return firstFincialObjectCode;
604 }
605
606 /**
607 * Sets the firstFincialObjectCode attribute value.
608 *
609 * @param firstFincialObjectCode The firstFincialObjectCode to set.
610 */
611 public void setFirstFincialObjectCode(String firstFincialObjectCode) {
612 this.firstFincialObjectCode = firstFincialObjectCode;
613 }
614
615 public String getPreTagInquiryUrl() {
616 if (StringUtils.isNotBlank(this.preTagInquiryUrl)) {
617 return preTagInquiryUrl;
618 }
619
620 if (ObjectUtils.isNotNull(this.getPurchasingAccountsPayableDocument())) {
621 Integer purchaseOrderIdentifier = this.getPurchasingAccountsPayableDocument().getPurchaseOrderIdentifier();
622
623 PurApLineService purApLineService = SpringContext.getBean(PurApLineService.class);
624 if (purApLineService.isPretaggingExisting(purApLineService.getPreTagLineItem(purchaseOrderIdentifier, this.getItemLineNumber()))) {
625 String baseUrl = KFSConstants.INQUIRY_ACTION;
626 Properties parameters = new Properties();
627 parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.START_METHOD);
628 parameters.put(KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, Pretag.class.getName());
629 parameters.put(CabPropertyConstants.Pretag.PURCHASE_ORDER_NUMBER, purchaseOrderIdentifier.toString());
630 parameters.put(CabPropertyConstants.Pretag.ITEM_LINE_NUMBER, this.getItemLineNumber().toString());
631
632 this.preTagInquiryUrl = UrlFactory.parameterizeUrl(baseUrl, parameters);
633
634 return this.preTagInquiryUrl;
635 }
636 }
637 return "";
638 }
639
640 /**
641 * @see java.lang.Comparable#compareTo(java.lang.Object)
642 */
643 public int compareTo(PurchasingAccountsPayableItemAsset o) {
644 boolean o1ItemTypeBelowTheLine = this.isAdditionalChargeNonTradeInIndicator() || this.isTradeInAllowance();
645 boolean o2ItemTypeBelowTheLine = o.isAdditionalChargeNonTradeInIndicator() || o.isTradeInAllowance();
646 if (o1ItemTypeBelowTheLine && !o2ItemTypeBelowTheLine) {
647 return 1;
648 }
649 else if (o2ItemTypeBelowTheLine && !o1ItemTypeBelowTheLine) {
650 return -1;
651 }
652 return 0;
653 }
654
655 /**
656 * Gets the approvedAssetNumbers attribute.
657 *
658 * @return Returns the approvedAssetNumbers.
659 */
660 public List<Long> getApprovedAssetNumbers() {
661 if (this.approvedAssetNumbers != null && !this.approvedAssetNumbers.isEmpty()) {
662 return this.approvedAssetNumbers;
663 }
664 else {
665 this.approvedAssetNumbers = new ArrayList<Long>();
666 if (!StringUtils.isEmpty(this.getCapitalAssetManagementDocumentNumber())) {
667 Map<String, String> fieldValues = new HashMap<String, String>();
668 if (CabConstants.ActivityStatusCode.PROCESSED_IN_CAMS.equalsIgnoreCase(this.getActivityStatusCode())) {
669 // get asset number from asset global add doc
670 fieldValues.put(CamsPropertyConstants.AssetGlobalDetail.DOCUMENT_NUMBER, this.getCapitalAssetManagementDocumentNumber());
671 Collection<AssetGlobalDetail> assetGlobalDetails = SpringContext.getBean(BusinessObjectService.class).findMatching(AssetGlobalDetail.class, fieldValues);
672 for (AssetGlobalDetail detail : assetGlobalDetails) {
673 this.approvedAssetNumbers.add(detail.getCapitalAssetNumber());
674 }
675 if (assetGlobalDetails.isEmpty()) {
676 // get asset number from asset payment doc
677 fieldValues.clear();
678 fieldValues.put(CamsPropertyConstants.DOCUMENT_NUMBER, this.getCapitalAssetManagementDocumentNumber());
679 Collection<AssetPaymentAssetDetail> paymentAssetDetails = SpringContext.getBean(BusinessObjectService.class).findMatching(AssetPaymentAssetDetail.class, fieldValues);
680 for (AssetPaymentAssetDetail detail : paymentAssetDetails) {
681 this.approvedAssetNumbers.add(detail.getCapitalAssetNumber());
682 }
683 }
684 }
685 }
686 return this.approvedAssetNumbers;
687 }
688 }
689
690 private DataDictionaryService getDataDictionaryService() {
691 return SpringContext.getBean(DataDictionaryService.class);
692 }
693
694 public PurchasingAccountsPayableLineAssetAccount getPurchasingAccountsPayableLineAssetAccount(int index) {
695 int size = getPurchasingAccountsPayableLineAssetAccounts().size();
696 while (size <= index || getPurchasingAccountsPayableLineAssetAccounts().get(index) == null) {
697 getPurchasingAccountsPayableLineAssetAccounts().add(size++, new PurchasingAccountsPayableLineAssetAccount());
698 }
699 return (PurchasingAccountsPayableLineAssetAccount) getPurchasingAccountsPayableLineAssetAccounts().get(index);
700
701 }
702
703 /**
704 * Gets the paymentRequestIdentifier attribute.
705 * @return Returns the paymentRequestIdentifier.
706 */
707 public Integer getPaymentRequestIdentifier() {
708 return paymentRequestIdentifier;
709 }
710
711 /**
712 * Sets the paymentRequestIdentifier attribute value.
713 * @param paymentRequestIdentifier The paymentRequestIdentifier to set.
714 */
715 public void setPaymentRequestIdentifier(Integer paymentRequestIdentifier) {
716 this.paymentRequestIdentifier = paymentRequestIdentifier;
717 }
718
719
720 }