001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_metadata_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.Base64Adapter;
006import dev.metaschema.core.datatype.adapter.DateTimeWithTZAdapter;
007import dev.metaschema.core.datatype.adapter.StringAdapter;
008import dev.metaschema.core.datatype.adapter.TokenAdapter;
009import dev.metaschema.core.datatype.adapter.UriReferenceAdapter;
010import dev.metaschema.core.datatype.adapter.UuidAdapter;
011import dev.metaschema.core.datatype.markup.MarkupLine;
012import dev.metaschema.core.datatype.markup.MarkupLineAdapter;
013import dev.metaschema.core.datatype.markup.MarkupMultiline;
014import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
015import dev.metaschema.core.model.IBoundObject;
016import dev.metaschema.core.model.IMetaschemaData;
017import dev.metaschema.core.model.JsonGroupAsBehavior;
018import dev.metaschema.core.model.constraint.IConstraint;
019import dev.metaschema.core.util.ObjectUtils;
020import dev.metaschema.databind.model.annotations.AllowedValue;
021import dev.metaschema.databind.model.annotations.AllowedValues;
022import dev.metaschema.databind.model.annotations.AssemblyConstraints;
023import dev.metaschema.databind.model.annotations.BoundAssembly;
024import dev.metaschema.databind.model.annotations.BoundField;
025import dev.metaschema.databind.model.annotations.BoundFieldValue;
026import dev.metaschema.databind.model.annotations.BoundFlag;
027import dev.metaschema.databind.model.annotations.Expect;
028import dev.metaschema.databind.model.annotations.GroupAs;
029import dev.metaschema.databind.model.annotations.HasCardinality;
030import dev.metaschema.databind.model.annotations.Index;
031import dev.metaschema.databind.model.annotations.IsUnique;
032import dev.metaschema.databind.model.annotations.KeyField;
033import dev.metaschema.databind.model.annotations.Matches;
034import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
035import dev.metaschema.databind.model.annotations.MetaschemaField;
036import dev.metaschema.databind.model.annotations.ValueConstraints;
037import dev.metaschema.oscal.lib.model.metadata.AbstractBackMatter;
038import edu.umd.cs.findbugs.annotations.NonNull;
039import edu.umd.cs.findbugs.annotations.Nullable;
040import java.net.URI;
041import java.nio.ByteBuffer;
042import java.util.LinkedList;
043import java.util.List;
044import java.util.UUID;
045import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
046import org.apache.commons.lang3.builder.ToStringStyle;
047
048/**
049 * A collection of resources that may be referenced from within the OSCAL document instance.
050 */
051@MetaschemaAssembly(
052    formalName = "Back matter",
053    description = "A collection of resources that may be referenced from within the OSCAL document instance.",
054    name = "back-matter",
055    moduleClass = OscalMetadataModule.class,
056    remarks = "Provides a collection of identified `resource` objects that can be referenced by a `link` with a `rel` value of \"reference\" and an `href` value that is a fragment \"#\" followed by a reference to a reference's `uuid`. Other specialized link \"rel\" values also use this pattern when indicated in that context of use.",
057    modelConstraints = @AssemblyConstraints(index = @Index(id = "oscal-back-matter-resource-uuid-index", level = IConstraint.Level.ERROR, target = "resource", name = "index-back-matter-resource", keyFields = @KeyField(target = "@uuid")))
058)
059public class BackMatter extends AbstractBackMatter implements IBoundObject {
060  private final IMetaschemaData __metaschemaData;
061
062  /**
063   * A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.
064   */
065  @BoundAssembly(
066      formalName = "Resource",
067      description = "A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.",
068      useName = "resource",
069      remarks = "A resource can be used in two ways. 1) it may point to an specific retrievable network resource using a `rlink`, or 2) it may be included as an attachment using a `base64`. A resource may contain multiple `rlink` and `base64` entries that represent alternative download locations (rlink) and attachments (base64) for the same resource.\n"
070              + "\n"
071              + "Both rlink and base64 allow for a `media-type` to be specified, which is used to distinguish between different representations of the same resource (e.g., Microsoft Word, PDF). When multiple `rlink` and `base64` items are included for a given resource, all items must contain equivalent information. This allows the document consumer to choose a preferred item to process based on a the selected item's `media-type`. This is extremely important when the items represent OSCAL content that is represented in alternate formats (i.e., XML, JSON, YAML), allowing the same OSCAL data to be processed from any of the available formats indicated by the items.\n"
072              + "\n"
073              + "When a resource includes a citation, then the `title` and `citation` properties must both be included.",
074      maxOccurs = -1,
075      groupAs = @GroupAs(name = "resources", inJson = JsonGroupAsBehavior.LIST)
076  )
077  private List<Resource> _resources;
078
079  /**
080   * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter} instance with no metadata.
081   */
082  public BackMatter() {
083    this(null);
084  }
085
086  /**
087   * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter} instance with the specified metadata.
088   *
089   * @param data
090   *           the metaschema data, or {@code null} if none
091   */
092  public BackMatter(IMetaschemaData data) {
093    this.__metaschemaData = data;
094  }
095
096  @Override
097  public IMetaschemaData getMetaschemaData() {
098    return __metaschemaData;
099  }
100
101  /**
102   * Get the "{@literal Resource}".
103   *
104   * <p>
105   * A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.
106   *
107   * @return the resource value
108   */
109  @NonNull
110  public List<Resource> getResources() {
111    if (_resources == null) {
112      _resources = new LinkedList<>();
113    }
114    return ObjectUtils.notNull(_resources);
115  }
116
117  /**
118   * Set the "{@literal Resource}".
119   *
120   * <p>
121   * A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.
122   *
123   * @param value
124   *           the resource value to set
125   */
126  public void setResources(@NonNull List<Resource> value) {
127    _resources = value;
128  }
129
130  /**
131   * Add a new {@link Resource} item to the underlying collection.
132   * @param item the item to add
133   * @return {@code true}
134   */
135  public boolean addResource(Resource item) {
136    Resource value = ObjectUtils.requireNonNull(item,"item cannot be null");
137    if (_resources == null) {
138      _resources = new LinkedList<>();
139    }
140    return _resources.add(value);
141  }
142
143  /**
144   * Remove the first matching {@link Resource} item from the underlying collection.
145   * @param item the item to remove
146   * @return {@code true} if the item was removed or {@code false} otherwise
147   */
148  public boolean removeResource(Resource item) {
149    Resource value = ObjectUtils.requireNonNull(item,"item cannot be null");
150    return _resources != null && _resources.remove(value);
151  }
152
153  @Override
154  public String toString() {
155    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
156  }
157
158  /**
159   * A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.
160   */
161  @MetaschemaAssembly(
162      formalName = "Resource",
163      description = "A resource associated with content in the containing document instance. A resource may be directly included in the document using base64 encoding or may point to one or more equivalent internet resources.",
164      name = "resource",
165      moduleClass = OscalMetadataModule.class,
166      remarks = "A resource can be used in two ways. 1) it may point to an specific retrievable network resource using a `rlink`, or 2) it may be included as an attachment using a `base64`. A resource may contain multiple `rlink` and `base64` entries that represent alternative download locations (rlink) and attachments (base64) for the same resource.\n"
167              + "\n"
168              + "Both rlink and base64 allow for a `media-type` to be specified, which is used to distinguish between different representations of the same resource (e.g., Microsoft Word, PDF). When multiple `rlink` and `base64` items are included for a given resource, all items must contain equivalent information. This allows the document consumer to choose a preferred item to process based on a the selected item's `media-type`. This is extremely important when the items represent OSCAL content that is represented in alternate formats (i.e., XML, JSON, YAML), allowing the same OSCAL data to be processed from any of the available formats indicated by the items.\n"
169              + "\n"
170              + "When a resource includes a citation, then the `title` and `citation` properties must both be included.",
171      valueConstraints = @ValueConstraints(allowedValues = {@AllowedValues(id = "oscal-back-matter-resource-prop-name-values", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = {@AllowedValue(value = "type", description = "Identifies the type of resource represented. The most specific appropriate type value SHOULD be used."), @AllowedValue(value = "version", description = "For resources representing a published document, this represents the version number of that document."), @AllowedValue(value = "published", description = "For resources representing a published document, this represents the publication date of that document.")}), @AllowedValues(id = "oscal-back-matter-resource-prop-type-values", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='type']/@value", values = {@AllowedValue(value = "logo", description = "Indicates the resource is an organization's logo."), @AllowedValue(value = "image", description = "Indicates the resource represents an image."), @AllowedValue(value = "screen-shot", description = "Indicates the resource represents an image of screen content."), @AllowedValue(value = "law", description = "Indicates the resource represents an applicable law."), @AllowedValue(value = "regulation", description = "Indicates the resource represents an applicable regulation."), @AllowedValue(value = "standard", description = "Indicates the resource represents an applicable standard."), @AllowedValue(value = "external-guidance", description = "Indicates the resource represents applicable guidance."), @AllowedValue(value = "acronyms", description = "Indicates the resource provides a list of relevant acronyms."), @AllowedValue(value = "citation", description = "Indicates the resource cites relevant information."), @AllowedValue(value = "policy", description = "Indicates the resource is a policy."), @AllowedValue(value = "procedure", description = "Indicates the resource is a procedure."), @AllowedValue(value = "system-guide", description = "Indicates the resource is guidance document related to the subject system of an SSP."), @AllowedValue(value = "users-guide", description = "Indicates the resource is guidance document a user's guide or administrator's guide."), @AllowedValue(value = "administrators-guide", description = "Indicates the resource is guidance document a administrator's guide."), @AllowedValue(value = "rules-of-behavior", description = "Indicates the resource represents rules of behavior content."), @AllowedValue(value = "plan", description = "Indicates the resource represents a plan."), @AllowedValue(value = "artifact", description = "Indicates the resource represents an artifact, such as may be reviewed by an assessor."), @AllowedValue(value = "evidence", description = "Indicates the resource represents evidence, such as to support an assessment finding."), @AllowedValue(value = "tool-output", description = "Indicates the resource represents output from a tool."), @AllowedValue(value = "raw-data", description = "Indicates the resource represents machine data, which may require a tool or analysis for interpretation or presentation."), @AllowedValue(value = "interview-notes", description = "Indicates the resource represents notes from an interview, such as may be collected during an assessment."), @AllowedValue(value = "questionnaire", description = "Indicates the resource is a set of questions, possibly with responses."), @AllowedValue(value = "report", description = "Indicates the resource is a report."), @AllowedValue(value = "agreement", description = "Indicates the resource is a formal agreement between two or more parties.")})}, matches = @Matches(id = "oscal-back-matter-resource-prop-published-datatype", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='published']/@value", typeAdapter = DateTimeWithTZAdapter.class), expect = @Expect(id = "oscal-back-matter-resource-citation-title", description = "A `title` is required when a `citation` is provided.", level = IConstraint.Level.ERROR, target = ".[citation]", test = "title")),
172      modelConstraints = @AssemblyConstraints(unique = {@IsUnique(id = "oscal-unique-resource-rlink-href", description = "Ensure that each rlink item references a unique resource.", level = IConstraint.Level.ERROR, target = "rlink", keyFields = {@KeyField(target = "@href"), @KeyField(target = "@media-type")}), @IsUnique(id = "oscal-unique-resource-base64-filename", description = "Ensure that all base64 resources have a unique `filename`.", level = IConstraint.Level.ERROR, target = "base64", keyFields = @KeyField(target = "@filename"))}, cardinality = @HasCardinality(id = "oscal-back-matter-resource-base64-rlink-cardinality", description = "A resource should provide at least an `rlink` or `base64` object.", level = IConstraint.Level.WARNING, target = "rlink|base64", minOccurs = 1))
173  )
174  public static class Resource implements IBoundObject {
175    private final IMetaschemaData __metaschemaData;
176
177    /**
178     * A unique identifier for a resource.
179     */
180    @BoundFlag(
181        formalName = "Resource Universally Unique Identifier",
182        description = "A unique identifier for a resource.",
183        name = "uuid",
184        required = true,
185        typeAdapter = UuidAdapter.class
186    )
187    private UUID _uuid;
188
189    /**
190     * An optional name given to the resource, which may be used by a tool for display and navigation.
191     */
192    @BoundField(
193        formalName = "Resource Title",
194        description = "An optional name given to the resource, which may be used by a tool for display and navigation.",
195        useName = "title",
196        typeAdapter = MarkupLineAdapter.class
197    )
198    private MarkupLine _title;
199
200    /**
201     * An optional short summary of the resource used to indicate the purpose of the resource.
202     */
203    @BoundField(
204        formalName = "Resource Description",
205        description = "An optional short summary of the resource used to indicate the purpose of the resource.",
206        useName = "description",
207        typeAdapter = MarkupMultilineAdapter.class
208    )
209    private MarkupMultiline _description;
210
211    /**
212     * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
213     */
214    @BoundAssembly(
215        formalName = "Property",
216        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
217        useName = "prop",
218        maxOccurs = -1,
219        groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
220    )
221    private List<Property> _props;
222
223    /**
224     * A document identifier qualified by an identifier <code>scheme</code>.
225     */
226    @BoundField(
227        formalName = "Document Identifier",
228        description = "A document identifier qualified by an identifier `scheme`.",
229        useName = "document-id",
230        maxOccurs = -1,
231        groupAs = @GroupAs(name = "document-ids", inJson = JsonGroupAsBehavior.LIST)
232    )
233    private List<DocumentId> _documentIds;
234
235    /**
236     * An optional citation consisting of end note text using structured markup.
237     */
238    @BoundAssembly(
239        formalName = "Citation",
240        description = "An optional citation consisting of end note text using structured markup.",
241        useName = "citation"
242    )
243    private Citation _citation;
244
245    /**
246     * A URL-based pointer to an external resource with an optional hash for verification and change detection.
247     */
248    @BoundAssembly(
249        formalName = "Resource link",
250        description = "A URL-based pointer to an external resource with an optional hash for verification and change detection.",
251        useName = "rlink",
252        remarks = "Multiple `rlink` objects can be included for a resource. In such a case, all provided `rlink` items are intended to be equivalent in content, but may differ in structure or format.\n"
253                + "\n"
254                + "A `media-type` is used to identify the format of a given rlink, and can be used to differentiate items in a collection of rlinks. The `media-type` provides a hint to the OSCAL document consumer about the structure of the resource referenced by the `rlink`.",
255        maxOccurs = -1,
256        groupAs = @GroupAs(name = "rlinks", inJson = JsonGroupAsBehavior.LIST)
257    )
258    private List<Rlink> _rlinks;
259
260    /**
261     * A resource encoded using the Base64 alphabet defined by <a href="https://www.rfc-editor.org/rfc/rfc2045.html">RFC 2045</a>.
262     */
263    @BoundField(
264        formalName = "Base64",
265        description = "A resource encoded using the Base64 alphabet defined by [RFC 2045](https://www.rfc-editor.org/rfc/rfc2045.html).",
266        useName = "base64"
267    )
268    private Base64 _base64;
269
270    /**
271     * Additional commentary about the containing object.
272     */
273    @BoundField(
274        formalName = "Remarks",
275        description = "Additional commentary about the containing object.",
276        useName = "remarks",
277        typeAdapter = MarkupMultilineAdapter.class
278    )
279    private MarkupMultiline _remarks;
280
281    /**
282     * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource} instance with no metadata.
283     */
284    public Resource() {
285      this(null);
286    }
287
288    /**
289     * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource} instance with the specified metadata.
290     *
291     * @param data
292     *           the metaschema data, or {@code null} if none
293     */
294    public Resource(IMetaschemaData data) {
295      this.__metaschemaData = data;
296    }
297
298    @Override
299    public IMetaschemaData getMetaschemaData() {
300      return __metaschemaData;
301    }
302
303    /**
304     * Get the "{@literal Resource Universally Unique Identifier}".
305     *
306     * <p>
307     * A unique identifier for a resource.
308     *
309     * @return the uuid value
310     */
311    @NonNull
312    public UUID getUuid() {
313      return _uuid;
314    }
315
316    /**
317     * Set the "{@literal Resource Universally Unique Identifier}".
318     *
319     * <p>
320     * A unique identifier for a resource.
321     *
322     * @param value
323     *           the uuid value to set
324     */
325    public void setUuid(@NonNull UUID value) {
326      _uuid = value;
327    }
328
329    /**
330     * Get the "{@literal Resource Title}".
331     *
332     * <p>
333     * An optional name given to the resource, which may be used by a tool for display and navigation.
334     *
335     * @return the title value, or {@code null} if not set
336     */
337    @Nullable
338    public MarkupLine getTitle() {
339      return _title;
340    }
341
342    /**
343     * Set the "{@literal Resource Title}".
344     *
345     * <p>
346     * An optional name given to the resource, which may be used by a tool for display and navigation.
347     *
348     * @param value
349     *           the title value to set, or {@code null} to clear
350     */
351    public void setTitle(@Nullable MarkupLine value) {
352      _title = value;
353    }
354
355    /**
356     * Get the "{@literal Resource Description}".
357     *
358     * <p>
359     * An optional short summary of the resource used to indicate the purpose of the resource.
360     *
361     * @return the description value, or {@code null} if not set
362     */
363    @Nullable
364    public MarkupMultiline getDescription() {
365      return _description;
366    }
367
368    /**
369     * Set the "{@literal Resource Description}".
370     *
371     * <p>
372     * An optional short summary of the resource used to indicate the purpose of the resource.
373     *
374     * @param value
375     *           the description value to set, or {@code null} to clear
376     */
377    public void setDescription(@Nullable MarkupMultiline value) {
378      _description = value;
379    }
380
381    /**
382     * Get the "{@literal Property}".
383     *
384     * <p>
385     * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
386     *
387     * @return the prop value
388     */
389    @NonNull
390    public List<Property> getProps() {
391      if (_props == null) {
392        _props = new LinkedList<>();
393      }
394      return ObjectUtils.notNull(_props);
395    }
396
397    /**
398     * Set the "{@literal Property}".
399     *
400     * <p>
401     * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
402     *
403     * @param value
404     *           the prop value to set
405     */
406    public void setProps(@NonNull List<Property> value) {
407      _props = value;
408    }
409
410    /**
411     * Add a new {@link Property} item to the underlying collection.
412     * @param item the item to add
413     * @return {@code true}
414     */
415    public boolean addProp(Property item) {
416      Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
417      if (_props == null) {
418        _props = new LinkedList<>();
419      }
420      return _props.add(value);
421    }
422
423    /**
424     * Remove the first matching {@link Property} item from the underlying collection.
425     * @param item the item to remove
426     * @return {@code true} if the item was removed or {@code false} otherwise
427     */
428    public boolean removeProp(Property item) {
429      Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
430      return _props != null && _props.remove(value);
431    }
432
433    /**
434     * Get the "{@literal Document Identifier}".
435     *
436     * <p>
437     * A document identifier qualified by an identifier <code>scheme</code>.
438     *
439     * @return the document-id value
440     */
441    @NonNull
442    public List<DocumentId> getDocumentIds() {
443      if (_documentIds == null) {
444        _documentIds = new LinkedList<>();
445      }
446      return ObjectUtils.notNull(_documentIds);
447    }
448
449    /**
450     * Set the "{@literal Document Identifier}".
451     *
452     * <p>
453     * A document identifier qualified by an identifier <code>scheme</code>.
454     *
455     * @param value
456     *           the document-id value to set
457     */
458    public void setDocumentIds(@NonNull List<DocumentId> value) {
459      _documentIds = value;
460    }
461
462    /**
463     * Add a new {@link DocumentId} item to the underlying collection.
464     * @param item the item to add
465     * @return {@code true}
466     */
467    public boolean addDocumentId(DocumentId item) {
468      DocumentId value = ObjectUtils.requireNonNull(item,"item cannot be null");
469      if (_documentIds == null) {
470        _documentIds = new LinkedList<>();
471      }
472      return _documentIds.add(value);
473    }
474
475    /**
476     * Remove the first matching {@link DocumentId} item from the underlying collection.
477     * @param item the item to remove
478     * @return {@code true} if the item was removed or {@code false} otherwise
479     */
480    public boolean removeDocumentId(DocumentId item) {
481      DocumentId value = ObjectUtils.requireNonNull(item,"item cannot be null");
482      return _documentIds != null && _documentIds.remove(value);
483    }
484
485    /**
486     * Get the "{@literal Citation}".
487     *
488     * <p>
489     * An optional citation consisting of end note text using structured markup.
490     *
491     * @return the citation value, or {@code null} if not set
492     */
493    @Nullable
494    public Citation getCitation() {
495      return _citation;
496    }
497
498    /**
499     * Set the "{@literal Citation}".
500     *
501     * <p>
502     * An optional citation consisting of end note text using structured markup.
503     *
504     * @param value
505     *           the citation value to set, or {@code null} to clear
506     */
507    public void setCitation(@Nullable Citation value) {
508      _citation = value;
509    }
510
511    /**
512     * Get the "{@literal Resource link}".
513     *
514     * <p>
515     * A URL-based pointer to an external resource with an optional hash for verification and change detection.
516     *
517     * @return the rlink value
518     */
519    @NonNull
520    public List<Rlink> getRlinks() {
521      if (_rlinks == null) {
522        _rlinks = new LinkedList<>();
523      }
524      return ObjectUtils.notNull(_rlinks);
525    }
526
527    /**
528     * Set the "{@literal Resource link}".
529     *
530     * <p>
531     * A URL-based pointer to an external resource with an optional hash for verification and change detection.
532     *
533     * @param value
534     *           the rlink value to set
535     */
536    public void setRlinks(@NonNull List<Rlink> value) {
537      _rlinks = value;
538    }
539
540    /**
541     * Add a new {@link Rlink} item to the underlying collection.
542     * @param item the item to add
543     * @return {@code true}
544     */
545    public boolean addRlink(Rlink item) {
546      Rlink value = ObjectUtils.requireNonNull(item,"item cannot be null");
547      if (_rlinks == null) {
548        _rlinks = new LinkedList<>();
549      }
550      return _rlinks.add(value);
551    }
552
553    /**
554     * Remove the first matching {@link Rlink} item from the underlying collection.
555     * @param item the item to remove
556     * @return {@code true} if the item was removed or {@code false} otherwise
557     */
558    public boolean removeRlink(Rlink item) {
559      Rlink value = ObjectUtils.requireNonNull(item,"item cannot be null");
560      return _rlinks != null && _rlinks.remove(value);
561    }
562
563    /**
564     * Get the "{@literal Base64}".
565     *
566     * <p>
567     * A resource encoded using the Base64 alphabet defined by <a href="https://www.rfc-editor.org/rfc/rfc2045.html">RFC 2045</a>.
568     *
569     * @return the base64 value, or {@code null} if not set
570     */
571    @Nullable
572    public Base64 getBase64() {
573      return _base64;
574    }
575
576    /**
577     * Set the "{@literal Base64}".
578     *
579     * <p>
580     * A resource encoded using the Base64 alphabet defined by <a href="https://www.rfc-editor.org/rfc/rfc2045.html">RFC 2045</a>.
581     *
582     * @param value
583     *           the base64 value to set, or {@code null} to clear
584     */
585    public void setBase64(@Nullable Base64 value) {
586      _base64 = value;
587    }
588
589    /**
590     * Get the "{@literal Remarks}".
591     *
592     * <p>
593     * Additional commentary about the containing object.
594     *
595     * @return the remarks value, or {@code null} if not set
596     */
597    @Nullable
598    public MarkupMultiline getRemarks() {
599      return _remarks;
600    }
601
602    /**
603     * Set the "{@literal Remarks}".
604     *
605     * <p>
606     * Additional commentary about the containing object.
607     *
608     * @param value
609     *           the remarks value to set, or {@code null} to clear
610     */
611    public void setRemarks(@Nullable MarkupMultiline value) {
612      _remarks = value;
613    }
614
615    @Override
616    public String toString() {
617      return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
618    }
619
620    /**
621     * An optional citation consisting of end note text using structured markup.
622     */
623    @MetaschemaAssembly(
624        formalName = "Citation",
625        description = "An optional citation consisting of end note text using structured markup.",
626        name = "citation",
627        moduleClass = OscalMetadataModule.class
628    )
629    public static class Citation implements IBoundObject {
630      private final IMetaschemaData __metaschemaData;
631
632      /**
633       * A line of citation text.
634       */
635      @BoundField(
636          formalName = "Citation Text",
637          description = "A line of citation text.",
638          useName = "text",
639          minOccurs = 1,
640          typeAdapter = MarkupLineAdapter.class
641      )
642      private MarkupLine _text;
643
644      /**
645       * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
646       */
647      @BoundAssembly(
648          formalName = "Property",
649          description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
650          useName = "prop",
651          maxOccurs = -1,
652          groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
653      )
654      private List<Property> _props;
655
656      /**
657       * A reference to a local or remote resource, that has a specific relation to the containing object.
658       */
659      @BoundAssembly(
660          formalName = "Link",
661          description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
662          useName = "link",
663          maxOccurs = -1,
664          groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
665      )
666      private List<Link> _links;
667
668      /**
669       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Citation} instance with no metadata.
670       */
671      public Citation() {
672        this(null);
673      }
674
675      /**
676       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Citation} instance with the specified metadata.
677       *
678       * @param data
679       *           the metaschema data, or {@code null} if none
680       */
681      public Citation(IMetaschemaData data) {
682        this.__metaschemaData = data;
683      }
684
685      @Override
686      public IMetaschemaData getMetaschemaData() {
687        return __metaschemaData;
688      }
689
690      /**
691       * Get the "{@literal Citation Text}".
692       *
693       * <p>
694       * A line of citation text.
695       *
696       * @return the text value
697       */
698      @NonNull
699      public MarkupLine getText() {
700        return _text;
701      }
702
703      /**
704       * Set the "{@literal Citation Text}".
705       *
706       * <p>
707       * A line of citation text.
708       *
709       * @param value
710       *           the text value to set
711       */
712      public void setText(@NonNull MarkupLine value) {
713        _text = value;
714      }
715
716      /**
717       * Get the "{@literal Property}".
718       *
719       * <p>
720       * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
721       *
722       * @return the prop value
723       */
724      @NonNull
725      public List<Property> getProps() {
726        if (_props == null) {
727          _props = new LinkedList<>();
728        }
729        return ObjectUtils.notNull(_props);
730      }
731
732      /**
733       * Set the "{@literal Property}".
734       *
735       * <p>
736       * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
737       *
738       * @param value
739       *           the prop value to set
740       */
741      public void setProps(@NonNull List<Property> value) {
742        _props = value;
743      }
744
745      /**
746       * Add a new {@link Property} item to the underlying collection.
747       * @param item the item to add
748       * @return {@code true}
749       */
750      public boolean addProp(Property item) {
751        Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
752        if (_props == null) {
753          _props = new LinkedList<>();
754        }
755        return _props.add(value);
756      }
757
758      /**
759       * Remove the first matching {@link Property} item from the underlying collection.
760       * @param item the item to remove
761       * @return {@code true} if the item was removed or {@code false} otherwise
762       */
763      public boolean removeProp(Property item) {
764        Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
765        return _props != null && _props.remove(value);
766      }
767
768      /**
769       * Get the "{@literal Link}".
770       *
771       * <p>
772       * A reference to a local or remote resource, that has a specific relation to the containing object.
773       *
774       * @return the link value
775       */
776      @NonNull
777      public List<Link> getLinks() {
778        if (_links == null) {
779          _links = new LinkedList<>();
780        }
781        return ObjectUtils.notNull(_links);
782      }
783
784      /**
785       * Set the "{@literal Link}".
786       *
787       * <p>
788       * A reference to a local or remote resource, that has a specific relation to the containing object.
789       *
790       * @param value
791       *           the link value to set
792       */
793      public void setLinks(@NonNull List<Link> value) {
794        _links = value;
795      }
796
797      /**
798       * Add a new {@link Link} item to the underlying collection.
799       * @param item the item to add
800       * @return {@code true}
801       */
802      public boolean addLink(Link item) {
803        Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
804        if (_links == null) {
805          _links = new LinkedList<>();
806        }
807        return _links.add(value);
808      }
809
810      /**
811       * Remove the first matching {@link Link} item from the underlying collection.
812       * @param item the item to remove
813       * @return {@code true} if the item was removed or {@code false} otherwise
814       */
815      public boolean removeLink(Link item) {
816        Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
817        return _links != null && _links.remove(value);
818      }
819
820      @Override
821      public String toString() {
822        return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
823      }
824    }
825
826    /**
827     * A URL-based pointer to an external resource with an optional hash for verification and change detection.
828     */
829    @MetaschemaAssembly(
830        formalName = "Resource link",
831        description = "A URL-based pointer to an external resource with an optional hash for verification and change detection.",
832        name = "rlink",
833        moduleClass = OscalMetadataModule.class,
834        remarks = "Multiple `rlink` objects can be included for a resource. In such a case, all provided `rlink` items are intended to be equivalent in content, but may differ in structure or format.\n"
835                + "\n"
836                + "A `media-type` is used to identify the format of a given rlink, and can be used to differentiate items in a collection of rlinks. The `media-type` provides a hint to the OSCAL document consumer about the structure of the resource referenced by the `rlink`."
837    )
838    public static class Rlink implements IBoundObject {
839      private final IMetaschemaData __metaschemaData;
840
841      /**
842       * A resolvable URL pointing to the referenced resource.
843       */
844      @BoundFlag(
845          formalName = "Hypertext Reference",
846          description = "A resolvable URL pointing to the referenced resource.",
847          name = "href",
848          required = true,
849          typeAdapter = UriReferenceAdapter.class,
850          remarks = "This value may be either:\n"
851                  + "\n"
852                  + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n"
853                  + "2. a [relative reference](https://pages.nist.gov/OSCAL/concepts/uri-use/#relative-reference) pointing to a network resolvable resource whose base URI is the URI of the containing document, or"
854      )
855      private URI _href;
856
857      /**
858       * A label that indicates the nature of a resource, as a data serialization or format.
859       */
860      @BoundFlag(
861          formalName = "Media Type",
862          description = "A label that indicates the nature of a resource, as a data serialization or format.",
863          name = "media-type",
864          typeAdapter = StringAdapter.class
865      )
866      private String _mediaType;
867
868      /**
869       * A hash of the resource identified by <code>href</code>, which can be used to verify the resource was not changed since it was hashed.
870       */
871      @BoundField(
872          formalName = "Hash",
873          description = "A hash of the resource identified by `href`, which can be used to verify the resource was not changed since it was hashed.",
874          useName = "hash",
875          remarks = "The `hash` value can be used to confirm that the resource referenced by the `href` is the same resources that was hashed by retrieving the resource, calculating a hash, and comparing the result to this value.",
876          maxOccurs = -1,
877          groupAs = @GroupAs(name = "hashes", inJson = JsonGroupAsBehavior.LIST)
878      )
879      private List<Hash> _hashes;
880
881      /**
882       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Rlink} instance with no metadata.
883       */
884      public Rlink() {
885        this(null);
886      }
887
888      /**
889       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Rlink} instance with the specified metadata.
890       *
891       * @param data
892       *           the metaschema data, or {@code null} if none
893       */
894      public Rlink(IMetaschemaData data) {
895        this.__metaschemaData = data;
896      }
897
898      @Override
899      public IMetaschemaData getMetaschemaData() {
900        return __metaschemaData;
901      }
902
903      /**
904       * Get the "{@literal Hypertext Reference}".
905       *
906       * <p>
907       * A resolvable URL pointing to the referenced resource.
908       *
909       * @return the href value
910       */
911      @NonNull
912      public URI getHref() {
913        return _href;
914      }
915
916      /**
917       * Set the "{@literal Hypertext Reference}".
918       *
919       * <p>
920       * A resolvable URL pointing to the referenced resource.
921       *
922       * @param value
923       *           the href value to set
924       */
925      public void setHref(@NonNull URI value) {
926        _href = value;
927      }
928
929      /**
930       * Get the "{@literal Media Type}".
931       *
932       * <p>
933       * A label that indicates the nature of a resource, as a data serialization or format.
934       *
935       * @return the media-type value, or {@code null} if not set
936       */
937      @Nullable
938      public String getMediaType() {
939        return _mediaType;
940      }
941
942      /**
943       * Set the "{@literal Media Type}".
944       *
945       * <p>
946       * A label that indicates the nature of a resource, as a data serialization or format.
947       *
948       * @param value
949       *           the media-type value to set, or {@code null} to clear
950       */
951      public void setMediaType(@Nullable String value) {
952        _mediaType = value;
953      }
954
955      /**
956       * Get the "{@literal Hash}".
957       *
958       * <p>
959       * A hash of the resource identified by <code>href</code>, which can be used to verify the resource was not changed since it was hashed.
960       *
961       * @return the hash value
962       */
963      @NonNull
964      public List<Hash> getHashes() {
965        if (_hashes == null) {
966          _hashes = new LinkedList<>();
967        }
968        return ObjectUtils.notNull(_hashes);
969      }
970
971      /**
972       * Set the "{@literal Hash}".
973       *
974       * <p>
975       * A hash of the resource identified by <code>href</code>, which can be used to verify the resource was not changed since it was hashed.
976       *
977       * @param value
978       *           the hash value to set
979       */
980      public void setHashes(@NonNull List<Hash> value) {
981        _hashes = value;
982      }
983
984      /**
985       * Add a new {@link Hash} item to the underlying collection.
986       * @param item the item to add
987       * @return {@code true}
988       */
989      public boolean addHash(Hash item) {
990        Hash value = ObjectUtils.requireNonNull(item,"item cannot be null");
991        if (_hashes == null) {
992          _hashes = new LinkedList<>();
993        }
994        return _hashes.add(value);
995      }
996
997      /**
998       * Remove the first matching {@link Hash} item from the underlying collection.
999       * @param item the item to remove
1000       * @return {@code true} if the item was removed or {@code false} otherwise
1001       */
1002      public boolean removeHash(Hash item) {
1003        Hash value = ObjectUtils.requireNonNull(item,"item cannot be null");
1004        return _hashes != null && _hashes.remove(value);
1005      }
1006
1007      @Override
1008      public String toString() {
1009        return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
1010      }
1011    }
1012
1013    /**
1014     * A resource encoded using the Base64 alphabet defined by <a href="https://www.rfc-editor.org/rfc/rfc2045.html">RFC 2045</a>.
1015     */
1016    @MetaschemaField(
1017        formalName = "Base64",
1018        description = "A resource encoded using the Base64 alphabet defined by [RFC 2045](https://www.rfc-editor.org/rfc/rfc2045.html).",
1019        name = "base64",
1020        moduleClass = OscalMetadataModule.class
1021    )
1022    public static class Base64 implements IBoundObject {
1023      private final IMetaschemaData __metaschemaData;
1024
1025      /**
1026       * Name of the file before it was encoded as Base64 to be embedded in a <code>resource</code>. This is the name that will be assigned to the file when the file is decoded.
1027       */
1028      @BoundFlag(
1029          formalName = "File Name",
1030          description = "Name of the file before it was encoded as Base64 to be embedded in a `resource`. This is the name that will be assigned to the file when the file is decoded.",
1031          name = "filename",
1032          typeAdapter = TokenAdapter.class
1033      )
1034      private String _filename;
1035
1036      /**
1037       * A label that indicates the nature of a resource, as a data serialization or format.
1038       */
1039      @BoundFlag(
1040          formalName = "Media Type",
1041          description = "A label that indicates the nature of a resource, as a data serialization or format.",
1042          name = "media-type",
1043          typeAdapter = StringAdapter.class
1044      )
1045      private String _mediaType;
1046
1047      /**
1048       * The field value.
1049       */
1050      @BoundFieldValue(
1051          valueKeyName = "value",
1052          typeAdapter = Base64Adapter.class
1053      )
1054      private ByteBuffer _value;
1055
1056      /**
1057       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Base64} instance with no metadata.
1058       */
1059      public Base64() {
1060        this(null);
1061      }
1062
1063      /**
1064       * Constructs a new {@code dev.metaschema.oscal.lib.model.BackMatter.Resource.Base64} instance with the specified metadata.
1065       *
1066       * @param data
1067       *           the metaschema data, or {@code null} if none
1068       */
1069      public Base64(IMetaschemaData data) {
1070        this.__metaschemaData = data;
1071      }
1072
1073      @Override
1074      public IMetaschemaData getMetaschemaData() {
1075        return __metaschemaData;
1076      }
1077
1078      /**
1079       * Get the "{@literal File Name}".
1080       *
1081       * <p>
1082       * Name of the file before it was encoded as Base64 to be embedded in a <code>resource</code>. This is the name that will be assigned to the file when the file is decoded.
1083       *
1084       * @return the filename value, or {@code null} if not set
1085       */
1086      @Nullable
1087      public String getFilename() {
1088        return _filename;
1089      }
1090
1091      /**
1092       * Set the "{@literal File Name}".
1093       *
1094       * <p>
1095       * Name of the file before it was encoded as Base64 to be embedded in a <code>resource</code>. This is the name that will be assigned to the file when the file is decoded.
1096       *
1097       * @param value
1098       *           the filename value to set, or {@code null} to clear
1099       */
1100      public void setFilename(@Nullable String value) {
1101        _filename = value;
1102      }
1103
1104      /**
1105       * Get the "{@literal Media Type}".
1106       *
1107       * <p>
1108       * A label that indicates the nature of a resource, as a data serialization or format.
1109       *
1110       * @return the media-type value, or {@code null} if not set
1111       */
1112      @Nullable
1113      public String getMediaType() {
1114        return _mediaType;
1115      }
1116
1117      /**
1118       * Set the "{@literal Media Type}".
1119       *
1120       * <p>
1121       * A label that indicates the nature of a resource, as a data serialization or format.
1122       *
1123       * @param value
1124       *           the media-type value to set, or {@code null} to clear
1125       */
1126      public void setMediaType(@Nullable String value) {
1127        _mediaType = value;
1128      }
1129
1130      /**
1131       * Get the field value.
1132       *
1133       * @return the value
1134       */
1135      @Nullable
1136      public ByteBuffer getValue() {
1137        return _value;
1138      }
1139
1140      /**
1141       * Set the field value.
1142       *
1143       * @param value
1144       *           the value to set
1145       */
1146      public void setValue(@Nullable ByteBuffer value) {
1147        _value = value;
1148      }
1149
1150      @Override
1151      public String toString() {
1152        return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
1153      }
1154    }
1155  }
1156}