001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
004import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
005import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
006import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
007import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
008import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
009import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
010import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
011import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
012import java.lang.Override;
013import java.lang.String;
014import java.util.LinkedList;
015import java.util.List;
016import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
017import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
018
019/**
020 * The expected level of impact resulting from the described information.
021 */
022@MetaschemaAssembly(
023    formalName = "Impact Level",
024    description = "The expected level of impact resulting from the described information.",
025    name = "impact",
026    metaschema = OscalSspMetaschema.class
027)
028public class Impact {
029  @BoundAssembly(
030      formalName = "Property",
031      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
032      useName = "prop",
033      maxOccurs = -1
034  )
035  @GroupAs(
036      name = "props",
037      inJson = JsonGroupAsBehavior.LIST
038  )
039  private List<Property> _props;
040
041  @BoundAssembly(
042      formalName = "Link",
043      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
044      useName = "link",
045      maxOccurs = -1
046  )
047  @GroupAs(
048      name = "links",
049      inJson = JsonGroupAsBehavior.LIST
050  )
051  private List<Link> _links;
052
053  @BoundField(
054      formalName = "Base Level (Confidentiality, Integrity, or Availability)",
055      description = "The prescribed base (Confidentiality, Integrity, or Availability) security impact level.",
056      useName = "base",
057      minOccurs = 1
058  )
059  private String _base;
060
061  @BoundField(
062      formalName = "Selected Level (Confidentiality, Integrity, or Availability)",
063      description = "The selected (Confidentiality, Integrity, or Availability) security impact level.",
064      useName = "selected"
065  )
066  private String _selected;
067
068  @BoundField(
069      formalName = "Adjustment Justification",
070      description = "If the selected security level is different from the base security level, this contains the justification for the change.",
071      useName = "adjustment-justification"
072  )
073  @BoundFieldValue(
074      typeAdapter = MarkupMultilineAdapter.class
075  )
076  private MarkupMultiline _adjustmentJustification;
077
078  public Impact() {
079  }
080
081  public List<Property> getProps() {
082    return _props;
083  }
084
085  public void setProps(List<Property> value) {
086    _props = value;
087  }
088
089  /**
090   * Add a new {@link Property} item to the underlying collection.
091   * @param item the item to add
092   * @return {@code true}
093   */
094  public boolean addProp(Property item) {
095    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
096    if (_props == null) {
097      _props = new LinkedList<>();
098    }
099    return _props.add(value);
100  }
101
102  /**
103   * Remove the first matching {@link Property} item from the underlying collection.
104   * @param item the item to remove
105   * @return {@code true} if the item was removed or {@code false} otherwise
106   */
107  public boolean removeProp(Property item) {
108    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
109    return _props == null ? false : _props.remove(value);
110  }
111
112  public List<Link> getLinks() {
113    return _links;
114  }
115
116  public void setLinks(List<Link> value) {
117    _links = value;
118  }
119
120  /**
121   * Add a new {@link Link} item to the underlying collection.
122   * @param item the item to add
123   * @return {@code true}
124   */
125  public boolean addLink(Link item) {
126    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
127    if (_links == null) {
128      _links = new LinkedList<>();
129    }
130    return _links.add(value);
131  }
132
133  /**
134   * Remove the first matching {@link Link} item from the underlying collection.
135   * @param item the item to remove
136   * @return {@code true} if the item was removed or {@code false} otherwise
137   */
138  public boolean removeLink(Link item) {
139    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
140    return _links == null ? false : _links.remove(value);
141  }
142
143  public String getBase() {
144    return _base;
145  }
146
147  public void setBase(String value) {
148    _base = value;
149  }
150
151  public String getSelected() {
152    return _selected;
153  }
154
155  public void setSelected(String value) {
156    _selected = value;
157  }
158
159  public MarkupMultiline getAdjustmentJustification() {
160    return _adjustmentJustification;
161  }
162
163  public void setAdjustmentJustification(MarkupMultiline value) {
164    _adjustmentJustification = value;
165  }
166
167  @Override
168  public String toString() {
169    return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
170  }
171}