001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_assessment-common_metaschema.xml
002// Do not edit - changes will be lost when regenerated.
003package dev.metaschema.oscal.lib.model;
004
005import dev.metaschema.core.datatype.adapter.TokenAdapter;
006import dev.metaschema.core.datatype.adapter.UuidAdapter;
007import dev.metaschema.core.datatype.markup.MarkupMultiline;
008import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
009import dev.metaschema.core.model.IBoundObject;
010import dev.metaschema.core.model.IMetaschemaData;
011import dev.metaschema.core.model.JsonGroupAsBehavior;
012import dev.metaschema.core.model.constraint.IConstraint;
013import dev.metaschema.core.util.ObjectUtils;
014import dev.metaschema.databind.model.annotations.AllowedValue;
015import dev.metaschema.databind.model.annotations.AllowedValues;
016import dev.metaschema.databind.model.annotations.BoundAssembly;
017import dev.metaschema.databind.model.annotations.BoundField;
018import dev.metaschema.databind.model.annotations.BoundFlag;
019import dev.metaschema.databind.model.annotations.GroupAs;
020import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
021import dev.metaschema.databind.model.annotations.ValueConstraints;
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 * Identifies a set of assessment subjects to include/exclude by UUID.
032 */
033@MetaschemaAssembly(
034    formalName = "Select Assessment Subject",
035    description = "Identifies a set of assessment subjects to include/exclude by UUID.",
036    name = "select-subject-by-id",
037    moduleClass = OscalAssessmentCommonModule.class
038)
039public class SelectSubjectById implements IBoundObject {
040  private final IMetaschemaData __metaschemaData;
041
042  /**
043   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.
044   */
045  @BoundFlag(
046      formalName = "Subject Universally Unique Identifier Reference",
047      description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.",
048      name = "subject-uuid",
049      required = true,
050      typeAdapter = UuidAdapter.class
051  )
052  private UUID _subjectUuid;
053
054  /**
055   * Used to indicate the type of object pointed to by the <code>uuid-ref</code> within a subject.
056   */
057  @BoundFlag(
058      formalName = "Subject Universally Unique Identifier Reference Type",
059      description = "Used to indicate the type of object pointed to by the `uuid-ref` within a subject.",
060      name = "type",
061      required = true,
062      typeAdapter = TokenAdapter.class,
063      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-assessment-subject-type-values", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "component", description = "Component"), @AllowedValue(value = "inventory-item", description = "Inventory Item"), @AllowedValue(value = "location", description = "Location"), @AllowedValue(value = "party", description = "Interview Party"), @AllowedValue(value = "user", description = "User"), @AllowedValue(value = "resource", description = "Resource or Artifact")}))
064  )
065  private String _type;
066
067  /**
068   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
069   */
070  @BoundAssembly(
071      formalName = "Property",
072      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
073      useName = "prop",
074      maxOccurs = -1,
075      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
076  )
077  private List<Property> _props;
078
079  /**
080   * A reference to a local or remote resource, that has a specific relation to the containing object.
081   */
082  @BoundAssembly(
083      formalName = "Link",
084      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
085      useName = "link",
086      maxOccurs = -1,
087      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
088  )
089  private List<Link> _links;
090
091  /**
092   * Additional commentary about the containing object.
093   */
094  @BoundField(
095      formalName = "Remarks",
096      description = "Additional commentary about the containing object.",
097      useName = "remarks",
098      typeAdapter = MarkupMultilineAdapter.class
099  )
100  private MarkupMultiline _remarks;
101
102  /**
103   * Constructs a new {@code dev.metaschema.oscal.lib.model.SelectSubjectById} instance with no metadata.
104   */
105  public SelectSubjectById() {
106    this(null);
107  }
108
109  /**
110   * Constructs a new {@code dev.metaschema.oscal.lib.model.SelectSubjectById} instance with the specified metadata.
111   *
112   * @param data
113   *           the metaschema data, or {@code null} if none
114   */
115  public SelectSubjectById(IMetaschemaData data) {
116    this.__metaschemaData = data;
117  }
118
119  @Override
120  public IMetaschemaData getMetaschemaData() {
121    return __metaschemaData;
122  }
123
124  /**
125   * Get the "{@literal Subject Universally Unique Identifier Reference}".
126   *
127   * <p>
128   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.
129   *
130   * @return the subject-uuid value
131   */
132  @NonNull
133  public UUID getSubjectUuid() {
134    return _subjectUuid;
135  }
136
137  /**
138   * Set the "{@literal Subject Universally Unique Identifier Reference}".
139   *
140   * <p>
141   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.
142   *
143   * @param value
144   *           the subject-uuid value to set
145   */
146  public void setSubjectUuid(@NonNull UUID value) {
147    _subjectUuid = value;
148  }
149
150  /**
151   * Get the "{@literal Subject Universally Unique Identifier Reference Type}".
152   *
153   * <p>
154   * Used to indicate the type of object pointed to by the <code>uuid-ref</code> within a subject.
155   *
156   * @return the type value
157   */
158  @NonNull
159  public String getType() {
160    return _type;
161  }
162
163  /**
164   * Set the "{@literal Subject Universally Unique Identifier Reference Type}".
165   *
166   * <p>
167   * Used to indicate the type of object pointed to by the <code>uuid-ref</code> within a subject.
168   *
169   * @param value
170   *           the type value to set
171   */
172  public void setType(@NonNull String value) {
173    _type = value;
174  }
175
176  /**
177   * Get the "{@literal Property}".
178   *
179   * <p>
180   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
181   *
182   * @return the prop value
183   */
184  @NonNull
185  public List<Property> getProps() {
186    if (_props == null) {
187      _props = new LinkedList<>();
188    }
189    return ObjectUtils.notNull(_props);
190  }
191
192  /**
193   * Set the "{@literal Property}".
194   *
195   * <p>
196   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
197   *
198   * @param value
199   *           the prop value to set
200   */
201  public void setProps(@NonNull List<Property> value) {
202    _props = value;
203  }
204
205  /**
206   * Add a new {@link Property} item to the underlying collection.
207   * @param item the item to add
208   * @return {@code true}
209   */
210  public boolean addProp(Property item) {
211    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
212    if (_props == null) {
213      _props = new LinkedList<>();
214    }
215    return _props.add(value);
216  }
217
218  /**
219   * Remove the first matching {@link Property} item from the underlying collection.
220   * @param item the item to remove
221   * @return {@code true} if the item was removed or {@code false} otherwise
222   */
223  public boolean removeProp(Property item) {
224    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
225    return _props != null && _props.remove(value);
226  }
227
228  /**
229   * Get the "{@literal Link}".
230   *
231   * <p>
232   * A reference to a local or remote resource, that has a specific relation to the containing object.
233   *
234   * @return the link value
235   */
236  @NonNull
237  public List<Link> getLinks() {
238    if (_links == null) {
239      _links = new LinkedList<>();
240    }
241    return ObjectUtils.notNull(_links);
242  }
243
244  /**
245   * Set the "{@literal Link}".
246   *
247   * <p>
248   * A reference to a local or remote resource, that has a specific relation to the containing object.
249   *
250   * @param value
251   *           the link value to set
252   */
253  public void setLinks(@NonNull List<Link> value) {
254    _links = value;
255  }
256
257  /**
258   * Add a new {@link Link} item to the underlying collection.
259   * @param item the item to add
260   * @return {@code true}
261   */
262  public boolean addLink(Link item) {
263    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
264    if (_links == null) {
265      _links = new LinkedList<>();
266    }
267    return _links.add(value);
268  }
269
270  /**
271   * Remove the first matching {@link Link} item from the underlying collection.
272   * @param item the item to remove
273   * @return {@code true} if the item was removed or {@code false} otherwise
274   */
275  public boolean removeLink(Link item) {
276    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
277    return _links != null && _links.remove(value);
278  }
279
280  /**
281   * Get the "{@literal Remarks}".
282   *
283   * <p>
284   * Additional commentary about the containing object.
285   *
286   * @return the remarks value, or {@code null} if not set
287   */
288  @Nullable
289  public MarkupMultiline getRemarks() {
290    return _remarks;
291  }
292
293  /**
294   * Set the "{@literal Remarks}".
295   *
296   * <p>
297   * Additional commentary about the containing object.
298   *
299   * @param value
300   *           the remarks value to set, or {@code null} to clear
301   */
302  public void setRemarks(@Nullable MarkupMultiline value) {
303    _remarks = value;
304  }
305
306  @Override
307  public String toString() {
308    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
309  }
310}