1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.document.authorization;
17
18 import java.util.Set;
19
20 import org.kuali.ole.fp.batch.ProcurementCardCreateDocumentsStep;
21 import org.kuali.ole.sys.context.SpringContext;
22 import org.kuali.ole.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
23 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
24 import org.kuali.rice.krad.bo.BusinessObject;
25
26
27
28
29 public class ProcurementCardDefaultMaintenanceDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
30 protected static ParameterService parameterService;
31
32 protected final static String PROCUREMENT_CARD_DEFAULT_HOLDER_SECTION_ID = "KFS-FP_ProcurementCardDefault-EditProcurementCardHolder";
33 protected final static String PROCUREMENT_CARD_DEFAULT_ACCOUNTING_SECTION_ID = "KFS-FP_ProcurementCardDefault-EditProcurementCardAccounting";
34
35
36
37
38
39
40 @Override
41 public Set<String> getConditionallyHiddenSectionIds(BusinessObject businessObject) {
42 Set<String> sectionIds = super.getConditionallyHiddenSectionIds(businessObject);
43 final boolean cardHolderDefaultTurnedOn = isCardHolderDefaultTurnedOn();
44 if (!cardHolderDefaultTurnedOn) {
45 sectionIds.add(PROCUREMENT_CARD_DEFAULT_HOLDER_SECTION_ID);
46 }
47 if (!cardHolderDefaultTurnedOn && !isAccountDefaultTurnedOn()) {
48 sectionIds.add(PROCUREMENT_CARD_DEFAULT_ACCOUNTING_SECTION_ID);
49 }
50 return sectionIds;
51 }
52
53
54
55
56 protected boolean isCardHolderDefaultTurnedOn() {
57 return getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_CARD_HOLDER_DEFAULT_PARAMETER_NAME);
58 }
59
60
61
62
63 protected boolean isAccountDefaultTurnedOn() {
64 return getParameterService().getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, ProcurementCardCreateDocumentsStep.USE_ACCOUNTING_DEFAULT_PARAMETER_NAME);
65 }
66
67
68
69
70 @Override
71 protected synchronized ParameterService getParameterService() {
72 if (parameterService == null) {
73 parameterService = SpringContext.getBean(ParameterService.class);
74 }
75 return parameterService;
76 }
77 }