001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_implementation-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.StringAdapter;
006import dev.metaschema.core.datatype.adapter.TokenAdapter;
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.MetaschemaAssembly;
026import dev.metaschema.databind.model.annotations.ValueConstraints;
027import edu.umd.cs.findbugs.annotations.NonNull;
028import edu.umd.cs.findbugs.annotations.Nullable;
029import java.util.LinkedList;
030import java.util.List;
031import java.util.UUID;
032import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
033import org.apache.commons.lang3.builder.ToStringStyle;
034
035/**
036 * A type of user that interacts with the system based on an associated role.
037 */
038@MetaschemaAssembly(
039    formalName = "System User",
040    description = "A type of user that interacts with the system based on an associated role.",
041    name = "system-user",
042    moduleClass = OscalImplementationCommonModule.class,
043    remarks = "Permissible values to be determined closer to the application, such as by a receiving authority.",
044    valueConstraints = @ValueConstraints(allowedValues = {@AllowedValues(id = "oscal-user-prop-name-values", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = {@AllowedValue(value = "type", description = "The type of user, such as internal, external, or general-public."), @AllowedValue(value = "privilege-level", description = "The user's privilege level within the system, such as privileged, non-privileged, no-logical-access.")}), @AllowedValues(id = "oscal-user-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 = "internal", description = "A user account for a person or entity that is part of the organization who owns or operates the system."), @AllowedValue(value = "external", description = "A user account for a person or entity that is not part of the organization who owns or operates the system."), @AllowedValue(value = "general-public", description = "A user of the system considered to be outside")}), @AllowedValues(id = "oscal-user-prop-privilege-level-values", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='privilege-level']/@value", values = {@AllowedValue(value = "privileged", description = "This role has elevated access to the system, such as a group or system administrator."), @AllowedValue(value = "non-privileged", description = "This role has typical user-level access to the system without elevated access."), @AllowedValue(value = "no-logical-access", description = "This role has no access to the system, such as a manager who approves access as part of a process.")}), @AllowedValues(id = "oscal-user-role-id-values", level = IConstraint.Level.ERROR, target = "role-id", allowOthers = true, values = {@AllowedValue(value = "asset-owner", description = "Accountable for ensuring the asset is managed in accordance with organizational policies and procedures."), @AllowedValue(value = "asset-administrator", description = "Responsible for administering a set of assets."), @AllowedValue(value = "security-operations", description = "Members of the security operations center (SOC)."), @AllowedValue(value = "network-operations", description = "Members of the network operations center (NOC)."), @AllowedValue(value = "incident-response", description = "Responsible for responding to an event that could lead to loss of, or disruption to, an organization's operations, services or functions."), @AllowedValue(value = "help-desk", description = "Responsible for providing information and support to users."), @AllowedValue(value = "configuration-management", description = "Responsible for the configuration management processes governing changes to the asset.")})})
045)
046public class SystemUser implements IBoundObject {
047  private final IMetaschemaData __metaschemaData;
048
049  /**
050   * 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 user class elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>system user</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.
051   */
052  @BoundFlag(
053      formalName = "User Universally Unique Identifier",
054      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 user class elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `system user` 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.",
055      name = "uuid",
056      required = true,
057      typeAdapter = UuidAdapter.class
058  )
059  private UUID _uuid;
060
061  /**
062   * A name given to the user, which may be used by a tool for display and navigation.
063   */
064  @BoundField(
065      formalName = "User Title",
066      description = "A name given to the user, which may be used by a tool for display and navigation.",
067      useName = "title",
068      typeAdapter = MarkupLineAdapter.class
069  )
070  private MarkupLine _title;
071
072  /**
073   * A short common name, abbreviation, or acronym for the user.
074   */
075  @BoundField(
076      formalName = "User Short Name",
077      description = "A short common name, abbreviation, or acronym for the user.",
078      useName = "short-name",
079      typeAdapter = StringAdapter.class
080  )
081  private String _shortName;
082
083  /**
084   * A summary of the user's purpose within the system.
085   */
086  @BoundField(
087      formalName = "User Description",
088      description = "A summary of the user's purpose within the system.",
089      useName = "description",
090      typeAdapter = MarkupMultilineAdapter.class
091  )
092  private MarkupMultiline _description;
093
094  /**
095   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
096   */
097  @BoundAssembly(
098      formalName = "Property",
099      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
100      useName = "prop",
101      maxOccurs = -1,
102      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
103  )
104  private List<Property> _props;
105
106  /**
107   * A reference to a local or remote resource, that has a specific relation to the containing object.
108   */
109  @BoundAssembly(
110      formalName = "Link",
111      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
112      useName = "link",
113      maxOccurs = -1,
114      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
115  )
116  private List<Link> _links;
117
118  /**
119   * Reference to a role by UUID.
120   */
121  @BoundField(
122      formalName = "Role Identifier Reference",
123      description = "Reference to a role by UUID.",
124      useName = "role-id",
125      maxOccurs = -1,
126      groupAs = @GroupAs(name = "role-ids", inJson = JsonGroupAsBehavior.LIST),
127      typeAdapter = TokenAdapter.class,
128      valueConstraints = @ValueConstraints(indexHasKey = @IndexHasKey(id = "oscal-index-metadata-role-id", level = IConstraint.Level.ERROR, indexName = "index-metadata-role-id", keyFields = @KeyField))
129  )
130  private List<String> _roleIds;
131
132  /**
133   * Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.
134   */
135  @BoundAssembly(
136      formalName = "Privilege",
137      description = "Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.",
138      useName = "authorized-privilege",
139      maxOccurs = -1,
140      groupAs = @GroupAs(name = "authorized-privileges", inJson = JsonGroupAsBehavior.LIST)
141  )
142  private List<AuthorizedPrivilege> _authorizedPrivileges;
143
144  /**
145   * Additional commentary about the containing object.
146   */
147  @BoundField(
148      formalName = "Remarks",
149      description = "Additional commentary about the containing object.",
150      useName = "remarks",
151      typeAdapter = MarkupMultilineAdapter.class
152  )
153  private MarkupMultiline _remarks;
154
155  /**
156   * Constructs a new {@code dev.metaschema.oscal.lib.model.SystemUser} instance with no metadata.
157   */
158  public SystemUser() {
159    this(null);
160  }
161
162  /**
163   * Constructs a new {@code dev.metaschema.oscal.lib.model.SystemUser} instance with the specified metadata.
164   *
165   * @param data
166   *           the metaschema data, or {@code null} if none
167   */
168  public SystemUser(IMetaschemaData data) {
169    this.__metaschemaData = data;
170  }
171
172  @Override
173  public IMetaschemaData getMetaschemaData() {
174    return __metaschemaData;
175  }
176
177  /**
178   * Get the "{@literal User Universally Unique Identifier}".
179   *
180   * <p>
181   * 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 user class elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>system user</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.
182   *
183   * @return the uuid value
184   */
185  @NonNull
186  public UUID getUuid() {
187    return _uuid;
188  }
189
190  /**
191   * Set the "{@literal User Universally Unique Identifier}".
192   *
193   * <p>
194   * 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 user class elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>system user</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.
195   *
196   * @param value
197   *           the uuid value to set
198   */
199  public void setUuid(@NonNull UUID value) {
200    _uuid = value;
201  }
202
203  /**
204   * Get the "{@literal User Title}".
205   *
206   * <p>
207   * A name given to the user, which may be used by a tool for display and navigation.
208   *
209   * @return the title value, or {@code null} if not set
210   */
211  @Nullable
212  public MarkupLine getTitle() {
213    return _title;
214  }
215
216  /**
217   * Set the "{@literal User Title}".
218   *
219   * <p>
220   * A name given to the user, which may be used by a tool for display and navigation.
221   *
222   * @param value
223   *           the title value to set, or {@code null} to clear
224   */
225  public void setTitle(@Nullable MarkupLine value) {
226    _title = value;
227  }
228
229  /**
230   * Get the "{@literal User Short Name}".
231   *
232   * <p>
233   * A short common name, abbreviation, or acronym for the user.
234   *
235   * @return the short-name value, or {@code null} if not set
236   */
237  @Nullable
238  public String getShortName() {
239    return _shortName;
240  }
241
242  /**
243   * Set the "{@literal User Short Name}".
244   *
245   * <p>
246   * A short common name, abbreviation, or acronym for the user.
247   *
248   * @param value
249   *           the short-name value to set, or {@code null} to clear
250   */
251  public void setShortName(@Nullable String value) {
252    _shortName = value;
253  }
254
255  /**
256   * Get the "{@literal User Description}".
257   *
258   * <p>
259   * A summary of the user's purpose within the system.
260   *
261   * @return the description value, or {@code null} if not set
262   */
263  @Nullable
264  public MarkupMultiline getDescription() {
265    return _description;
266  }
267
268  /**
269   * Set the "{@literal User Description}".
270   *
271   * <p>
272   * A summary of the user's purpose within the system.
273   *
274   * @param value
275   *           the description value to set, or {@code null} to clear
276   */
277  public void setDescription(@Nullable MarkupMultiline value) {
278    _description = value;
279  }
280
281  /**
282   * Get the "{@literal Property}".
283   *
284   * <p>
285   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
286   *
287   * @return the prop value
288   */
289  @NonNull
290  public List<Property> getProps() {
291    if (_props == null) {
292      _props = new LinkedList<>();
293    }
294    return ObjectUtils.notNull(_props);
295  }
296
297  /**
298   * Set the "{@literal Property}".
299   *
300   * <p>
301   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
302   *
303   * @param value
304   *           the prop value to set
305   */
306  public void setProps(@NonNull List<Property> value) {
307    _props = value;
308  }
309
310  /**
311   * Add a new {@link Property} item to the underlying collection.
312   * @param item the item to add
313   * @return {@code true}
314   */
315  public boolean addProp(Property item) {
316    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
317    if (_props == null) {
318      _props = new LinkedList<>();
319    }
320    return _props.add(value);
321  }
322
323  /**
324   * Remove the first matching {@link Property} item from the underlying collection.
325   * @param item the item to remove
326   * @return {@code true} if the item was removed or {@code false} otherwise
327   */
328  public boolean removeProp(Property item) {
329    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
330    return _props != null && _props.remove(value);
331  }
332
333  /**
334   * Get the "{@literal Link}".
335   *
336   * <p>
337   * A reference to a local or remote resource, that has a specific relation to the containing object.
338   *
339   * @return the link value
340   */
341  @NonNull
342  public List<Link> getLinks() {
343    if (_links == null) {
344      _links = new LinkedList<>();
345    }
346    return ObjectUtils.notNull(_links);
347  }
348
349  /**
350   * Set the "{@literal Link}".
351   *
352   * <p>
353   * A reference to a local or remote resource, that has a specific relation to the containing object.
354   *
355   * @param value
356   *           the link value to set
357   */
358  public void setLinks(@NonNull List<Link> value) {
359    _links = value;
360  }
361
362  /**
363   * Add a new {@link Link} item to the underlying collection.
364   * @param item the item to add
365   * @return {@code true}
366   */
367  public boolean addLink(Link item) {
368    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
369    if (_links == null) {
370      _links = new LinkedList<>();
371    }
372    return _links.add(value);
373  }
374
375  /**
376   * Remove the first matching {@link Link} item from the underlying collection.
377   * @param item the item to remove
378   * @return {@code true} if the item was removed or {@code false} otherwise
379   */
380  public boolean removeLink(Link item) {
381    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
382    return _links != null && _links.remove(value);
383  }
384
385  /**
386   * Get the "{@literal Role Identifier Reference}".
387   *
388   * <p>
389   * Reference to a role by UUID.
390   *
391   * @return the role-id value
392   */
393  @NonNull
394  public List<String> getRoleIds() {
395    if (_roleIds == null) {
396      _roleIds = new LinkedList<>();
397    }
398    return ObjectUtils.notNull(_roleIds);
399  }
400
401  /**
402   * Set the "{@literal Role Identifier Reference}".
403   *
404   * <p>
405   * Reference to a role by UUID.
406   *
407   * @param value
408   *           the role-id value to set
409   */
410  public void setRoleIds(@NonNull List<String> value) {
411    _roleIds = value;
412  }
413
414  /**
415   * Add a new {@link String} item to the underlying collection.
416   * @param item the item to add
417   * @return {@code true}
418   */
419  public boolean addRoleId(String item) {
420    String value = ObjectUtils.requireNonNull(item,"item cannot be null");
421    if (_roleIds == null) {
422      _roleIds = new LinkedList<>();
423    }
424    return _roleIds.add(value);
425  }
426
427  /**
428   * Remove the first matching {@link String} item from the underlying collection.
429   * @param item the item to remove
430   * @return {@code true} if the item was removed or {@code false} otherwise
431   */
432  public boolean removeRoleId(String item) {
433    String value = ObjectUtils.requireNonNull(item,"item cannot be null");
434    return _roleIds != null && _roleIds.remove(value);
435  }
436
437  /**
438   * Get the "{@literal Privilege}".
439   *
440   * <p>
441   * Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.
442   *
443   * @return the authorized-privilege value
444   */
445  @NonNull
446  public List<AuthorizedPrivilege> getAuthorizedPrivileges() {
447    if (_authorizedPrivileges == null) {
448      _authorizedPrivileges = new LinkedList<>();
449    }
450    return ObjectUtils.notNull(_authorizedPrivileges);
451  }
452
453  /**
454   * Set the "{@literal Privilege}".
455   *
456   * <p>
457   * Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.
458   *
459   * @param value
460   *           the authorized-privilege value to set
461   */
462  public void setAuthorizedPrivileges(@NonNull List<AuthorizedPrivilege> value) {
463    _authorizedPrivileges = value;
464  }
465
466  /**
467   * Add a new {@link AuthorizedPrivilege} item to the underlying collection.
468   * @param item the item to add
469   * @return {@code true}
470   */
471  public boolean addAuthorizedPrivilege(AuthorizedPrivilege item) {
472    AuthorizedPrivilege value = ObjectUtils.requireNonNull(item,"item cannot be null");
473    if (_authorizedPrivileges == null) {
474      _authorizedPrivileges = new LinkedList<>();
475    }
476    return _authorizedPrivileges.add(value);
477  }
478
479  /**
480   * Remove the first matching {@link AuthorizedPrivilege} item from the underlying collection.
481   * @param item the item to remove
482   * @return {@code true} if the item was removed or {@code false} otherwise
483   */
484  public boolean removeAuthorizedPrivilege(AuthorizedPrivilege item) {
485    AuthorizedPrivilege value = ObjectUtils.requireNonNull(item,"item cannot be null");
486    return _authorizedPrivileges != null && _authorizedPrivileges.remove(value);
487  }
488
489  /**
490   * Get the "{@literal Remarks}".
491   *
492   * <p>
493   * Additional commentary about the containing object.
494   *
495   * @return the remarks value, or {@code null} if not set
496   */
497  @Nullable
498  public MarkupMultiline getRemarks() {
499    return _remarks;
500  }
501
502  /**
503   * Set the "{@literal Remarks}".
504   *
505   * <p>
506   * Additional commentary about the containing object.
507   *
508   * @param value
509   *           the remarks value to set, or {@code null} to clear
510   */
511  public void setRemarks(@Nullable MarkupMultiline value) {
512    _remarks = value;
513  }
514
515  @Override
516  public String toString() {
517    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
518  }
519}