001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_ssp_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.adapter.UuidAdapter;
007import dev.metaschema.core.datatype.markup.MarkupMultiline;
008import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
009import dev.metaschema.core.model.IBoundObject;
010import dev.metaschema.core.model.IMetaschemaData;
011import dev.metaschema.core.model.JsonGroupAsBehavior;
012import dev.metaschema.core.model.constraint.IConstraint;
013import dev.metaschema.core.util.ObjectUtils;
014import dev.metaschema.databind.model.annotations.AllowedValue;
015import dev.metaschema.databind.model.annotations.AllowedValues;
016import dev.metaschema.databind.model.annotations.AssemblyConstraints;
017import dev.metaschema.databind.model.annotations.BoundAssembly;
018import dev.metaschema.databind.model.annotations.BoundField;
019import dev.metaschema.databind.model.annotations.BoundFlag;
020import dev.metaschema.databind.model.annotations.GroupAs;
021import dev.metaschema.databind.model.annotations.IsUnique;
022import dev.metaschema.databind.model.annotations.KeyField;
023import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
024import dev.metaschema.databind.model.annotations.ValueConstraints;
025import edu.umd.cs.findbugs.annotations.NonNull;
026import edu.umd.cs.findbugs.annotations.Nullable;
027import java.util.LinkedList;
028import java.util.List;
029import java.util.UUID;
030import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
031import org.apache.commons.lang3.builder.ToStringStyle;
032
033/**
034 * Identifies which statements within a control are addressed.
035 */
036@MetaschemaAssembly(
037    formalName = "Specific Control Statement",
038    description = "Identifies which statements within a control are addressed.",
039    name = "statement",
040    moduleClass = OscalSspModule.class,
041    valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-statement-responsible-role-id-values", level = IConstraint.Level.ERROR, target = "responsible-role/@role-id", allowOthers = true, values = {@AllowedValue(value = "asset-owner", description = "Accountable for ensuring the asset is managed in accordance with organizational policies and procedures."), @AllowedValue(value = "asset-administrator", description = "Responsible for administering a set of assets."), @AllowedValue(value = "security-operations", description = "Members of the security operations center (SOC)."), @AllowedValue(value = "network-operations", description = "Members of the network operations center (NOC)."), @AllowedValue(value = "incident-response", description = "Responsible for responding to an event that could lead to loss of, or disruption to, an organization's operations, services or functions."), @AllowedValue(value = "help-desk", description = "Responsible for providing information and support to users."), @AllowedValue(value = "configuration-management", description = "Responsible for the configuration management processes governing changes to the asset.")})),
042    modelConstraints = @AssemblyConstraints(unique = {@IsUnique(id = "oscal-unique-ssp-statement-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once."), @IsUnique(id = "oscal-unique-ssp-implemented-requirement-statement-by-component", level = IConstraint.Level.ERROR, target = "by-component", keyFields = @KeyField(target = "@component-uuid"), remarks = "Since `by-component` can reference `component` entries using the component's uuid, each component must be referenced only once. This ensures that all implementation statements are contained in the same `by-component` entry.")})
043)
044public class Statement implements IBoundObject {
045  private final IMetaschemaData __metaschemaData;
046
047  /**
048   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>.
049   */
050  @BoundFlag(
051      formalName = "Control Statement Reference",
052      description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) identifier reference to a `control statement`.",
053      name = "statement-id",
054      required = true,
055      typeAdapter = TokenAdapter.class,
056      remarks = "A reference to the specific implemented statement associated with a control."
057  )
058  private String _statementId;
059
060  /**
061   * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).
062   */
063  @BoundFlag(
064      formalName = "Control Statement Reference Universally Unique Identifier",
065      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 control statement elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers). The *UUID* of the `control statement` in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).",
066      name = "uuid",
067      required = true,
068      typeAdapter = UuidAdapter.class
069  )
070  private UUID _uuid;
071
072  /**
073   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
074   */
075  @BoundAssembly(
076      formalName = "Property",
077      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
078      useName = "prop",
079      maxOccurs = -1,
080      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
081  )
082  private List<Property> _props;
083
084  /**
085   * A reference to a local or remote resource, that has a specific relation to the containing object.
086   */
087  @BoundAssembly(
088      formalName = "Link",
089      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
090      useName = "link",
091      maxOccurs = -1,
092      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
093  )
094  private List<Link> _links;
095
096  /**
097   * A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.
098   */
099  @BoundAssembly(
100      formalName = "Responsible Role",
101      description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.",
102      useName = "responsible-role",
103      maxOccurs = -1,
104      groupAs = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST)
105  )
106  private List<ResponsibleRole> _responsibleRoles;
107
108  /**
109   * Defines how the referenced component implements a set of controls.
110   */
111  @BoundAssembly(
112      formalName = "Component Control Implementation",
113      description = "Defines how the referenced component implements a set of controls.",
114      useName = "by-component",
115      maxOccurs = -1,
116      groupAs = @GroupAs(name = "by-components", inJson = JsonGroupAsBehavior.LIST)
117  )
118  private List<ByComponent> _byComponents;
119
120  /**
121   * Additional commentary about the containing object.
122   */
123  @BoundField(
124      formalName = "Remarks",
125      description = "Additional commentary about the containing object.",
126      useName = "remarks",
127      typeAdapter = MarkupMultilineAdapter.class
128  )
129  private MarkupMultiline _remarks;
130
131  /**
132   * Constructs a new {@code dev.metaschema.oscal.lib.model.Statement} instance with no metadata.
133   */
134  public Statement() {
135    this(null);
136  }
137
138  /**
139   * Constructs a new {@code dev.metaschema.oscal.lib.model.Statement} instance with the specified metadata.
140   *
141   * @param data
142   *           the metaschema data, or {@code null} if none
143   */
144  public Statement(IMetaschemaData data) {
145    this.__metaschemaData = data;
146  }
147
148  @Override
149  public IMetaschemaData getMetaschemaData() {
150    return __metaschemaData;
151  }
152
153  /**
154   * Get the "{@literal Control Statement Reference}".
155   *
156   * <p>
157   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>.
158   *
159   * @return the statement-id value
160   */
161  @NonNull
162  public String getStatementId() {
163    return _statementId;
164  }
165
166  /**
167   * Set the "{@literal Control Statement Reference}".
168   *
169   * <p>
170   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>.
171   *
172   * @param value
173   *           the statement-id value to set
174   */
175  public void setStatementId(@NonNull String value) {
176    _statementId = value;
177  }
178
179  /**
180   * Get the "{@literal Control Statement Reference Universally Unique Identifier}".
181   *
182   * <p>
183   * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).
184   *
185   * @return the uuid value
186   */
187  @NonNull
188  public UUID getUuid() {
189    return _uuid;
190  }
191
192  /**
193   * Set the "{@literal Control Statement Reference Universally Unique Identifier}".
194   *
195   * <p>
196   * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).
197   *
198   * @param value
199   *           the uuid value to set
200   */
201  public void setUuid(@NonNull UUID value) {
202    _uuid = value;
203  }
204
205  /**
206   * Get the "{@literal Property}".
207   *
208   * <p>
209   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
210   *
211   * @return the prop value
212   */
213  @NonNull
214  public List<Property> getProps() {
215    if (_props == null) {
216      _props = new LinkedList<>();
217    }
218    return ObjectUtils.notNull(_props);
219  }
220
221  /**
222   * Set the "{@literal Property}".
223   *
224   * <p>
225   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
226   *
227   * @param value
228   *           the prop value to set
229   */
230  public void setProps(@NonNull List<Property> value) {
231    _props = value;
232  }
233
234  /**
235   * Add a new {@link Property} item to the underlying collection.
236   * @param item the item to add
237   * @return {@code true}
238   */
239  public boolean addProp(Property item) {
240    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
241    if (_props == null) {
242      _props = new LinkedList<>();
243    }
244    return _props.add(value);
245  }
246
247  /**
248   * Remove the first matching {@link Property} item from the underlying collection.
249   * @param item the item to remove
250   * @return {@code true} if the item was removed or {@code false} otherwise
251   */
252  public boolean removeProp(Property item) {
253    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
254    return _props != null && _props.remove(value);
255  }
256
257  /**
258   * Get the "{@literal Link}".
259   *
260   * <p>
261   * A reference to a local or remote resource, that has a specific relation to the containing object.
262   *
263   * @return the link value
264   */
265  @NonNull
266  public List<Link> getLinks() {
267    if (_links == null) {
268      _links = new LinkedList<>();
269    }
270    return ObjectUtils.notNull(_links);
271  }
272
273  /**
274   * Set the "{@literal Link}".
275   *
276   * <p>
277   * A reference to a local or remote resource, that has a specific relation to the containing object.
278   *
279   * @param value
280   *           the link value to set
281   */
282  public void setLinks(@NonNull List<Link> value) {
283    _links = value;
284  }
285
286  /**
287   * Add a new {@link Link} item to the underlying collection.
288   * @param item the item to add
289   * @return {@code true}
290   */
291  public boolean addLink(Link item) {
292    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
293    if (_links == null) {
294      _links = new LinkedList<>();
295    }
296    return _links.add(value);
297  }
298
299  /**
300   * Remove the first matching {@link Link} item from the underlying collection.
301   * @param item the item to remove
302   * @return {@code true} if the item was removed or {@code false} otherwise
303   */
304  public boolean removeLink(Link item) {
305    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
306    return _links != null && _links.remove(value);
307  }
308
309  /**
310   * Get the "{@literal Responsible Role}".
311   *
312   * <p>
313   * A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.
314   *
315   * @return the responsible-role value
316   */
317  @NonNull
318  public List<ResponsibleRole> getResponsibleRoles() {
319    if (_responsibleRoles == null) {
320      _responsibleRoles = new LinkedList<>();
321    }
322    return ObjectUtils.notNull(_responsibleRoles);
323  }
324
325  /**
326   * Set the "{@literal Responsible Role}".
327   *
328   * <p>
329   * A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.
330   *
331   * @param value
332   *           the responsible-role value to set
333   */
334  public void setResponsibleRoles(@NonNull List<ResponsibleRole> value) {
335    _responsibleRoles = value;
336  }
337
338  /**
339   * Add a new {@link ResponsibleRole} item to the underlying collection.
340   * @param item the item to add
341   * @return {@code true}
342   */
343  public boolean addResponsibleRole(ResponsibleRole item) {
344    ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
345    if (_responsibleRoles == null) {
346      _responsibleRoles = new LinkedList<>();
347    }
348    return _responsibleRoles.add(value);
349  }
350
351  /**
352   * Remove the first matching {@link ResponsibleRole} item from the underlying collection.
353   * @param item the item to remove
354   * @return {@code true} if the item was removed or {@code false} otherwise
355   */
356  public boolean removeResponsibleRole(ResponsibleRole item) {
357    ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
358    return _responsibleRoles != null && _responsibleRoles.remove(value);
359  }
360
361  /**
362   * Get the "{@literal Component Control Implementation}".
363   *
364   * <p>
365   * Defines how the referenced component implements a set of controls.
366   *
367   * @return the by-component value
368   */
369  @NonNull
370  public List<ByComponent> getByComponents() {
371    if (_byComponents == null) {
372      _byComponents = new LinkedList<>();
373    }
374    return ObjectUtils.notNull(_byComponents);
375  }
376
377  /**
378   * Set the "{@literal Component Control Implementation}".
379   *
380   * <p>
381   * Defines how the referenced component implements a set of controls.
382   *
383   * @param value
384   *           the by-component value to set
385   */
386  public void setByComponents(@NonNull List<ByComponent> value) {
387    _byComponents = value;
388  }
389
390  /**
391   * Add a new {@link ByComponent} item to the underlying collection.
392   * @param item the item to add
393   * @return {@code true}
394   */
395  public boolean addByComponent(ByComponent item) {
396    ByComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
397    if (_byComponents == null) {
398      _byComponents = new LinkedList<>();
399    }
400    return _byComponents.add(value);
401  }
402
403  /**
404   * Remove the first matching {@link ByComponent} item from the underlying collection.
405   * @param item the item to remove
406   * @return {@code true} if the item was removed or {@code false} otherwise
407   */
408  public boolean removeByComponent(ByComponent item) {
409    ByComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
410    return _byComponents != null && _byComponents.remove(value);
411  }
412
413  /**
414   * Get the "{@literal Remarks}".
415   *
416   * <p>
417   * Additional commentary about the containing object.
418   *
419   * @return the remarks value, or {@code null} if not set
420   */
421  @Nullable
422  public MarkupMultiline getRemarks() {
423    return _remarks;
424  }
425
426  /**
427   * Set the "{@literal Remarks}".
428   *
429   * <p>
430   * Additional commentary about the containing object.
431   *
432   * @param value
433   *           the remarks value to set, or {@code null} to clear
434   */
435  public void setRemarks(@Nullable MarkupMultiline value) {
436    _remarks = value;
437  }
438
439  @Override
440  public String toString() {
441    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
442  }
443}