001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_component_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.AssemblyConstraints; 015import dev.metaschema.databind.model.annotations.BoundAssembly; 016import dev.metaschema.databind.model.annotations.BoundField; 017import dev.metaschema.databind.model.annotations.BoundFlag; 018import dev.metaschema.databind.model.annotations.GroupAs; 019import dev.metaschema.databind.model.annotations.IsUnique; 020import dev.metaschema.databind.model.annotations.KeyField; 021import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 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 which statements within a control are addressed. 032 */ 033@MetaschemaAssembly( 034 formalName = "Control Statement Implementation", 035 description = "Identifies which statements within a control are addressed.", 036 name = "statement", 037 moduleClass = OscalComponentDefinitionModule.class, 038 modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-unique-component-definition-statement-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once.")) 039) 040public class ComponentStatement implements IBoundObject { 041 private final IMetaschemaData __metaschemaData; 042 043 /** 044 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>. 045 */ 046 @BoundFlag( 047 formalName = "Control Statement Reference", 048 description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) identifier reference to a `control statement`.", 049 name = "statement-id", 050 required = true, 051 typeAdapter = TokenAdapter.class, 052 remarks = "A reference to the specific implemented statement associated with a control." 053 ) 054 private String _statementId; 055 056 /** 057 * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance). 058 */ 059 @BoundFlag( 060 formalName = "Control Statement Reference Universally Unique Identifier", 061 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 control statement elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-identifiers). The *UUID* of the `control statement` in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).", 062 name = "uuid", 063 required = true, 064 typeAdapter = UuidAdapter.class 065 ) 066 private UUID _uuid; 067 068 /** 069 * A summary of how the containing control statement is implemented by the component or capability. 070 */ 071 @BoundField( 072 formalName = "Statement Implementation Description", 073 description = "A summary of how the containing control statement is implemented by the component or capability.", 074 useName = "description", 075 minOccurs = 1, 076 typeAdapter = MarkupMultilineAdapter.class 077 ) 078 private MarkupMultiline _description; 079 080 /** 081 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 082 */ 083 @BoundAssembly( 084 formalName = "Property", 085 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 086 useName = "prop", 087 maxOccurs = -1, 088 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 089 ) 090 private List<Property> _props; 091 092 /** 093 * A reference to a local or remote resource, that has a specific relation to the containing object. 094 */ 095 @BoundAssembly( 096 formalName = "Link", 097 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 098 useName = "link", 099 maxOccurs = -1, 100 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 101 ) 102 private List<Link> _links; 103 104 /** 105 * 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. 106 */ 107 @BoundAssembly( 108 formalName = "Responsible Role", 109 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.", 110 useName = "responsible-role", 111 maxOccurs = -1, 112 groupAs = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST) 113 ) 114 private List<ResponsibleRole> _responsibleRoles; 115 116 /** 117 * Additional commentary about the containing object. 118 */ 119 @BoundField( 120 formalName = "Remarks", 121 description = "Additional commentary about the containing object.", 122 useName = "remarks", 123 typeAdapter = MarkupMultilineAdapter.class 124 ) 125 private MarkupMultiline _remarks; 126 127 /** 128 * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentStatement} instance with no metadata. 129 */ 130 public ComponentStatement() { 131 this(null); 132 } 133 134 /** 135 * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentStatement} instance with the specified metadata. 136 * 137 * @param data 138 * the metaschema data, or {@code null} if none 139 */ 140 public ComponentStatement(IMetaschemaData data) { 141 this.__metaschemaData = data; 142 } 143 144 @Override 145 public IMetaschemaData getMetaschemaData() { 146 return __metaschemaData; 147 } 148 149 /** 150 * Get the "{@literal Control Statement Reference}". 151 * 152 * <p> 153 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>. 154 * 155 * @return the statement-id value 156 */ 157 @NonNull 158 public String getStatementId() { 159 return _statementId; 160 } 161 162 /** 163 * Set the "{@literal Control Statement Reference}". 164 * 165 * <p> 166 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a <code>control statement</code>. 167 * 168 * @param value 169 * the statement-id value to set 170 */ 171 public void setStatementId(@NonNull String value) { 172 _statementId = value; 173 } 174 175 /** 176 * Get the "{@literal Control Statement Reference Universally Unique Identifier}". 177 * 178 * <p> 179 * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance). 180 * 181 * @return the uuid value 182 */ 183 @NonNull 184 public UUID getUuid() { 185 return _uuid; 186 } 187 188 /** 189 * Set the "{@literal Control Statement Reference Universally Unique Identifier}". 190 * 191 * <p> 192 * 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 control statement elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-identifiers">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance). 193 * 194 * @param value 195 * the uuid value to set 196 */ 197 public void setUuid(@NonNull UUID value) { 198 _uuid = value; 199 } 200 201 /** 202 * Get the "{@literal Statement Implementation Description}". 203 * 204 * <p> 205 * A summary of how the containing control statement is implemented by the component or capability. 206 * 207 * @return the description value 208 */ 209 @NonNull 210 public MarkupMultiline getDescription() { 211 return _description; 212 } 213 214 /** 215 * Set the "{@literal Statement Implementation Description}". 216 * 217 * <p> 218 * A summary of how the containing control statement is implemented by the component or capability. 219 * 220 * @param value 221 * the description value to set 222 */ 223 public void setDescription(@NonNull MarkupMultiline value) { 224 _description = value; 225 } 226 227 /** 228 * Get the "{@literal Property}". 229 * 230 * <p> 231 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 232 * 233 * @return the prop value 234 */ 235 @NonNull 236 public List<Property> getProps() { 237 if (_props == null) { 238 _props = new LinkedList<>(); 239 } 240 return ObjectUtils.notNull(_props); 241 } 242 243 /** 244 * Set the "{@literal Property}". 245 * 246 * <p> 247 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 248 * 249 * @param value 250 * the prop value to set 251 */ 252 public void setProps(@NonNull List<Property> value) { 253 _props = value; 254 } 255 256 /** 257 * Add a new {@link Property} item to the underlying collection. 258 * @param item the item to add 259 * @return {@code true} 260 */ 261 public boolean addProp(Property item) { 262 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 263 if (_props == null) { 264 _props = new LinkedList<>(); 265 } 266 return _props.add(value); 267 } 268 269 /** 270 * Remove the first matching {@link Property} item from the underlying collection. 271 * @param item the item to remove 272 * @return {@code true} if the item was removed or {@code false} otherwise 273 */ 274 public boolean removeProp(Property item) { 275 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 276 return _props != null && _props.remove(value); 277 } 278 279 /** 280 * Get the "{@literal Link}". 281 * 282 * <p> 283 * A reference to a local or remote resource, that has a specific relation to the containing object. 284 * 285 * @return the link value 286 */ 287 @NonNull 288 public List<Link> getLinks() { 289 if (_links == null) { 290 _links = new LinkedList<>(); 291 } 292 return ObjectUtils.notNull(_links); 293 } 294 295 /** 296 * Set the "{@literal Link}". 297 * 298 * <p> 299 * A reference to a local or remote resource, that has a specific relation to the containing object. 300 * 301 * @param value 302 * the link value to set 303 */ 304 public void setLinks(@NonNull List<Link> value) { 305 _links = value; 306 } 307 308 /** 309 * Add a new {@link Link} item to the underlying collection. 310 * @param item the item to add 311 * @return {@code true} 312 */ 313 public boolean addLink(Link item) { 314 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 315 if (_links == null) { 316 _links = new LinkedList<>(); 317 } 318 return _links.add(value); 319 } 320 321 /** 322 * Remove the first matching {@link Link} item from the underlying collection. 323 * @param item the item to remove 324 * @return {@code true} if the item was removed or {@code false} otherwise 325 */ 326 public boolean removeLink(Link item) { 327 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 328 return _links != null && _links.remove(value); 329 } 330 331 /** 332 * Get the "{@literal Responsible Role}". 333 * 334 * <p> 335 * 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. 336 * 337 * @return the responsible-role value 338 */ 339 @NonNull 340 public List<ResponsibleRole> getResponsibleRoles() { 341 if (_responsibleRoles == null) { 342 _responsibleRoles = new LinkedList<>(); 343 } 344 return ObjectUtils.notNull(_responsibleRoles); 345 } 346 347 /** 348 * Set the "{@literal Responsible Role}". 349 * 350 * <p> 351 * 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. 352 * 353 * @param value 354 * the responsible-role value to set 355 */ 356 public void setResponsibleRoles(@NonNull List<ResponsibleRole> value) { 357 _responsibleRoles = value; 358 } 359 360 /** 361 * Add a new {@link ResponsibleRole} item to the underlying collection. 362 * @param item the item to add 363 * @return {@code true} 364 */ 365 public boolean addResponsibleRole(ResponsibleRole item) { 366 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 367 if (_responsibleRoles == null) { 368 _responsibleRoles = new LinkedList<>(); 369 } 370 return _responsibleRoles.add(value); 371 } 372 373 /** 374 * Remove the first matching {@link ResponsibleRole} item from the underlying collection. 375 * @param item the item to remove 376 * @return {@code true} if the item was removed or {@code false} otherwise 377 */ 378 public boolean removeResponsibleRole(ResponsibleRole item) { 379 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 380 return _responsibleRoles != null && _responsibleRoles.remove(value); 381 } 382 383 /** 384 * Get the "{@literal Remarks}". 385 * 386 * <p> 387 * Additional commentary about the containing object. 388 * 389 * @return the remarks value, or {@code null} if not set 390 */ 391 @Nullable 392 public MarkupMultiline getRemarks() { 393 return _remarks; 394 } 395 396 /** 397 * Set the "{@literal Remarks}". 398 * 399 * <p> 400 * Additional commentary about the containing object. 401 * 402 * @param value 403 * the remarks value to set, or {@code null} to clear 404 */ 405 public void setRemarks(@Nullable MarkupMultiline value) { 406 _remarks = value; 407 } 408 409 @Override 410 public String toString() { 411 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 412 } 413}