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.model.IBoundObject;
008import dev.metaschema.core.model.IMetaschemaData;
009import dev.metaschema.core.model.JsonGroupAsBehavior;
010import dev.metaschema.core.model.constraint.IConstraint;
011import dev.metaschema.core.util.ObjectUtils;
012import dev.metaschema.databind.model.annotations.AllowedValue;
013import dev.metaschema.databind.model.annotations.AllowedValues;
014import dev.metaschema.databind.model.annotations.BoundAssembly;
015import dev.metaschema.databind.model.annotations.BoundFlag;
016import dev.metaschema.databind.model.annotations.GroupAs;
017import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
018import dev.metaschema.databind.model.annotations.ValueConstraints;
019import edu.umd.cs.findbugs.annotations.NonNull;
020import edu.umd.cs.findbugs.annotations.Nullable;
021import java.util.LinkedList;
022import java.util.List;
023import java.util.UUID;
024import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
025import org.apache.commons.lang3.builder.ToStringStyle;
026
027/**
028 * The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.
029 */
030@MetaschemaAssembly(
031    formalName = "Originating Actor",
032    description = "The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.",
033    name = "origin-actor",
034    moduleClass = OscalAssessmentCommonModule.class
035)
036public class OriginActor implements IBoundObject {
037  private final IMetaschemaData __metaschemaData;
038
039  /**
040   * The kind of actor.
041   */
042  @BoundFlag(
043      formalName = "Actor Type",
044      description = "The kind of actor.",
045      name = "type",
046      required = true,
047      typeAdapter = TokenAdapter.class,
048      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-origin-actor-type-values", level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "tool", description = "A reference to a tool component defined with the assessment assets."), @AllowedValue(value = "assessment-platform", description = "A reference to an assessment-platform defined with the assessment assets."), @AllowedValue(value = "party", description = "A reference to a party defined within the document metadata.")}))
049  )
050  private String _type;
051
052  /**
053   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to the tool or person based on the associated type.
054   */
055  @BoundFlag(
056      formalName = "Actor Universally Unique Identifier Reference",
057      description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to the tool or person based on the associated type.",
058      name = "actor-uuid",
059      required = true,
060      typeAdapter = UuidAdapter.class
061  )
062  private UUID _actorUuid;
063
064  /**
065   * For a party, this can optionally be used to specify the role the actor was performing.
066   */
067  @BoundFlag(
068      formalName = "Actor Role",
069      description = "For a party, this can optionally be used to specify the role the actor was performing.",
070      name = "role-id",
071      typeAdapter = TokenAdapter.class
072  )
073  private String _roleId;
074
075  /**
076   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
077   */
078  @BoundAssembly(
079      formalName = "Property",
080      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
081      useName = "prop",
082      maxOccurs = -1,
083      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
084  )
085  private List<Property> _props;
086
087  /**
088   * A reference to a local or remote resource, that has a specific relation to the containing object.
089   */
090  @BoundAssembly(
091      formalName = "Link",
092      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
093      useName = "link",
094      maxOccurs = -1,
095      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
096  )
097  private List<Link> _links;
098
099  /**
100   * Constructs a new {@code dev.metaschema.oscal.lib.model.OriginActor} instance with no metadata.
101   */
102  public OriginActor() {
103    this(null);
104  }
105
106  /**
107   * Constructs a new {@code dev.metaschema.oscal.lib.model.OriginActor} instance with the specified metadata.
108   *
109   * @param data
110   *           the metaschema data, or {@code null} if none
111   */
112  public OriginActor(IMetaschemaData data) {
113    this.__metaschemaData = data;
114  }
115
116  @Override
117  public IMetaschemaData getMetaschemaData() {
118    return __metaschemaData;
119  }
120
121  /**
122   * Get the "{@literal Actor Type}".
123   *
124   * <p>
125   * The kind of actor.
126   *
127   * @return the type value
128   */
129  @NonNull
130  public String getType() {
131    return _type;
132  }
133
134  /**
135   * Set the "{@literal Actor Type}".
136   *
137   * <p>
138   * The kind of actor.
139   *
140   * @param value
141   *           the type value to set
142   */
143  public void setType(@NonNull String value) {
144    _type = value;
145  }
146
147  /**
148   * Get the "{@literal Actor Universally Unique Identifier Reference}".
149   *
150   * <p>
151   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to the tool or person based on the associated type.
152   *
153   * @return the actor-uuid value
154   */
155  @NonNull
156  public UUID getActorUuid() {
157    return _actorUuid;
158  }
159
160  /**
161   * Set the "{@literal Actor Universally Unique Identifier Reference}".
162   *
163   * <p>
164   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to the tool or person based on the associated type.
165   *
166   * @param value
167   *           the actor-uuid value to set
168   */
169  public void setActorUuid(@NonNull UUID value) {
170    _actorUuid = value;
171  }
172
173  /**
174   * Get the "{@literal Actor Role}".
175   *
176   * <p>
177   * For a party, this can optionally be used to specify the role the actor was performing.
178   *
179   * @return the role-id value, or {@code null} if not set
180   */
181  @Nullable
182  public String getRoleId() {
183    return _roleId;
184  }
185
186  /**
187   * Set the "{@literal Actor Role}".
188   *
189   * <p>
190   * For a party, this can optionally be used to specify the role the actor was performing.
191   *
192   * @param value
193   *           the role-id value to set, or {@code null} to clear
194   */
195  public void setRoleId(@Nullable String value) {
196    _roleId = value;
197  }
198
199  /**
200   * Get the "{@literal Property}".
201   *
202   * <p>
203   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
204   *
205   * @return the prop value
206   */
207  @NonNull
208  public List<Property> getProps() {
209    if (_props == null) {
210      _props = new LinkedList<>();
211    }
212    return ObjectUtils.notNull(_props);
213  }
214
215  /**
216   * Set the "{@literal Property}".
217   *
218   * <p>
219   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
220   *
221   * @param value
222   *           the prop value to set
223   */
224  public void setProps(@NonNull List<Property> value) {
225    _props = value;
226  }
227
228  /**
229   * Add a new {@link Property} item to the underlying collection.
230   * @param item the item to add
231   * @return {@code true}
232   */
233  public boolean addProp(Property item) {
234    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
235    if (_props == null) {
236      _props = new LinkedList<>();
237    }
238    return _props.add(value);
239  }
240
241  /**
242   * Remove the first matching {@link Property} item from the underlying collection.
243   * @param item the item to remove
244   * @return {@code true} if the item was removed or {@code false} otherwise
245   */
246  public boolean removeProp(Property item) {
247    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
248    return _props != null && _props.remove(value);
249  }
250
251  /**
252   * Get the "{@literal Link}".
253   *
254   * <p>
255   * A reference to a local or remote resource, that has a specific relation to the containing object.
256   *
257   * @return the link value
258   */
259  @NonNull
260  public List<Link> getLinks() {
261    if (_links == null) {
262      _links = new LinkedList<>();
263    }
264    return ObjectUtils.notNull(_links);
265  }
266
267  /**
268   * Set the "{@literal Link}".
269   *
270   * <p>
271   * A reference to a local or remote resource, that has a specific relation to the containing object.
272   *
273   * @param value
274   *           the link value to set
275   */
276  public void setLinks(@NonNull List<Link> value) {
277    _links = value;
278  }
279
280  /**
281   * Add a new {@link Link} item to the underlying collection.
282   * @param item the item to add
283   * @return {@code true}
284   */
285  public boolean addLink(Link item) {
286    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
287    if (_links == null) {
288      _links = new LinkedList<>();
289    }
290    return _links.add(value);
291  }
292
293  /**
294   * Remove the first matching {@link Link} item from the underlying collection.
295   * @param item the item to remove
296   * @return {@code true} if the item was removed or {@code false} otherwise
297   */
298  public boolean removeLink(Link item) {
299    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
300    return _links != null && _links.remove(value);
301  }
302
303  @Override
304  public String toString() {
305    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
306  }
307}