View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.purap.fixture;
20  
21  import org.kuali.kfs.integration.purap.CapitalAssetLocation;
22  import org.kuali.kfs.integration.purap.CapitalAssetSystem;
23  import org.kuali.kfs.module.purap.businessobject.RequisitionCapitalAssetLocation;
24  
25  public enum PurchasingCapitalAssetSystemFixture {
26    
27      ASSET_SYSTEM_BASIC_1 ( 
28              "Asset 1", //capitalAssetSystemDescription
29              false, //capitalAssetNotReceivedCurrentFiscalYearIndicator
30              "TYPE1", //capitalAssetTypeCode
31              "manufacturer", //capitalAssetManufacturerName
32              "description", //capitalAssetModelDescription
33              "note text", //capitalAssetNoteText
34              new PurchasingCapitalAssetLocationFixture[] {PurchasingCapitalAssetLocationFixture.LOCATION_BASIC} //location multifixtures
35              ),       
36      ASSET_SYSTEM_BASIC_2(
37              "Asset 2", // capitalAssetSystemDescription
38              false, // capitalAssetNotReceivedCurrentFiscalYearIndicator
39              "TYPE2", // capitalAssetTypeCode
40              "manufacturer", // capitalAssetManufacturerName
41              "description", // capitalAssetModelDescription
42              "note text", // capitalAssetNoteText
43              new PurchasingCapitalAssetLocationFixture[] {PurchasingCapitalAssetLocationFixture.LOCATION_BASIC} //location multifixtures
44      ),             
45              ;
46      
47      private String capitalAssetSystemDescription;
48      private boolean capitalAssetNotReceivedCurrentFiscalYearIndicator;
49      private String capitalAssetTypeCode;
50      private String capitalAssetManufacturerName;
51      private String capitalAssetModelDescription;
52      private String capitalAssetNoteText;
53      private PurchasingCapitalAssetLocationFixture[] locations;
54      
55      private PurchasingCapitalAssetSystemFixture (String capitalAssetSystemDescription, boolean capitalAssetNotReceivedCurrentFiscalYearIndicator, String capitalAssetTypeCode, String capitalAssetManufacturerName, String capitalAssetModelDescription, String capitalAssetNoteText, PurchasingCapitalAssetLocationFixture[] locations) {
56          this.capitalAssetSystemDescription = capitalAssetSystemDescription;
57          this.capitalAssetNotReceivedCurrentFiscalYearIndicator = capitalAssetNotReceivedCurrentFiscalYearIndicator;
58          this.capitalAssetTypeCode = capitalAssetTypeCode;
59          this.capitalAssetManufacturerName = capitalAssetManufacturerName;
60          this.capitalAssetModelDescription = capitalAssetModelDescription;
61          this.capitalAssetNoteText = capitalAssetNoteText;
62          this.locations = locations;
63      }
64      
65      public CapitalAssetSystem createPurchasingCapitalAssetSystem(Class clazz) {
66          CapitalAssetSystem assetSystem = null;
67          try {
68              assetSystem = (CapitalAssetSystem) clazz.newInstance();
69          }
70          catch (InstantiationException e) {
71              throw new RuntimeException("asset system creation failed. class = " + clazz);
72          }
73          catch (IllegalAccessException e) {
74              throw new RuntimeException("asset system creation failed. class = " + clazz);
75          }
76  
77          assetSystem.setCapitalAssetSystemDescription(capitalAssetSystemDescription);
78          assetSystem.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(capitalAssetNotReceivedCurrentFiscalYearIndicator);
79          assetSystem.setCapitalAssetTypeCode(capitalAssetTypeCode);
80          assetSystem.setCapitalAssetManufacturerName(capitalAssetManufacturerName);
81          assetSystem.setCapitalAssetModelDescription(capitalAssetModelDescription);
82          assetSystem.setCapitalAssetNoteText(capitalAssetNoteText);
83          
84          for (PurchasingCapitalAssetLocationFixture locationFixture : locations) {
85              CapitalAssetLocation location = locationFixture.createPurchasingCapitalAssetLocation(RequisitionCapitalAssetLocation.class);
86              assetSystem.getCapitalAssetLocations().add(location);
87          }
88          return assetSystem;
89      }
90  }