001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_assessment-common_metaschema.xml 002// Do not edit - changes will be lost when regenerated. 003package dev.metaschema.oscal.lib.model; 004 005import dev.metaschema.core.datatype.adapter.TokenAdapter; 006import dev.metaschema.core.datatype.markup.MarkupMultiline; 007import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 008import dev.metaschema.core.model.IBoundObject; 009import dev.metaschema.core.model.IMetaschemaData; 010import dev.metaschema.core.model.JsonGroupAsBehavior; 011import dev.metaschema.core.model.constraint.IConstraint; 012import dev.metaschema.core.util.ObjectUtils; 013import dev.metaschema.databind.model.annotations.AllowedValue; 014import dev.metaschema.databind.model.annotations.AllowedValues; 015import dev.metaschema.databind.model.annotations.BoundAssembly; 016import dev.metaschema.databind.model.annotations.BoundChoice; 017import dev.metaschema.databind.model.annotations.BoundField; 018import dev.metaschema.databind.model.annotations.BoundFlag; 019import dev.metaschema.databind.model.annotations.GroupAs; 020import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 021import dev.metaschema.databind.model.annotations.ValueConstraints; 022import edu.umd.cs.findbugs.annotations.NonNull; 023import edu.umd.cs.findbugs.annotations.Nullable; 024import java.util.LinkedList; 025import java.util.List; 026import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 027import org.apache.commons.lang3.builder.ToStringStyle; 028 029/** 030 * 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. 031 */ 032@MetaschemaAssembly( 033 formalName = "Subject of Assessment", 034 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.", 035 name = "assessment-subject", 036 moduleClass = OscalAssessmentCommonModule.class, 037 remarks = "Processing of an include/exclude pair starts with processing the include, then removing matching entries in the exclude." 038) 039public class AssessmentSubject implements IBoundObject { 040 private final IMetaschemaData __metaschemaData; 041 042 /** 043 * Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement. 044 */ 045 @BoundFlag( 046 formalName = "Subject Type", 047 description = "Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement.", 048 name = "type", 049 required = true, 050 typeAdapter = TokenAdapter.class, 051 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-assessment-subject-values", 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.")})) 052 ) 053 private String _type; 054 055 /** 056 * A human-readable description of the collection of subjects being included in this assessment. 057 */ 058 @BoundField( 059 formalName = "Include Subjects Description", 060 description = "A human-readable description of the collection of subjects being included in this assessment.", 061 useName = "description", 062 typeAdapter = MarkupMultilineAdapter.class 063 ) 064 private MarkupMultiline _description; 065 066 /** 067 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 068 */ 069 @BoundAssembly( 070 formalName = "Property", 071 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 072 useName = "prop", 073 maxOccurs = -1, 074 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 075 ) 076 private List<Property> _props; 077 078 /** 079 * A reference to a local or remote resource, that has a specific relation to the containing object. 080 */ 081 @BoundAssembly( 082 formalName = "Link", 083 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 084 useName = "link", 085 maxOccurs = -1, 086 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 087 ) 088 private List<Link> _links; 089 090 /** 091 * Include all controls from the imported catalog or profile resources. 092 */ 093 @BoundAssembly( 094 formalName = "Include All", 095 description = "Include all controls from the imported catalog or profile resources.", 096 useName = "include-all", 097 minOccurs = 1 098 ) 099 @BoundChoice( 100 choiceId = "choice-1" 101 ) 102 private IncludeAll _includeAll; 103 104 /** 105 * Identifies a set of assessment subjects to include/exclude by UUID. 106 */ 107 @BoundAssembly( 108 formalName = "Select Assessment Subject", 109 description = "Identifies a set of assessment subjects to include/exclude by UUID.", 110 useName = "include-subject", 111 minOccurs = 1, 112 maxOccurs = -1, 113 groupAs = @GroupAs(name = "include-subjects", inJson = JsonGroupAsBehavior.LIST) 114 ) 115 @BoundChoice( 116 choiceId = "choice-1" 117 ) 118 private List<SelectSubjectById> _includeSubjects; 119 120 /** 121 * Identifies a set of assessment subjects to include/exclude by UUID. 122 */ 123 @BoundAssembly( 124 formalName = "Select Assessment Subject", 125 description = "Identifies a set of assessment subjects to include/exclude by UUID.", 126 useName = "exclude-subject", 127 maxOccurs = -1, 128 groupAs = @GroupAs(name = "exclude-subjects", inJson = JsonGroupAsBehavior.LIST) 129 ) 130 private List<SelectSubjectById> _excludeSubjects; 131 132 /** 133 * Additional commentary about the containing object. 134 */ 135 @BoundField( 136 formalName = "Remarks", 137 description = "Additional commentary about the containing object.", 138 useName = "remarks", 139 typeAdapter = MarkupMultilineAdapter.class 140 ) 141 private MarkupMultiline _remarks; 142 143 /** 144 * Constructs a new {@code dev.metaschema.oscal.lib.model.AssessmentSubject} instance with no metadata. 145 */ 146 public AssessmentSubject() { 147 this(null); 148 } 149 150 /** 151 * Constructs a new {@code dev.metaschema.oscal.lib.model.AssessmentSubject} instance with the specified metadata. 152 * 153 * @param data 154 * the metaschema data, or {@code null} if none 155 */ 156 public AssessmentSubject(IMetaschemaData data) { 157 this.__metaschemaData = data; 158 } 159 160 @Override 161 public IMetaschemaData getMetaschemaData() { 162 return __metaschemaData; 163 } 164 165 /** 166 * Get the "{@literal Subject Type}". 167 * 168 * <p> 169 * Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement. 170 * 171 * @return the type value 172 */ 173 @NonNull 174 public String getType() { 175 return _type; 176 } 177 178 /** 179 * Set the "{@literal Subject Type}". 180 * 181 * <p> 182 * Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement. 183 * 184 * @param value 185 * the type value to set 186 */ 187 public void setType(@NonNull String value) { 188 _type = value; 189 } 190 191 /** 192 * Get the "{@literal Include Subjects Description}". 193 * 194 * <p> 195 * A human-readable description of the collection of subjects being included in this assessment. 196 * 197 * @return the description value, or {@code null} if not set 198 */ 199 @Nullable 200 public MarkupMultiline getDescription() { 201 return _description; 202 } 203 204 /** 205 * Set the "{@literal Include Subjects Description}". 206 * 207 * <p> 208 * A human-readable description of the collection of subjects being included in this assessment. 209 * 210 * @param value 211 * the description value to set, or {@code null} to clear 212 */ 213 public void setDescription(@Nullable MarkupMultiline value) { 214 _description = value; 215 } 216 217 /** 218 * Get the "{@literal Property}". 219 * 220 * <p> 221 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 222 * 223 * @return the prop value 224 */ 225 @NonNull 226 public List<Property> getProps() { 227 if (_props == null) { 228 _props = new LinkedList<>(); 229 } 230 return ObjectUtils.notNull(_props); 231 } 232 233 /** 234 * Set the "{@literal Property}". 235 * 236 * <p> 237 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 238 * 239 * @param value 240 * the prop value to set 241 */ 242 public void setProps(@NonNull List<Property> value) { 243 _props = value; 244 } 245 246 /** 247 * Add a new {@link Property} item to the underlying collection. 248 * @param item the item to add 249 * @return {@code true} 250 */ 251 public boolean addProp(Property item) { 252 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 253 if (_props == null) { 254 _props = new LinkedList<>(); 255 } 256 return _props.add(value); 257 } 258 259 /** 260 * Remove the first matching {@link Property} item from the underlying collection. 261 * @param item the item to remove 262 * @return {@code true} if the item was removed or {@code false} otherwise 263 */ 264 public boolean removeProp(Property item) { 265 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 266 return _props != null && _props.remove(value); 267 } 268 269 /** 270 * Get the "{@literal Link}". 271 * 272 * <p> 273 * A reference to a local or remote resource, that has a specific relation to the containing object. 274 * 275 * @return the link value 276 */ 277 @NonNull 278 public List<Link> getLinks() { 279 if (_links == null) { 280 _links = new LinkedList<>(); 281 } 282 return ObjectUtils.notNull(_links); 283 } 284 285 /** 286 * Set the "{@literal Link}". 287 * 288 * <p> 289 * A reference to a local or remote resource, that has a specific relation to the containing object. 290 * 291 * @param value 292 * the link value to set 293 */ 294 public void setLinks(@NonNull List<Link> value) { 295 _links = value; 296 } 297 298 /** 299 * Add a new {@link Link} item to the underlying collection. 300 * @param item the item to add 301 * @return {@code true} 302 */ 303 public boolean addLink(Link item) { 304 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 305 if (_links == null) { 306 _links = new LinkedList<>(); 307 } 308 return _links.add(value); 309 } 310 311 /** 312 * Remove the first matching {@link Link} item from the underlying collection. 313 * @param item the item to remove 314 * @return {@code true} if the item was removed or {@code false} otherwise 315 */ 316 public boolean removeLink(Link item) { 317 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 318 return _links != null && _links.remove(value); 319 } 320 321 /** 322 * Get the "{@literal Include All}". 323 * 324 * <p> 325 * Include all controls from the imported catalog or profile resources. 326 * 327 * @return the include-all value, or {@code null} if not set 328 */ 329 @Nullable 330 public IncludeAll getIncludeAll() { 331 return _includeAll; 332 } 333 334 /** 335 * Set the "{@literal Include All}". 336 * 337 * <p> 338 * Include all controls from the imported catalog or profile resources. 339 * 340 * @param value 341 * the include-all value to set, or {@code null} to clear 342 */ 343 public void setIncludeAll(@Nullable IncludeAll value) { 344 _includeAll = value; 345 } 346 347 /** 348 * Get the "{@literal Select Assessment Subject}". 349 * 350 * <p> 351 * Identifies a set of assessment subjects to include/exclude by UUID. 352 * 353 * @return the include-subject value 354 */ 355 @NonNull 356 public List<SelectSubjectById> getIncludeSubjects() { 357 if (_includeSubjects == null) { 358 _includeSubjects = new LinkedList<>(); 359 } 360 return ObjectUtils.notNull(_includeSubjects); 361 } 362 363 /** 364 * Set the "{@literal Select Assessment Subject}". 365 * 366 * <p> 367 * Identifies a set of assessment subjects to include/exclude by UUID. 368 * 369 * @param value 370 * the include-subject value to set 371 */ 372 public void setIncludeSubjects(@NonNull List<SelectSubjectById> value) { 373 _includeSubjects = value; 374 } 375 376 /** 377 * Add a new {@link SelectSubjectById} item to the underlying collection. 378 * @param item the item to add 379 * @return {@code true} 380 */ 381 public boolean addIncludeSubject(SelectSubjectById item) { 382 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null"); 383 if (_includeSubjects == null) { 384 _includeSubjects = new LinkedList<>(); 385 } 386 return _includeSubjects.add(value); 387 } 388 389 /** 390 * Remove the first matching {@link SelectSubjectById} item from the underlying collection. 391 * @param item the item to remove 392 * @return {@code true} if the item was removed or {@code false} otherwise 393 */ 394 public boolean removeIncludeSubject(SelectSubjectById item) { 395 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null"); 396 return _includeSubjects != null && _includeSubjects.remove(value); 397 } 398 399 /** 400 * Get the "{@literal Select Assessment Subject}". 401 * 402 * <p> 403 * Identifies a set of assessment subjects to include/exclude by UUID. 404 * 405 * @return the exclude-subject value 406 */ 407 @NonNull 408 public List<SelectSubjectById> getExcludeSubjects() { 409 if (_excludeSubjects == null) { 410 _excludeSubjects = new LinkedList<>(); 411 } 412 return ObjectUtils.notNull(_excludeSubjects); 413 } 414 415 /** 416 * Set the "{@literal Select Assessment Subject}". 417 * 418 * <p> 419 * Identifies a set of assessment subjects to include/exclude by UUID. 420 * 421 * @param value 422 * the exclude-subject value to set 423 */ 424 public void setExcludeSubjects(@NonNull List<SelectSubjectById> value) { 425 _excludeSubjects = value; 426 } 427 428 /** 429 * Add a new {@link SelectSubjectById} item to the underlying collection. 430 * @param item the item to add 431 * @return {@code true} 432 */ 433 public boolean addExcludeSubject(SelectSubjectById item) { 434 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null"); 435 if (_excludeSubjects == null) { 436 _excludeSubjects = new LinkedList<>(); 437 } 438 return _excludeSubjects.add(value); 439 } 440 441 /** 442 * Remove the first matching {@link SelectSubjectById} item from the underlying collection. 443 * @param item the item to remove 444 * @return {@code true} if the item was removed or {@code false} otherwise 445 */ 446 public boolean removeExcludeSubject(SelectSubjectById item) { 447 SelectSubjectById value = ObjectUtils.requireNonNull(item,"item cannot be null"); 448 return _excludeSubjects != null && _excludeSubjects.remove(value); 449 } 450 451 /** 452 * Get the "{@literal Remarks}". 453 * 454 * <p> 455 * Additional commentary about the containing object. 456 * 457 * @return the remarks value, or {@code null} if not set 458 */ 459 @Nullable 460 public MarkupMultiline getRemarks() { 461 return _remarks; 462 } 463 464 /** 465 * Set the "{@literal Remarks}". 466 * 467 * <p> 468 * Additional commentary about the containing object. 469 * 470 * @param value 471 * the remarks value to set, or {@code null} to clear 472 */ 473 public void setRemarks(@Nullable MarkupMultiline value) { 474 _remarks = value; 475 } 476 477 @Override 478 public String toString() { 479 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 480 } 481}