View Javadoc
1   /*
2    * Copyright 2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.module.purap.businessobject;
17  
18  import org.kuali.ole.integration.purap.ItemCapitalAsset;
19  import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
20  import org.kuali.ole.module.purap.document.PurchasingDocument;
21  import org.kuali.rice.krad.util.ObjectUtils;
22  
23  import java.util.LinkedHashMap;
24  
25  public class PurchaseOrderCapitalAssetItem extends PurchasingCapitalAssetItemBase {
26  
27      private String documentNumber;
28  
29      public PurchaseOrderCapitalAssetItem() {
30          super();
31      }
32  
33      public PurchaseOrderCapitalAssetItem(RequisitionCapitalAssetItem reqAssetItem, Integer itemIdentifier) {
34          this.setItemIdentifier(itemIdentifier);
35          this.setCapitalAssetTransactionTypeCode(reqAssetItem.getCapitalAssetTransactionTypeCode());
36          if (ObjectUtils.isNotNull(reqAssetItem.getPurchasingCapitalAssetSystem())) {
37              this.setPurchasingCapitalAssetSystem(new PurchaseOrderCapitalAssetSystem((RequisitionCapitalAssetSystem) reqAssetItem.getPurchasingCapitalAssetSystem()));
38          }
39      }
40  
41      public String getDocumentNumber() {
42          return documentNumber;
43      }
44  
45      public void setDocumentNumber(String documentNumber) {
46          this.documentNumber = documentNumber;
47      }
48  
49  
50      public void setPurchasingDocument(PurchasingDocument pd) {
51          super.setPurchasingDocument(pd);
52  
53          PurchaseOrderDocument po = (PurchaseOrderDocument) pd;
54          if (po != null) {
55              setDocumentNumber(po.getDocumentNumber());
56          }
57      }
58  
59      @Override
60      protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
61          LinkedHashMap m = new LinkedHashMap();
62          if (this.getCapitalAssetItemIdentifier() != null) {
63              m.put("capitalAssetItemIdentifier", this.getCapitalAssetItemIdentifier().toString());
64          }
65          if (this.getItemIdentifier() != null) {
66              m.put("itemIdentifier", this.getItemIdentifier().toString());
67          }
68          if (this.documentNumber != null) {
69              m.put("documentNumber", this.documentNumber);
70          }
71          return m;
72      }
73  
74      @Override
75      public ItemCapitalAsset setupNewPurchasingItemCapitalAssetLine() {
76          ItemCapitalAsset asset = new PurchaseOrderItemCapitalAsset();
77          return asset;
78      }
79  }