1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
4 import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
6 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
7 import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
8 import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
9 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
10 import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
11 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLine;
12 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
13 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
14 import java.lang.Override;
15 import java.lang.String;
16 import java.util.LinkedList;
17 import java.util.List;
18 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
19 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20
21
22
23
24 @MetaschemaAssembly(
25 formalName = "Control Group",
26 description = "A group of (selected) controls or of groups of controls.",
27 name = "group",
28 metaschema = OscalProfileMetaschema.class,
29 remarks = "This construct mirrors the same construct that exists in an OSCAL catalog."
30 )
31 public class ProfileGroup {
32 @BoundFlag(
33 formalName = "Group Identifier",
34 description = "Identifies the group.",
35 useName = "id",
36 typeAdapter = TokenAdapter.class,
37 remarks = "This optional data element is available to support hyperlinking to formal groups or families as defined in control catalogs, among other operations."
38 )
39 private String _id;
40
41 @BoundFlag(
42 formalName = "Group Class",
43 description = "A textual label that provides a sub-type or characterization of the group.",
44 useName = "class",
45 typeAdapter = TokenAdapter.class,
46 remarks = "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value.\n"
47 + "\n"
48 + "A `class` can also be used in an OSCAL profile as a means to target an alteration to control content."
49 )
50 private String _clazz;
51
52
53
54
55 @BoundField(
56 formalName = "Group Title",
57 description = "A name to be given to the group for use in display.",
58 useName = "title",
59 minOccurs = 1
60 )
61 @BoundFieldValue(
62 typeAdapter = MarkupLineAdapter.class
63 )
64 private MarkupLine _title;
65
66 @BoundAssembly(
67 formalName = "Parameter",
68 description = "Parameters provide a mechanism for the dynamic assignment of value(s) in a control.",
69 useName = "param",
70 maxOccurs = -1
71 )
72 @GroupAs(
73 name = "params",
74 inJson = JsonGroupAsBehavior.LIST
75 )
76 private List<Parameter> _params;
77
78 @BoundAssembly(
79 formalName = "Property",
80 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
81 useName = "prop",
82 maxOccurs = -1
83 )
84 @GroupAs(
85 name = "props",
86 inJson = JsonGroupAsBehavior.LIST
87 )
88 private List<Property> _props;
89
90 @BoundAssembly(
91 formalName = "Link",
92 description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
93 useName = "link",
94 maxOccurs = -1
95 )
96 @GroupAs(
97 name = "links",
98 inJson = JsonGroupAsBehavior.LIST
99 )
100 private List<Link> _links;
101
102 @BoundAssembly(
103 formalName = "Part",
104 description = "An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part.",
105 useName = "part",
106 maxOccurs = -1
107 )
108 @GroupAs(
109 name = "parts",
110 inJson = JsonGroupAsBehavior.LIST
111 )
112 private List<ControlPart> _parts;
113
114 @BoundAssembly(
115 formalName = "Control Group",
116 description = "A group of (selected) controls or of groups of controls.",
117 useName = "group",
118 maxOccurs = -1
119 )
120 @GroupAs(
121 name = "groups",
122 inJson = JsonGroupAsBehavior.LIST
123 )
124 private List<ProfileGroup> _groups;
125
126 @BoundAssembly(
127 formalName = "Insert Controls",
128 description = "Specifies which controls to use in the containing context.",
129 useName = "insert-controls",
130 maxOccurs = -1
131 )
132 @GroupAs(
133 name = "insert-controls",
134 inJson = JsonGroupAsBehavior.LIST
135 )
136 private List<InsertControls> _insertControls;
137
138 public ProfileGroup() {
139 }
140
141 public String getId() {
142 return _id;
143 }
144
145 public void setId(String value) {
146 _id = value;
147 }
148
149 public String getClazz() {
150 return _clazz;
151 }
152
153 public void setClazz(String value) {
154 _clazz = value;
155 }
156
157 public MarkupLine getTitle() {
158 return _title;
159 }
160
161 public void setTitle(MarkupLine value) {
162 _title = value;
163 }
164
165 public List<Parameter> getParams() {
166 return _params;
167 }
168
169 public void setParams(List<Parameter> value) {
170 _params = value;
171 }
172
173
174
175
176
177
178 public boolean addParam(Parameter item) {
179 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
180 if (_params == null) {
181 _params = new LinkedList<>();
182 }
183 return _params.add(value);
184 }
185
186
187
188
189
190
191 public boolean removeParam(Parameter item) {
192 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
193 return _params == null ? false : _params.remove(value);
194 }
195
196 public List<Property> getProps() {
197 return _props;
198 }
199
200 public void setProps(List<Property> value) {
201 _props = value;
202 }
203
204
205
206
207
208
209 public boolean addProp(Property item) {
210 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
211 if (_props == null) {
212 _props = new LinkedList<>();
213 }
214 return _props.add(value);
215 }
216
217
218
219
220
221
222 public boolean removeProp(Property item) {
223 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
224 return _props == null ? false : _props.remove(value);
225 }
226
227 public List<Link> getLinks() {
228 return _links;
229 }
230
231 public void setLinks(List<Link> value) {
232 _links = value;
233 }
234
235
236
237
238
239
240 public boolean addLink(Link item) {
241 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
242 if (_links == null) {
243 _links = new LinkedList<>();
244 }
245 return _links.add(value);
246 }
247
248
249
250
251
252
253 public boolean removeLink(Link item) {
254 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
255 return _links == null ? false : _links.remove(value);
256 }
257
258 public List<ControlPart> getParts() {
259 return _parts;
260 }
261
262 public void setParts(List<ControlPart> value) {
263 _parts = value;
264 }
265
266
267
268
269
270
271 public boolean addPart(ControlPart item) {
272 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null");
273 if (_parts == null) {
274 _parts = new LinkedList<>();
275 }
276 return _parts.add(value);
277 }
278
279
280
281
282
283
284 public boolean removePart(ControlPart item) {
285 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null");
286 return _parts == null ? false : _parts.remove(value);
287 }
288
289 public List<ProfileGroup> getGroups() {
290 return _groups;
291 }
292
293 public void setGroups(List<ProfileGroup> value) {
294 _groups = value;
295 }
296
297
298
299
300
301
302 public boolean addGroup(ProfileGroup item) {
303 ProfileGroup value = ObjectUtils.requireNonNull(item,"item cannot be null");
304 if (_groups == null) {
305 _groups = new LinkedList<>();
306 }
307 return _groups.add(value);
308 }
309
310
311
312
313
314
315 public boolean removeGroup(ProfileGroup item) {
316 ProfileGroup value = ObjectUtils.requireNonNull(item,"item cannot be null");
317 return _groups == null ? false : _groups.remove(value);
318 }
319
320 public List<InsertControls> getInsertControls() {
321 return _insertControls;
322 }
323
324 public void setInsertControls(List<InsertControls> value) {
325 _insertControls = value;
326 }
327
328
329
330
331
332
333 public boolean addInsertControls(InsertControls item) {
334 InsertControls value = ObjectUtils.requireNonNull(item,"item cannot be null");
335 if (_insertControls == null) {
336 _insertControls = new LinkedList<>();
337 }
338 return _insertControls.add(value);
339 }
340
341
342
343
344
345
346 public boolean removeInsertControls(InsertControls item) {
347 InsertControls value = ObjectUtils.requireNonNull(item,"item cannot be null");
348 return _insertControls == null ? false : _insertControls.remove(value);
349 }
350
351 @Override
352 public String toString() {
353 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
354 }
355 }