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.StringAdapter; 006import dev.metaschema.core.datatype.adapter.TokenAdapter; 007import dev.metaschema.core.datatype.adapter.UriAdapter; 008import dev.metaschema.core.datatype.markup.MarkupLine; 009import dev.metaschema.core.datatype.markup.MarkupLineAdapter; 010import dev.metaschema.core.datatype.markup.MarkupMultiline; 011import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 012import dev.metaschema.core.model.IBoundObject; 013import dev.metaschema.core.model.IMetaschemaData; 014import dev.metaschema.core.model.JsonGroupAsBehavior; 015import dev.metaschema.core.model.constraint.IConstraint; 016import dev.metaschema.core.util.ObjectUtils; 017import dev.metaschema.databind.model.annotations.AllowedValue; 018import dev.metaschema.databind.model.annotations.AllowedValues; 019import dev.metaschema.databind.model.annotations.AssemblyConstraints; 020import dev.metaschema.databind.model.annotations.BoundAssembly; 021import dev.metaschema.databind.model.annotations.BoundChoice; 022import dev.metaschema.databind.model.annotations.BoundField; 023import dev.metaschema.databind.model.annotations.BoundFlag; 024import dev.metaschema.databind.model.annotations.GroupAs; 025import dev.metaschema.databind.model.annotations.IsUnique; 026import dev.metaschema.databind.model.annotations.KeyField; 027import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 028import dev.metaschema.databind.model.annotations.ValueConstraints; 029import edu.umd.cs.findbugs.annotations.NonNull; 030import edu.umd.cs.findbugs.annotations.Nullable; 031import java.net.URI; 032import java.util.LinkedList; 033import java.util.List; 034import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 035import org.apache.commons.lang3.builder.ToStringStyle; 036 037/** 038 * Set parameters or amend controls in resolution. 039 */ 040@MetaschemaAssembly( 041 formalName = "Modify Controls", 042 description = "Set parameters or amend controls in resolution.", 043 name = "modify", 044 moduleClass = OscalProfileModule.class, 045 modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-unique-profile-modify-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.")) 046) 047public class Modify implements IBoundObject { 048 private final IMetaschemaData __metaschemaData; 049 050 /** 051 * A parameter setting, to be propagated to points of insertion. 052 */ 053 @BoundAssembly( 054 formalName = "Parameter Setting", 055 description = "A parameter setting, to be propagated to points of insertion.", 056 useName = "set-parameter", 057 maxOccurs = -1, 058 groupAs = @GroupAs(name = "set-parameters", inJson = JsonGroupAsBehavior.LIST) 059 ) 060 private List<ProfileSetParameter> _setParameters; 061 062 /** 063 * Specifies changes to be made to an included control when a profile is resolved. 064 */ 065 @BoundAssembly( 066 formalName = "Alteration", 067 description = "Specifies changes to be made to an included control when a profile is resolved.", 068 useName = "alter", 069 remarks = "Use `@control-id` to indicate the scope of alteration.\n" 070 + "\n" 071 + "It is an error for two `alter` elements to apply to the same control. In practice, multiple alterations can be applied (together), but it creates confusion.\n" 072 + "\n" 073 + "At present, no provision is made for altering many controls at once (for example, to systematically remove properties or add global properties); extending this element to match multiple control IDs could provide for this.", 074 maxOccurs = -1, 075 groupAs = @GroupAs(name = "alters", inJson = JsonGroupAsBehavior.LIST) 076 ) 077 private List<Alter> _alters; 078 079 /** 080 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify} instance with no metadata. 081 */ 082 public Modify() { 083 this(null); 084 } 085 086 /** 087 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify} instance with the specified metadata. 088 * 089 * @param data 090 * the metaschema data, or {@code null} if none 091 */ 092 public Modify(IMetaschemaData data) { 093 this.__metaschemaData = data; 094 } 095 096 @Override 097 public IMetaschemaData getMetaschemaData() { 098 return __metaschemaData; 099 } 100 101 /** 102 * Get the "{@literal Parameter Setting}". 103 * 104 * <p> 105 * A parameter setting, to be propagated to points of insertion. 106 * 107 * @return the set-parameter value 108 */ 109 @NonNull 110 public List<ProfileSetParameter> getSetParameters() { 111 if (_setParameters == null) { 112 _setParameters = new LinkedList<>(); 113 } 114 return ObjectUtils.notNull(_setParameters); 115 } 116 117 /** 118 * Set the "{@literal Parameter Setting}". 119 * 120 * <p> 121 * A parameter setting, to be propagated to points of insertion. 122 * 123 * @param value 124 * the set-parameter value to set 125 */ 126 public void setSetParameters(@NonNull List<ProfileSetParameter> value) { 127 _setParameters = value; 128 } 129 130 /** 131 * Add a new {@link ProfileSetParameter} item to the underlying collection. 132 * @param item the item to add 133 * @return {@code true} 134 */ 135 public boolean addSetParameter(ProfileSetParameter item) { 136 ProfileSetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 137 if (_setParameters == null) { 138 _setParameters = new LinkedList<>(); 139 } 140 return _setParameters.add(value); 141 } 142 143 /** 144 * Remove the first matching {@link ProfileSetParameter} item from the underlying collection. 145 * @param item the item to remove 146 * @return {@code true} if the item was removed or {@code false} otherwise 147 */ 148 public boolean removeSetParameter(ProfileSetParameter item) { 149 ProfileSetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 150 return _setParameters != null && _setParameters.remove(value); 151 } 152 153 /** 154 * Get the "{@literal Alteration}". 155 * 156 * <p> 157 * Specifies changes to be made to an included control when a profile is resolved. 158 * 159 * @return the alter value 160 */ 161 @NonNull 162 public List<Alter> getAlters() { 163 if (_alters == null) { 164 _alters = new LinkedList<>(); 165 } 166 return ObjectUtils.notNull(_alters); 167 } 168 169 /** 170 * Set the "{@literal Alteration}". 171 * 172 * <p> 173 * Specifies changes to be made to an included control when a profile is resolved. 174 * 175 * @param value 176 * the alter value to set 177 */ 178 public void setAlters(@NonNull List<Alter> value) { 179 _alters = value; 180 } 181 182 /** 183 * Add a new {@link Alter} item to the underlying collection. 184 * @param item the item to add 185 * @return {@code true} 186 */ 187 public boolean addAlter(Alter item) { 188 Alter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 189 if (_alters == null) { 190 _alters = new LinkedList<>(); 191 } 192 return _alters.add(value); 193 } 194 195 /** 196 * Remove the first matching {@link Alter} item from the underlying collection. 197 * @param item the item to remove 198 * @return {@code true} if the item was removed or {@code false} otherwise 199 */ 200 public boolean removeAlter(Alter item) { 201 Alter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 202 return _alters != null && _alters.remove(value); 203 } 204 205 @Override 206 public String toString() { 207 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 208 } 209 210 /** 211 * A parameter setting, to be propagated to points of insertion. 212 */ 213 @MetaschemaAssembly( 214 formalName = "Parameter Setting", 215 description = "A parameter setting, to be propagated to points of insertion.", 216 name = "set-parameter", 217 moduleClass = OscalProfileModule.class 218 ) 219 public static class ProfileSetParameter implements IBoundObject { 220 private final IMetaschemaData __metaschemaData; 221 222 /** 223 * An identifier for the parameter. 224 */ 225 @BoundFlag( 226 formalName = "Parameter ID", 227 description = "An identifier for the parameter.", 228 name = "param-id", 229 required = true, 230 typeAdapter = TokenAdapter.class 231 ) 232 private String _paramId; 233 234 /** 235 * A textual label that provides a characterization of the parameter. 236 */ 237 @BoundFlag( 238 formalName = "Parameter Class", 239 description = "A textual label that provides a characterization of the parameter.", 240 name = "class", 241 typeAdapter = TokenAdapter.class, 242 remarks = "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value." 243 ) 244 private String _clazz; 245 246 /** 247 * **(deprecated)** Another parameter invoking this one. This construct has been deprecated and should not be used. 248 */ 249 @BoundFlag( 250 formalName = "Depends On", 251 description = "\\*\\*(deprecated)\\*\\* Another parameter invoking this one. This construct has been deprecated and should not be used.", 252 name = "depends-on", 253 typeAdapter = TokenAdapter.class 254 ) 255 private String _dependsOn; 256 257 /** 258 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 259 */ 260 @BoundAssembly( 261 formalName = "Property", 262 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 263 useName = "prop", 264 maxOccurs = -1, 265 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 266 ) 267 private List<Property> _props; 268 269 /** 270 * A reference to a local or remote resource, that has a specific relation to the containing object. 271 */ 272 @BoundAssembly( 273 formalName = "Link", 274 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 275 useName = "link", 276 maxOccurs = -1, 277 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 278 ) 279 private List<Link> _links; 280 281 /** 282 * A short, placeholder name for the parameter, which can be used as a substitute for a <code>value</code> if no value is assigned. 283 */ 284 @BoundField( 285 formalName = "Parameter Label", 286 description = "A short, placeholder name for the parameter, which can be used as a substitute for a `value` if no value is assigned.", 287 useName = "label", 288 remarks = "The label value should be suitable for inline display in a rendered catalog.", 289 typeAdapter = MarkupLineAdapter.class 290 ) 291 private MarkupLine _label; 292 293 /** 294 * Describes the purpose and use of a parameter. 295 */ 296 @BoundField( 297 formalName = "Parameter Usage Description", 298 description = "Describes the purpose and use of a parameter.", 299 useName = "usage", 300 typeAdapter = MarkupMultilineAdapter.class 301 ) 302 private MarkupMultiline _usage; 303 304 /** 305 * A formal or informal expression of a constraint or test. 306 */ 307 @BoundAssembly( 308 formalName = "Constraint", 309 description = "A formal or informal expression of a constraint or test.", 310 useName = "constraint", 311 maxOccurs = -1, 312 groupAs = @GroupAs(name = "constraints", inJson = JsonGroupAsBehavior.LIST) 313 ) 314 private List<ParameterConstraint> _constraints; 315 316 /** 317 * A prose statement that provides a recommendation for the use of a parameter. 318 */ 319 @BoundAssembly( 320 formalName = "Guideline", 321 description = "A prose statement that provides a recommendation for the use of a parameter.", 322 useName = "guideline", 323 maxOccurs = -1, 324 groupAs = @GroupAs(name = "guidelines", inJson = JsonGroupAsBehavior.LIST) 325 ) 326 private List<ParameterGuideline> _guidelines; 327 328 /** 329 * A parameter value or set of values. 330 */ 331 @BoundField( 332 formalName = "Parameter Value", 333 description = "A parameter value or set of values.", 334 useName = "value", 335 remarks = "Used to (re)define a parameter value.", 336 maxOccurs = -1, 337 groupAs = @GroupAs(name = "values", inJson = JsonGroupAsBehavior.LIST), 338 typeAdapter = StringAdapter.class 339 ) 340 @BoundChoice( 341 choiceId = "choice-1" 342 ) 343 private List<String> _values; 344 345 /** 346 * Presenting a choice among alternatives. 347 */ 348 @BoundAssembly( 349 formalName = "Selection", 350 description = "Presenting a choice among alternatives.", 351 useName = "select" 352 ) 353 @BoundChoice( 354 choiceId = "choice-1" 355 ) 356 private ParameterSelection _select; 357 358 /** 359 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.ProfileSetParameter} instance with no metadata. 360 */ 361 public ProfileSetParameter() { 362 this(null); 363 } 364 365 /** 366 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.ProfileSetParameter} instance with the specified metadata. 367 * 368 * @param data 369 * the metaschema data, or {@code null} if none 370 */ 371 public ProfileSetParameter(IMetaschemaData data) { 372 this.__metaschemaData = data; 373 } 374 375 @Override 376 public IMetaschemaData getMetaschemaData() { 377 return __metaschemaData; 378 } 379 380 /** 381 * Get the "{@literal Parameter ID}". 382 * 383 * <p> 384 * An identifier for the parameter. 385 * 386 * @return the param-id value 387 */ 388 @NonNull 389 public String getParamId() { 390 return _paramId; 391 } 392 393 /** 394 * Set the "{@literal Parameter ID}". 395 * 396 * <p> 397 * An identifier for the parameter. 398 * 399 * @param value 400 * the param-id value to set 401 */ 402 public void setParamId(@NonNull String value) { 403 _paramId = value; 404 } 405 406 /** 407 * Get the "{@literal Parameter Class}". 408 * 409 * <p> 410 * A textual label that provides a characterization of the parameter. 411 * 412 * @return the class value, or {@code null} if not set 413 */ 414 @Nullable 415 public String getClazz() { 416 return _clazz; 417 } 418 419 /** 420 * Set the "{@literal Parameter Class}". 421 * 422 * <p> 423 * A textual label that provides a characterization of the parameter. 424 * 425 * @param value 426 * the class value to set, or {@code null} to clear 427 */ 428 public void setClazz(@Nullable String value) { 429 _clazz = value; 430 } 431 432 /** 433 * Get the "{@literal Depends On}". 434 * 435 * <p> 436 * **(deprecated)** Another parameter invoking this one. This construct has been deprecated and should not be used. 437 * 438 * @return the depends-on value, or {@code null} if not set 439 */ 440 @Nullable 441 public String getDependsOn() { 442 return _dependsOn; 443 } 444 445 /** 446 * Set the "{@literal Depends On}". 447 * 448 * <p> 449 * **(deprecated)** Another parameter invoking this one. This construct has been deprecated and should not be used. 450 * 451 * @param value 452 * the depends-on value to set, or {@code null} to clear 453 */ 454 public void setDependsOn(@Nullable String value) { 455 _dependsOn = value; 456 } 457 458 /** 459 * Get the "{@literal Property}". 460 * 461 * <p> 462 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 463 * 464 * @return the prop value 465 */ 466 @NonNull 467 public List<Property> getProps() { 468 if (_props == null) { 469 _props = new LinkedList<>(); 470 } 471 return ObjectUtils.notNull(_props); 472 } 473 474 /** 475 * Set the "{@literal Property}". 476 * 477 * <p> 478 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 479 * 480 * @param value 481 * the prop value to set 482 */ 483 public void setProps(@NonNull List<Property> value) { 484 _props = value; 485 } 486 487 /** 488 * Add a new {@link Property} item to the underlying collection. 489 * @param item the item to add 490 * @return {@code true} 491 */ 492 public boolean addProp(Property item) { 493 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 494 if (_props == null) { 495 _props = new LinkedList<>(); 496 } 497 return _props.add(value); 498 } 499 500 /** 501 * Remove the first matching {@link Property} item from the underlying collection. 502 * @param item the item to remove 503 * @return {@code true} if the item was removed or {@code false} otherwise 504 */ 505 public boolean removeProp(Property item) { 506 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 507 return _props != null && _props.remove(value); 508 } 509 510 /** 511 * Get the "{@literal Link}". 512 * 513 * <p> 514 * A reference to a local or remote resource, that has a specific relation to the containing object. 515 * 516 * @return the link value 517 */ 518 @NonNull 519 public List<Link> getLinks() { 520 if (_links == null) { 521 _links = new LinkedList<>(); 522 } 523 return ObjectUtils.notNull(_links); 524 } 525 526 /** 527 * Set the "{@literal Link}". 528 * 529 * <p> 530 * A reference to a local or remote resource, that has a specific relation to the containing object. 531 * 532 * @param value 533 * the link value to set 534 */ 535 public void setLinks(@NonNull List<Link> value) { 536 _links = value; 537 } 538 539 /** 540 * Add a new {@link Link} item to the underlying collection. 541 * @param item the item to add 542 * @return {@code true} 543 */ 544 public boolean addLink(Link item) { 545 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 546 if (_links == null) { 547 _links = new LinkedList<>(); 548 } 549 return _links.add(value); 550 } 551 552 /** 553 * Remove the first matching {@link Link} item from the underlying collection. 554 * @param item the item to remove 555 * @return {@code true} if the item was removed or {@code false} otherwise 556 */ 557 public boolean removeLink(Link item) { 558 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 559 return _links != null && _links.remove(value); 560 } 561 562 /** 563 * Get the "{@literal Parameter Label}". 564 * 565 * <p> 566 * A short, placeholder name for the parameter, which can be used as a substitute for a <code>value</code> if no value is assigned. 567 * 568 * @return the label value, or {@code null} if not set 569 */ 570 @Nullable 571 public MarkupLine getLabel() { 572 return _label; 573 } 574 575 /** 576 * Set the "{@literal Parameter Label}". 577 * 578 * <p> 579 * A short, placeholder name for the parameter, which can be used as a substitute for a <code>value</code> if no value is assigned. 580 * 581 * @param value 582 * the label value to set, or {@code null} to clear 583 */ 584 public void setLabel(@Nullable MarkupLine value) { 585 _label = value; 586 } 587 588 /** 589 * Get the "{@literal Parameter Usage Description}". 590 * 591 * <p> 592 * Describes the purpose and use of a parameter. 593 * 594 * @return the usage value, or {@code null} if not set 595 */ 596 @Nullable 597 public MarkupMultiline getUsage() { 598 return _usage; 599 } 600 601 /** 602 * Set the "{@literal Parameter Usage Description}". 603 * 604 * <p> 605 * Describes the purpose and use of a parameter. 606 * 607 * @param value 608 * the usage value to set, or {@code null} to clear 609 */ 610 public void setUsage(@Nullable MarkupMultiline value) { 611 _usage = value; 612 } 613 614 /** 615 * Get the "{@literal Constraint}". 616 * 617 * <p> 618 * A formal or informal expression of a constraint or test. 619 * 620 * @return the constraint value 621 */ 622 @NonNull 623 public List<ParameterConstraint> getConstraints() { 624 if (_constraints == null) { 625 _constraints = new LinkedList<>(); 626 } 627 return ObjectUtils.notNull(_constraints); 628 } 629 630 /** 631 * Set the "{@literal Constraint}". 632 * 633 * <p> 634 * A formal or informal expression of a constraint or test. 635 * 636 * @param value 637 * the constraint value to set 638 */ 639 public void setConstraints(@NonNull List<ParameterConstraint> value) { 640 _constraints = value; 641 } 642 643 /** 644 * Add a new {@link ParameterConstraint} item to the underlying collection. 645 * @param item the item to add 646 * @return {@code true} 647 */ 648 public boolean addConstraint(ParameterConstraint item) { 649 ParameterConstraint value = ObjectUtils.requireNonNull(item,"item cannot be null"); 650 if (_constraints == null) { 651 _constraints = new LinkedList<>(); 652 } 653 return _constraints.add(value); 654 } 655 656 /** 657 * Remove the first matching {@link ParameterConstraint} item from the underlying collection. 658 * @param item the item to remove 659 * @return {@code true} if the item was removed or {@code false} otherwise 660 */ 661 public boolean removeConstraint(ParameterConstraint item) { 662 ParameterConstraint value = ObjectUtils.requireNonNull(item,"item cannot be null"); 663 return _constraints != null && _constraints.remove(value); 664 } 665 666 /** 667 * Get the "{@literal Guideline}". 668 * 669 * <p> 670 * A prose statement that provides a recommendation for the use of a parameter. 671 * 672 * @return the guideline value 673 */ 674 @NonNull 675 public List<ParameterGuideline> getGuidelines() { 676 if (_guidelines == null) { 677 _guidelines = new LinkedList<>(); 678 } 679 return ObjectUtils.notNull(_guidelines); 680 } 681 682 /** 683 * Set the "{@literal Guideline}". 684 * 685 * <p> 686 * A prose statement that provides a recommendation for the use of a parameter. 687 * 688 * @param value 689 * the guideline value to set 690 */ 691 public void setGuidelines(@NonNull List<ParameterGuideline> value) { 692 _guidelines = value; 693 } 694 695 /** 696 * Add a new {@link ParameterGuideline} item to the underlying collection. 697 * @param item the item to add 698 * @return {@code true} 699 */ 700 public boolean addGuideline(ParameterGuideline item) { 701 ParameterGuideline value = ObjectUtils.requireNonNull(item,"item cannot be null"); 702 if (_guidelines == null) { 703 _guidelines = new LinkedList<>(); 704 } 705 return _guidelines.add(value); 706 } 707 708 /** 709 * Remove the first matching {@link ParameterGuideline} item from the underlying collection. 710 * @param item the item to remove 711 * @return {@code true} if the item was removed or {@code false} otherwise 712 */ 713 public boolean removeGuideline(ParameterGuideline item) { 714 ParameterGuideline value = ObjectUtils.requireNonNull(item,"item cannot be null"); 715 return _guidelines != null && _guidelines.remove(value); 716 } 717 718 /** 719 * Get the "{@literal Parameter Value}". 720 * 721 * <p> 722 * A parameter value or set of values. 723 * 724 * @return the value value 725 */ 726 @NonNull 727 public List<String> getValues() { 728 if (_values == null) { 729 _values = new LinkedList<>(); 730 } 731 return ObjectUtils.notNull(_values); 732 } 733 734 /** 735 * Set the "{@literal Parameter Value}". 736 * 737 * <p> 738 * A parameter value or set of values. 739 * 740 * @param value 741 * the value value to set 742 */ 743 public void setValues(@NonNull List<String> value) { 744 _values = value; 745 } 746 747 /** 748 * Add a new {@link String} item to the underlying collection. 749 * @param item the item to add 750 * @return {@code true} 751 */ 752 public boolean addValue(String item) { 753 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 754 if (_values == null) { 755 _values = new LinkedList<>(); 756 } 757 return _values.add(value); 758 } 759 760 /** 761 * Remove the first matching {@link String} item from the underlying collection. 762 * @param item the item to remove 763 * @return {@code true} if the item was removed or {@code false} otherwise 764 */ 765 public boolean removeValue(String item) { 766 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 767 return _values != null && _values.remove(value); 768 } 769 770 /** 771 * Get the "{@literal Selection}". 772 * 773 * <p> 774 * Presenting a choice among alternatives. 775 * 776 * @return the select value, or {@code null} if not set 777 */ 778 @Nullable 779 public ParameterSelection getSelect() { 780 return _select; 781 } 782 783 /** 784 * Set the "{@literal Selection}". 785 * 786 * <p> 787 * Presenting a choice among alternatives. 788 * 789 * @param value 790 * the select value to set, or {@code null} to clear 791 */ 792 public void setSelect(@Nullable ParameterSelection value) { 793 _select = value; 794 } 795 796 @Override 797 public String toString() { 798 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 799 } 800 } 801 802 /** 803 * Specifies changes to be made to an included control when a profile is resolved. 804 */ 805 @MetaschemaAssembly( 806 formalName = "Alteration", 807 description = "Specifies changes to be made to an included control when a profile is resolved.", 808 name = "alter", 809 moduleClass = OscalProfileModule.class, 810 remarks = "Use `@control-id` to indicate the scope of alteration.\n" 811 + "\n" 812 + "It is an error for two `alter` elements to apply to the same control. In practice, multiple alterations can be applied (together), but it creates confusion.\n" 813 + "\n" 814 + "At present, no provision is made for altering many controls at once (for example, to systematically remove properties or add global properties); extending this element to match multiple control IDs could provide for this." 815 ) 816 public static class Alter implements IBoundObject { 817 private final IMetaschemaData __metaschemaData; 818 819 /** 820 * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference). 821 */ 822 @BoundFlag( 823 formalName = "Control Identifier Reference", 824 description = "A reference to a control with a corresponding `id` value. When referencing an externally defined `control`, the `Control Identifier Reference` must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).", 825 name = "control-id", 826 required = true, 827 typeAdapter = TokenAdapter.class 828 ) 829 private String _controlId; 830 831 /** 832 * Specifies objects to be removed from a control based on specific aspects of the object that must all match. 833 */ 834 @BoundAssembly( 835 formalName = "Removal", 836 description = "Specifies objects to be removed from a control based on specific aspects of the object that must all match.", 837 useName = "remove", 838 remarks = "Use `by-name`, `by-class`, `by-id` or `by-item-name` to indicate class tokens or ID reference, or the formal name, of the component to be removed or erased from a control, when a catalog is resolved. The control affected is indicated by the pointer on the removal's parent (containing) `alter` element.\n" 839 + "\n" 840 + "To change an element, use `remove` to remove the element, then `add` to add it back again with changes.", 841 maxOccurs = -1, 842 groupAs = @GroupAs(name = "removes", inJson = JsonGroupAsBehavior.LIST) 843 ) 844 private List<Remove> _removes; 845 846 /** 847 * Specifies contents to be added into controls, in resolution. 848 */ 849 @BoundAssembly( 850 formalName = "Addition", 851 description = "Specifies contents to be added into controls, in resolution.", 852 useName = "add", 853 remarks = "When no `by-id` is given, the addition is inserted into the control targeted by the alteration at the start or end as indicated by `position`. Only `position` values of \"starting\" or \"ending\" are permitted when there is no `by-id`.\n" 854 + "\n" 855 + "`by-id`, when given, should indicate, by its ID, an element inside the control to serve as the anchor point for the addition. In this case, `position` value may be any of the permitted values.", 856 maxOccurs = -1, 857 groupAs = @GroupAs(name = "adds", inJson = JsonGroupAsBehavior.LIST) 858 ) 859 private List<Add> _adds; 860 861 /** 862 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter} instance with no metadata. 863 */ 864 public Alter() { 865 this(null); 866 } 867 868 /** 869 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter} instance with the specified metadata. 870 * 871 * @param data 872 * the metaschema data, or {@code null} if none 873 */ 874 public Alter(IMetaschemaData data) { 875 this.__metaschemaData = data; 876 } 877 878 @Override 879 public IMetaschemaData getMetaschemaData() { 880 return __metaschemaData; 881 } 882 883 /** 884 * Get the "{@literal Control Identifier Reference}". 885 * 886 * <p> 887 * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference). 888 * 889 * @return the control-id value 890 */ 891 @NonNull 892 public String getControlId() { 893 return _controlId; 894 } 895 896 /** 897 * Set the "{@literal Control Identifier Reference}". 898 * 899 * <p> 900 * A reference to a control with a corresponding <code>id</code> value. When referencing an externally defined <code>control</code>, the <code>Control Identifier Reference</code> must be used in the context of the external / imported OSCAL instance (e.g., uri-reference). 901 * 902 * @param value 903 * the control-id value to set 904 */ 905 public void setControlId(@NonNull String value) { 906 _controlId = value; 907 } 908 909 /** 910 * Get the "{@literal Removal}". 911 * 912 * <p> 913 * Specifies objects to be removed from a control based on specific aspects of the object that must all match. 914 * 915 * @return the remove value 916 */ 917 @NonNull 918 public List<Remove> getRemoves() { 919 if (_removes == null) { 920 _removes = new LinkedList<>(); 921 } 922 return ObjectUtils.notNull(_removes); 923 } 924 925 /** 926 * Set the "{@literal Removal}". 927 * 928 * <p> 929 * Specifies objects to be removed from a control based on specific aspects of the object that must all match. 930 * 931 * @param value 932 * the remove value to set 933 */ 934 public void setRemoves(@NonNull List<Remove> value) { 935 _removes = value; 936 } 937 938 /** 939 * Add a new {@link Remove} item to the underlying collection. 940 * @param item the item to add 941 * @return {@code true} 942 */ 943 public boolean addRemove(Remove item) { 944 Remove value = ObjectUtils.requireNonNull(item,"item cannot be null"); 945 if (_removes == null) { 946 _removes = new LinkedList<>(); 947 } 948 return _removes.add(value); 949 } 950 951 /** 952 * Remove the first matching {@link Remove} item from the underlying collection. 953 * @param item the item to remove 954 * @return {@code true} if the item was removed or {@code false} otherwise 955 */ 956 public boolean removeRemove(Remove item) { 957 Remove value = ObjectUtils.requireNonNull(item,"item cannot be null"); 958 return _removes != null && _removes.remove(value); 959 } 960 961 /** 962 * Get the "{@literal Addition}". 963 * 964 * <p> 965 * Specifies contents to be added into controls, in resolution. 966 * 967 * @return the add value 968 */ 969 @NonNull 970 public List<Add> getAdds() { 971 if (_adds == null) { 972 _adds = new LinkedList<>(); 973 } 974 return ObjectUtils.notNull(_adds); 975 } 976 977 /** 978 * Set the "{@literal Addition}". 979 * 980 * <p> 981 * Specifies contents to be added into controls, in resolution. 982 * 983 * @param value 984 * the add value to set 985 */ 986 public void setAdds(@NonNull List<Add> value) { 987 _adds = value; 988 } 989 990 /** 991 * Add a new {@link Add} item to the underlying collection. 992 * @param item the item to add 993 * @return {@code true} 994 */ 995 public boolean addAdd(Add item) { 996 Add value = ObjectUtils.requireNonNull(item,"item cannot be null"); 997 if (_adds == null) { 998 _adds = new LinkedList<>(); 999 } 1000 return _adds.add(value); 1001 } 1002 1003 /** 1004 * Remove the first matching {@link Add} item from the underlying collection. 1005 * @param item the item to remove 1006 * @return {@code true} if the item was removed or {@code false} otherwise 1007 */ 1008 public boolean removeAdd(Add item) { 1009 Add value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1010 return _adds != null && _adds.remove(value); 1011 } 1012 1013 @Override 1014 public String toString() { 1015 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 1016 } 1017 1018 /** 1019 * Specifies objects to be removed from a control based on specific aspects of the object that must all match. 1020 */ 1021 @MetaschemaAssembly( 1022 formalName = "Removal", 1023 description = "Specifies objects to be removed from a control based on specific aspects of the object that must all match.", 1024 name = "remove", 1025 moduleClass = OscalProfileModule.class, 1026 remarks = "Use `by-name`, `by-class`, `by-id` or `by-item-name` to indicate class tokens or ID reference, or the formal name, of the component to be removed or erased from a control, when a catalog is resolved. The control affected is indicated by the pointer on the removal's parent (containing) `alter` element.\n" 1027 + "\n" 1028 + "To change an element, use `remove` to remove the element, then `add` to add it back again with changes." 1029 ) 1030 public static class Remove implements IBoundObject { 1031 private final IMetaschemaData __metaschemaData; 1032 1033 /** 1034 * Identify items remove by matching their assigned name. 1035 */ 1036 @BoundFlag( 1037 formalName = "Reference by (assigned) name", 1038 description = "Identify items remove by matching their assigned name.", 1039 name = "by-name", 1040 typeAdapter = TokenAdapter.class 1041 ) 1042 private String _byName; 1043 1044 /** 1045 * Identify items to remove by matching their <code>class</code>. 1046 */ 1047 @BoundFlag( 1048 formalName = "Reference by class", 1049 description = "Identify items to remove by matching their `class`.", 1050 name = "by-class", 1051 typeAdapter = TokenAdapter.class 1052 ) 1053 private String _byClass; 1054 1055 /** 1056 * Identify items to remove indicated by their <code>id</code>. 1057 */ 1058 @BoundFlag( 1059 formalName = "Reference by ID", 1060 description = "Identify items to remove indicated by their `id`.", 1061 name = "by-id", 1062 typeAdapter = TokenAdapter.class 1063 ) 1064 private String _byId; 1065 1066 /** 1067 * Identify items to remove by the name of the item's information object name, e.g. <code>title</code> or <code>prop</code>. 1068 */ 1069 @BoundFlag( 1070 formalName = "Item Name Reference", 1071 description = "Identify items to remove by the name of the item's information object name, e.g. `title` or `prop`.", 1072 name = "by-item-name", 1073 typeAdapter = TokenAdapter.class, 1074 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-profile-alter-by-item-name-values", level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "param", description = "A descendant parameter and all of its descendants."), @AllowedValue(value = "prop", description = "A descendant property and all of its descendants."), @AllowedValue(value = "link", description = "A descendant link and all of its descendants."), @AllowedValue(value = "part", description = "A descendant parameter and all of its descendants."), @AllowedValue(value = "mapping", description = "A descendant mapping and all of its descendants."), @AllowedValue(value = "map", description = "A descendant mapping entry (map) and all of its descendants.")})) 1075 ) 1076 private String _byItemName; 1077 1078 /** 1079 * Identify items to remove by the item's <code>ns</code>, which is the namespace associated with a <code>part</code>, or <code>prop</code>. 1080 */ 1081 @BoundFlag( 1082 formalName = "Item Namespace Reference", 1083 description = "Identify items to remove by the item's `ns`, which is the namespace associated with a `part`, or `prop`.", 1084 name = "by-ns", 1085 typeAdapter = UriAdapter.class 1086 ) 1087 private URI _byNs; 1088 1089 /** 1090 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter.Remove} instance with no metadata. 1091 */ 1092 public Remove() { 1093 this(null); 1094 } 1095 1096 /** 1097 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter.Remove} instance with the specified metadata. 1098 * 1099 * @param data 1100 * the metaschema data, or {@code null} if none 1101 */ 1102 public Remove(IMetaschemaData data) { 1103 this.__metaschemaData = data; 1104 } 1105 1106 @Override 1107 public IMetaschemaData getMetaschemaData() { 1108 return __metaschemaData; 1109 } 1110 1111 /** 1112 * Get the "{@literal Reference by (assigned) name}". 1113 * 1114 * <p> 1115 * Identify items remove by matching their assigned name. 1116 * 1117 * @return the by-name value, or {@code null} if not set 1118 */ 1119 @Nullable 1120 public String getByName() { 1121 return _byName; 1122 } 1123 1124 /** 1125 * Set the "{@literal Reference by (assigned) name}". 1126 * 1127 * <p> 1128 * Identify items remove by matching their assigned name. 1129 * 1130 * @param value 1131 * the by-name value to set, or {@code null} to clear 1132 */ 1133 public void setByName(@Nullable String value) { 1134 _byName = value; 1135 } 1136 1137 /** 1138 * Get the "{@literal Reference by class}". 1139 * 1140 * <p> 1141 * Identify items to remove by matching their <code>class</code>. 1142 * 1143 * @return the by-class value, or {@code null} if not set 1144 */ 1145 @Nullable 1146 public String getByClass() { 1147 return _byClass; 1148 } 1149 1150 /** 1151 * Set the "{@literal Reference by class}". 1152 * 1153 * <p> 1154 * Identify items to remove by matching their <code>class</code>. 1155 * 1156 * @param value 1157 * the by-class value to set, or {@code null} to clear 1158 */ 1159 public void setByClass(@Nullable String value) { 1160 _byClass = value; 1161 } 1162 1163 /** 1164 * Get the "{@literal Reference by ID}". 1165 * 1166 * <p> 1167 * Identify items to remove indicated by their <code>id</code>. 1168 * 1169 * @return the by-id value, or {@code null} if not set 1170 */ 1171 @Nullable 1172 public String getById() { 1173 return _byId; 1174 } 1175 1176 /** 1177 * Set the "{@literal Reference by ID}". 1178 * 1179 * <p> 1180 * Identify items to remove indicated by their <code>id</code>. 1181 * 1182 * @param value 1183 * the by-id value to set, or {@code null} to clear 1184 */ 1185 public void setById(@Nullable String value) { 1186 _byId = value; 1187 } 1188 1189 /** 1190 * Get the "{@literal Item Name Reference}". 1191 * 1192 * <p> 1193 * Identify items to remove by the name of the item's information object name, e.g. <code>title</code> or <code>prop</code>. 1194 * 1195 * @return the by-item-name value, or {@code null} if not set 1196 */ 1197 @Nullable 1198 public String getByItemName() { 1199 return _byItemName; 1200 } 1201 1202 /** 1203 * Set the "{@literal Item Name Reference}". 1204 * 1205 * <p> 1206 * Identify items to remove by the name of the item's information object name, e.g. <code>title</code> or <code>prop</code>. 1207 * 1208 * @param value 1209 * the by-item-name value to set, or {@code null} to clear 1210 */ 1211 public void setByItemName(@Nullable String value) { 1212 _byItemName = value; 1213 } 1214 1215 /** 1216 * Get the "{@literal Item Namespace Reference}". 1217 * 1218 * <p> 1219 * Identify items to remove by the item's <code>ns</code>, which is the namespace associated with a <code>part</code>, or <code>prop</code>. 1220 * 1221 * @return the by-ns value, or {@code null} if not set 1222 */ 1223 @Nullable 1224 public URI getByNs() { 1225 return _byNs; 1226 } 1227 1228 /** 1229 * Set the "{@literal Item Namespace Reference}". 1230 * 1231 * <p> 1232 * Identify items to remove by the item's <code>ns</code>, which is the namespace associated with a <code>part</code>, or <code>prop</code>. 1233 * 1234 * @param value 1235 * the by-ns value to set, or {@code null} to clear 1236 */ 1237 public void setByNs(@Nullable URI value) { 1238 _byNs = value; 1239 } 1240 1241 @Override 1242 public String toString() { 1243 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 1244 } 1245 } 1246 1247 /** 1248 * Specifies contents to be added into controls, in resolution. 1249 */ 1250 @MetaschemaAssembly( 1251 formalName = "Addition", 1252 description = "Specifies contents to be added into controls, in resolution.", 1253 name = "add", 1254 moduleClass = OscalProfileModule.class, 1255 remarks = "When no `by-id` is given, the addition is inserted into the control targeted by the alteration at the start or end as indicated by `position`. Only `position` values of \"starting\" or \"ending\" are permitted when there is no `by-id`.\n" 1256 + "\n" 1257 + "`by-id`, when given, should indicate, by its ID, an element inside the control to serve as the anchor point for the addition. In this case, `position` value may be any of the permitted values.", 1258 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-profile-modify-alter-prop-name-values", 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.")})) 1259 ) 1260 public static class Add implements IBoundObject { 1261 private final IMetaschemaData __metaschemaData; 1262 1263 /** 1264 * Where to add the new content with respect to the targeted element (beside it or inside it). 1265 */ 1266 @BoundFlag( 1267 formalName = "Position", 1268 description = "Where to add the new content with respect to the targeted element (beside it or inside it).", 1269 name = "position", 1270 defaultValue = "ending", 1271 typeAdapter = TokenAdapter.class, 1272 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-alter-position-values", level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "before", description = "Preceding the by-id target"), @AllowedValue(value = "after", description = "Following the by-id target"), @AllowedValue(value = "starting", description = "Inside the control or by-id target, at the start"), @AllowedValue(value = "ending", description = "Inside the control or by-id target, at the end")})) 1273 ) 1274 private String _position; 1275 1276 /** 1277 * Target location of the addition. 1278 */ 1279 @BoundFlag( 1280 formalName = "Reference by ID", 1281 description = "Target location of the addition.", 1282 name = "by-id", 1283 typeAdapter = TokenAdapter.class 1284 ) 1285 private String _byId; 1286 1287 /** 1288 * A name given to the control, which may be used by a tool for display and navigation. 1289 */ 1290 @BoundField( 1291 formalName = "Title Change", 1292 description = "A name given to the control, which may be used by a tool for display and navigation.", 1293 useName = "title", 1294 typeAdapter = MarkupLineAdapter.class 1295 ) 1296 private MarkupLine _title; 1297 1298 /** 1299 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 1300 */ 1301 @BoundAssembly( 1302 formalName = "Parameter", 1303 description = "Parameters provide a mechanism for the dynamic assignment of value(s) in a control.", 1304 useName = "param", 1305 maxOccurs = -1, 1306 groupAs = @GroupAs(name = "params", inJson = JsonGroupAsBehavior.LIST) 1307 ) 1308 private List<Parameter> _params; 1309 1310 /** 1311 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 1312 */ 1313 @BoundAssembly( 1314 formalName = "Property", 1315 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 1316 useName = "prop", 1317 maxOccurs = -1, 1318 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 1319 ) 1320 private List<Property> _props; 1321 1322 /** 1323 * A reference to a local or remote resource, that has a specific relation to the containing object. 1324 */ 1325 @BoundAssembly( 1326 formalName = "Link", 1327 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 1328 useName = "link", 1329 maxOccurs = -1, 1330 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 1331 ) 1332 private List<Link> _links; 1333 1334 /** 1335 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 1336 */ 1337 @BoundAssembly( 1338 formalName = "Part", 1339 description = "An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part.", 1340 useName = "part", 1341 maxOccurs = -1, 1342 groupAs = @GroupAs(name = "parts", inJson = JsonGroupAsBehavior.LIST) 1343 ) 1344 private List<ControlPart> _parts; 1345 1346 /** 1347 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter.Add} instance with no metadata. 1348 */ 1349 public Add() { 1350 this(null); 1351 } 1352 1353 /** 1354 * Constructs a new {@code dev.metaschema.oscal.lib.model.Modify.Alter.Add} instance with the specified metadata. 1355 * 1356 * @param data 1357 * the metaschema data, or {@code null} if none 1358 */ 1359 public Add(IMetaschemaData data) { 1360 this.__metaschemaData = data; 1361 } 1362 1363 @Override 1364 public IMetaschemaData getMetaschemaData() { 1365 return __metaschemaData; 1366 } 1367 1368 /** 1369 * Get the "{@literal Position}". 1370 * 1371 * <p> 1372 * Where to add the new content with respect to the targeted element (beside it or inside it). 1373 * 1374 * @return the position value, or {@code null} if not set 1375 */ 1376 @Nullable 1377 public String getPosition() { 1378 return _position; 1379 } 1380 1381 /** 1382 * Set the "{@literal Position}". 1383 * 1384 * <p> 1385 * Where to add the new content with respect to the targeted element (beside it or inside it). 1386 * 1387 * @param value 1388 * the position value to set, or {@code null} to clear 1389 */ 1390 public void setPosition(@Nullable String value) { 1391 _position = value; 1392 } 1393 1394 /** 1395 * Get the "{@literal Reference by ID}". 1396 * 1397 * <p> 1398 * Target location of the addition. 1399 * 1400 * @return the by-id value, or {@code null} if not set 1401 */ 1402 @Nullable 1403 public String getById() { 1404 return _byId; 1405 } 1406 1407 /** 1408 * Set the "{@literal Reference by ID}". 1409 * 1410 * <p> 1411 * Target location of the addition. 1412 * 1413 * @param value 1414 * the by-id value to set, or {@code null} to clear 1415 */ 1416 public void setById(@Nullable String value) { 1417 _byId = value; 1418 } 1419 1420 /** 1421 * Get the "{@literal Title Change}". 1422 * 1423 * <p> 1424 * A name given to the control, which may be used by a tool for display and navigation. 1425 * 1426 * @return the title value, or {@code null} if not set 1427 */ 1428 @Nullable 1429 public MarkupLine getTitle() { 1430 return _title; 1431 } 1432 1433 /** 1434 * Set the "{@literal Title Change}". 1435 * 1436 * <p> 1437 * A name given to the control, which may be used by a tool for display and navigation. 1438 * 1439 * @param value 1440 * the title value to set, or {@code null} to clear 1441 */ 1442 public void setTitle(@Nullable MarkupLine value) { 1443 _title = value; 1444 } 1445 1446 /** 1447 * Get the "{@literal Parameter}". 1448 * 1449 * <p> 1450 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 1451 * 1452 * @return the param value 1453 */ 1454 @NonNull 1455 public List<Parameter> getParams() { 1456 if (_params == null) { 1457 _params = new LinkedList<>(); 1458 } 1459 return ObjectUtils.notNull(_params); 1460 } 1461 1462 /** 1463 * Set the "{@literal Parameter}". 1464 * 1465 * <p> 1466 * Parameters provide a mechanism for the dynamic assignment of value(s) in a control. 1467 * 1468 * @param value 1469 * the param value to set 1470 */ 1471 public void setParams(@NonNull List<Parameter> value) { 1472 _params = value; 1473 } 1474 1475 /** 1476 * Add a new {@link Parameter} item to the underlying collection. 1477 * @param item the item to add 1478 * @return {@code true} 1479 */ 1480 public boolean addParam(Parameter item) { 1481 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1482 if (_params == null) { 1483 _params = new LinkedList<>(); 1484 } 1485 return _params.add(value); 1486 } 1487 1488 /** 1489 * Remove the first matching {@link Parameter} item from the underlying collection. 1490 * @param item the item to remove 1491 * @return {@code true} if the item was removed or {@code false} otherwise 1492 */ 1493 public boolean removeParam(Parameter item) { 1494 Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1495 return _params != null && _params.remove(value); 1496 } 1497 1498 /** 1499 * Get the "{@literal Property}". 1500 * 1501 * <p> 1502 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 1503 * 1504 * @return the prop value 1505 */ 1506 @NonNull 1507 public List<Property> getProps() { 1508 if (_props == null) { 1509 _props = new LinkedList<>(); 1510 } 1511 return ObjectUtils.notNull(_props); 1512 } 1513 1514 /** 1515 * Set the "{@literal Property}". 1516 * 1517 * <p> 1518 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 1519 * 1520 * @param value 1521 * the prop value to set 1522 */ 1523 public void setProps(@NonNull List<Property> value) { 1524 _props = value; 1525 } 1526 1527 /** 1528 * Add a new {@link Property} item to the underlying collection. 1529 * @param item the item to add 1530 * @return {@code true} 1531 */ 1532 public boolean addProp(Property item) { 1533 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1534 if (_props == null) { 1535 _props = new LinkedList<>(); 1536 } 1537 return _props.add(value); 1538 } 1539 1540 /** 1541 * Remove the first matching {@link Property} item from the underlying collection. 1542 * @param item the item to remove 1543 * @return {@code true} if the item was removed or {@code false} otherwise 1544 */ 1545 public boolean removeProp(Property item) { 1546 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1547 return _props != null && _props.remove(value); 1548 } 1549 1550 /** 1551 * Get the "{@literal Link}". 1552 * 1553 * <p> 1554 * A reference to a local or remote resource, that has a specific relation to the containing object. 1555 * 1556 * @return the link value 1557 */ 1558 @NonNull 1559 public List<Link> getLinks() { 1560 if (_links == null) { 1561 _links = new LinkedList<>(); 1562 } 1563 return ObjectUtils.notNull(_links); 1564 } 1565 1566 /** 1567 * Set the "{@literal Link}". 1568 * 1569 * <p> 1570 * A reference to a local or remote resource, that has a specific relation to the containing object. 1571 * 1572 * @param value 1573 * the link value to set 1574 */ 1575 public void setLinks(@NonNull List<Link> value) { 1576 _links = value; 1577 } 1578 1579 /** 1580 * Add a new {@link Link} item to the underlying collection. 1581 * @param item the item to add 1582 * @return {@code true} 1583 */ 1584 public boolean addLink(Link item) { 1585 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1586 if (_links == null) { 1587 _links = new LinkedList<>(); 1588 } 1589 return _links.add(value); 1590 } 1591 1592 /** 1593 * Remove the first matching {@link Link} item from the underlying collection. 1594 * @param item the item to remove 1595 * @return {@code true} if the item was removed or {@code false} otherwise 1596 */ 1597 public boolean removeLink(Link item) { 1598 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1599 return _links != null && _links.remove(value); 1600 } 1601 1602 /** 1603 * Get the "{@literal Part}". 1604 * 1605 * <p> 1606 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 1607 * 1608 * @return the part value 1609 */ 1610 @NonNull 1611 public List<ControlPart> getParts() { 1612 if (_parts == null) { 1613 _parts = new LinkedList<>(); 1614 } 1615 return ObjectUtils.notNull(_parts); 1616 } 1617 1618 /** 1619 * Set the "{@literal Part}". 1620 * 1621 * <p> 1622 * An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part. 1623 * 1624 * @param value 1625 * the part value to set 1626 */ 1627 public void setParts(@NonNull List<ControlPart> value) { 1628 _parts = value; 1629 } 1630 1631 /** 1632 * Add a new {@link ControlPart} item to the underlying collection. 1633 * @param item the item to add 1634 * @return {@code true} 1635 */ 1636 public boolean addPart(ControlPart item) { 1637 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1638 if (_parts == null) { 1639 _parts = new LinkedList<>(); 1640 } 1641 return _parts.add(value); 1642 } 1643 1644 /** 1645 * Remove the first matching {@link ControlPart} item from the underlying collection. 1646 * @param item the item to remove 1647 * @return {@code true} if the item was removed or {@code false} otherwise 1648 */ 1649 public boolean removePart(ControlPart item) { 1650 ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1651 return _parts != null && _parts.remove(value); 1652 } 1653 1654 @Override 1655 public String toString() { 1656 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 1657 } 1658 } 1659 } 1660}