1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
6 import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
7 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
8 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
9 import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
10 import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
11 import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
12 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
13 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
14 import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
15 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
16 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
17 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
18 import java.lang.Override;
19 import java.lang.String;
20 import java.util.LinkedList;
21 import java.util.List;
22 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
23 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
24
25
26
27
28 @MetaschemaAssembly(
29 formalName = "Subject of Assessment",
30 description = "Identifies system elements being assessed, such as components, inventory items, and locations. In the assessment plan, this identifies a planned assessment subject. In the assessment results this is an actual assessment subject, and reflects any changes from the plan. exactly what will be the focus of this assessment. Any subjects not identified in this way are out-of-scope.",
31 name = "assessment-subject",
32 metaschema = OscalAssessmentCommonMetaschema.class,
33 remarks = "Processing of an include/exclude pair starts with processing the include, then removing matching entries in the exclude."
34 )
35 public class AssessmentSubject {
36 @BoundFlag(
37 formalName = "Subject Type",
38 description = "Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement.",
39 useName = "type",
40 required = true,
41 typeAdapter = TokenAdapter.class
42 )
43 @ValueConstraints(
44 allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "component", description = "The referenced assessment subject is a component defined in the SSP, or in the `local-definitions` of an Assessment Plan or Assessment Results."), @AllowedValue(value = "inventory-item", description = "The referenced assessment subject is a inventory item defined in the SSP, or in the `local-definitions` of an Assessment Plan or Assessment Results."), @AllowedValue(value = "location", description = "The referenced assessment subject is a `location` defined in the `metadata` of the SSP, Assessment Plan, or Assessment Results."), @AllowedValue(value = "party", description = "The referenced assessment subject is a person or team to interview, who is defined as a `party` in the `metadata` of the SSP, Assessment Plan, or Assessment Results."), @AllowedValue(value = "user", description = "The referenced assessment subject is a `user` defined in the SSP, or in the `local-definitions` of an Assessment Plan or Assessment Results.")})
45 )
46 private String _type;
47
48
49
50
51 @BoundField(
52 formalName = "Include Subjects Description",
53 description = "A human-readable description of the collection of subjects being included in this assessment.",
54 useName = "description"
55 )
56 @BoundFieldValue(
57 typeAdapter = MarkupMultilineAdapter.class
58 )
59 private MarkupMultiline _description;
60
61 @BoundAssembly(
62 formalName = "Property",
63 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
64 useName = "prop",
65 maxOccurs = -1
66 )
67 @GroupAs(
68 name = "props",
69 inJson = JsonGroupAsBehavior.LIST
70 )
71 private List<Property> _props;
72
73 @BoundAssembly(
74 formalName = "Link",
75 description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
76 useName = "link",
77 maxOccurs = -1
78 )
79 @GroupAs(
80 name = "links",
81 inJson = JsonGroupAsBehavior.LIST
82 )
83 private List<Link> _links;
84
85 @BoundAssembly(
86 formalName = "Include All",
87 description = "Include all controls from the imported catalog or profile resources.",
88 useName = "include-all",
89 minOccurs = 1
90 )
91 private IncludeAll _includeAll;
92
93 @BoundAssembly(
94 formalName = "Select Assessment Subject",
95 description = "Identifies a set of assessment subjects to include/exclude by UUID.",
96 useName = "include-subject",
97 minOccurs = 1,
98 maxOccurs = -1
99 )
100 @GroupAs(
101 name = "include-subjects",
102 inJson = JsonGroupAsBehavior.LIST
103 )
104 private List<SelectSubjectById> _includeSubjects;
105
106 @BoundAssembly(
107 formalName = "Select Assessment Subject",
108 description = "Identifies a set of assessment subjects to include/exclude by UUID.",
109 useName = "exclude-subject",
110 maxOccurs = -1
111 )
112 @GroupAs(
113 name = "exclude-subjects",
114 inJson = JsonGroupAsBehavior.LIST
115 )
116 private List<SelectSubjectById> _excludeSubjects;
117
118 @BoundField(
119 formalName = "Remarks",
120 description = "Additional commentary about the containing object.",
121 useName = "remarks"
122 )
123 @BoundFieldValue(
124 typeAdapter = MarkupMultilineAdapter.class
125 )
126 private MarkupMultiline _remarks;
127
128 public AssessmentSubject() {
129 }
130
131 public String getType() {
132 return _type;
133 }
134
135 public void setType(String value) {
136 _type = value;
137 }
138
139 public MarkupMultiline getDescription() {
140 return _description;
141 }
142
143 public void setDescription(MarkupMultiline value) {
144 _description = value;
145 }
146
147 public List<Property> getProps() {
148 return _props;
149 }
150
151 public void setProps(List<Property> value) {
152 _props = value;
153 }
154
155
156
157
158
159
160 public boolean addProp(Property item) {
161 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
162 if (_props == null) {
163 _props = new LinkedList<>();
164 }
165 return _props.add(value);
166 }
167
168
169
170
171
172
173 public boolean removeProp(Property item) {
174 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
175 return _props == null ? false : _props.remove(value);
176 }
177
178 public List<Link> getLinks() {
179 return _links;
180 }
181
182 public void setLinks(List<Link> value) {
183 _links = value;
184 }
185
186
187
188
189
190
191 public boolean addLink(Link item) {
192 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
193 if (_links == null) {
194 _links = new LinkedList<>();
195 }
196 return _links.add(value);
197 }
198
199
200
201
202
203
204 public boolean removeLink(Link item) {
205 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
206 return _links == null ? false : _links.remove(value);
207 }
208
209 public IncludeAll getIncludeAll() {
210 return _includeAll;
211 }
212
213 public void setIncludeAll(IncludeAll value) {
214 _includeAll = value;
215 }
216
217 public List<SelectSubjectById> getIncludeSubjects() {
218 return _includeSubjects;
219 }
220
221 public void setIncludeSubjects(List<SelectSubjectById> value) {
222 _includeSubjects = value;
223 }
224
225
226
227
228
229
230 public boolean addIncludeSubject(SelectSubjectById item) {
231 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null");
232 if (_includeSubjects == null) {
233 _includeSubjects = new LinkedList<>();
234 }
235 return _includeSubjects.add(value);
236 }
237
238
239
240
241
242
243 public boolean removeIncludeSubject(SelectSubjectById item) {
244 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null");
245 return _includeSubjects == null ? false : _includeSubjects.remove(value);
246 }
247
248 public List<SelectSubjectById> getExcludeSubjects() {
249 return _excludeSubjects;
250 }
251
252 public void setExcludeSubjects(List<SelectSubjectById> value) {
253 _excludeSubjects = value;
254 }
255
256
257
258
259
260
261 public boolean addExcludeSubject(SelectSubjectById item) {
262 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null");
263 if (_excludeSubjects == null) {
264 _excludeSubjects = new LinkedList<>();
265 }
266 return _excludeSubjects.add(value);
267 }
268
269
270
271
272
273
274 public boolean removeExcludeSubject(SelectSubjectById item) {
275 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null");
276 return _excludeSubjects == null ? false : _excludeSubjects.remove(value);
277 }
278
279 public MarkupMultiline getRemarks() {
280 return _remarks;
281 }
282
283 public void setRemarks(MarkupMultiline value) {
284 _remarks = value;
285 }
286
287 @Override
288 public String toString() {
289 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
290 }
291 }