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.UriReferenceAdapter; 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 java.net.URI; 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 * Defines how the component or capability supports a set of controls. 032 */ 033@MetaschemaAssembly( 034 formalName = "Control Implementation Set", 035 description = "Defines how the component or capability supports a set of controls.", 036 name = "control-implementation", 037 moduleClass = OscalComponentDefinitionModule.class, 038 remarks = "Use of `set-parameter` in this context, sets the parameter for all controls referenced by any `implemented-requirement` contained in this context. Any `set-parameter` defined in a child context will override this value. If not overridden by a child, this value applies in the child context.", 039 modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-unique-component-definition-control-implementation-set-parameter", level = IConstraint.Level.ERROR, target = "set-parameter", keyFields = @KeyField(target = "@param-id"), remarks = "Since multiple `set-parameter` entries can be provided, each parameter must be set only once.")) 040) 041public class ComponentControlImplementation implements IBoundObject { 042 private final IMetaschemaData __metaschemaData; 043 044 /** 045 * Provides a means to identify a set of control implementations that are supported by a given component or capability. 046 */ 047 @BoundFlag( 048 formalName = "Control Implementation Set Identifier", 049 description = "Provides a means to identify a set of control implementations that are supported by a given component or capability.", 050 name = "uuid", 051 required = true, 052 typeAdapter = UuidAdapter.class 053 ) 054 private UUID _uuid; 055 056 /** 057 * A reference to an OSCAL catalog or profile providing the referenced control or subcontrol definition. 058 */ 059 @BoundFlag( 060 formalName = "Source Resource Reference", 061 description = "A reference to an OSCAL catalog or profile providing the referenced control or subcontrol definition.", 062 name = "source", 063 required = true, 064 typeAdapter = UriReferenceAdapter.class, 065 remarks = "This value may be one of:\n" 066 + "\n" 067 + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n" 068 + "2. a [relative reference](https://pages.nist.gov/OSCAL/concepts/uri-use/#relative-reference) pointing to a network resolvable resource whose base URI is the URI of the containing document, or\n" 069 + "3. a bare URI fragment (i.e., \\`#uuid\\`) pointing to a `back-matter` resource in this or an imported document (see [linking to another OSCAL object](https://pages.nist.gov/OSCAL/concepts/uri-use/#linking-to-another-oscal-object))." 070 ) 071 private URI _source; 072 073 /** 074 * A description of how the specified set of controls are implemented for the containing component or capability. 075 */ 076 @BoundField( 077 formalName = "Control Implementation Description", 078 description = "A description of how the specified set of controls are implemented for the containing component or capability.", 079 useName = "description", 080 minOccurs = 1, 081 typeAdapter = MarkupMultilineAdapter.class 082 ) 083 private MarkupMultiline _description; 084 085 /** 086 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 087 */ 088 @BoundAssembly( 089 formalName = "Property", 090 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 091 useName = "prop", 092 maxOccurs = -1, 093 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 094 ) 095 private List<Property> _props; 096 097 /** 098 * A reference to a local or remote resource, that has a specific relation to the containing object. 099 */ 100 @BoundAssembly( 101 formalName = "Link", 102 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 103 useName = "link", 104 maxOccurs = -1, 105 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 106 ) 107 private List<Link> _links; 108 109 /** 110 * Identifies the parameter that will be set by the enclosed value. 111 */ 112 @BoundAssembly( 113 formalName = "Set Parameter Value", 114 description = "Identifies the parameter that will be set by the enclosed value.", 115 useName = "set-parameter", 116 maxOccurs = -1, 117 groupAs = @GroupAs(name = "set-parameters", inJson = JsonGroupAsBehavior.LIST) 118 ) 119 private List<SetParameter> _setParameters; 120 121 /** 122 * Describes how the containing component or capability implements an individual control. 123 */ 124 @BoundAssembly( 125 formalName = "Control Implementation", 126 description = "Describes how the containing component or capability implements an individual control.", 127 useName = "implemented-requirement", 128 minOccurs = 1, 129 maxOccurs = -1, 130 groupAs = @GroupAs(name = "implemented-requirements", inJson = JsonGroupAsBehavior.LIST) 131 ) 132 private List<ComponentImplementedRequirement> _implementedRequirements; 133 134 /** 135 * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentControlImplementation} instance with no metadata. 136 */ 137 public ComponentControlImplementation() { 138 this(null); 139 } 140 141 /** 142 * Constructs a new {@code dev.metaschema.oscal.lib.model.ComponentControlImplementation} instance with the specified metadata. 143 * 144 * @param data 145 * the metaschema data, or {@code null} if none 146 */ 147 public ComponentControlImplementation(IMetaschemaData data) { 148 this.__metaschemaData = data; 149 } 150 151 @Override 152 public IMetaschemaData getMetaschemaData() { 153 return __metaschemaData; 154 } 155 156 /** 157 * Get the "{@literal Control Implementation Set Identifier}". 158 * 159 * <p> 160 * Provides a means to identify a set of control implementations that are supported by a given component or capability. 161 * 162 * @return the uuid value 163 */ 164 @NonNull 165 public UUID getUuid() { 166 return _uuid; 167 } 168 169 /** 170 * Set the "{@literal Control Implementation Set Identifier}". 171 * 172 * <p> 173 * Provides a means to identify a set of control implementations that are supported by a given component or capability. 174 * 175 * @param value 176 * the uuid value to set 177 */ 178 public void setUuid(@NonNull UUID value) { 179 _uuid = value; 180 } 181 182 /** 183 * Get the "{@literal Source Resource Reference}". 184 * 185 * <p> 186 * A reference to an OSCAL catalog or profile providing the referenced control or subcontrol definition. 187 * 188 * @return the source value 189 */ 190 @NonNull 191 public URI getSource() { 192 return _source; 193 } 194 195 /** 196 * Set the "{@literal Source Resource Reference}". 197 * 198 * <p> 199 * A reference to an OSCAL catalog or profile providing the referenced control or subcontrol definition. 200 * 201 * @param value 202 * the source value to set 203 */ 204 public void setSource(@NonNull URI value) { 205 _source = value; 206 } 207 208 /** 209 * Get the "{@literal Control Implementation Description}". 210 * 211 * <p> 212 * A description of how the specified set of controls are implemented for the containing component or capability. 213 * 214 * @return the description value 215 */ 216 @NonNull 217 public MarkupMultiline getDescription() { 218 return _description; 219 } 220 221 /** 222 * Set the "{@literal Control Implementation Description}". 223 * 224 * <p> 225 * A description of how the specified set of controls are implemented for the containing component or capability. 226 * 227 * @param value 228 * the description value to set 229 */ 230 public void setDescription(@NonNull MarkupMultiline value) { 231 _description = value; 232 } 233 234 /** 235 * Get the "{@literal Property}". 236 * 237 * <p> 238 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 239 * 240 * @return the prop value 241 */ 242 @NonNull 243 public List<Property> getProps() { 244 if (_props == null) { 245 _props = new LinkedList<>(); 246 } 247 return ObjectUtils.notNull(_props); 248 } 249 250 /** 251 * Set the "{@literal Property}". 252 * 253 * <p> 254 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 255 * 256 * @param value 257 * the prop value to set 258 */ 259 public void setProps(@NonNull List<Property> value) { 260 _props = value; 261 } 262 263 /** 264 * Add a new {@link Property} item to the underlying collection. 265 * @param item the item to add 266 * @return {@code true} 267 */ 268 public boolean addProp(Property item) { 269 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 270 if (_props == null) { 271 _props = new LinkedList<>(); 272 } 273 return _props.add(value); 274 } 275 276 /** 277 * Remove the first matching {@link Property} item from the underlying collection. 278 * @param item the item to remove 279 * @return {@code true} if the item was removed or {@code false} otherwise 280 */ 281 public boolean removeProp(Property item) { 282 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 283 return _props != null && _props.remove(value); 284 } 285 286 /** 287 * Get the "{@literal Link}". 288 * 289 * <p> 290 * A reference to a local or remote resource, that has a specific relation to the containing object. 291 * 292 * @return the link value 293 */ 294 @NonNull 295 public List<Link> getLinks() { 296 if (_links == null) { 297 _links = new LinkedList<>(); 298 } 299 return ObjectUtils.notNull(_links); 300 } 301 302 /** 303 * Set the "{@literal Link}". 304 * 305 * <p> 306 * A reference to a local or remote resource, that has a specific relation to the containing object. 307 * 308 * @param value 309 * the link value to set 310 */ 311 public void setLinks(@NonNull List<Link> value) { 312 _links = value; 313 } 314 315 /** 316 * Add a new {@link Link} item to the underlying collection. 317 * @param item the item to add 318 * @return {@code true} 319 */ 320 public boolean addLink(Link item) { 321 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 322 if (_links == null) { 323 _links = new LinkedList<>(); 324 } 325 return _links.add(value); 326 } 327 328 /** 329 * Remove the first matching {@link Link} item from the underlying collection. 330 * @param item the item to remove 331 * @return {@code true} if the item was removed or {@code false} otherwise 332 */ 333 public boolean removeLink(Link item) { 334 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 335 return _links != null && _links.remove(value); 336 } 337 338 /** 339 * Get the "{@literal Set Parameter Value}". 340 * 341 * <p> 342 * Identifies the parameter that will be set by the enclosed value. 343 * 344 * @return the set-parameter value 345 */ 346 @NonNull 347 public List<SetParameter> getSetParameters() { 348 if (_setParameters == null) { 349 _setParameters = new LinkedList<>(); 350 } 351 return ObjectUtils.notNull(_setParameters); 352 } 353 354 /** 355 * Set the "{@literal Set Parameter Value}". 356 * 357 * <p> 358 * Identifies the parameter that will be set by the enclosed value. 359 * 360 * @param value 361 * the set-parameter value to set 362 */ 363 public void setSetParameters(@NonNull List<SetParameter> value) { 364 _setParameters = value; 365 } 366 367 /** 368 * Add a new {@link SetParameter} item to the underlying collection. 369 * @param item the item to add 370 * @return {@code true} 371 */ 372 public boolean addSetParameter(SetParameter item) { 373 SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 374 if (_setParameters == null) { 375 _setParameters = new LinkedList<>(); 376 } 377 return _setParameters.add(value); 378 } 379 380 /** 381 * Remove the first matching {@link SetParameter} item from the underlying collection. 382 * @param item the item to remove 383 * @return {@code true} if the item was removed or {@code false} otherwise 384 */ 385 public boolean removeSetParameter(SetParameter item) { 386 SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 387 return _setParameters != null && _setParameters.remove(value); 388 } 389 390 /** 391 * Get the "{@literal Control Implementation}". 392 * 393 * <p> 394 * Describes how the containing component or capability implements an individual control. 395 * 396 * @return the implemented-requirement value 397 */ 398 @NonNull 399 public List<ComponentImplementedRequirement> getImplementedRequirements() { 400 if (_implementedRequirements == null) { 401 _implementedRequirements = new LinkedList<>(); 402 } 403 return ObjectUtils.notNull(_implementedRequirements); 404 } 405 406 /** 407 * Set the "{@literal Control Implementation}". 408 * 409 * <p> 410 * Describes how the containing component or capability implements an individual control. 411 * 412 * @param value 413 * the implemented-requirement value to set 414 */ 415 public void setImplementedRequirements(@NonNull List<ComponentImplementedRequirement> value) { 416 _implementedRequirements = value; 417 } 418 419 /** 420 * Add a new {@link ComponentImplementedRequirement} item to the underlying collection. 421 * @param item the item to add 422 * @return {@code true} 423 */ 424 public boolean addImplementedRequirement(ComponentImplementedRequirement item) { 425 ComponentImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null"); 426 if (_implementedRequirements == null) { 427 _implementedRequirements = new LinkedList<>(); 428 } 429 return _implementedRequirements.add(value); 430 } 431 432 /** 433 * Remove the first matching {@link ComponentImplementedRequirement} item from the underlying collection. 434 * @param item the item to remove 435 * @return {@code true} if the item was removed or {@code false} otherwise 436 */ 437 public boolean removeImplementedRequirement(ComponentImplementedRequirement item) { 438 ComponentImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null"); 439 return _implementedRequirements != null && _implementedRequirements.remove(value); 440 } 441 442 @Override 443 public String toString() { 444 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 445 } 446}