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.UriAdapter;
006import dev.metaschema.core.datatype.adapter.UriReferenceAdapter;
007import dev.metaschema.core.datatype.adapter.UuidAdapter;
008import dev.metaschema.core.datatype.markup.MarkupLine;
009import dev.metaschema.core.datatype.markup.MarkupLineAdapter;
010import dev.metaschema.core.datatype.markup.MarkupMultiline;
011import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
012import dev.metaschema.core.model.IBoundObject;
013import dev.metaschema.core.model.IMetaschemaData;
014import dev.metaschema.core.model.JsonGroupAsBehavior;
015import dev.metaschema.core.model.constraint.IConstraint;
016import dev.metaschema.core.util.ObjectUtils;
017import dev.metaschema.databind.model.annotations.AllowedValue;
018import dev.metaschema.databind.model.annotations.AllowedValues;
019import dev.metaschema.databind.model.annotations.BoundAssembly;
020import dev.metaschema.databind.model.annotations.BoundField;
021import dev.metaschema.databind.model.annotations.BoundFlag;
022import dev.metaschema.databind.model.annotations.GroupAs;
023import dev.metaschema.databind.model.annotations.IndexHasKey;
024import dev.metaschema.databind.model.annotations.KeyField;
025import dev.metaschema.databind.model.annotations.Matches;
026import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
027import dev.metaschema.databind.model.annotations.ValueConstraints;
028import edu.umd.cs.findbugs.annotations.NonNull;
029import edu.umd.cs.findbugs.annotations.Nullable;
030import java.util.LinkedList;
031import java.util.List;
032import java.util.UUID;
033import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
034import org.apache.commons.lang3.builder.ToStringStyle;
035
036/**
037 * A graphic that provides a visual representation the system, or some aspect of it.
038 */
039@MetaschemaAssembly(
040    formalName = "Diagram",
041    description = "A graphic that provides a visual representation the system, or some aspect of it.",
042    name = "diagram",
043    moduleClass = OscalSspModule.class,
044    remarks = "A diagram must include a `link` with a rel value of \"diagram\", who's href references a remote URI or an internal reference within this document containing the diagram.",
045    valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-diagram-link-rel-values", level = IConstraint.Level.ERROR, target = "link/@rel", allowOthers = true, values = @AllowedValue(value = "diagram", description = "A reference to the diagram image.")), indexHasKey = @IndexHasKey(id = "oscal-diagram-index-back-matter-resource-link-rel", level = IConstraint.Level.ERROR, target = "link[@rel='diagram' and starts-with(@href,'#')]", indexName = "index-back-matter-resource", keyFields = @KeyField(target = "@href", pattern = "#(.*)")), matches = {@Matches(id = "oscal-diagram-datatype-uri-reference", level = IConstraint.Level.ERROR, target = "link[@rel='diagram']/@href[starts-with(.,'#')]", typeAdapter = UriReferenceAdapter.class), @Matches(id = "oscal-diagram-datatype-uri", level = IConstraint.Level.ERROR, target = "link[@rel='diagram']/@href[not(starts-with(.,'#'))]", typeAdapter = UriAdapter.class)})
046)
047public class Diagram implements IBoundObject {
048  private final IMetaschemaData __metaschemaData;
049
050  /**
051   * 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 diagram elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>diagram</code> can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document.
052   */
053  @BoundFlag(
054      formalName = "Diagram ID",
055      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 diagram elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers). The locally defined *UUID* of the `diagram` can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.",
056      name = "uuid",
057      required = true,
058      typeAdapter = UuidAdapter.class
059  )
060  private UUID _uuid;
061
062  /**
063   * A summary of the diagram.
064   */
065  @BoundField(
066      formalName = "Diagram Description",
067      description = "A summary of the diagram.",
068      useName = "description",
069      remarks = "This description is intended to be used as alternate text to support compliance with requirements from [Section 508 of the United States Workforce Rehabilitation Act of 1973](https://www.section508.gov/manage/laws-and-policies).",
070      typeAdapter = MarkupMultilineAdapter.class
071  )
072  private MarkupMultiline _description;
073
074  /**
075   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
076   */
077  @BoundAssembly(
078      formalName = "Property",
079      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
080      useName = "prop",
081      maxOccurs = -1,
082      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
083  )
084  private List<Property> _props;
085
086  /**
087   * A reference to a local or remote resource, that has a specific relation to the containing object.
088   */
089  @BoundAssembly(
090      formalName = "Link",
091      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
092      useName = "link",
093      maxOccurs = -1,
094      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
095  )
096  private List<Link> _links;
097
098  /**
099   * A brief caption to annotate the diagram.
100   */
101  @BoundField(
102      formalName = "Caption",
103      description = "A brief caption to annotate the diagram.",
104      useName = "caption",
105      typeAdapter = MarkupLineAdapter.class
106  )
107  private MarkupLine _caption;
108
109  /**
110   * Additional commentary about the containing object.
111   */
112  @BoundField(
113      formalName = "Remarks",
114      description = "Additional commentary about the containing object.",
115      useName = "remarks",
116      typeAdapter = MarkupMultilineAdapter.class
117  )
118  private MarkupMultiline _remarks;
119
120  /**
121   * Constructs a new {@code dev.metaschema.oscal.lib.model.Diagram} instance with no metadata.
122   */
123  public Diagram() {
124    this(null);
125  }
126
127  /**
128   * Constructs a new {@code dev.metaschema.oscal.lib.model.Diagram} instance with the specified metadata.
129   *
130   * @param data
131   *           the metaschema data, or {@code null} if none
132   */
133  public Diagram(IMetaschemaData data) {
134    this.__metaschemaData = data;
135  }
136
137  @Override
138  public IMetaschemaData getMetaschemaData() {
139    return __metaschemaData;
140  }
141
142  /**
143   * Get the "{@literal Diagram ID}".
144   *
145   * <p>
146   * 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 diagram elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>diagram</code> can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document.
147   *
148   * @return the uuid value
149   */
150  @NonNull
151  public UUID getUuid() {
152    return _uuid;
153  }
154
155  /**
156   * Set the "{@literal Diagram ID}".
157   *
158   * <p>
159   * 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 diagram elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#ssp-identifiers">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>diagram</code> can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document.
160   *
161   * @param value
162   *           the uuid value to set
163   */
164  public void setUuid(@NonNull UUID value) {
165    _uuid = value;
166  }
167
168  /**
169   * Get the "{@literal Diagram Description}".
170   *
171   * <p>
172   * A summary of the diagram.
173   *
174   * @return the description value, or {@code null} if not set
175   */
176  @Nullable
177  public MarkupMultiline getDescription() {
178    return _description;
179  }
180
181  /**
182   * Set the "{@literal Diagram Description}".
183   *
184   * <p>
185   * A summary of the diagram.
186   *
187   * @param value
188   *           the description value to set, or {@code null} to clear
189   */
190  public void setDescription(@Nullable MarkupMultiline value) {
191    _description = value;
192  }
193
194  /**
195   * Get the "{@literal Property}".
196   *
197   * <p>
198   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
199   *
200   * @return the prop value
201   */
202  @NonNull
203  public List<Property> getProps() {
204    if (_props == null) {
205      _props = new LinkedList<>();
206    }
207    return ObjectUtils.notNull(_props);
208  }
209
210  /**
211   * Set the "{@literal Property}".
212   *
213   * <p>
214   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
215   *
216   * @param value
217   *           the prop value to set
218   */
219  public void setProps(@NonNull List<Property> value) {
220    _props = value;
221  }
222
223  /**
224   * Add a new {@link Property} item to the underlying collection.
225   * @param item the item to add
226   * @return {@code true}
227   */
228  public boolean addProp(Property item) {
229    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
230    if (_props == null) {
231      _props = new LinkedList<>();
232    }
233    return _props.add(value);
234  }
235
236  /**
237   * Remove the first matching {@link Property} item from the underlying collection.
238   * @param item the item to remove
239   * @return {@code true} if the item was removed or {@code false} otherwise
240   */
241  public boolean removeProp(Property item) {
242    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
243    return _props != null && _props.remove(value);
244  }
245
246  /**
247   * Get the "{@literal Link}".
248   *
249   * <p>
250   * A reference to a local or remote resource, that has a specific relation to the containing object.
251   *
252   * @return the link value
253   */
254  @NonNull
255  public List<Link> getLinks() {
256    if (_links == null) {
257      _links = new LinkedList<>();
258    }
259    return ObjectUtils.notNull(_links);
260  }
261
262  /**
263   * Set the "{@literal Link}".
264   *
265   * <p>
266   * A reference to a local or remote resource, that has a specific relation to the containing object.
267   *
268   * @param value
269   *           the link value to set
270   */
271  public void setLinks(@NonNull List<Link> value) {
272    _links = value;
273  }
274
275  /**
276   * Add a new {@link Link} item to the underlying collection.
277   * @param item the item to add
278   * @return {@code true}
279   */
280  public boolean addLink(Link item) {
281    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
282    if (_links == null) {
283      _links = new LinkedList<>();
284    }
285    return _links.add(value);
286  }
287
288  /**
289   * Remove the first matching {@link Link} item from the underlying collection.
290   * @param item the item to remove
291   * @return {@code true} if the item was removed or {@code false} otherwise
292   */
293  public boolean removeLink(Link item) {
294    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
295    return _links != null && _links.remove(value);
296  }
297
298  /**
299   * Get the "{@literal Caption}".
300   *
301   * <p>
302   * A brief caption to annotate the diagram.
303   *
304   * @return the caption value, or {@code null} if not set
305   */
306  @Nullable
307  public MarkupLine getCaption() {
308    return _caption;
309  }
310
311  /**
312   * Set the "{@literal Caption}".
313   *
314   * <p>
315   * A brief caption to annotate the diagram.
316   *
317   * @param value
318   *           the caption value to set, or {@code null} to clear
319   */
320  public void setCaption(@Nullable MarkupLine value) {
321    _caption = value;
322  }
323
324  /**
325   * Get the "{@literal Remarks}".
326   *
327   * <p>
328   * Additional commentary about the containing object.
329   *
330   * @return the remarks value, or {@code null} if not set
331   */
332  @Nullable
333  public MarkupMultiline getRemarks() {
334    return _remarks;
335  }
336
337  /**
338   * Set the "{@literal Remarks}".
339   *
340   * <p>
341   * Additional commentary about the containing object.
342   *
343   * @param value
344   *           the remarks value to set, or {@code null} to clear
345   */
346  public void setRemarks(@Nullable MarkupMultiline value) {
347    _remarks = value;
348  }
349
350  @Override
351  public String toString() {
352    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
353  }
354}