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