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.cab.fixture;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import org.kuali.kfs.module.purap.businessobject.PurchaseOrderCapitalAssetLocation;
25  import org.kuali.kfs.sys.context.SpringContext;
26  import org.kuali.rice.core.api.util.type.KualiDecimal;
27  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
28  import org.kuali.rice.krad.service.BusinessObjectService;
29  
30  public enum PurchaseOrderCapitalAssetLocationFixture {
31  
32      REC1 {
33          @Override
34          public PurchaseOrderCapitalAssetLocation newRecord() {
35              PurchaseOrderCapitalAssetLocation obj = new PurchaseOrderCapitalAssetLocation();
36              obj.setCapitalAssetLocationIdentifier(1300);
37              obj.setCapitalAssetSystemIdentifier(1102);
38              obj.setItemQuantity(new KualiDecimal(3));
39              obj.setCampusCode("BL");
40              obj.setOffCampusIndicator(false);
41              obj.setBuildingCode("BL001");
42              obj.setBuildingRoomNumber("009");
43              return obj;
44          };
45      },
46      REC2 {
47          @Override
48          public PurchaseOrderCapitalAssetLocation newRecord() {
49              PurchaseOrderCapitalAssetLocation obj = new PurchaseOrderCapitalAssetLocation();
50              obj.setCapitalAssetLocationIdentifier(1301);
51              obj.setCapitalAssetSystemIdentifier(1103);
52              obj.setItemQuantity(new KualiDecimal(2));
53              obj.setCampusCode("BL");
54              obj.setOffCampusIndicator(true);
55              obj.setCapitalAssetLine1Address("2700 Broadway");
56              obj.setCapitalAssetCityName("Lansing");
57              obj.setCapitalAssetStateCode("MI");
58              obj.setCapitalAssetPostalCode("44555");
59              return obj;
60          };
61      };
62      public abstract PurchaseOrderCapitalAssetLocation newRecord();
63  
64      public static void setUpData() {
65          BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
66          businessObjectService.save(getAll());
67  
68      }
69  
70      private static List<PersistableBusinessObjectBase> getAll() {
71          List<PersistableBusinessObjectBase> recs = new ArrayList<PersistableBusinessObjectBase>();
72          recs.add(REC1.newRecord());
73          recs.add(REC2.newRecord());
74          return recs;
75      }
76  }