001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter;
004import gov.nist.secauto.metaschema.core.datatype.adapter.UriAdapter;
005import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine;
006import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter;
007import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
008import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter;
009import gov.nist.secauto.metaschema.core.model.IBoundObject;
010import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
011import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
012import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
013import gov.nist.secauto.metaschema.core.util.ObjectUtils;
014import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue;
015import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
016import gov.nist.secauto.metaschema.databind.model.annotations.AssemblyConstraints;
017import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
018import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
019import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
020import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
021import gov.nist.secauto.metaschema.databind.model.annotations.IsUnique;
022import gov.nist.secauto.metaschema.databind.model.annotations.KeyField;
023import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
024import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
025import java.lang.Override;
026import java.lang.String;
027import java.net.URI;
028import java.util.LinkedList;
029import java.util.List;
030import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
031import org.apache.commons.lang3.builder.ToStringStyle;
032
033/**
034 * Set parameters or amend controls in resolution.
035 */
036@MetaschemaAssembly(
037    formalName = "Modify Controls",
038    description = "Set parameters or amend controls in resolution.",
039    name = "modify",
040    moduleClass = OscalProfileModule.class,
041    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."))
042)
043public class Modify implements IBoundObject {
044  private final IMetaschemaData __metaschemaData;
045
046  @BoundAssembly(
047      formalName = "Parameter Setting",
048      description = "A parameter setting, to be propagated to points of insertion.",
049      useName = "set-parameter",
050      maxOccurs = -1,
051      groupAs = @GroupAs(name = "set-parameters", inJson = JsonGroupAsBehavior.LIST)
052  )
053  private List<ProfileSetParameter> _setParameters;
054
055  @BoundAssembly(
056      formalName = "Alteration",
057      description = "Specifies changes to be made to an included control when a profile is resolved.",
058      useName = "alter",
059      remarks = "Use `@control-id` to indicate the scope of alteration.\n"
060              + "\n"
061              + "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"
062              + "\n"
063              + "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.",
064      maxOccurs = -1,
065      groupAs = @GroupAs(name = "alters", inJson = JsonGroupAsBehavior.LIST)
066  )
067  private List<Alter> _alters;
068
069  public Modify() {
070    this(null);
071  }
072
073  public Modify(IMetaschemaData data) {
074    this.__metaschemaData = data;
075  }
076
077  @Override
078  public IMetaschemaData getMetaschemaData() {
079    return __metaschemaData;
080  }
081
082  public List<ProfileSetParameter> getSetParameters() {
083    return _setParameters;
084  }
085
086  public void setSetParameters(List<ProfileSetParameter> value) {
087    _setParameters = value;
088  }
089
090  /**
091   * Add a new {@link ProfileSetParameter} item to the underlying collection.
092   * @param item the item to add
093   * @return {@code true}
094   */
095  public boolean addSetParameter(ProfileSetParameter item) {
096    ProfileSetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
097    if (_setParameters == null) {
098      _setParameters = new LinkedList<>();
099    }
100    return _setParameters.add(value);
101  }
102
103  /**
104   * Remove the first matching {@link ProfileSetParameter} item from the underlying collection.
105   * @param item the item to remove
106   * @return {@code true} if the item was removed or {@code false} otherwise
107   */
108  public boolean removeSetParameter(ProfileSetParameter item) {
109    ProfileSetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
110    return _setParameters != null && _setParameters.remove(value);
111  }
112
113  public List<Alter> getAlters() {
114    return _alters;
115  }
116
117  public void setAlters(List<Alter> value) {
118    _alters = value;
119  }
120
121  /**
122   * Add a new {@link Alter} item to the underlying collection.
123   * @param item the item to add
124   * @return {@code true}
125   */
126  public boolean addAlter(Alter item) {
127    Alter value = ObjectUtils.requireNonNull(item,"item cannot be null");
128    if (_alters == null) {
129      _alters = new LinkedList<>();
130    }
131    return _alters.add(value);
132  }
133
134  /**
135   * Remove the first matching {@link Alter} item from the underlying collection.
136   * @param item the item to remove
137   * @return {@code true} if the item was removed or {@code false} otherwise
138   */
139  public boolean removeAlter(Alter item) {
140    Alter value = ObjectUtils.requireNonNull(item,"item cannot be null");
141    return _alters != null && _alters.remove(value);
142  }
143
144  @Override
145  public String toString() {
146    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
147  }
148
149  /**
150   * A parameter setting, to be propagated to points of insertion.
151   */
152  @MetaschemaAssembly(
153      formalName = "Parameter Setting",
154      description = "A parameter setting, to be propagated to points of insertion.",
155      name = "set-parameter",
156      moduleClass = OscalProfileModule.class
157  )
158  public static class ProfileSetParameter implements IBoundObject {
159    private final IMetaschemaData __metaschemaData;
160
161    /**
162     * "An identifier for the parameter."
163     */
164    @BoundFlag(
165        formalName = "Parameter ID",
166        description = "An identifier for the parameter.",
167        name = "param-id",
168        required = true,
169        typeAdapter = TokenAdapter.class
170    )
171    private String _paramId;
172
173    /**
174     * "A textual label that provides a characterization of the parameter."
175     */
176    @BoundFlag(
177        formalName = "Parameter Class",
178        description = "A textual label that provides a characterization of the parameter.",
179        name = "class",
180        typeAdapter = TokenAdapter.class,
181        remarks = "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value."
182    )
183    private String _clazz;
184
185    /**
186     * "**(deprecated)** Another parameter invoking this one. This construct has been deprecated and should not be used."
187     */
188    @BoundFlag(
189        formalName = "Depends On",
190        description = "\\*\\*(deprecated)\\*\\* Another parameter invoking this one. This construct has been deprecated and should not be used.",
191        name = "depends-on",
192        typeAdapter = TokenAdapter.class
193    )
194    private String _dependsOn;
195
196    @BoundAssembly(
197        formalName = "Property",
198        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
199        useName = "prop",
200        maxOccurs = -1,
201        groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
202    )
203    private List<Property> _props;
204
205    @BoundAssembly(
206        formalName = "Link",
207        description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
208        useName = "link",
209        maxOccurs = -1,
210        groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
211    )
212    private List<Link> _links;
213
214    @BoundField(
215        formalName = "Parameter Label",
216        description = "A short, placeholder name for the parameter, which can be used as a substitute for a `value` if no value is assigned.",
217        useName = "label",
218        remarks = "The label value should be suitable for inline display in a rendered catalog.",
219        typeAdapter = MarkupLineAdapter.class
220    )
221    private MarkupLine _label;
222
223    @BoundField(
224        formalName = "Parameter Usage Description",
225        description = "Describes the purpose and use of a parameter.",
226        useName = "usage",
227        typeAdapter = MarkupMultilineAdapter.class
228    )
229    private MarkupMultiline _usage;
230
231    @BoundAssembly(
232        formalName = "Constraint",
233        description = "A formal or informal expression of a constraint or test.",
234        useName = "constraint",
235        maxOccurs = -1,
236        groupAs = @GroupAs(name = "constraints", inJson = JsonGroupAsBehavior.LIST)
237    )
238    private List<ParameterConstraint> _constraints;
239
240    @BoundAssembly(
241        formalName = "Guideline",
242        description = "A prose statement that provides a recommendation for the use of a parameter.",
243        useName = "guideline",
244        maxOccurs = -1,
245        groupAs = @GroupAs(name = "guidelines", inJson = JsonGroupAsBehavior.LIST)
246    )
247    private List<ParameterGuideline> _guidelines;
248
249    @BoundField(
250        formalName = "Parameter Value",
251        description = "A parameter value or set of values.",
252        useName = "value",
253        remarks = "Used to (re)define a parameter value.",
254        maxOccurs = -1,
255        groupAs = @GroupAs(name = "values", inJson = JsonGroupAsBehavior.LIST)
256    )
257    private List<String> _values;
258
259    @BoundAssembly(
260        formalName = "Selection",
261        description = "Presenting a choice among alternatives.",
262        useName = "select"
263    )
264    private ParameterSelection _select;
265
266    public ProfileSetParameter() {
267      this(null);
268    }
269
270    public ProfileSetParameter(IMetaschemaData data) {
271      this.__metaschemaData = data;
272    }
273
274    @Override
275    public IMetaschemaData getMetaschemaData() {
276      return __metaschemaData;
277    }
278
279    public String getParamId() {
280      return _paramId;
281    }
282
283    public void setParamId(String value) {
284      _paramId = value;
285    }
286
287    public String getClazz() {
288      return _clazz;
289    }
290
291    public void setClazz(String value) {
292      _clazz = value;
293    }
294
295    public String getDependsOn() {
296      return _dependsOn;
297    }
298
299    public void setDependsOn(String value) {
300      _dependsOn = value;
301    }
302
303    public List<Property> getProps() {
304      return _props;
305    }
306
307    public void setProps(List<Property> value) {
308      _props = value;
309    }
310
311    /**
312     * Add a new {@link Property} item to the underlying collection.
313     * @param item the item to add
314     * @return {@code true}
315     */
316    public boolean addProp(Property item) {
317      Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
318      if (_props == null) {
319        _props = new LinkedList<>();
320      }
321      return _props.add(value);
322    }
323
324    /**
325     * Remove the first matching {@link Property} item from the underlying collection.
326     * @param item the item to remove
327     * @return {@code true} if the item was removed or {@code false} otherwise
328     */
329    public boolean removeProp(Property item) {
330      Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
331      return _props != null && _props.remove(value);
332    }
333
334    public List<Link> getLinks() {
335      return _links;
336    }
337
338    public void setLinks(List<Link> value) {
339      _links = value;
340    }
341
342    /**
343     * Add a new {@link Link} item to the underlying collection.
344     * @param item the item to add
345     * @return {@code true}
346     */
347    public boolean addLink(Link item) {
348      Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
349      if (_links == null) {
350        _links = new LinkedList<>();
351      }
352      return _links.add(value);
353    }
354
355    /**
356     * Remove the first matching {@link Link} 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 removeLink(Link item) {
361      Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
362      return _links != null && _links.remove(value);
363    }
364
365    public MarkupLine getLabel() {
366      return _label;
367    }
368
369    public void setLabel(MarkupLine value) {
370      _label = value;
371    }
372
373    public MarkupMultiline getUsage() {
374      return _usage;
375    }
376
377    public void setUsage(MarkupMultiline value) {
378      _usage = value;
379    }
380
381    public List<ParameterConstraint> getConstraints() {
382      return _constraints;
383    }
384
385    public void setConstraints(List<ParameterConstraint> value) {
386      _constraints = value;
387    }
388
389    /**
390     * Add a new {@link ParameterConstraint} item to the underlying collection.
391     * @param item the item to add
392     * @return {@code true}
393     */
394    public boolean addConstraint(ParameterConstraint item) {
395      ParameterConstraint value = ObjectUtils.requireNonNull(item,"item cannot be null");
396      if (_constraints == null) {
397        _constraints = new LinkedList<>();
398      }
399      return _constraints.add(value);
400    }
401
402    /**
403     * Remove the first matching {@link ParameterConstraint} item from the underlying collection.
404     * @param item the item to remove
405     * @return {@code true} if the item was removed or {@code false} otherwise
406     */
407    public boolean removeConstraint(ParameterConstraint item) {
408      ParameterConstraint value = ObjectUtils.requireNonNull(item,"item cannot be null");
409      return _constraints != null && _constraints.remove(value);
410    }
411
412    public List<ParameterGuideline> getGuidelines() {
413      return _guidelines;
414    }
415
416    public void setGuidelines(List<ParameterGuideline> value) {
417      _guidelines = value;
418    }
419
420    /**
421     * Add a new {@link ParameterGuideline} item to the underlying collection.
422     * @param item the item to add
423     * @return {@code true}
424     */
425    public boolean addGuideline(ParameterGuideline item) {
426      ParameterGuideline value = ObjectUtils.requireNonNull(item,"item cannot be null");
427      if (_guidelines == null) {
428        _guidelines = new LinkedList<>();
429      }
430      return _guidelines.add(value);
431    }
432
433    /**
434     * Remove the first matching {@link ParameterGuideline} item from the underlying collection.
435     * @param item the item to remove
436     * @return {@code true} if the item was removed or {@code false} otherwise
437     */
438    public boolean removeGuideline(ParameterGuideline item) {
439      ParameterGuideline value = ObjectUtils.requireNonNull(item,"item cannot be null");
440      return _guidelines != null && _guidelines.remove(value);
441    }
442
443    public List<String> getValues() {
444      return _values;
445    }
446
447    public void setValues(List<String> value) {
448      _values = value;
449    }
450
451    /**
452     * Add a new {@link String} item to the underlying collection.
453     * @param item the item to add
454     * @return {@code true}
455     */
456    public boolean addValue(String item) {
457      String value = ObjectUtils.requireNonNull(item,"item cannot be null");
458      if (_values == null) {
459        _values = new LinkedList<>();
460      }
461      return _values.add(value);
462    }
463
464    /**
465     * Remove the first matching {@link String} item from the underlying collection.
466     * @param item the item to remove
467     * @return {@code true} if the item was removed or {@code false} otherwise
468     */
469    public boolean removeValue(String item) {
470      String value = ObjectUtils.requireNonNull(item,"item cannot be null");
471      return _values != null && _values.remove(value);
472    }
473
474    public ParameterSelection getSelect() {
475      return _select;
476    }
477
478    public void setSelect(ParameterSelection value) {
479      _select = value;
480    }
481
482    @Override
483    public String toString() {
484      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
485    }
486  }
487
488  /**
489   * Specifies changes to be made to an included control when a profile is resolved.
490   */
491  @MetaschemaAssembly(
492      formalName = "Alteration",
493      description = "Specifies changes to be made to an included control when a profile is resolved.",
494      name = "alter",
495      moduleClass = OscalProfileModule.class,
496      remarks = "Use `@control-id` to indicate the scope of alteration.\n"
497              + "\n"
498              + "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"
499              + "\n"
500              + "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."
501  )
502  public static class Alter implements IBoundObject {
503    private final IMetaschemaData __metaschemaData;
504
505    /**
506     * "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)."
507     */
508    @BoundFlag(
509        formalName = "Control Identifier Reference",
510        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).",
511        name = "control-id",
512        required = true,
513        typeAdapter = TokenAdapter.class
514    )
515    private String _controlId;
516
517    @BoundAssembly(
518        formalName = "Removal",
519        description = "Specifies objects to be removed from a control based on specific aspects of the object that must all match.",
520        useName = "remove",
521        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"
522                + "\n"
523                + "To change an element, use `remove` to remove the element, then `add` to add it back again with changes.",
524        maxOccurs = -1,
525        groupAs = @GroupAs(name = "removes", inJson = JsonGroupAsBehavior.LIST)
526    )
527    private List<Remove> _removes;
528
529    @BoundAssembly(
530        formalName = "Addition",
531        description = "Specifies contents to be added into controls, in resolution.",
532        useName = "add",
533        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"
534                + "\n"
535                + "`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.",
536        maxOccurs = -1,
537        groupAs = @GroupAs(name = "adds", inJson = JsonGroupAsBehavior.LIST)
538    )
539    private List<Add> _adds;
540
541    public Alter() {
542      this(null);
543    }
544
545    public Alter(IMetaschemaData data) {
546      this.__metaschemaData = data;
547    }
548
549    @Override
550    public IMetaschemaData getMetaschemaData() {
551      return __metaschemaData;
552    }
553
554    public String getControlId() {
555      return _controlId;
556    }
557
558    public void setControlId(String value) {
559      _controlId = value;
560    }
561
562    public List<Remove> getRemoves() {
563      return _removes;
564    }
565
566    public void setRemoves(List<Remove> value) {
567      _removes = value;
568    }
569
570    /**
571     * Add a new {@link Remove} item to the underlying collection.
572     * @param item the item to add
573     * @return {@code true}
574     */
575    public boolean addRemove(Remove item) {
576      Remove value = ObjectUtils.requireNonNull(item,"item cannot be null");
577      if (_removes == null) {
578        _removes = new LinkedList<>();
579      }
580      return _removes.add(value);
581    }
582
583    /**
584     * Remove the first matching {@link Remove} item from the underlying collection.
585     * @param item the item to remove
586     * @return {@code true} if the item was removed or {@code false} otherwise
587     */
588    public boolean removeRemove(Remove item) {
589      Remove value = ObjectUtils.requireNonNull(item,"item cannot be null");
590      return _removes != null && _removes.remove(value);
591    }
592
593    public List<Add> getAdds() {
594      return _adds;
595    }
596
597    public void setAdds(List<Add> value) {
598      _adds = value;
599    }
600
601    /**
602     * Add a new {@link Add} item to the underlying collection.
603     * @param item the item to add
604     * @return {@code true}
605     */
606    public boolean addAdd(Add item) {
607      Add value = ObjectUtils.requireNonNull(item,"item cannot be null");
608      if (_adds == null) {
609        _adds = new LinkedList<>();
610      }
611      return _adds.add(value);
612    }
613
614    /**
615     * Remove the first matching {@link Add} item from the underlying collection.
616     * @param item the item to remove
617     * @return {@code true} if the item was removed or {@code false} otherwise
618     */
619    public boolean removeAdd(Add item) {
620      Add value = ObjectUtils.requireNonNull(item,"item cannot be null");
621      return _adds != null && _adds.remove(value);
622    }
623
624    @Override
625    public String toString() {
626      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
627    }
628
629    /**
630     * Specifies objects to be removed from a control based on specific aspects of the object that must all match.
631     */
632    @MetaschemaAssembly(
633        formalName = "Removal",
634        description = "Specifies objects to be removed from a control based on specific aspects of the object that must all match.",
635        name = "remove",
636        moduleClass = OscalProfileModule.class,
637        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"
638                + "\n"
639                + "To change an element, use `remove` to remove the element, then `add` to add it back again with changes."
640    )
641    public static class Remove implements IBoundObject {
642      private final IMetaschemaData __metaschemaData;
643
644      /**
645       * "Identify items remove by matching their assigned name."
646       */
647      @BoundFlag(
648          formalName = "Reference by (assigned) name",
649          description = "Identify items remove by matching their assigned name.",
650          name = "by-name",
651          typeAdapter = TokenAdapter.class
652      )
653      private String _byName;
654
655      /**
656       * "Identify items to remove by matching their <code>class</code>."
657       */
658      @BoundFlag(
659          formalName = "Reference by class",
660          description = "Identify items to remove by matching their `class`.",
661          name = "by-class",
662          typeAdapter = TokenAdapter.class
663      )
664      private String _byClass;
665
666      /**
667       * "Identify items to remove indicated by their <code>id</code>."
668       */
669      @BoundFlag(
670          formalName = "Reference by ID",
671          description = "Identify items to remove indicated by their `id`.",
672          name = "by-id",
673          typeAdapter = TokenAdapter.class
674      )
675      private String _byId;
676
677      /**
678       * "Identify items to remove by the name of the item's information object name, e.g. <code>title</code> or <code>prop</code>."
679       */
680      @BoundFlag(
681          formalName = "Item Name Reference",
682          description = "Identify items to remove by the name of the item's information object name, e.g. `title` or `prop`.",
683          name = "by-item-name",
684          typeAdapter = TokenAdapter.class,
685          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.")}))
686      )
687      private String _byItemName;
688
689      /**
690       * "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>."
691       */
692      @BoundFlag(
693          formalName = "Item Namespace Reference",
694          description = "Identify items to remove by the item's `ns`, which is the namespace associated with a `part`, or `prop`.",
695          name = "by-ns",
696          typeAdapter = UriAdapter.class
697      )
698      private URI _byNs;
699
700      public Remove() {
701        this(null);
702      }
703
704      public Remove(IMetaschemaData data) {
705        this.__metaschemaData = data;
706      }
707
708      @Override
709      public IMetaschemaData getMetaschemaData() {
710        return __metaschemaData;
711      }
712
713      public String getByName() {
714        return _byName;
715      }
716
717      public void setByName(String value) {
718        _byName = value;
719      }
720
721      public String getByClass() {
722        return _byClass;
723      }
724
725      public void setByClass(String value) {
726        _byClass = value;
727      }
728
729      public String getById() {
730        return _byId;
731      }
732
733      public void setById(String value) {
734        _byId = value;
735      }
736
737      public String getByItemName() {
738        return _byItemName;
739      }
740
741      public void setByItemName(String value) {
742        _byItemName = value;
743      }
744
745      public URI getByNs() {
746        return _byNs;
747      }
748
749      public void setByNs(URI value) {
750        _byNs = value;
751      }
752
753      @Override
754      public String toString() {
755        return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
756      }
757    }
758
759    /**
760     * Specifies contents to be added into controls, in resolution.
761     */
762    @MetaschemaAssembly(
763        formalName = "Addition",
764        description = "Specifies contents to be added into controls, in resolution.",
765        name = "add",
766        moduleClass = OscalProfileModule.class,
767        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"
768                + "\n"
769                + "`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.",
770        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.")}))
771    )
772    public static class Add implements IBoundObject {
773      private final IMetaschemaData __metaschemaData;
774
775      /**
776       * "Where to add the new content with respect to the targeted element (beside it or inside it)."
777       */
778      @BoundFlag(
779          formalName = "Position",
780          description = "Where to add the new content with respect to the targeted element (beside it or inside it).",
781          name = "position",
782          defaultValue = "ending",
783          typeAdapter = TokenAdapter.class,
784          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")}))
785      )
786      private String _position;
787
788      /**
789       * "Target location of the addition."
790       */
791      @BoundFlag(
792          formalName = "Reference by ID",
793          description = "Target location of the addition.",
794          name = "by-id",
795          typeAdapter = TokenAdapter.class
796      )
797      private String _byId;
798
799      @BoundField(
800          formalName = "Title Change",
801          description = "A name given to the control, which may be used by a tool for display and navigation.",
802          useName = "title",
803          typeAdapter = MarkupLineAdapter.class
804      )
805      private MarkupLine _title;
806
807      @BoundAssembly(
808          formalName = "Parameter",
809          description = "Parameters provide a mechanism for the dynamic assignment of value(s) in a control.",
810          useName = "param",
811          maxOccurs = -1,
812          groupAs = @GroupAs(name = "params", inJson = JsonGroupAsBehavior.LIST)
813      )
814      private List<Parameter> _params;
815
816      @BoundAssembly(
817          formalName = "Property",
818          description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
819          useName = "prop",
820          maxOccurs = -1,
821          groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
822      )
823      private List<Property> _props;
824
825      @BoundAssembly(
826          formalName = "Link",
827          description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
828          useName = "link",
829          maxOccurs = -1,
830          groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
831      )
832      private List<Link> _links;
833
834      @BoundAssembly(
835          formalName = "Part",
836          description = "An annotated, markup-based textual element of a control's or catalog group's definition, or a child of another part.",
837          useName = "part",
838          maxOccurs = -1,
839          groupAs = @GroupAs(name = "parts", inJson = JsonGroupAsBehavior.LIST)
840      )
841      private List<ControlPart> _parts;
842
843      public Add() {
844        this(null);
845      }
846
847      public Add(IMetaschemaData data) {
848        this.__metaschemaData = data;
849      }
850
851      @Override
852      public IMetaschemaData getMetaschemaData() {
853        return __metaschemaData;
854      }
855
856      public String getPosition() {
857        return _position;
858      }
859
860      public void setPosition(String value) {
861        _position = value;
862      }
863
864      public String getById() {
865        return _byId;
866      }
867
868      public void setById(String value) {
869        _byId = value;
870      }
871
872      public MarkupLine getTitle() {
873        return _title;
874      }
875
876      public void setTitle(MarkupLine value) {
877        _title = value;
878      }
879
880      public List<Parameter> getParams() {
881        return _params;
882      }
883
884      public void setParams(List<Parameter> value) {
885        _params = value;
886      }
887
888      /**
889       * Add a new {@link Parameter} item to the underlying collection.
890       * @param item the item to add
891       * @return {@code true}
892       */
893      public boolean addParam(Parameter item) {
894        Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
895        if (_params == null) {
896          _params = new LinkedList<>();
897        }
898        return _params.add(value);
899      }
900
901      /**
902       * Remove the first matching {@link Parameter} item from the underlying collection.
903       * @param item the item to remove
904       * @return {@code true} if the item was removed or {@code false} otherwise
905       */
906      public boolean removeParam(Parameter item) {
907        Parameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
908        return _params != null && _params.remove(value);
909      }
910
911      public List<Property> getProps() {
912        return _props;
913      }
914
915      public void setProps(List<Property> value) {
916        _props = value;
917      }
918
919      /**
920       * Add a new {@link Property} item to the underlying collection.
921       * @param item the item to add
922       * @return {@code true}
923       */
924      public boolean addProp(Property item) {
925        Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
926        if (_props == null) {
927          _props = new LinkedList<>();
928        }
929        return _props.add(value);
930      }
931
932      /**
933       * Remove the first matching {@link Property} item from the underlying collection.
934       * @param item the item to remove
935       * @return {@code true} if the item was removed or {@code false} otherwise
936       */
937      public boolean removeProp(Property item) {
938        Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
939        return _props != null && _props.remove(value);
940      }
941
942      public List<Link> getLinks() {
943        return _links;
944      }
945
946      public void setLinks(List<Link> value) {
947        _links = value;
948      }
949
950      /**
951       * Add a new {@link Link} item to the underlying collection.
952       * @param item the item to add
953       * @return {@code true}
954       */
955      public boolean addLink(Link item) {
956        Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
957        if (_links == null) {
958          _links = new LinkedList<>();
959        }
960        return _links.add(value);
961      }
962
963      /**
964       * Remove the first matching {@link Link} item from the underlying collection.
965       * @param item the item to remove
966       * @return {@code true} if the item was removed or {@code false} otherwise
967       */
968      public boolean removeLink(Link item) {
969        Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
970        return _links != null && _links.remove(value);
971      }
972
973      public List<ControlPart> getParts() {
974        return _parts;
975      }
976
977      public void setParts(List<ControlPart> value) {
978        _parts = value;
979      }
980
981      /**
982       * Add a new {@link ControlPart} item to the underlying collection.
983       * @param item the item to add
984       * @return {@code true}
985       */
986      public boolean addPart(ControlPart item) {
987        ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null");
988        if (_parts == null) {
989          _parts = new LinkedList<>();
990        }
991        return _parts.add(value);
992      }
993
994      /**
995       * Remove the first matching {@link ControlPart} item from the underlying collection.
996       * @param item the item to remove
997       * @return {@code true} if the item was removed or {@code false} otherwise
998       */
999      public boolean removePart(ControlPart item) {
1000        ControlPart value = ObjectUtils.requireNonNull(item,"item cannot be null");
1001        return _parts != null && _parts.remove(value);
1002      }
1003
1004      @Override
1005      public String toString() {
1006        return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
1007      }
1008    }
1009  }
1010}