1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.document.authorization;
17
18 import org.kuali.rice.kns.inquiry.InquiryRestrictions;
19 import org.kuali.rice.kns.web.ui.Field;
20
21 import java.util.HashSet;
22 import java.util.Set;
23
24
25
26
27 @Deprecated
28 public class InquiryOrMaintenanceDocumentRestrictionsBase extends
29 BusinessObjectRestrictionsBase implements InquiryOrMaintenanceDocumentRestrictions, InquiryRestrictions {
30 private Set<String> hiddenFields;
31 private Set<String> hiddenSectionIds;
32
33 public void addHiddenField(String fieldName) {
34 hiddenFields.add(fieldName);
35 }
36
37 public void addHiddenSectionId(String sectionId) {
38 hiddenSectionIds.add(sectionId);
39 }
40
41 @Override
42 public FieldRestriction getFieldRestriction(String fieldName) {
43 FieldRestriction fieldRestriction = super
44 .getFieldRestriction(fieldName);
45 if (isHiddenField(fieldName)) {
46 fieldRestriction = new FieldRestriction(fieldName, Field.HIDDEN);
47 }
48 return fieldRestriction;
49 }
50
51
52
53
54 @Override
55 public boolean hasRestriction(String fieldName) {
56 return super.hasRestriction(fieldName) || isHiddenField(fieldName);
57 }
58
59
60
61
62 @Override
63 public boolean hasAnyFieldRestrictions() {
64 return super.hasAnyFieldRestrictions() || !hiddenFields.isEmpty();
65 }
66
67 @Override
68 public void clearAllRestrictions() {
69 super.clearAllRestrictions();
70 hiddenFields = new HashSet<String>();
71 hiddenSectionIds = new HashSet<String>();
72 }
73
74
75
76
77 public boolean isHiddenSectionId(String sectionId) {
78 return hiddenSectionIds.contains(sectionId);
79 }
80
81 protected boolean isHiddenField(String fieldName) {
82 String normalizedFieldName = normalizeFieldName(fieldName);
83 return hiddenFields.contains(normalizedFieldName);
84 }
85 }