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