1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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",
29 false,
30 "TYPE1",
31 "manufacturer",
32 "description",
33 "note text",
34 new PurchasingCapitalAssetLocationFixture[] {PurchasingCapitalAssetLocationFixture.LOCATION_BASIC}
35 ),
36 ASSET_SYSTEM_BASIC_2(
37 "Asset 2",
38 false,
39 "TYPE2",
40 "manufacturer",
41 "description",
42 "note text",
43 new PurchasingCapitalAssetLocationFixture[] {PurchasingCapitalAssetLocationFixture.LOCATION_BASIC}
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 }