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.DateTimeWithTZAdapter; 006import dev.metaschema.core.datatype.adapter.TokenAdapter; 007import dev.metaschema.core.datatype.adapter.UriAdapter; 008import dev.metaschema.core.datatype.adapter.UuidAdapter; 009import dev.metaschema.core.datatype.markup.MarkupMultiline; 010import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 011import dev.metaschema.core.model.IBoundObject; 012import dev.metaschema.core.model.IMetaschemaData; 013import dev.metaschema.core.model.JsonGroupAsBehavior; 014import dev.metaschema.core.model.constraint.IConstraint; 015import dev.metaschema.core.util.ObjectUtils; 016import dev.metaschema.databind.model.annotations.AllowedValue; 017import dev.metaschema.databind.model.annotations.AllowedValues; 018import dev.metaschema.databind.model.annotations.BoundAssembly; 019import dev.metaschema.databind.model.annotations.BoundField; 020import dev.metaschema.databind.model.annotations.BoundFlag; 021import dev.metaschema.databind.model.annotations.GroupAs; 022import dev.metaschema.databind.model.annotations.IndexHasKey; 023import dev.metaschema.databind.model.annotations.KeyField; 024import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 025import dev.metaschema.databind.model.annotations.ValueConstraints; 026import edu.umd.cs.findbugs.annotations.NonNull; 027import edu.umd.cs.findbugs.annotations.Nullable; 028import java.net.URI; 029import java.time.ZonedDateTime; 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 * An action applied by a role within a given party to the content. 038 */ 039@MetaschemaAssembly( 040 formalName = "Action", 041 description = "An action applied by a role within a given party to the content.", 042 name = "action", 043 moduleClass = OscalMetadataModule.class, 044 valueConstraints = @ValueConstraints(allowedValues = {@AllowedValues(id = "oscal-metadata-action-system-values", level = IConstraint.Level.ERROR, target = "./system/@value", allowOthers = true, values = @AllowedValue(value = "http://csrc.nist.gov/ns/oscal", description = "This value identifies action types defined in the NIST OSCAL namespace.")), @AllowedValues(id = "oscal-metadata-action-type-values", level = IConstraint.Level.ERROR, target = "./type[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@value", values = {@AllowedValue(value = "approval", description = "An approval of a document instance's content."), @AllowedValue(value = "request-changes", description = "A request from the responsible party or parties to change the content.")})}, indexHasKey = {@IndexHasKey(id = "oscal-metadata-action-name-index-metadata-role-id", level = IConstraint.Level.ERROR, target = "responsible-party", indexName = "index-metadata-role-id", keyFields = @KeyField(target = "@role-id")), @IndexHasKey(id = "oscal-metadata-action-name-index-metadata-party-uuid", level = IConstraint.Level.ERROR, target = "responsible-party", indexName = "index-metadata-party-uuid", keyFields = @KeyField(target = "party-uuid"))}) 045) 046public class Action implements IBoundObject { 047 private final IMetaschemaData __metaschemaData; 048 049 /** 050 * A unique identifier that can be used to reference this defined action elsewhere in an OSCAL document. A UUID should be consistently used for a given location across revisions of the document. 051 */ 052 @BoundFlag( 053 formalName = "Action Universally Unique Identifier", 054 description = "A unique identifier that can be used to reference this defined action elsewhere in an OSCAL document. A UUID should be consistently used for a given location across revisions of the document.", 055 name = "uuid", 056 required = true, 057 typeAdapter = UuidAdapter.class 058 ) 059 private UUID _uuid; 060 061 /** 062 * The date and time when the action occurred. 063 */ 064 @BoundFlag( 065 formalName = "Action Occurrence Date", 066 description = "The date and time when the action occurred.", 067 name = "date", 068 typeAdapter = DateTimeWithTZAdapter.class 069 ) 070 private ZonedDateTime _date; 071 072 /** 073 * The type of action documented by the assembly, such as an approval. 074 */ 075 @BoundFlag( 076 formalName = "Action Type", 077 description = "The type of action documented by the assembly, such as an approval.", 078 name = "type", 079 required = true, 080 typeAdapter = TokenAdapter.class 081 ) 082 private String _type; 083 084 /** 085 * Specifies the action type system used. 086 */ 087 @BoundFlag( 088 formalName = "Action Type System", 089 description = "Specifies the action type system used.", 090 name = "system", 091 required = true, 092 typeAdapter = UriAdapter.class, 093 remarks = "Provides a means to segment the value space for the `type`, so that different organizations and individuals can assert control over the allowed `action`'s `type`. This allows the semantics associated with a given `type` to be defined on an organization-by-organization basis.\n" 094 + "\n" 095 + "An organization MUST use a URI that they have control over. e.g., a domain registered to the organization in a URI, a registered uniform resource names (URN) namespace." 096 ) 097 private URI _system; 098 099 /** 100 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 101 */ 102 @BoundAssembly( 103 formalName = "Property", 104 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 105 useName = "prop", 106 maxOccurs = -1, 107 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 108 ) 109 private List<Property> _props; 110 111 /** 112 * A reference to a local or remote resource, that has a specific relation to the containing object. 113 */ 114 @BoundAssembly( 115 formalName = "Link", 116 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 117 useName = "link", 118 maxOccurs = -1, 119 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 120 ) 121 private List<Link> _links; 122 123 /** 124 * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object. 125 */ 126 @BoundAssembly( 127 formalName = "Responsible Party", 128 description = "A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.", 129 useName = "responsible-party", 130 maxOccurs = -1, 131 groupAs = @GroupAs(name = "responsible-parties", inJson = JsonGroupAsBehavior.LIST) 132 ) 133 private List<ResponsibleParty> _responsibleParties; 134 135 /** 136 * Additional commentary about the containing object. 137 */ 138 @BoundField( 139 formalName = "Remarks", 140 description = "Additional commentary about the containing object.", 141 useName = "remarks", 142 typeAdapter = MarkupMultilineAdapter.class 143 ) 144 private MarkupMultiline _remarks; 145 146 /** 147 * Constructs a new {@code dev.metaschema.oscal.lib.model.Action} instance with no metadata. 148 */ 149 public Action() { 150 this(null); 151 } 152 153 /** 154 * Constructs a new {@code dev.metaschema.oscal.lib.model.Action} instance with the specified metadata. 155 * 156 * @param data 157 * the metaschema data, or {@code null} if none 158 */ 159 public Action(IMetaschemaData data) { 160 this.__metaschemaData = data; 161 } 162 163 @Override 164 public IMetaschemaData getMetaschemaData() { 165 return __metaschemaData; 166 } 167 168 /** 169 * Get the "{@literal Action Universally Unique Identifier}". 170 * 171 * <p> 172 * A unique identifier that can be used to reference this defined action elsewhere in an OSCAL document. A UUID should be consistently used for a given location across revisions of the document. 173 * 174 * @return the uuid value 175 */ 176 @NonNull 177 public UUID getUuid() { 178 return _uuid; 179 } 180 181 /** 182 * Set the "{@literal Action Universally Unique Identifier}". 183 * 184 * <p> 185 * A unique identifier that can be used to reference this defined action elsewhere in an OSCAL document. A UUID should be consistently used for a given location across revisions of the document. 186 * 187 * @param value 188 * the uuid value to set 189 */ 190 public void setUuid(@NonNull UUID value) { 191 _uuid = value; 192 } 193 194 /** 195 * Get the "{@literal Action Occurrence Date}". 196 * 197 * <p> 198 * The date and time when the action occurred. 199 * 200 * @return the date value, or {@code null} if not set 201 */ 202 @Nullable 203 public ZonedDateTime getDate() { 204 return _date; 205 } 206 207 /** 208 * Set the "{@literal Action Occurrence Date}". 209 * 210 * <p> 211 * The date and time when the action occurred. 212 * 213 * @param value 214 * the date value to set, or {@code null} to clear 215 */ 216 public void setDate(@Nullable ZonedDateTime value) { 217 _date = value; 218 } 219 220 /** 221 * Get the "{@literal Action Type}". 222 * 223 * <p> 224 * The type of action documented by the assembly, such as an approval. 225 * 226 * @return the type value 227 */ 228 @NonNull 229 public String getType() { 230 return _type; 231 } 232 233 /** 234 * Set the "{@literal Action Type}". 235 * 236 * <p> 237 * The type of action documented by the assembly, such as an approval. 238 * 239 * @param value 240 * the type value to set 241 */ 242 public void setType(@NonNull String value) { 243 _type = value; 244 } 245 246 /** 247 * Get the "{@literal Action Type System}". 248 * 249 * <p> 250 * Specifies the action type system used. 251 * 252 * @return the system value 253 */ 254 @NonNull 255 public URI getSystem() { 256 return _system; 257 } 258 259 /** 260 * Set the "{@literal Action Type System}". 261 * 262 * <p> 263 * Specifies the action type system used. 264 * 265 * @param value 266 * the system value to set 267 */ 268 public void setSystem(@NonNull URI value) { 269 _system = value; 270 } 271 272 /** 273 * Get the "{@literal Property}". 274 * 275 * <p> 276 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 277 * 278 * @return the prop value 279 */ 280 @NonNull 281 public List<Property> getProps() { 282 if (_props == null) { 283 _props = new LinkedList<>(); 284 } 285 return ObjectUtils.notNull(_props); 286 } 287 288 /** 289 * Set the "{@literal Property}". 290 * 291 * <p> 292 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 293 * 294 * @param value 295 * the prop value to set 296 */ 297 public void setProps(@NonNull List<Property> value) { 298 _props = value; 299 } 300 301 /** 302 * Add a new {@link Property} item to the underlying collection. 303 * @param item the item to add 304 * @return {@code true} 305 */ 306 public boolean addProp(Property item) { 307 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 308 if (_props == null) { 309 _props = new LinkedList<>(); 310 } 311 return _props.add(value); 312 } 313 314 /** 315 * Remove the first matching {@link Property} item from the underlying collection. 316 * @param item the item to remove 317 * @return {@code true} if the item was removed or {@code false} otherwise 318 */ 319 public boolean removeProp(Property item) { 320 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 321 return _props != null && _props.remove(value); 322 } 323 324 /** 325 * Get the "{@literal Link}". 326 * 327 * <p> 328 * A reference to a local or remote resource, that has a specific relation to the containing object. 329 * 330 * @return the link value 331 */ 332 @NonNull 333 public List<Link> getLinks() { 334 if (_links == null) { 335 _links = new LinkedList<>(); 336 } 337 return ObjectUtils.notNull(_links); 338 } 339 340 /** 341 * Set the "{@literal Link}". 342 * 343 * <p> 344 * A reference to a local or remote resource, that has a specific relation to the containing object. 345 * 346 * @param value 347 * the link value to set 348 */ 349 public void setLinks(@NonNull List<Link> value) { 350 _links = value; 351 } 352 353 /** 354 * Add a new {@link Link} item to the underlying collection. 355 * @param item the item to add 356 * @return {@code true} 357 */ 358 public boolean addLink(Link item) { 359 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 360 if (_links == null) { 361 _links = new LinkedList<>(); 362 } 363 return _links.add(value); 364 } 365 366 /** 367 * Remove the first matching {@link Link} item from the underlying collection. 368 * @param item the item to remove 369 * @return {@code true} if the item was removed or {@code false} otherwise 370 */ 371 public boolean removeLink(Link item) { 372 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 373 return _links != null && _links.remove(value); 374 } 375 376 /** 377 * Get the "{@literal Responsible Party}". 378 * 379 * <p> 380 * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object. 381 * 382 * @return the responsible-party value 383 */ 384 @NonNull 385 public List<ResponsibleParty> getResponsibleParties() { 386 if (_responsibleParties == null) { 387 _responsibleParties = new LinkedList<>(); 388 } 389 return ObjectUtils.notNull(_responsibleParties); 390 } 391 392 /** 393 * Set the "{@literal Responsible Party}". 394 * 395 * <p> 396 * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object. 397 * 398 * @param value 399 * the responsible-party value to set 400 */ 401 public void setResponsibleParties(@NonNull List<ResponsibleParty> value) { 402 _responsibleParties = value; 403 } 404 405 /** 406 * Add a new {@link ResponsibleParty} item to the underlying collection. 407 * @param item the item to add 408 * @return {@code true} 409 */ 410 public boolean addResponsibleParty(ResponsibleParty item) { 411 ResponsibleParty value = ObjectUtils.requireNonNull(item,"item cannot be null"); 412 if (_responsibleParties == null) { 413 _responsibleParties = new LinkedList<>(); 414 } 415 return _responsibleParties.add(value); 416 } 417 418 /** 419 * Remove the first matching {@link ResponsibleParty} item from the underlying collection. 420 * @param item the item to remove 421 * @return {@code true} if the item was removed or {@code false} otherwise 422 */ 423 public boolean removeResponsibleParty(ResponsibleParty item) { 424 ResponsibleParty value = ObjectUtils.requireNonNull(item,"item cannot be null"); 425 return _responsibleParties != null && _responsibleParties.remove(value); 426 } 427 428 /** 429 * Get the "{@literal Remarks}". 430 * 431 * <p> 432 * Additional commentary about the containing object. 433 * 434 * @return the remarks value, or {@code null} if not set 435 */ 436 @Nullable 437 public MarkupMultiline getRemarks() { 438 return _remarks; 439 } 440 441 /** 442 * Set the "{@literal Remarks}". 443 * 444 * <p> 445 * Additional commentary about the containing object. 446 * 447 * @param value 448 * the remarks value to set, or {@code null} to clear 449 */ 450 public void setRemarks(@Nullable MarkupMultiline value) { 451 _remarks = value; 452 } 453 454 @Override 455 public String toString() { 456 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 457 } 458}