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 * Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.
025 */
026@MetaschemaAssembly(
027    formalName = "Assessment Subject Placeholder",
028    description = "Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.",
029    name = "assessment-subject-placeholder",
030    moduleClass = OscalAssessmentCommonModule.class
031)
032public class AssessmentSubjectPlaceholder 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 for a set of assessment subjects that will be identified by a task or an activity that is part of a task. The locally defined <em>UUID</em> of the <code>assessment subject placeholder</code> can be used to reference the data item locally or globally (e.g., in an <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope\">imported OSCAL instance</a>). 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 Subject Placeholder 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 for a set of assessment subjects that will be identified by a task or an activity that is part of a task. The locally defined *UUID* of the `assessment subject placeholder` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). 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 Subject Placeholder Description",
049      description = "A human-readable description of intent of this assessment subject placeholder.",
050      useName = "description",
051      typeAdapter = MarkupMultilineAdapter.class
052  )
053  private MarkupMultiline _description;
054
055  @BoundAssembly(
056      formalName = "Assessment Subject Source",
057      description = "Assessment subjects will be identified while conducting the referenced activity-instance.",
058      useName = "source",
059      minOccurs = 1,
060      maxOccurs = -1,
061      groupAs = @GroupAs(name = "sources", inJson = JsonGroupAsBehavior.LIST)
062  )
063  private List<Source> _sources;
064
065  @BoundAssembly(
066      formalName = "Property",
067      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
068      useName = "prop",
069      maxOccurs = -1,
070      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
071  )
072  private List<Property> _props;
073
074  @BoundAssembly(
075      formalName = "Link",
076      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
077      useName = "link",
078      maxOccurs = -1,
079      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
080  )
081  private List<Link> _links;
082
083  @BoundField(
084      formalName = "Remarks",
085      description = "Additional commentary about the containing object.",
086      useName = "remarks",
087      typeAdapter = MarkupMultilineAdapter.class
088  )
089  private MarkupMultiline _remarks;
090
091  public AssessmentSubjectPlaceholder() {
092    this(null);
093  }
094
095  public AssessmentSubjectPlaceholder(IMetaschemaData data) {
096    this.__metaschemaData = data;
097  }
098
099  @Override
100  public IMetaschemaData getMetaschemaData() {
101    return __metaschemaData;
102  }
103
104  public UUID getUuid() {
105    return _uuid;
106  }
107
108  public void setUuid(UUID value) {
109    _uuid = value;
110  }
111
112  public MarkupMultiline getDescription() {
113    return _description;
114  }
115
116  public void setDescription(MarkupMultiline value) {
117    _description = value;
118  }
119
120  public List<Source> getSources() {
121    return _sources;
122  }
123
124  public void setSources(List<Source> value) {
125    _sources = value;
126  }
127
128  /**
129   * Add a new {@link Source} item to the underlying collection.
130   * @param item the item to add
131   * @return {@code true}
132   */
133  public boolean addSource(Source item) {
134    Source value = ObjectUtils.requireNonNull(item,"item cannot be null");
135    if (_sources == null) {
136      _sources = new LinkedList<>();
137    }
138    return _sources.add(value);
139  }
140
141  /**
142   * Remove the first matching {@link Source} item from the underlying collection.
143   * @param item the item to remove
144   * @return {@code true} if the item was removed or {@code false} otherwise
145   */
146  public boolean removeSource(Source item) {
147    Source value = ObjectUtils.requireNonNull(item,"item cannot be null");
148    return _sources != null && _sources.remove(value);
149  }
150
151  public List<Property> getProps() {
152    return _props;
153  }
154
155  public void setProps(List<Property> value) {
156    _props = value;
157  }
158
159  /**
160   * Add a new {@link Property} item to the underlying collection.
161   * @param item the item to add
162   * @return {@code true}
163   */
164  public boolean addProp(Property item) {
165    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
166    if (_props == null) {
167      _props = new LinkedList<>();
168    }
169    return _props.add(value);
170  }
171
172  /**
173   * Remove the first matching {@link Property} item from the underlying collection.
174   * @param item the item to remove
175   * @return {@code true} if the item was removed or {@code false} otherwise
176   */
177  public boolean removeProp(Property item) {
178    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
179    return _props != null && _props.remove(value);
180  }
181
182  public List<Link> getLinks() {
183    return _links;
184  }
185
186  public void setLinks(List<Link> value) {
187    _links = value;
188  }
189
190  /**
191   * Add a new {@link Link} item to the underlying collection.
192   * @param item the item to add
193   * @return {@code true}
194   */
195  public boolean addLink(Link item) {
196    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
197    if (_links == null) {
198      _links = new LinkedList<>();
199    }
200    return _links.add(value);
201  }
202
203  /**
204   * Remove the first matching {@link Link} item from the underlying collection.
205   * @param item the item to remove
206   * @return {@code true} if the item was removed or {@code false} otherwise
207   */
208  public boolean removeLink(Link item) {
209    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
210    return _links != null && _links.remove(value);
211  }
212
213  public MarkupMultiline getRemarks() {
214    return _remarks;
215  }
216
217  public void setRemarks(MarkupMultiline value) {
218    _remarks = value;
219  }
220
221  @Override
222  public String toString() {
223    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
224  }
225
226  /**
227   * Assessment subjects will be identified while conducting the referenced activity-instance.
228   */
229  @MetaschemaAssembly(
230      formalName = "Assessment Subject Source",
231      description = "Assessment subjects will be identified while conducting the referenced activity-instance.",
232      name = "source",
233      moduleClass = OscalAssessmentCommonModule.class
234  )
235  public static class Source implements IBoundObject {
236    private final IMetaschemaData __metaschemaData;
237
238    /**
239     * "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 (in this or other OSCAL instances) an assessment activity to be performed as part of the event. The locally defined <em>UUID</em> of the <code>task</code> can be used to reference the data item locally or globally (e.g., in an <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope\">imported OSCAL instance</a>). This UUID should be assigned <em>per-subject</em>, which means it should be consistently used to identify the same subject across revisions of the document."
240     */
241    @BoundFlag(
242        formalName = "Task Universally Unique Identifier",
243        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 (in this or other OSCAL instances) an assessment activity to be performed as part of the event. The locally defined *UUID* of the `task` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). This UUID should be assigned *per-subject*, which means it should be consistently used to identify the same subject across revisions of the document.",
244        name = "task-uuid",
245        required = true,
246        typeAdapter = UuidAdapter.class
247    )
248    private UUID _taskUuid;
249
250    public Source() {
251      this(null);
252    }
253
254    public Source(IMetaschemaData data) {
255      this.__metaschemaData = data;
256    }
257
258    @Override
259    public IMetaschemaData getMetaschemaData() {
260      return __metaschemaData;
261    }
262
263    public UUID getTaskUuid() {
264      return _taskUuid;
265    }
266
267    public void setTaskUuid(UUID value) {
268      _taskUuid = value;
269    }
270
271    @Override
272    public String toString() {
273      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
274    }
275  }
276}