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