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  
19  import org.kuali.ole.integration.purap.CapitalAssetLocation;
20  import org.kuali.ole.integration.purap.CapitalAssetSystem;
21  import org.kuali.ole.integration.purap.ItemCapitalAsset;
22  
23  /**
24   * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu)
25   */
26  
27  public class RequisitionCapitalAssetSystem extends PurchasingCapitalAssetSystemBase {
28  
29      protected Integer purapDocumentIdentifier;
30  
31      /**
32       * Default constructor.
33       */
34      public RequisitionCapitalAssetSystem() {
35          super();
36      }
37  
38      public RequisitionCapitalAssetSystem(CapitalAssetSystem originalSystem) {
39          super();
40          if (originalSystem != null) {
41              this.setCapitalAssetSystemDescription(originalSystem.getCapitalAssetSystemDescription());
42              this.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(originalSystem.isCapitalAssetNotReceivedCurrentFiscalYearIndicator());
43              this.setCapitalAssetTypeCode(originalSystem.getCapitalAssetTypeCode());
44              this.setCapitalAssetManufacturerName(originalSystem.getCapitalAssetManufacturerName());
45              this.setCapitalAssetModelDescription(originalSystem.getCapitalAssetModelDescription());
46              this.setCapitalAssetNoteText(originalSystem.getCapitalAssetNoteText());
47              populatePurchaseOrderItemCapitalAssets(originalSystem);
48              populateCapitalAssetLocations(originalSystem);
49              this.setCapitalAssetCountAssetNumber(originalSystem.getCapitalAssetCountAssetNumber());
50          }
51      }
52  
53      private void populatePurchaseOrderItemCapitalAssets(CapitalAssetSystem originalSystem) {
54          for (ItemCapitalAsset reqAsset : originalSystem.getItemCapitalAssets()) {
55              PurchaseOrderItemCapitalAsset poAsset = new PurchaseOrderItemCapitalAsset(reqAsset.getCapitalAssetNumber());
56              this.getItemCapitalAssets().add(poAsset);
57          }
58      }
59  
60      private void populateCapitalAssetLocations(CapitalAssetSystem originalSystem) {
61          for (CapitalAssetLocation reqLocation : originalSystem.getCapitalAssetLocations()) {
62              PurchaseOrderCapitalAssetLocation poLocation = new PurchaseOrderCapitalAssetLocation();
63              poLocation.setItemQuantity(reqLocation.getItemQuantity());
64              poLocation.setCampusCode(reqLocation.getCampusCode());
65              poLocation.setOffCampusIndicator(reqLocation.isOffCampusIndicator());
66              poLocation.setBuildingCode(reqLocation.getBuildingCode());
67              poLocation.setBuildingRoomNumber(reqLocation.getBuildingRoomNumber());
68              poLocation.setCapitalAssetLine1Address(reqLocation.getCapitalAssetLine1Address());
69              poLocation.setCapitalAssetCityName(reqLocation.getCapitalAssetCityName());
70              poLocation.setCapitalAssetStateCode(reqLocation.getCapitalAssetStateCode());
71              poLocation.setCapitalAssetPostalCode(reqLocation.getCapitalAssetPostalCode());
72              poLocation.setCapitalAssetCountryCode(reqLocation.getCapitalAssetCountryCode());
73              this.getCapitalAssetLocations().add(poLocation);
74          }
75      }
76  
77      @Override
78      public Class getCapitalAssetLocationClass() {
79          return RequisitionCapitalAssetLocation.class;
80      }
81  
82      @Override
83      public Class getItemCapitalAssetClass() {
84          return RequisitionItemCapitalAsset.class;
85      }
86  
87      public Integer getPurapDocumentIdentifier() {
88          return purapDocumentIdentifier;
89      }
90  
91      public void setPurapDocumentIdentifier(Integer purapDocumentIdentifier) {
92          this.purapDocumentIdentifier = purapDocumentIdentifier;
93      }
94  
95  }