001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter;
004import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
005import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter;
006import gov.nist.secauto.metaschema.core.model.IBoundObject;
007import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
008import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
009import gov.nist.secauto.metaschema.core.util.ObjectUtils;
010import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
011import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
012import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
013import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
014import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
015import java.lang.Override;
016import java.lang.String;
017import java.util.LinkedList;
018import java.util.List;
019import java.util.UUID;
020import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
021import org.apache.commons.lang3.builder.ToStringStyle;
022
023/**
024 * A local definition of a control objective. Uses catalog syntax for control objective and assessment activities.
025 */
026@MetaschemaAssembly(
027    formalName = "Assessment Method",
028    description = "A local definition of a control objective. Uses catalog syntax for control objective and assessment activities.",
029    name = "assessment-method",
030    moduleClass = OscalAssessmentCommonModule.class
031)
032public class AssessmentMethod implements IBoundObject {
033  private final IMetaschemaData __metaschemaData;
034
035  /**
036   * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a>, <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique\">globally unique</a> identifier with <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance\">cross-instance</a> scope that can be used to reference this assessment method elsewhere in <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope\">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>assessment method</code> can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency\">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document."
037   */
038  @BoundFlag(
039      formalName = "Assessment Method Universally Unique Identifier",
040      description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this assessment method elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `assessment method` can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.",
041      name = "uuid",
042      required = true,
043      typeAdapter = UuidAdapter.class
044  )
045  private UUID _uuid;
046
047  @BoundField(
048      formalName = "Assessment Method Description",
049      description = "A human-readable description of this assessment method.",
050      useName = "description",
051      typeAdapter = MarkupMultilineAdapter.class
052  )
053  private MarkupMultiline _description;
054
055  @BoundAssembly(
056      formalName = "Property",
057      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
058      useName = "prop",
059      maxOccurs = -1,
060      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
061  )
062  private List<Property> _props;
063
064  @BoundAssembly(
065      formalName = "Link",
066      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
067      useName = "link",
068      maxOccurs = -1,
069      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
070  )
071  private List<Link> _links;
072
073  @BoundAssembly(
074      formalName = "Assessment Part",
075      description = "A partition of an assessment plan or results or a child of another part.",
076      useName = "part",
077      minOccurs = 1
078  )
079  private AssessmentPart _part;
080
081  @BoundField(
082      formalName = "Remarks",
083      description = "Additional commentary about the containing object.",
084      useName = "remarks",
085      typeAdapter = MarkupMultilineAdapter.class
086  )
087  private MarkupMultiline _remarks;
088
089  public AssessmentMethod() {
090    this(null);
091  }
092
093  public AssessmentMethod(IMetaschemaData data) {
094    this.__metaschemaData = data;
095  }
096
097  @Override
098  public IMetaschemaData getMetaschemaData() {
099    return __metaschemaData;
100  }
101
102  public UUID getUuid() {
103    return _uuid;
104  }
105
106  public void setUuid(UUID value) {
107    _uuid = value;
108  }
109
110  public MarkupMultiline getDescription() {
111    return _description;
112  }
113
114  public void setDescription(MarkupMultiline value) {
115    _description = value;
116  }
117
118  public List<Property> getProps() {
119    return _props;
120  }
121
122  public void setProps(List<Property> value) {
123    _props = value;
124  }
125
126  /**
127   * Add a new {@link Property} item to the underlying collection.
128   * @param item the item to add
129   * @return {@code true}
130   */
131  public boolean addProp(Property item) {
132    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
133    if (_props == null) {
134      _props = new LinkedList<>();
135    }
136    return _props.add(value);
137  }
138
139  /**
140   * Remove the first matching {@link Property} item from the underlying collection.
141   * @param item the item to remove
142   * @return {@code true} if the item was removed or {@code false} otherwise
143   */
144  public boolean removeProp(Property item) {
145    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
146    return _props != null && _props.remove(value);
147  }
148
149  public List<Link> getLinks() {
150    return _links;
151  }
152
153  public void setLinks(List<Link> value) {
154    _links = value;
155  }
156
157  /**
158   * Add a new {@link Link} item to the underlying collection.
159   * @param item the item to add
160   * @return {@code true}
161   */
162  public boolean addLink(Link item) {
163    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
164    if (_links == null) {
165      _links = new LinkedList<>();
166    }
167    return _links.add(value);
168  }
169
170  /**
171   * Remove the first matching {@link Link} item from the underlying collection.
172   * @param item the item to remove
173   * @return {@code true} if the item was removed or {@code false} otherwise
174   */
175  public boolean removeLink(Link item) {
176    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
177    return _links != null && _links.remove(value);
178  }
179
180  public AssessmentPart getPart() {
181    return _part;
182  }
183
184  public void setPart(AssessmentPart value) {
185    _part = value;
186  }
187
188  public MarkupMultiline getRemarks() {
189    return _remarks;
190  }
191
192  public void setRemarks(MarkupMultiline value) {
193    _remarks = value;
194  }
195
196  @Override
197  public String toString() {
198    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
199  }
200}