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.StringAdapter;
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 * A grouping of other components and/or capabilities.
032 */
033@MetaschemaAssembly(
034    formalName = "Capability",
035    description = "A grouping of other components and/or capabilities.",
036    name = "capability",
037    moduleClass = OscalComponentDefinitionModule.class,
038    modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-unique-component-definition-capability-incorporates-component", level = IConstraint.Level.ERROR, target = "incorporates-component", keyFields = @KeyField(target = "@component-uuid"), remarks = "A given `component` must not be referenced more than once within the same `capability`."))
039)
040public class Capability implements IBoundObject {
041  private final IMetaschemaData __metaschemaData;
042
043  /**
044   * Provides a globally unique means to identify a given capability.
045   */
046  @BoundFlag(
047      formalName = "Capability Identifier",
048      description = "Provides a globally unique means to identify a given capability.",
049      name = "uuid",
050      required = true,
051      typeAdapter = UuidAdapter.class
052  )
053  private UUID _uuid;
054
055  /**
056   * The capability's human-readable name.
057   */
058  @BoundFlag(
059      formalName = "Capability Name",
060      description = "The capability's human-readable name.",
061      name = "name",
062      required = true,
063      typeAdapter = StringAdapter.class
064  )
065  private String _name;
066
067  /**
068   * A summary of the capability.
069   */
070  @BoundField(
071      formalName = "Capability Description",
072      description = "A summary of the capability.",
073      useName = "description",
074      minOccurs = 1,
075      typeAdapter = MarkupMultilineAdapter.class
076  )
077  private MarkupMultiline _description;
078
079  /**
080   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
081   */
082  @BoundAssembly(
083      formalName = "Property",
084      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
085      useName = "prop",
086      maxOccurs = -1,
087      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
088  )
089  private List<Property> _props;
090
091  /**
092   * A reference to a local or remote resource, that has a specific relation to the containing object.
093   */
094  @BoundAssembly(
095      formalName = "Link",
096      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
097      useName = "link",
098      maxOccurs = -1,
099      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
100  )
101  private List<Link> _links;
102
103  /**
104   * The collection of components comprising this capability.
105   */
106  @BoundAssembly(
107      formalName = "Incorporates Component",
108      description = "The collection of components comprising this capability.",
109      useName = "incorporates-component",
110      maxOccurs = -1,
111      groupAs = @GroupAs(name = "incorporates-components", inJson = JsonGroupAsBehavior.LIST)
112  )
113  private List<IncorporatesComponent> _incorporatesComponents;
114
115  /**
116   * Defines how the component or capability supports a set of controls.
117   */
118  @BoundAssembly(
119      formalName = "Control Implementation Set",
120      description = "Defines how the component or capability supports a set of controls.",
121      useName = "control-implementation",
122      maxOccurs = -1,
123      groupAs = @GroupAs(name = "control-implementations", inJson = JsonGroupAsBehavior.LIST)
124  )
125  private List<ComponentControlImplementation> _controlImplementations;
126
127  /**
128   * Additional commentary about the containing object.
129   */
130  @BoundField(
131      formalName = "Remarks",
132      description = "Additional commentary about the containing object.",
133      useName = "remarks",
134      typeAdapter = MarkupMultilineAdapter.class
135  )
136  private MarkupMultiline _remarks;
137
138  /**
139   * Constructs a new {@code dev.metaschema.oscal.lib.model.Capability} instance with no metadata.
140   */
141  public Capability() {
142    this(null);
143  }
144
145  /**
146   * Constructs a new {@code dev.metaschema.oscal.lib.model.Capability} instance with the specified metadata.
147   *
148   * @param data
149   *           the metaschema data, or {@code null} if none
150   */
151  public Capability(IMetaschemaData data) {
152    this.__metaschemaData = data;
153  }
154
155  @Override
156  public IMetaschemaData getMetaschemaData() {
157    return __metaschemaData;
158  }
159
160  /**
161   * Get the "{@literal Capability Identifier}".
162   *
163   * <p>
164   * Provides a globally unique means to identify a given capability.
165   *
166   * @return the uuid value
167   */
168  @NonNull
169  public UUID getUuid() {
170    return _uuid;
171  }
172
173  /**
174   * Set the "{@literal Capability Identifier}".
175   *
176   * <p>
177   * Provides a globally unique means to identify a given capability.
178   *
179   * @param value
180   *           the uuid value to set
181   */
182  public void setUuid(@NonNull UUID value) {
183    _uuid = value;
184  }
185
186  /**
187   * Get the "{@literal Capability Name}".
188   *
189   * <p>
190   * The capability's human-readable name.
191   *
192   * @return the name value
193   */
194  @NonNull
195  public String getName() {
196    return _name;
197  }
198
199  /**
200   * Set the "{@literal Capability Name}".
201   *
202   * <p>
203   * The capability's human-readable name.
204   *
205   * @param value
206   *           the name value to set
207   */
208  public void setName(@NonNull String value) {
209    _name = value;
210  }
211
212  /**
213   * Get the "{@literal Capability Description}".
214   *
215   * <p>
216   * A summary of the capability.
217   *
218   * @return the description value
219   */
220  @NonNull
221  public MarkupMultiline getDescription() {
222    return _description;
223  }
224
225  /**
226   * Set the "{@literal Capability Description}".
227   *
228   * <p>
229   * A summary of the capability.
230   *
231   * @param value
232   *           the description value to set
233   */
234  public void setDescription(@NonNull MarkupMultiline value) {
235    _description = value;
236  }
237
238  /**
239   * Get the "{@literal Property}".
240   *
241   * <p>
242   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
243   *
244   * @return the prop value
245   */
246  @NonNull
247  public List<Property> getProps() {
248    if (_props == null) {
249      _props = new LinkedList<>();
250    }
251    return ObjectUtils.notNull(_props);
252  }
253
254  /**
255   * Set the "{@literal Property}".
256   *
257   * <p>
258   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
259   *
260   * @param value
261   *           the prop value to set
262   */
263  public void setProps(@NonNull List<Property> value) {
264    _props = value;
265  }
266
267  /**
268   * Add a new {@link Property} item to the underlying collection.
269   * @param item the item to add
270   * @return {@code true}
271   */
272  public boolean addProp(Property item) {
273    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
274    if (_props == null) {
275      _props = new LinkedList<>();
276    }
277    return _props.add(value);
278  }
279
280  /**
281   * Remove the first matching {@link Property} item from the underlying collection.
282   * @param item the item to remove
283   * @return {@code true} if the item was removed or {@code false} otherwise
284   */
285  public boolean removeProp(Property item) {
286    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
287    return _props != null && _props.remove(value);
288  }
289
290  /**
291   * Get the "{@literal Link}".
292   *
293   * <p>
294   * A reference to a local or remote resource, that has a specific relation to the containing object.
295   *
296   * @return the link value
297   */
298  @NonNull
299  public List<Link> getLinks() {
300    if (_links == null) {
301      _links = new LinkedList<>();
302    }
303    return ObjectUtils.notNull(_links);
304  }
305
306  /**
307   * Set the "{@literal Link}".
308   *
309   * <p>
310   * A reference to a local or remote resource, that has a specific relation to the containing object.
311   *
312   * @param value
313   *           the link value to set
314   */
315  public void setLinks(@NonNull List<Link> value) {
316    _links = value;
317  }
318
319  /**
320   * Add a new {@link Link} item to the underlying collection.
321   * @param item the item to add
322   * @return {@code true}
323   */
324  public boolean addLink(Link item) {
325    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
326    if (_links == null) {
327      _links = new LinkedList<>();
328    }
329    return _links.add(value);
330  }
331
332  /**
333   * Remove the first matching {@link Link} item from the underlying collection.
334   * @param item the item to remove
335   * @return {@code true} if the item was removed or {@code false} otherwise
336   */
337  public boolean removeLink(Link item) {
338    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
339    return _links != null && _links.remove(value);
340  }
341
342  /**
343   * Get the "{@literal Incorporates Component}".
344   *
345   * <p>
346   * The collection of components comprising this capability.
347   *
348   * @return the incorporates-component value
349   */
350  @NonNull
351  public List<IncorporatesComponent> getIncorporatesComponents() {
352    if (_incorporatesComponents == null) {
353      _incorporatesComponents = new LinkedList<>();
354    }
355    return ObjectUtils.notNull(_incorporatesComponents);
356  }
357
358  /**
359   * Set the "{@literal Incorporates Component}".
360   *
361   * <p>
362   * The collection of components comprising this capability.
363   *
364   * @param value
365   *           the incorporates-component value to set
366   */
367  public void setIncorporatesComponents(@NonNull List<IncorporatesComponent> value) {
368    _incorporatesComponents = value;
369  }
370
371  /**
372   * Add a new {@link IncorporatesComponent} item to the underlying collection.
373   * @param item the item to add
374   * @return {@code true}
375   */
376  public boolean addIncorporatesComponent(IncorporatesComponent item) {
377    IncorporatesComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
378    if (_incorporatesComponents == null) {
379      _incorporatesComponents = new LinkedList<>();
380    }
381    return _incorporatesComponents.add(value);
382  }
383
384  /**
385   * Remove the first matching {@link IncorporatesComponent} item from the underlying collection.
386   * @param item the item to remove
387   * @return {@code true} if the item was removed or {@code false} otherwise
388   */
389  public boolean removeIncorporatesComponent(IncorporatesComponent item) {
390    IncorporatesComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
391    return _incorporatesComponents != null && _incorporatesComponents.remove(value);
392  }
393
394  /**
395   * Get the "{@literal Control Implementation Set}".
396   *
397   * <p>
398   * Defines how the component or capability supports a set of controls.
399   *
400   * @return the control-implementation value
401   */
402  @NonNull
403  public List<ComponentControlImplementation> getControlImplementations() {
404    if (_controlImplementations == null) {
405      _controlImplementations = new LinkedList<>();
406    }
407    return ObjectUtils.notNull(_controlImplementations);
408  }
409
410  /**
411   * Set the "{@literal Control Implementation Set}".
412   *
413   * <p>
414   * Defines how the component or capability supports a set of controls.
415   *
416   * @param value
417   *           the control-implementation value to set
418   */
419  public void setControlImplementations(@NonNull List<ComponentControlImplementation> value) {
420    _controlImplementations = value;
421  }
422
423  /**
424   * Add a new {@link ComponentControlImplementation} item to the underlying collection.
425   * @param item the item to add
426   * @return {@code true}
427   */
428  public boolean addControlImplementation(ComponentControlImplementation item) {
429    ComponentControlImplementation value = ObjectUtils.requireNonNull(item,"item cannot be null");
430    if (_controlImplementations == null) {
431      _controlImplementations = new LinkedList<>();
432    }
433    return _controlImplementations.add(value);
434  }
435
436  /**
437   * Remove the first matching {@link ComponentControlImplementation} item from the underlying collection.
438   * @param item the item to remove
439   * @return {@code true} if the item was removed or {@code false} otherwise
440   */
441  public boolean removeControlImplementation(ComponentControlImplementation item) {
442    ComponentControlImplementation value = ObjectUtils.requireNonNull(item,"item cannot be null");
443    return _controlImplementations != null && _controlImplementations.remove(value);
444  }
445
446  /**
447   * Get the "{@literal Remarks}".
448   *
449   * <p>
450   * Additional commentary about the containing object.
451   *
452   * @return the remarks value, or {@code null} if not set
453   */
454  @Nullable
455  public MarkupMultiline getRemarks() {
456    return _remarks;
457  }
458
459  /**
460   * Set the "{@literal Remarks}".
461   *
462   * <p>
463   * Additional commentary about the containing object.
464   *
465   * @param value
466   *           the remarks value to set, or {@code null} to clear
467   */
468  public void setRemarks(@Nullable MarkupMultiline value) {
469    _remarks = value;
470  }
471
472  @Override
473  public String toString() {
474    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
475  }
476}