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.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.BoundAssembly;
015import dev.metaschema.databind.model.annotations.BoundField;
016import dev.metaschema.databind.model.annotations.BoundFlag;
017import dev.metaschema.databind.model.annotations.GroupAs;
018import dev.metaschema.databind.model.annotations.IndexHasKey;
019import dev.metaschema.databind.model.annotations.KeyField;
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 * A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.
032 */
033@MetaschemaAssembly(
034    formalName = "Responsible Role",
035    description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.",
036    name = "responsible-role",
037    moduleClass = OscalMetadataModule.class,
038    remarks = "A `responsible-role` allows zero or more `party-uuid` references, each of which creates a relationship arc between the referenced `role-id` and the referenced party. This differs in semantics from `responsible-party`, which requires that at least one `party-uuid` is referenced.\n"
039            + "\n"
040            + "The scope of use of this object determines if the responsibility has been performed or will be performed in the future. The containing object will describe the intent."
041)
042public class ResponsibleRole implements IBoundObject {
043  private final IMetaschemaData __metaschemaData;
044
045  /**
046   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>role</code> performed.
047   */
048  @BoundFlag(
049      formalName = "Responsible Role ID",
050      description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) identifier reference to a `role` performed.",
051      name = "role-id",
052      required = true,
053      typeAdapter = TokenAdapter.class
054  )
055  private String _roleId;
056
057  /**
058   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
059   */
060  @BoundAssembly(
061      formalName = "Property",
062      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
063      useName = "prop",
064      maxOccurs = -1,
065      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
066  )
067  private List<Property> _props;
068
069  /**
070   * A reference to a local or remote resource, that has a specific relation to the containing object.
071   */
072  @BoundAssembly(
073      formalName = "Link",
074      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
075      useName = "link",
076      maxOccurs = -1,
077      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
078  )
079  private List<Link> _links;
080
081  /**
082   * Specifies zero or more parties responsible for performing the associated <code>role</code>.
083   */
084  @BoundField(
085      formalName = "Party Universally Unique Identifier Reference",
086      description = "Specifies zero or more parties responsible for performing the associated `role`.",
087      useName = "party-uuid",
088      maxOccurs = -1,
089      groupAs = @GroupAs(name = "party-uuids", inJson = JsonGroupAsBehavior.LIST),
090      typeAdapter = UuidAdapter.class,
091      valueConstraints = @ValueConstraints(indexHasKey = @IndexHasKey(id = "oscal-index-metadata-party-uuid", level = IConstraint.Level.ERROR, indexName = "index-metadata-party-uuid", keyFields = @KeyField))
092  )
093  private List<UUID> _partyUuids;
094
095  /**
096   * Additional commentary about the containing object.
097   */
098  @BoundField(
099      formalName = "Remarks",
100      description = "Additional commentary about the containing object.",
101      useName = "remarks",
102      typeAdapter = MarkupMultilineAdapter.class
103  )
104  private MarkupMultiline _remarks;
105
106  /**
107   * Constructs a new {@code dev.metaschema.oscal.lib.model.ResponsibleRole} instance with no metadata.
108   */
109  public ResponsibleRole() {
110    this(null);
111  }
112
113  /**
114   * Constructs a new {@code dev.metaschema.oscal.lib.model.ResponsibleRole} instance with the specified metadata.
115   *
116   * @param data
117   *           the metaschema data, or {@code null} if none
118   */
119  public ResponsibleRole(IMetaschemaData data) {
120    this.__metaschemaData = data;
121  }
122
123  @Override
124  public IMetaschemaData getMetaschemaData() {
125    return __metaschemaData;
126  }
127
128  /**
129   * Get the "{@literal Responsible Role ID}".
130   *
131   * <p>
132   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>role</code> performed.
133   *
134   * @return the role-id value
135   */
136  @NonNull
137  public String getRoleId() {
138    return _roleId;
139  }
140
141  /**
142   * Set the "{@literal Responsible Role ID}".
143   *
144   * <p>
145   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>role</code> performed.
146   *
147   * @param value
148   *           the role-id value to set
149   */
150  public void setRoleId(@NonNull String value) {
151    _roleId = value;
152  }
153
154  /**
155   * Get the "{@literal Property}".
156   *
157   * <p>
158   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
159   *
160   * @return the prop value
161   */
162  @NonNull
163  public List<Property> getProps() {
164    if (_props == null) {
165      _props = new LinkedList<>();
166    }
167    return ObjectUtils.notNull(_props);
168  }
169
170  /**
171   * Set the "{@literal Property}".
172   *
173   * <p>
174   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
175   *
176   * @param value
177   *           the prop value to set
178   */
179  public void setProps(@NonNull List<Property> value) {
180    _props = value;
181  }
182
183  /**
184   * Add a new {@link Property} item to the underlying collection.
185   * @param item the item to add
186   * @return {@code true}
187   */
188  public boolean addProp(Property item) {
189    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
190    if (_props == null) {
191      _props = new LinkedList<>();
192    }
193    return _props.add(value);
194  }
195
196  /**
197   * Remove the first matching {@link Property} item from the underlying collection.
198   * @param item the item to remove
199   * @return {@code true} if the item was removed or {@code false} otherwise
200   */
201  public boolean removeProp(Property item) {
202    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
203    return _props != null && _props.remove(value);
204  }
205
206  /**
207   * Get the "{@literal Link}".
208   *
209   * <p>
210   * A reference to a local or remote resource, that has a specific relation to the containing object.
211   *
212   * @return the link value
213   */
214  @NonNull
215  public List<Link> getLinks() {
216    if (_links == null) {
217      _links = new LinkedList<>();
218    }
219    return ObjectUtils.notNull(_links);
220  }
221
222  /**
223   * Set the "{@literal Link}".
224   *
225   * <p>
226   * A reference to a local or remote resource, that has a specific relation to the containing object.
227   *
228   * @param value
229   *           the link value to set
230   */
231  public void setLinks(@NonNull List<Link> value) {
232    _links = value;
233  }
234
235  /**
236   * Add a new {@link Link} item to the underlying collection.
237   * @param item the item to add
238   * @return {@code true}
239   */
240  public boolean addLink(Link item) {
241    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
242    if (_links == null) {
243      _links = new LinkedList<>();
244    }
245    return _links.add(value);
246  }
247
248  /**
249   * Remove the first matching {@link Link} item from the underlying collection.
250   * @param item the item to remove
251   * @return {@code true} if the item was removed or {@code false} otherwise
252   */
253  public boolean removeLink(Link item) {
254    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
255    return _links != null && _links.remove(value);
256  }
257
258  /**
259   * Get the "{@literal Party Universally Unique Identifier Reference}".
260   *
261   * <p>
262   * Specifies zero or more parties responsible for performing the associated <code>role</code>.
263   *
264   * @return the party-uuid value
265   */
266  @NonNull
267  public List<UUID> getPartyUuids() {
268    if (_partyUuids == null) {
269      _partyUuids = new LinkedList<>();
270    }
271    return ObjectUtils.notNull(_partyUuids);
272  }
273
274  /**
275   * Set the "{@literal Party Universally Unique Identifier Reference}".
276   *
277   * <p>
278   * Specifies zero or more parties responsible for performing the associated <code>role</code>.
279   *
280   * @param value
281   *           the party-uuid value to set
282   */
283  public void setPartyUuids(@NonNull List<UUID> value) {
284    _partyUuids = value;
285  }
286
287  /**
288   * Add a new {@link UUID} item to the underlying collection.
289   * @param item the item to add
290   * @return {@code true}
291   */
292  public boolean addPartyUuid(UUID item) {
293    UUID value = ObjectUtils.requireNonNull(item,"item cannot be null");
294    if (_partyUuids == null) {
295      _partyUuids = new LinkedList<>();
296    }
297    return _partyUuids.add(value);
298  }
299
300  /**
301   * Remove the first matching {@link UUID} item from the underlying collection.
302   * @param item the item to remove
303   * @return {@code true} if the item was removed or {@code false} otherwise
304   */
305  public boolean removePartyUuid(UUID item) {
306    UUID value = ObjectUtils.requireNonNull(item,"item cannot be null");
307    return _partyUuids != null && _partyUuids.remove(value);
308  }
309
310  /**
311   * Get the "{@literal Remarks}".
312   *
313   * <p>
314   * Additional commentary about the containing object.
315   *
316   * @return the remarks value, or {@code null} if not set
317   */
318  @Nullable
319  public MarkupMultiline getRemarks() {
320    return _remarks;
321  }
322
323  /**
324   * Set the "{@literal Remarks}".
325   *
326   * <p>
327   * Additional commentary about the containing object.
328   *
329   * @param value
330   *           the remarks value to set, or {@code null} to clear
331   */
332  public void setRemarks(@Nullable MarkupMultiline value) {
333    _remarks = value;
334  }
335
336  @Override
337  public String toString() {
338    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
339  }
340}