001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_component_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.AssemblyConstraints;
015import dev.metaschema.databind.model.annotations.BoundAssembly;
016import dev.metaschema.databind.model.annotations.BoundField;
017import dev.metaschema.databind.model.annotations.BoundFlag;
018import dev.metaschema.databind.model.annotations.GroupAs;
019import dev.metaschema.databind.model.annotations.IsUnique;
020import dev.metaschema.databind.model.annotations.KeyField;
021import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
022import edu.umd.cs.findbugs.annotations.NonNull;
023import edu.umd.cs.findbugs.annotations.Nullable;
024import java.util.LinkedList;
025import java.util.List;
026import java.util.UUID;
027import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
028import org.apache.commons.lang3.builder.ToStringStyle;
029
030/**
031 * Describes how the containing component or capability implements an individual control.
032 */
033@MetaschemaAssembly(
034    formalName = "Control Implementation",
035    description = "Describes how the containing component or capability implements an individual control.",
036    name = "implemented-requirement",
037    moduleClass = OscalComponentDefinitionModule.class,
038    remarks = "Implemented requirements within a component or capability in a component definition provide a means for component suppliers to suggest possible control implementation details, which may be used by a different party (e.g., component consumers) when authoring a system security plan. Thus, these requirements defined in a component definition are only a suggestion of how to implement, which may be adopted wholesale, changed, or ignored by a person defining an information system implementation.\n"
039            + "\n"
040            + "Use of `set-parameter` in this context, sets the parameter for the referenced control and any associated statements.",
041    modelConstraints = @AssemblyConstraints(unique = {@IsUnique(id = "oscal-unique-component-definition-implemented-requirement-set-parameter", level = IConstraint.Level.ERROR, target = "set-parameter", keyFields = @KeyField(target = "@param-id"), remarks = "Since multiple `set-parameter` entries can be provided, each parameter must be set only once."), @IsUnique(id = "oscal-unique-component-definition-implemented-requirement-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-component-definition-implemented-requirement-statement", level = IConstraint.Level.ERROR, target = "statement", keyFields = @KeyField(target = "@statement-id"), remarks = "Since `statement` entries can be referenced using the statement's statement-id, each statement must be referenced only once.")})
042)
043public class ComponentImplementedRequirement implements IBoundObject {
044  private final IMetaschemaData __metaschemaData;
045
046  /**
047   * Provides a globally unique means to identify a given control implementation by a component.
048   */
049  @BoundFlag(
050      formalName = "Control Implementation Identifier",
051      description = "Provides a globally unique means to identify a given control implementation by a component.",
052      name = "uuid",
053      required = true,
054      typeAdapter = UuidAdapter.class
055  )
056  private UUID _uuid;
057
058  /**
059   * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).
060   */
061  @BoundFlag(
062      formalName = "Control Identifier Reference",
063      description = "A reference to a control with a corresponding `id` value. When referencing an externally defined `control`, the `Control Identifier Reference` must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).",
064      name = "control-id",
065      required = true,
066      typeAdapter = TokenAdapter.class
067  )
068  private String _controlId;
069
070  /**
071   * A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan.
072   */
073  @BoundField(
074      formalName = "Control Implementation Description",
075      description = "A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan.",
076      useName = "description",
077      minOccurs = 1,
078      typeAdapter = MarkupMultilineAdapter.class
079  )
080  private MarkupMultiline _description;
081
082  /**
083   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
084   */
085  @BoundAssembly(
086      formalName = "Property",
087      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
088      useName = "prop",
089      maxOccurs = -1,
090      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
091  )
092  private List<Property> _props;
093
094  /**
095   * A reference to a local or remote resource, that has a specific relation to the containing object.
096   */
097  @BoundAssembly(
098      formalName = "Link",
099      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
100      useName = "link",
101      maxOccurs = -1,
102      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
103  )
104  private List<Link> _links;
105
106  /**
107   * Identifies the parameter that will be set by the enclosed value.
108   */
109  @BoundAssembly(
110      formalName = "Set Parameter Value",
111      description = "Identifies the parameter that will be set by the enclosed value.",
112      useName = "set-parameter",
113      maxOccurs = -1,
114      groupAs = @GroupAs(name = "set-parameters", inJson = JsonGroupAsBehavior.LIST)
115  )
116  private List<SetParameter> _setParameters;
117
118  /**
119   * 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.
120   */
121  @BoundAssembly(
122      formalName = "Responsible Role",
123      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.",
124      useName = "responsible-role",
125      maxOccurs = -1,
126      groupAs = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST)
127  )
128  private List<ResponsibleRole> _responsibleRoles;
129
130  /**
131   * Identifies which statements within a control are addressed.
132   */
133  @BoundAssembly(
134      formalName = "Control Statement Implementation",
135      description = "Identifies which statements within a control are addressed.",
136      useName = "statement",
137      maxOccurs = -1,
138      groupAs = @GroupAs(name = "statements", inJson = JsonGroupAsBehavior.LIST)
139  )
140  private List<ComponentStatement> _statements;
141
142  /**
143   * Additional commentary about the containing object.
144   */
145  @BoundField(
146      formalName = "Remarks",
147      description = "Additional commentary about the containing object.",
148      useName = "remarks",
149      typeAdapter = MarkupMultilineAdapter.class
150  )
151  private MarkupMultiline _remarks;
152
153  /**
154   * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentImplementedRequirement} instance with no metadata.
155   */
156  public ComponentImplementedRequirement() {
157    this(null);
158  }
159
160  /**
161   * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentImplementedRequirement} instance with the specified metadata.
162   *
163   * @param data
164   *           the metaschema data, or {@code null} if none
165   */
166  public ComponentImplementedRequirement(IMetaschemaData data) {
167    this.__metaschemaData = data;
168  }
169
170  @Override
171  public IMetaschemaData getMetaschemaData() {
172    return __metaschemaData;
173  }
174
175  /**
176   * Get the "{@literal Control Implementation Identifier}".
177   *
178   * <p>
179   * Provides a globally unique means to identify a given control implementation by a component.
180   *
181   * @return the uuid value
182   */
183  @NonNull
184  public UUID getUuid() {
185    return _uuid;
186  }
187
188  /**
189   * Set the "{@literal Control Implementation Identifier}".
190   *
191   * <p>
192   * Provides a globally unique means to identify a given control implementation by a component.
193   *
194   * @param value
195   *           the uuid value to set
196   */
197  public void setUuid(@NonNull UUID value) {
198    _uuid = value;
199  }
200
201  /**
202   * Get the "{@literal Control Identifier Reference}".
203   *
204   * <p>
205   * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).
206   *
207   * @return the control-id value
208   */
209  @NonNull
210  public String getControlId() {
211    return _controlId;
212  }
213
214  /**
215   * Set the "{@literal Control Identifier Reference}".
216   *
217   * <p>
218   * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).
219   *
220   * @param value
221   *           the control-id value to set
222   */
223  public void setControlId(@NonNull String value) {
224    _controlId = value;
225  }
226
227  /**
228   * Get the "{@literal Control Implementation Description}".
229   *
230   * <p>
231   * A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan.
232   *
233   * @return the description value
234   */
235  @NonNull
236  public MarkupMultiline getDescription() {
237    return _description;
238  }
239
240  /**
241   * Set the "{@literal Control Implementation Description}".
242   *
243   * <p>
244   * A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan.
245   *
246   * @param value
247   *           the description value to set
248   */
249  public void setDescription(@NonNull MarkupMultiline value) {
250    _description = value;
251  }
252
253  /**
254   * Get the "{@literal Property}".
255   *
256   * <p>
257   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
258   *
259   * @return the prop value
260   */
261  @NonNull
262  public List<Property> getProps() {
263    if (_props == null) {
264      _props = new LinkedList<>();
265    }
266    return ObjectUtils.notNull(_props);
267  }
268
269  /**
270   * Set the "{@literal Property}".
271   *
272   * <p>
273   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
274   *
275   * @param value
276   *           the prop value to set
277   */
278  public void setProps(@NonNull List<Property> value) {
279    _props = value;
280  }
281
282  /**
283   * Add a new {@link Property} item to the underlying collection.
284   * @param item the item to add
285   * @return {@code true}
286   */
287  public boolean addProp(Property item) {
288    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
289    if (_props == null) {
290      _props = new LinkedList<>();
291    }
292    return _props.add(value);
293  }
294
295  /**
296   * Remove the first matching {@link Property} item from the underlying collection.
297   * @param item the item to remove
298   * @return {@code true} if the item was removed or {@code false} otherwise
299   */
300  public boolean removeProp(Property item) {
301    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
302    return _props != null && _props.remove(value);
303  }
304
305  /**
306   * Get the "{@literal Link}".
307   *
308   * <p>
309   * A reference to a local or remote resource, that has a specific relation to the containing object.
310   *
311   * @return the link value
312   */
313  @NonNull
314  public List<Link> getLinks() {
315    if (_links == null) {
316      _links = new LinkedList<>();
317    }
318    return ObjectUtils.notNull(_links);
319  }
320
321  /**
322   * Set the "{@literal Link}".
323   *
324   * <p>
325   * A reference to a local or remote resource, that has a specific relation to the containing object.
326   *
327   * @param value
328   *           the link value to set
329   */
330  public void setLinks(@NonNull List<Link> value) {
331    _links = value;
332  }
333
334  /**
335   * Add a new {@link Link} item to the underlying collection.
336   * @param item the item to add
337   * @return {@code true}
338   */
339  public boolean addLink(Link item) {
340    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
341    if (_links == null) {
342      _links = new LinkedList<>();
343    }
344    return _links.add(value);
345  }
346
347  /**
348   * Remove the first matching {@link Link} item from the underlying collection.
349   * @param item the item to remove
350   * @return {@code true} if the item was removed or {@code false} otherwise
351   */
352  public boolean removeLink(Link item) {
353    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
354    return _links != null && _links.remove(value);
355  }
356
357  /**
358   * Get the "{@literal Set Parameter Value}".
359   *
360   * <p>
361   * Identifies the parameter that will be set by the enclosed value.
362   *
363   * @return the set-parameter value
364   */
365  @NonNull
366  public List<SetParameter> getSetParameters() {
367    if (_setParameters == null) {
368      _setParameters = new LinkedList<>();
369    }
370    return ObjectUtils.notNull(_setParameters);
371  }
372
373  /**
374   * Set the "{@literal Set Parameter Value}".
375   *
376   * <p>
377   * Identifies the parameter that will be set by the enclosed value.
378   *
379   * @param value
380   *           the set-parameter value to set
381   */
382  public void setSetParameters(@NonNull List<SetParameter> value) {
383    _setParameters = value;
384  }
385
386  /**
387   * Add a new {@link SetParameter} item to the underlying collection.
388   * @param item the item to add
389   * @return {@code true}
390   */
391  public boolean addSetParameter(SetParameter item) {
392    SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
393    if (_setParameters == null) {
394      _setParameters = new LinkedList<>();
395    }
396    return _setParameters.add(value);
397  }
398
399  /**
400   * Remove the first matching {@link SetParameter} item from the underlying collection.
401   * @param item the item to remove
402   * @return {@code true} if the item was removed or {@code false} otherwise
403   */
404  public boolean removeSetParameter(SetParameter item) {
405    SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
406    return _setParameters != null && _setParameters.remove(value);
407  }
408
409  /**
410   * Get the "{@literal Responsible Role}".
411   *
412   * <p>
413   * 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.
414   *
415   * @return the responsible-role value
416   */
417  @NonNull
418  public List<ResponsibleRole> getResponsibleRoles() {
419    if (_responsibleRoles == null) {
420      _responsibleRoles = new LinkedList<>();
421    }
422    return ObjectUtils.notNull(_responsibleRoles);
423  }
424
425  /**
426   * Set the "{@literal Responsible Role}".
427   *
428   * <p>
429   * 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.
430   *
431   * @param value
432   *           the responsible-role value to set
433   */
434  public void setResponsibleRoles(@NonNull List<ResponsibleRole> value) {
435    _responsibleRoles = value;
436  }
437
438  /**
439   * Add a new {@link ResponsibleRole} item to the underlying collection.
440   * @param item the item to add
441   * @return {@code true}
442   */
443  public boolean addResponsibleRole(ResponsibleRole item) {
444    ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
445    if (_responsibleRoles == null) {
446      _responsibleRoles = new LinkedList<>();
447    }
448    return _responsibleRoles.add(value);
449  }
450
451  /**
452   * Remove the first matching {@link ResponsibleRole} item from the underlying collection.
453   * @param item the item to remove
454   * @return {@code true} if the item was removed or {@code false} otherwise
455   */
456  public boolean removeResponsibleRole(ResponsibleRole item) {
457    ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
458    return _responsibleRoles != null && _responsibleRoles.remove(value);
459  }
460
461  /**
462   * Get the "{@literal Control Statement Implementation}".
463   *
464   * <p>
465   * Identifies which statements within a control are addressed.
466   *
467   * @return the statement value
468   */
469  @NonNull
470  public List<ComponentStatement> getStatements() {
471    if (_statements == null) {
472      _statements = new LinkedList<>();
473    }
474    return ObjectUtils.notNull(_statements);
475  }
476
477  /**
478   * Set the "{@literal Control Statement Implementation}".
479   *
480   * <p>
481   * Identifies which statements within a control are addressed.
482   *
483   * @param value
484   *           the statement value to set
485   */
486  public void setStatements(@NonNull List<ComponentStatement> value) {
487    _statements = value;
488  }
489
490  /**
491   * Add a new {@link ComponentStatement} item to the underlying collection.
492   * @param item the item to add
493   * @return {@code true}
494   */
495  public boolean addStatement(ComponentStatement item) {
496    ComponentStatement value = ObjectUtils.requireNonNull(item,"item cannot be null");
497    if (_statements == null) {
498      _statements = new LinkedList<>();
499    }
500    return _statements.add(value);
501  }
502
503  /**
504   * Remove the first matching {@link ComponentStatement} item from the underlying collection.
505   * @param item the item to remove
506   * @return {@code true} if the item was removed or {@code false} otherwise
507   */
508  public boolean removeStatement(ComponentStatement item) {
509    ComponentStatement value = ObjectUtils.requireNonNull(item,"item cannot be null");
510    return _statements != null && _statements.remove(value);
511  }
512
513  /**
514   * Get the "{@literal Remarks}".
515   *
516   * <p>
517   * Additional commentary about the containing object.
518   *
519   * @return the remarks value, or {@code null} if not set
520   */
521  @Nullable
522  public MarkupMultiline getRemarks() {
523    return _remarks;
524  }
525
526  /**
527   * Set the "{@literal Remarks}".
528   *
529   * <p>
530   * Additional commentary about the containing object.
531   *
532   * @param value
533   *           the remarks value to set, or {@code null} to clear
534   */
535  public void setRemarks(@Nullable MarkupMultiline value) {
536    _remarks = value;
537  }
538
539  @Override
540  public String toString() {
541    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
542  }
543}