1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.service;
17
18 import java.util.Map;
19
20 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
21 import org.kuali.rice.kns.document.MaintenanceDocument;
22 import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
23 import org.kuali.rice.kns.util.KNSConstants;
24
25 import edu.sampleu.travel.dto.FiscalOfficerInfo;
26
27
28
29
30 public class FiscalOfficerInfoMaintainableImpl extends KualiMaintainableImpl {
31
32 private transient FiscalOfficerService fiscalOfficerService;
33
34
35 @Override
36 public void saveBusinessObject() {
37 if(getMaintenanceAction().equals(KNSConstants.MAINTENANCE_NEW_ACTION) ||
38 getMaintenanceAction().equals(KNSConstants.MAINTENANCE_COPY_ACTION)) {
39 getFiscalOfficerService().createFiscalOfficer((FiscalOfficerInfo)getDataObject());
40 }
41 else {
42 getFiscalOfficerService().updateFiscalOfficer((FiscalOfficerInfo)getDataObject());
43 }
44 }
45
46 @Override
47 public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) {
48 return getFiscalOfficerService().retrieveFiscalOfficer(new Long(dataObjectKeys.get("id")));
49 }
50
51 protected FiscalOfficerService getFiscalOfficerService() {
52 if(fiscalOfficerService == null) {
53 fiscalOfficerService = GlobalResourceLoader.getService("fiscalOfficerService");
54 }
55 return this.fiscalOfficerService;
56 }
57
58 public void setFiscalOfficerService(FiscalOfficerService fiscalOfficerService) {
59 this.fiscalOfficerService = fiscalOfficerService;
60 }
61
62 }