001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_catalog_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.markup.MarkupLine; 007import dev.metaschema.core.datatype.markup.MarkupLineAdapter; 008import dev.metaschema.core.model.IBoundObject; 009import dev.metaschema.core.model.IMetaschemaData; 010import dev.metaschema.core.model.JsonGroupAsBehavior; 011import dev.metaschema.core.model.constraint.IConstraint; 012import dev.metaschema.core.util.ObjectUtils; 013import dev.metaschema.databind.model.annotations.AllowedValue; 014import dev.metaschema.databind.model.annotations.AllowedValues; 015import dev.metaschema.databind.model.annotations.BoundAssembly; 016import dev.metaschema.databind.model.annotations.BoundChoice; 017import dev.metaschema.databind.model.annotations.BoundField; 018import dev.metaschema.databind.model.annotations.BoundFlag; 019import dev.metaschema.databind.model.annotations.GroupAs; 020import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 021import dev.metaschema.databind.model.annotations.ValueConstraints; 022import dev.metaschema.oscal.lib.model.control.catalog.AbstractCatalogGroup; 023import edu.umd.cs.findbugs.annotations.NonNull; 024import edu.umd.cs.findbugs.annotations.Nullable; 025import java.util.LinkedList; 026import java.util.List; 027import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 028import org.apache.commons.lang3.builder.ToStringStyle; 029 030/** 031 * A group of controls, or of groups of controls. 032 */ 033@MetaschemaAssembly( 034 formalName = "Control Group", 035 description = "A group of controls, or of groups of controls.", 036 name = "group", 037 moduleClass = OscalCatalogModule.class, 038 remarks = "Catalogs can use the catalog `group` construct to organize related controls into a single grouping, such as a family of controls or other logical organizational structure.\n" 039 + "\n" 040 + "A `group` may have its own properties, statements, parameters, and references, which are inherited by all controls of that are a member of the group.", 041 valueConstraints = @ValueConstraints(allowedValues = {@AllowedValues(id = "oscal-group-prop-name", level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = {@AllowedValue(value = "label", description = "A human-readable label for the parent context, which may be rendered in place of the actual identifier for some use cases."), @AllowedValue(value = "sort-id", description = "An alternative identifier, whose value is easily sortable among other such values in the document."), @AllowedValue(value = "alt-identifier", description = "An alternate or aliased identifier for the parent context.")}), @AllowedValues(id = "oscal-group-part-name", level = IConstraint.Level.ERROR, target = "part[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = {@AllowedValue(value = "overview", description = "An introduction to a control or a group of controls."), @AllowedValue(value = "instruction", description = "Information providing directions for a control or a group of controls.")})}) 042) 043public class CatalogGroup extends AbstractCatalogGroup implements IBoundObject { 044 private final IMetaschemaData __metaschemaData; 045 046 /** 047 * Identifies the group for the purpose of cross-linking within the defining instance or from other instances that reference the catalog. 048 */ 049 @BoundFlag( 050 formalName = "Group Identifier", 051 description = "Identifies the group for the purpose of cross-linking within the defining instance or from other instances that reference the catalog.", 052 name = "id", 053 typeAdapter = TokenAdapter.class 054 ) 055 private String _id; 056 057 /** 058 * A textual label that provides a sub-type or characterization of the group. 059 */ 060 @BoundFlag( 061 formalName = "Group Class", 062 description = "A textual label that provides a sub-type or characterization of the group.", 063 name = "class", 064 typeAdapter = TokenAdapter.class, 065 remarks = "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value.\n" 066 + "\n" 067 + "A `class` can also be used in an OSCAL profile as a means to target an alteration to control content." 068 ) 069 private String _clazz; 070 071 /** 072 * A name given to the group, which may be used by a tool for display and navigation. 073 */ 074 @BoundField( 075 formalName = "Group Title", 076 description = "A name given to the group, which may be used by a tool for display and navigation.", 077 useName = "title", 078 minOccurs = 1, 079 typeAdapter = MarkupLineAdapter.class 080 ) 081 private MarkupLine _title; 082 083 /** 084 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 085 */ 086 @BoundAssembly( 087 formalName = "Parameter", 088 description = "Parameters provide a mechanism for the dynamic assignment of value(s) in a control.", 089 useName = "param", 090 maxOccurs = -1, 091 groupAs = @GroupAs(name = "params", inJson = JsonGroupAsBehavior.LIST) 092 ) 093 private List<Parameter> _params; 094 095 /** 096 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 097 */ 098 @BoundAssembly( 099 formalName = "Property", 100 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 101 useName = "prop", 102 maxOccurs = -1, 103 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 104 ) 105 private List<Property> _props; 106 107 /** 108 * A reference to a local or remote resource, that has a specific relation to the containing object. 109 */ 110 @BoundAssembly( 111 formalName = "Link", 112 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 113 useName = "link", 114 maxOccurs = -1, 115 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 116 ) 117 private List<Link> _links; 118 119 /** 120 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 121 */ 122 @BoundAssembly( 123 formalName = "Part", 124 description = "An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part.", 125 useName = "part", 126 maxOccurs = -1, 127 groupAs = @GroupAs(name = "parts", inJson = JsonGroupAsBehavior.LIST) 128 ) 129 private List<ControlPart> _parts; 130 131 /** 132 * A group of controls, or of groups of controls. 133 */ 134 @BoundAssembly( 135 formalName = "Control Group", 136 description = "A group of controls, or of groups of controls.", 137 useName = "group", 138 maxOccurs = -1, 139 groupAs = @GroupAs(name = "groups", inJson = JsonGroupAsBehavior.LIST) 140 ) 141 @BoundChoice( 142 choiceId = "choice-1" 143 ) 144 private List<CatalogGroup> _groups; 145 146 /** 147 * A <a href="https://pages.nist.gov/OSCAL/concepts/terminology/#control">structured object</a> representing a requirement or guideline, which when implemented will reduce an aspect of risk related to an information system and its information. 148 */ 149 @BoundAssembly( 150 formalName = "Control", 151 description = "A [structured object](https://pages.nist.gov/OSCAL/concepts/terminology/#control) representing a requirement or guideline, which when implemented will reduce an aspect of risk related to an information system and its information.", 152 useName = "control", 153 maxOccurs = -1, 154 groupAs = @GroupAs(name = "controls", inJson = JsonGroupAsBehavior.LIST) 155 ) 156 @BoundChoice( 157 choiceId = "choice-1" 158 ) 159 private List<Control> _controls; 160 161 /** 162 * Constructs a new {@code dev.metaschema.oscal.lib.model.CatalogGroup} instance with no metadata. 163 */ 164 public CatalogGroup() { 165 this(null); 166 } 167 168 /** 169 * Constructs a new {@code dev.metaschema.oscal.lib.model.CatalogGroup} instance with the specified metadata. 170 * 171 * @param data 172 * the metaschema data, or {@code null} if none 173 */ 174 public CatalogGroup(IMetaschemaData data) { 175 this.__metaschemaData = data; 176 } 177 178 @Override 179 public IMetaschemaData getMetaschemaData() { 180 return __metaschemaData; 181 } 182 183 /** 184 * Get the "{@literal Group Identifier}". 185 * 186 * <p> 187 * Identifies the group for the purpose of cross-linking within the defining instance or from other instances that reference the catalog. 188 * 189 * @return the id value, or {@code null} if not set 190 */ 191 @Nullable 192 public String getId() { 193 return _id; 194 } 195 196 /** 197 * Set the "{@literal Group Identifier}". 198 * 199 * <p> 200 * Identifies the group for the purpose of cross-linking within the defining instance or from other instances that reference the catalog. 201 * 202 * @param value 203 * the id value to set, or {@code null} to clear 204 */ 205 public void setId(@Nullable String value) { 206 _id = value; 207 } 208 209 /** 210 * Get the "{@literal Group Class}". 211 * 212 * <p> 213 * A textual label that provides a sub-type or characterization of the group. 214 * 215 * @return the class value, or {@code null} if not set 216 */ 217 @Nullable 218 public String getClazz() { 219 return _clazz; 220 } 221 222 /** 223 * Set the "{@literal Group Class}". 224 * 225 * <p> 226 * A textual label that provides a sub-type or characterization of the group. 227 * 228 * @param value 229 * the class value to set, or {@code null} to clear 230 */ 231 public void setClazz(@Nullable String value) { 232 _clazz = value; 233 } 234 235 /** 236 * Get the "{@literal Group Title}". 237 * 238 * <p> 239 * A name given to the group, which may be used by a tool for display and navigation. 240 * 241 * @return the title value 242 */ 243 @NonNull 244 public MarkupLine getTitle() { 245 return _title; 246 } 247 248 /** 249 * Set the "{@literal Group Title}". 250 * 251 * <p> 252 * A name given to the group, which may be used by a tool for display and navigation. 253 * 254 * @param value 255 * the title value to set 256 */ 257 public void setTitle(@NonNull MarkupLine value) { 258 _title = value; 259 } 260 261 /** 262 * Get the "{@literal Parameter}". 263 * 264 * <p> 265 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 266 * 267 * @return the param value 268 */ 269 @NonNull 270 public List<Parameter> getParams() { 271 if (_params == null) { 272 _params = new LinkedList<>(); 273 } 274 return ObjectUtils.notNull(_params); 275 } 276 277 /** 278 * Set the "{@literal Parameter}". 279 * 280 * <p> 281 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 282 * 283 * @param value 284 * the param value to set 285 */ 286 public void setParams(@NonNull List<Parameter> value) { 287 _params = value; 288 } 289 290 /** 291 * Add a new {@link Parameter} item to the underlying collection. 292 * @param item the item to add 293 * @return {@code true} 294 */ 295 public boolean addParam(Parameter item) { 296 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 297 if (_params == null) { 298 _params = new LinkedList<>(); 299 } 300 return _params.add(value); 301 } 302 303 /** 304 * Remove the first matching {@link Parameter} item from the underlying collection. 305 * @param item the item to remove 306 * @return {@code true} if the item was removed or {@code false} otherwise 307 */ 308 public boolean removeParam(Parameter item) { 309 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 310 return _params != null && _params.remove(value); 311 } 312 313 /** 314 * Get the "{@literal Property}". 315 * 316 * <p> 317 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 318 * 319 * @return the prop value 320 */ 321 @NonNull 322 public List<Property> getProps() { 323 if (_props == null) { 324 _props = new LinkedList<>(); 325 } 326 return ObjectUtils.notNull(_props); 327 } 328 329 /** 330 * Set the "{@literal Property}". 331 * 332 * <p> 333 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 334 * 335 * @param value 336 * the prop value to set 337 */ 338 public void setProps(@NonNull List<Property> value) { 339 _props = value; 340 } 341 342 /** 343 * Add a new {@link Property} item to the underlying collection. 344 * @param item the item to add 345 * @return {@code true} 346 */ 347 public boolean addProp(Property item) { 348 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 349 if (_props == null) { 350 _props = new LinkedList<>(); 351 } 352 return _props.add(value); 353 } 354 355 /** 356 * Remove the first matching {@link Property} item from the underlying collection. 357 * @param item the item to remove 358 * @return {@code true} if the item was removed or {@code false} otherwise 359 */ 360 public boolean removeProp(Property item) { 361 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 362 return _props != null && _props.remove(value); 363 } 364 365 /** 366 * Get the "{@literal Link}". 367 * 368 * <p> 369 * A reference to a local or remote resource, that has a specific relation to the containing object. 370 * 371 * @return the link value 372 */ 373 @NonNull 374 public List<Link> getLinks() { 375 if (_links == null) { 376 _links = new LinkedList<>(); 377 } 378 return ObjectUtils.notNull(_links); 379 } 380 381 /** 382 * Set the "{@literal Link}". 383 * 384 * <p> 385 * A reference to a local or remote resource, that has a specific relation to the containing object. 386 * 387 * @param value 388 * the link value to set 389 */ 390 public void setLinks(@NonNull List<Link> value) { 391 _links = value; 392 } 393 394 /** 395 * Add a new {@link Link} item to the underlying collection. 396 * @param item the item to add 397 * @return {@code true} 398 */ 399 public boolean addLink(Link item) { 400 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 401 if (_links == null) { 402 _links = new LinkedList<>(); 403 } 404 return _links.add(value); 405 } 406 407 /** 408 * Remove the first matching {@link Link} item from the underlying collection. 409 * @param item the item to remove 410 * @return {@code true} if the item was removed or {@code false} otherwise 411 */ 412 public boolean removeLink(Link item) { 413 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 414 return _links != null && _links.remove(value); 415 } 416 417 /** 418 * Get the "{@literal Part}". 419 * 420 * <p> 421 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 422 * 423 * @return the part value 424 */ 425 @NonNull 426 public List<ControlPart> getParts() { 427 if (_parts == null) { 428 _parts = new LinkedList<>(); 429 } 430 return ObjectUtils.notNull(_parts); 431 } 432 433 /** 434 * Set the "{@literal Part}". 435 * 436 * <p> 437 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 438 * 439 * @param value 440 * the part value to set 441 */ 442 public void setParts(@NonNull List<ControlPart> value) { 443 _parts = value; 444 } 445 446 /** 447 * Add a new {@link ControlPart} item to the underlying collection. 448 * @param item the item to add 449 * @return {@code true} 450 */ 451 public boolean addPart(ControlPart item) { 452 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 453 if (_parts == null) { 454 _parts = new LinkedList<>(); 455 } 456 return _parts.add(value); 457 } 458 459 /** 460 * Remove the first matching {@link ControlPart} item from the underlying collection. 461 * @param item the item to remove 462 * @return {@code true} if the item was removed or {@code false} otherwise 463 */ 464 public boolean removePart(ControlPart item) { 465 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 466 return _parts != null && _parts.remove(value); 467 } 468 469 /** 470 * Get the "{@literal Control Group}". 471 * 472 * <p> 473 * A group of controls, or of groups of controls. 474 * 475 * @return the group value 476 */ 477 @NonNull 478 public List<CatalogGroup> getGroups() { 479 if (_groups == null) { 480 _groups = new LinkedList<>(); 481 } 482 return ObjectUtils.notNull(_groups); 483 } 484 485 /** 486 * Set the "{@literal Control Group}". 487 * 488 * <p> 489 * A group of controls, or of groups of controls. 490 * 491 * @param value 492 * the group value to set 493 */ 494 public void setGroups(@NonNull List<CatalogGroup> value) { 495 _groups = value; 496 } 497 498 /** 499 * Add a new {@link CatalogGroup} item to the underlying collection. 500 * @param item the item to add 501 * @return {@code true} 502 */ 503 public boolean addGroup(CatalogGroup item) { 504 CatalogGroup value = ObjectUtils.requireNonNull(item,"item cannot be null"); 505 if (_groups == null) { 506 _groups = new LinkedList<>(); 507 } 508 return _groups.add(value); 509 } 510 511 /** 512 * Remove the first matching {@link CatalogGroup} item from the underlying collection. 513 * @param item the item to remove 514 * @return {@code true} if the item was removed or {@code false} otherwise 515 */ 516 public boolean removeGroup(CatalogGroup item) { 517 CatalogGroup value = ObjectUtils.requireNonNull(item,"item cannot be null"); 518 return _groups != null && _groups.remove(value); 519 } 520 521 /** 522 * Get the "{@literal Control}". 523 * 524 * <p> 525 * A <a href="https://pages.nist.gov/OSCAL/concepts/terminology/#control">structured object</a> representing a requirement or guideline, which when implemented will reduce an aspect of risk related to an information system and its information. 526 * 527 * @return the control value 528 */ 529 @NonNull 530 public List<Control> getControls() { 531 if (_controls == null) { 532 _controls = new LinkedList<>(); 533 } 534 return ObjectUtils.notNull(_controls); 535 } 536 537 /** 538 * Set the "{@literal Control}". 539 * 540 * <p> 541 * A <a href="https://pages.nist.gov/OSCAL/concepts/terminology/#control">structured object</a> representing a requirement or guideline, which when implemented will reduce an aspect of risk related to an information system and its information. 542 * 543 * @param value 544 * the control value to set 545 */ 546 public void setControls(@NonNull List<Control> value) { 547 _controls = value; 548 } 549 550 /** 551 * Add a new {@link Control} item to the underlying collection. 552 * @param item the item to add 553 * @return {@code true} 554 */ 555 public boolean addControl(Control item) { 556 Control value = ObjectUtils.requireNonNull(item,"item cannot be null"); 557 if (_controls == null) { 558 _controls = new LinkedList<>(); 559 } 560 return _controls.add(value); 561 } 562 563 /** 564 * Remove the first matching {@link Control} item from the underlying collection. 565 * @param item the item to remove 566 * @return {@code true} if the item was removed or {@code false} otherwise 567 */ 568 public boolean removeControl(Control item) { 569 Control value = ObjectUtils.requireNonNull(item,"item cannot be null"); 570 return _controls != null && _controls.remove(value); 571 } 572 573 @Override 574 public String toString() { 575 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 576 } 577}