View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
4   import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
5   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
6   import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
7   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
8   import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
9   import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
10  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
11  import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
12  import java.lang.Override;
13  import java.lang.String;
14  import java.util.LinkedList;
15  import java.util.List;
16  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
17  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
18  
19  /**
20   * The expected level of impact resulting from the described information.
21   */
22  @MetaschemaAssembly(
23      formalName = "Impact Level",
24      description = "The expected level of impact resulting from the described information.",
25      name = "impact",
26      metaschema = OscalSspMetaschema.class
27  )
28  public class Impact {
29    @BoundAssembly(
30        formalName = "Property",
31        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
32        useName = "prop",
33        maxOccurs = -1
34    )
35    @GroupAs(
36        name = "props",
37        inJson = JsonGroupAsBehavior.LIST
38    )
39    private List<Property> _props;
40  
41    @BoundAssembly(
42        formalName = "Link",
43        description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
44        useName = "link",
45        maxOccurs = -1
46    )
47    @GroupAs(
48        name = "links",
49        inJson = JsonGroupAsBehavior.LIST
50    )
51    private List<Link> _links;
52  
53    @BoundField(
54        formalName = "Base Level (Confidentiality, Integrity, or Availability)",
55        description = "The prescribed base (Confidentiality, Integrity, or Availability) security impact level.",
56        useName = "base",
57        minOccurs = 1
58    )
59    private String _base;
60  
61    @BoundField(
62        formalName = "Selected Level (Confidentiality, Integrity, or Availability)",
63        description = "The selected (Confidentiality, Integrity, or Availability) security impact level.",
64        useName = "selected"
65    )
66    private String _selected;
67  
68    @BoundField(
69        formalName = "Adjustment Justification",
70        description = "If the selected security level is different from the base security level, this contains the justification for the change.",
71        useName = "adjustment-justification"
72    )
73    @BoundFieldValue(
74        typeAdapter = MarkupMultilineAdapter.class
75    )
76    private MarkupMultiline _adjustmentJustification;
77  
78    public Impact() {
79    }
80  
81    public List<Property> getProps() {
82      return _props;
83    }
84  
85    public void setProps(List<Property> value) {
86      _props = value;
87    }
88  
89    /**
90     * Add a new {@link Property} item to the underlying collection.
91     * @param item the item to add
92     * @return {@code true}
93     */
94    public boolean addProp(Property item) {
95      Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
96      if (_props == null) {
97        _props = new LinkedList<>();
98      }
99      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 }