1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary;
17
18 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
19 import org.kuali.rice.krad.datadictionary.mask.MaskFormatter;
20
21
22
23
24
25
26
27 public class AttributeSecurity extends DataDictionaryDefinitionBase {
28 private static final long serialVersionUID = -7923499408946975318L;
29
30 boolean readOnly = false;
31 boolean hide = false;
32 boolean mask = false;
33 boolean partialMask = false;
34 MaskFormatter partialMaskFormatter;
35 MaskFormatter maskFormatter;
36
37
38
39
40 public boolean isReadOnly() {
41 return this.readOnly;
42 }
43
44
45
46
47
48 public void setReadOnly(boolean readOnly) {
49 this.readOnly = readOnly;
50 }
51
52
53
54
55 public boolean isHide() {
56 return this.hide;
57 }
58
59
60
61
62
63 public void setHide(boolean hide) {
64 this.hide = hide;
65 }
66
67
68
69
70 public boolean isMask() {
71 return this.mask;
72 }
73
74
75
76
77
78 public void setMask(boolean mask) {
79 this.mask = mask;
80 }
81
82
83
84
85 public boolean isPartialMask() {
86 return this.partialMask;
87 }
88
89
90
91
92
93 public void setPartialMask(boolean partialMask) {
94 this.partialMask = partialMask;
95 }
96
97
98
99
100 public MaskFormatter getMaskFormatter() {
101 return this.maskFormatter;
102 }
103
104
105
106
107
108 public void setMaskFormatter(MaskFormatter maskFormatter) {
109 this.maskFormatter = maskFormatter;
110 }
111
112
113
114
115 public MaskFormatter getPartialMaskFormatter() {
116 return this.partialMaskFormatter;
117 }
118
119
120
121
122
123 public void setPartialMaskFormatter(MaskFormatter partialMaskFormatter) {
124 this.partialMaskFormatter = partialMaskFormatter;
125 }
126
127
128
129
130
131
132
133 public void completeValidation(Class rootBusinessObjectClass,
134 Class otherBusinessObjectClass) {
135
136 if (mask && maskFormatter == null) {
137 throw new AttributeValidationException("MaskFormatter is required");
138 }
139 if (partialMask && partialMaskFormatter == null) {
140 throw new AttributeValidationException(
141 "PartialMaskFormatter is required");
142 }
143 }
144
145
146
147
148 public boolean hasAnyRestriction() {
149 return readOnly || mask || partialMask || hide;
150 }
151
152
153
154
155
156
157
158
159 public boolean hasRestrictionThatRemovesValueFromUI() {
160 return mask || partialMask || hide;
161 }
162 }