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.krad.document.MaintenanceDocument; |
22 | |
import org.kuali.rice.krad.maintenance.MaintainableImpl; |
23 | |
import org.kuali.rice.krad.util.KRADConstants; |
24 | |
|
25 | |
import edu.sampleu.travel.dto.FiscalOfficerInfo; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public class FiscalOfficerInfoMaintainableImpl extends MaintainableImpl { |
31 | |
|
32 | |
private transient FiscalOfficerService fiscalOfficerService; |
33 | |
|
34 | |
|
35 | |
@Override |
36 | |
public void saveDataObject() { |
37 | 0 | if(getMaintenanceAction().equals(KRADConstants.MAINTENANCE_NEW_ACTION) || |
38 | |
getMaintenanceAction().equals(KRADConstants.MAINTENANCE_COPY_ACTION)) { |
39 | 0 | getFiscalOfficerService().createFiscalOfficer((FiscalOfficerInfo)getDataObject()); |
40 | |
} |
41 | |
else { |
42 | 0 | getFiscalOfficerService().updateFiscalOfficer((FiscalOfficerInfo)getDataObject()); |
43 | |
} |
44 | 0 | } |
45 | |
|
46 | |
@Override |
47 | |
public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) { |
48 | 0 | return getFiscalOfficerService().retrieveFiscalOfficer(new Long(dataObjectKeys.get("id"))); |
49 | |
} |
50 | |
|
51 | |
protected FiscalOfficerService getFiscalOfficerService() { |
52 | 0 | if(fiscalOfficerService == null) { |
53 | 0 | fiscalOfficerService = GlobalResourceLoader.getService("fiscalOfficerService"); |
54 | |
} |
55 | 0 | return this.fiscalOfficerService; |
56 | |
} |
57 | |
|
58 | |
public void setFiscalOfficerService(FiscalOfficerService fiscalOfficerService) { |
59 | 0 | this.fiscalOfficerService = fiscalOfficerService; |
60 | 0 | } |
61 | |
|
62 | |
} |