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