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.StringAdapter;
006import dev.metaschema.core.datatype.adapter.TokenAdapter;
007import dev.metaschema.core.datatype.markup.MarkupLine;
008import dev.metaschema.core.datatype.markup.MarkupLineAdapter;
009import dev.metaschema.core.datatype.markup.MarkupMultiline;
010import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
011import dev.metaschema.core.model.IBoundObject;
012import dev.metaschema.core.model.IMetaschemaData;
013import dev.metaschema.core.model.JsonGroupAsBehavior;
014import dev.metaschema.core.model.constraint.IConstraint;
015import dev.metaschema.core.util.ObjectUtils;
016import dev.metaschema.databind.model.annotations.AllowedValue;
017import dev.metaschema.databind.model.annotations.AllowedValues;
018import dev.metaschema.databind.model.annotations.BoundAssembly;
019import dev.metaschema.databind.model.annotations.BoundField;
020import dev.metaschema.databind.model.annotations.BoundFlag;
021import dev.metaschema.databind.model.annotations.GroupAs;
022import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
023import dev.metaschema.databind.model.annotations.ValueConstraints;
024import edu.umd.cs.findbugs.annotations.NonNull;
025import edu.umd.cs.findbugs.annotations.Nullable;
026import java.util.LinkedList;
027import java.util.List;
028import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
029import org.apache.commons.lang3.builder.ToStringStyle;
030
031/**
032 * Captures an assessor's conclusions regarding the degree to which an objective is satisfied.
033 */
034@MetaschemaAssembly(
035    formalName = "Objective Status",
036    description = "Captures an assessor's conclusions regarding the degree to which an objective is satisfied.",
037    name = "finding-target",
038    moduleClass = OscalAssessmentCommonModule.class
039)
040public class FindingTarget implements IBoundObject {
041  private final IMetaschemaData __metaschemaData;
042
043  /**
044   * Identifies the type of the target.
045   */
046  @BoundFlag(
047      formalName = "Finding Target Type",
048      description = "Identifies the type of the target.",
049      name = "type",
050      required = true,
051      typeAdapter = StringAdapter.class,
052      remarks = "The target will always be a reference to: 1) a control statement, or 2) a control objective. In the former case, there is always a single top-level statement within a control. Thus, if the entire control is targeted, this statement identifier can be used.",
053      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-finding-target-values", level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "statement-id", description = "A reference to a control statement identifier within a control."), @AllowedValue(value = "objective-id", description = "A reference to a control objective identifier within a control.")}))
054  )
055  private String _type;
056
057  /**
058   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference for a specific target qualified by the <code>type</code>.
059   */
060  @BoundFlag(
061      formalName = "Finding Target Identifier Reference",
062      description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference for a specific target qualified by the `type`.",
063      name = "target-id",
064      required = true,
065      typeAdapter = TokenAdapter.class
066  )
067  private String _targetId;
068
069  /**
070   * The title for this objective status.
071   */
072  @BoundField(
073      formalName = "Objective Status Title",
074      description = "The title for this objective status.",
075      useName = "title",
076      typeAdapter = MarkupLineAdapter.class
077  )
078  private MarkupLine _title;
079
080  /**
081   * A human-readable description of the assessor's conclusions regarding the degree to which an objective is satisfied.
082   */
083  @BoundField(
084      formalName = "Objective Status Description",
085      description = "A human-readable description of the assessor's conclusions regarding the degree to which an objective is satisfied.",
086      useName = "description",
087      typeAdapter = MarkupMultilineAdapter.class
088  )
089  private MarkupMultiline _description;
090
091  /**
092   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
093   */
094  @BoundAssembly(
095      formalName = "Property",
096      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
097      useName = "prop",
098      maxOccurs = -1,
099      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
100  )
101  private List<Property> _props;
102
103  /**
104   * A reference to a local or remote resource, that has a specific relation to the containing object.
105   */
106  @BoundAssembly(
107      formalName = "Link",
108      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
109      useName = "link",
110      maxOccurs = -1,
111      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
112  )
113  private List<Link> _links;
114
115  /**
116   * A determination of if the objective is satisfied or not within a given system.
117   */
118  @BoundAssembly(
119      formalName = "Objective Status",
120      description = "A determination of if the objective is satisfied or not within a given system.",
121      useName = "status",
122      minOccurs = 1
123  )
124  private Status _status;
125
126  /**
127   * Indicates the degree to which the a given control is implemented.
128   */
129  @BoundAssembly(
130      formalName = "Implementation Status",
131      description = "Indicates the degree to which the a given control is implemented.",
132      useName = "implementation-status",
133      remarks = "The `implementation-status` is used to qualify the `status` value to indicate the degree to which the control was found to be implemented."
134  )
135  private ImplementationStatus _implementationStatus;
136
137  /**
138   * Additional commentary about the containing object.
139   */
140  @BoundField(
141      formalName = "Remarks",
142      description = "Additional commentary about the containing object.",
143      useName = "remarks",
144      typeAdapter = MarkupMultilineAdapter.class
145  )
146  private MarkupMultiline _remarks;
147
148  /**
149   * Constructs a new {@code dev.metaschema.oscal.lib.model.FindingTarget} instance with no metadata.
150   */
151  public FindingTarget() {
152    this(null);
153  }
154
155  /**
156   * Constructs a new {@code dev.metaschema.oscal.lib.model.FindingTarget} instance with the specified metadata.
157   *
158   * @param data
159   *           the metaschema data, or {@code null} if none
160   */
161  public FindingTarget(IMetaschemaData data) {
162    this.__metaschemaData = data;
163  }
164
165  @Override
166  public IMetaschemaData getMetaschemaData() {
167    return __metaschemaData;
168  }
169
170  /**
171   * Get the "{@literal Finding Target Type}".
172   *
173   * <p>
174   * Identifies the type of the target.
175   *
176   * @return the type value
177   */
178  @NonNull
179  public String getType() {
180    return _type;
181  }
182
183  /**
184   * Set the "{@literal Finding Target Type}".
185   *
186   * <p>
187   * Identifies the type of the target.
188   *
189   * @param value
190   *           the type value to set
191   */
192  public void setType(@NonNull String value) {
193    _type = value;
194  }
195
196  /**
197   * Get the "{@literal Finding Target Identifier Reference}".
198   *
199   * <p>
200   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference for a specific target qualified by the <code>type</code>.
201   *
202   * @return the target-id value
203   */
204  @NonNull
205  public String getTargetId() {
206    return _targetId;
207  }
208
209  /**
210   * Set the "{@literal Finding Target Identifier Reference}".
211   *
212   * <p>
213   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference for a specific target qualified by the <code>type</code>.
214   *
215   * @param value
216   *           the target-id value to set
217   */
218  public void setTargetId(@NonNull String value) {
219    _targetId = value;
220  }
221
222  /**
223   * Get the "{@literal Objective Status Title}".
224   *
225   * <p>
226   * The title for this objective status.
227   *
228   * @return the title value, or {@code null} if not set
229   */
230  @Nullable
231  public MarkupLine getTitle() {
232    return _title;
233  }
234
235  /**
236   * Set the "{@literal Objective Status Title}".
237   *
238   * <p>
239   * The title for this objective status.
240   *
241   * @param value
242   *           the title value to set, or {@code null} to clear
243   */
244  public void setTitle(@Nullable MarkupLine value) {
245    _title = value;
246  }
247
248  /**
249   * Get the "{@literal Objective Status Description}".
250   *
251   * <p>
252   * A human-readable description of the assessor's conclusions regarding the degree to which an objective is satisfied.
253   *
254   * @return the description value, or {@code null} if not set
255   */
256  @Nullable
257  public MarkupMultiline getDescription() {
258    return _description;
259  }
260
261  /**
262   * Set the "{@literal Objective Status Description}".
263   *
264   * <p>
265   * A human-readable description of the assessor's conclusions regarding the degree to which an objective is satisfied.
266   *
267   * @param value
268   *           the description value to set, or {@code null} to clear
269   */
270  public void setDescription(@Nullable MarkupMultiline value) {
271    _description = value;
272  }
273
274  /**
275   * Get the "{@literal Property}".
276   *
277   * <p>
278   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
279   *
280   * @return the prop value
281   */
282  @NonNull
283  public List<Property> getProps() {
284    if (_props == null) {
285      _props = new LinkedList<>();
286    }
287    return ObjectUtils.notNull(_props);
288  }
289
290  /**
291   * Set the "{@literal Property}".
292   *
293   * <p>
294   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
295   *
296   * @param value
297   *           the prop value to set
298   */
299  public void setProps(@NonNull List<Property> value) {
300    _props = value;
301  }
302
303  /**
304   * Add a new {@link Property} item to the underlying collection.
305   * @param item the item to add
306   * @return {@code true}
307   */
308  public boolean addProp(Property item) {
309    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
310    if (_props == null) {
311      _props = new LinkedList<>();
312    }
313    return _props.add(value);
314  }
315
316  /**
317   * Remove the first matching {@link Property} item from the underlying collection.
318   * @param item the item to remove
319   * @return {@code true} if the item was removed or {@code false} otherwise
320   */
321  public boolean removeProp(Property item) {
322    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
323    return _props != null && _props.remove(value);
324  }
325
326  /**
327   * Get the "{@literal Link}".
328   *
329   * <p>
330   * A reference to a local or remote resource, that has a specific relation to the containing object.
331   *
332   * @return the link value
333   */
334  @NonNull
335  public List<Link> getLinks() {
336    if (_links == null) {
337      _links = new LinkedList<>();
338    }
339    return ObjectUtils.notNull(_links);
340  }
341
342  /**
343   * Set the "{@literal Link}".
344   *
345   * <p>
346   * A reference to a local or remote resource, that has a specific relation to the containing object.
347   *
348   * @param value
349   *           the link value to set
350   */
351  public void setLinks(@NonNull List<Link> value) {
352    _links = value;
353  }
354
355  /**
356   * Add a new {@link Link} item to the underlying collection.
357   * @param item the item to add
358   * @return {@code true}
359   */
360  public boolean addLink(Link item) {
361    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
362    if (_links == null) {
363      _links = new LinkedList<>();
364    }
365    return _links.add(value);
366  }
367
368  /**
369   * Remove the first matching {@link Link} item from the underlying collection.
370   * @param item the item to remove
371   * @return {@code true} if the item was removed or {@code false} otherwise
372   */
373  public boolean removeLink(Link item) {
374    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
375    return _links != null && _links.remove(value);
376  }
377
378  /**
379   * Get the "{@literal Objective Status}".
380   *
381   * <p>
382   * A determination of if the objective is satisfied or not within a given system.
383   *
384   * @return the status value
385   */
386  @NonNull
387  public Status getStatus() {
388    return _status;
389  }
390
391  /**
392   * Set the "{@literal Objective Status}".
393   *
394   * <p>
395   * A determination of if the objective is satisfied or not within a given system.
396   *
397   * @param value
398   *           the status value to set
399   */
400  public void setStatus(@NonNull Status value) {
401    _status = value;
402  }
403
404  /**
405   * Get the "{@literal Implementation Status}".
406   *
407   * <p>
408   * Indicates the degree to which the a given control is implemented.
409   *
410   * @return the implementation-status value, or {@code null} if not set
411   */
412  @Nullable
413  public ImplementationStatus getImplementationStatus() {
414    return _implementationStatus;
415  }
416
417  /**
418   * Set the "{@literal Implementation Status}".
419   *
420   * <p>
421   * Indicates the degree to which the a given control is implemented.
422   *
423   * @param value
424   *           the implementation-status value to set, or {@code null} to clear
425   */
426  public void setImplementationStatus(@Nullable ImplementationStatus value) {
427    _implementationStatus = value;
428  }
429
430  /**
431   * Get the "{@literal Remarks}".
432   *
433   * <p>
434   * Additional commentary about the containing object.
435   *
436   * @return the remarks value, or {@code null} if not set
437   */
438  @Nullable
439  public MarkupMultiline getRemarks() {
440    return _remarks;
441  }
442
443  /**
444   * Set the "{@literal Remarks}".
445   *
446   * <p>
447   * Additional commentary about the containing object.
448   *
449   * @param value
450   *           the remarks value to set, or {@code null} to clear
451   */
452  public void setRemarks(@Nullable MarkupMultiline value) {
453    _remarks = value;
454  }
455
456  @Override
457  public String toString() {
458    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
459  }
460
461  /**
462   * A determination of if the objective is satisfied or not within a given system.
463   */
464  @MetaschemaAssembly(
465      formalName = "Objective Status",
466      description = "A determination of if the objective is satisfied or not within a given system.",
467      name = "status",
468      moduleClass = OscalAssessmentCommonModule.class
469  )
470  public static class Status implements IBoundObject {
471    private final IMetaschemaData __metaschemaData;
472
473    /**
474     * An indication as to whether the objective is satisfied or not.
475     */
476    @BoundFlag(
477        formalName = "Objective Status State",
478        description = "An indication as to whether the objective is satisfied or not.",
479        name = "state",
480        required = true,
481        typeAdapter = TokenAdapter.class,
482        valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-finding-target-status-state-values", level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "satisfied", description = "The objective has been completely satisfied."), @AllowedValue(value = "not-satisfied", description = "The objective has not been completely satisfied, but may be partially satisfied.")}))
483    )
484    private String _state;
485
486    /**
487     * The reason the objective was given it's status.
488     */
489    @BoundFlag(
490        formalName = "Objective Status Reason",
491        description = "The reason the objective was given it's status.",
492        name = "reason",
493        typeAdapter = TokenAdapter.class,
494        remarks = "Reason may contain any value, and should be used to communicate additional information regarding the status.",
495        valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-finding-target-reason-values", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "pass", description = "The target system or system component satisfied all the conditions."), @AllowedValue(value = "fail", description = "The target system or system component did not satisfy all the conditions."), @AllowedValue(value = "other", description = "Some other event took place that is not a pass or a fail.")}))
496    )
497    private String _reason;
498
499    /**
500     * Additional commentary about the containing object.
501     */
502    @BoundField(
503        formalName = "Remarks",
504        description = "Additional commentary about the containing object.",
505        useName = "remarks",
506        typeAdapter = MarkupMultilineAdapter.class
507    )
508    private MarkupMultiline _remarks;
509
510    /**
511     * Constructs a new {@code dev.metaschema.oscal.lib.model.FindingTarget.Status} instance with no metadata.
512     */
513    public Status() {
514      this(null);
515    }
516
517    /**
518     * Constructs a new {@code dev.metaschema.oscal.lib.model.FindingTarget.Status} instance with the specified metadata.
519     *
520     * @param data
521     *           the metaschema data, or {@code null} if none
522     */
523    public Status(IMetaschemaData data) {
524      this.__metaschemaData = data;
525    }
526
527    @Override
528    public IMetaschemaData getMetaschemaData() {
529      return __metaschemaData;
530    }
531
532    /**
533     * Get the "{@literal Objective Status State}".
534     *
535     * <p>
536     * An indication as to whether the objective is satisfied or not.
537     *
538     * @return the state value
539     */
540    @NonNull
541    public String getState() {
542      return _state;
543    }
544
545    /**
546     * Set the "{@literal Objective Status State}".
547     *
548     * <p>
549     * An indication as to whether the objective is satisfied or not.
550     *
551     * @param value
552     *           the state value to set
553     */
554    public void setState(@NonNull String value) {
555      _state = value;
556    }
557
558    /**
559     * Get the "{@literal Objective Status Reason}".
560     *
561     * <p>
562     * The reason the objective was given it's status.
563     *
564     * @return the reason value, or {@code null} if not set
565     */
566    @Nullable
567    public String getReason() {
568      return _reason;
569    }
570
571    /**
572     * Set the "{@literal Objective Status Reason}".
573     *
574     * <p>
575     * The reason the objective was given it's status.
576     *
577     * @param value
578     *           the reason value to set, or {@code null} to clear
579     */
580    public void setReason(@Nullable String value) {
581      _reason = value;
582    }
583
584    /**
585     * Get the "{@literal Remarks}".
586     *
587     * <p>
588     * Additional commentary about the containing object.
589     *
590     * @return the remarks value, or {@code null} if not set
591     */
592    @Nullable
593    public MarkupMultiline getRemarks() {
594      return _remarks;
595    }
596
597    /**
598     * Set the "{@literal Remarks}".
599     *
600     * <p>
601     * Additional commentary about the containing object.
602     *
603     * @param value
604     *           the remarks value to set, or {@code null} to clear
605     */
606    public void setRemarks(@Nullable MarkupMultiline value) {
607      _remarks = value;
608    }
609
610    @Override
611    public String toString() {
612      return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
613    }
614  }
615}