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.BoundFlag;
7   import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
8   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
9   import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
10  import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
11  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
12  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
13  import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
14  import java.lang.Override;
15  import java.lang.String;
16  import java.util.LinkedList;
17  import java.util.List;
18  import java.util.UUID;
19  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
20  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
21  
22  /**
23   * A local definition of a control objective. Uses catalog syntax for control objective and assessment activities.
24   */
25  @MetaschemaAssembly(
26      formalName = "Assessment Method",
27      description = "A local definition of a control objective. Uses catalog syntax for control objective and assessment activities.",
28      name = "assessment-method",
29      metaschema = OscalAssessmentCommonMetaschema.class
30  )
31  public class AssessmentMethod {
32    @BoundFlag(
33        formalName = "Assessment Method Universally Unique Identifier",
34        description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this assessment method elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `assessment method` can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.",
35        useName = "uuid",
36        required = true,
37        typeAdapter = UuidAdapter.class
38    )
39    private UUID _uuid;
40  
41    /**
42     * "A human-readable description of this assessment method."
43     */
44    @BoundField(
45        formalName = "Assessment Method Description",
46        description = "A human-readable description of this assessment method.",
47        useName = "description"
48    )
49    @BoundFieldValue(
50        typeAdapter = MarkupMultilineAdapter.class
51    )
52    private MarkupMultiline _description;
53  
54    @BoundAssembly(
55        formalName = "Property",
56        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
57        useName = "prop",
58        maxOccurs = -1
59    )
60    @GroupAs(
61        name = "props",
62        inJson = JsonGroupAsBehavior.LIST
63    )
64    private List<Property> _props;
65  
66    @BoundAssembly(
67        formalName = "Link",
68        description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
69        useName = "link",
70        maxOccurs = -1
71    )
72    @GroupAs(
73        name = "links",
74        inJson = JsonGroupAsBehavior.LIST
75    )
76    private List<Link> _links;
77  
78    @BoundAssembly(
79        formalName = "Assessment Part",
80        description = "A partition of an assessment plan or results or a child of another part.",
81        useName = "part",
82        minOccurs = 1
83    )
84    private AssessmentPart _part;
85  
86    @BoundField(
87        formalName = "Remarks",
88        description = "Additional commentary about the containing object.",
89        useName = "remarks"
90    )
91    @BoundFieldValue(
92        typeAdapter = MarkupMultilineAdapter.class
93    )
94    private MarkupMultiline _remarks;
95  
96    public AssessmentMethod() {
97    }
98  
99    public UUID getUuid() {
100     return _uuid;
101   }
102 
103   public void setUuid(UUID value) {
104     _uuid = value;
105   }
106 
107   public MarkupMultiline getDescription() {
108     return _description;
109   }
110 
111   public void setDescription(MarkupMultiline value) {
112     _description = value;
113   }
114 
115   public List<Property> getProps() {
116     return _props;
117   }
118 
119   public void setProps(List<Property> value) {
120     _props = value;
121   }
122 
123   /**
124    * Add a new {@link Property} item to the underlying collection.
125    * @param item the item to add
126    * @return {@code true}
127    */
128   public boolean addProp(Property item) {
129     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
130     if (_props == null) {
131       _props = new LinkedList<>();
132     }
133     return _props.add(value);
134   }
135 
136   /**
137    * Remove the first matching {@link Property} item from the underlying collection.
138    * @param item the item to remove
139    * @return {@code true} if the item was removed or {@code false} otherwise
140    */
141   public boolean removeProp(Property item) {
142     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
143     return _props == null ? false : _props.remove(value);
144   }
145 
146   public List<Link> getLinks() {
147     return _links;
148   }
149 
150   public void setLinks(List<Link> value) {
151     _links = value;
152   }
153 
154   /**
155    * Add a new {@link Link} item to the underlying collection.
156    * @param item the item to add
157    * @return {@code true}
158    */
159   public boolean addLink(Link item) {
160     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
161     if (_links == null) {
162       _links = new LinkedList<>();
163     }
164     return _links.add(value);
165   }
166 
167   /**
168    * Remove the first matching {@link Link} item from the underlying collection.
169    * @param item the item to remove
170    * @return {@code true} if the item was removed or {@code false} otherwise
171    */
172   public boolean removeLink(Link item) {
173     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
174     return _links == null ? false : _links.remove(value);
175   }
176 
177   public AssessmentPart getPart() {
178     return _part;
179   }
180 
181   public void setPart(AssessmentPart value) {
182     _part = value;
183   }
184 
185   public MarkupMultiline getRemarks() {
186     return _remarks;
187   }
188 
189   public void setRemarks(MarkupMultiline value) {
190     _remarks = value;
191   }
192 
193   @Override
194   public String toString() {
195     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
196   }
197 }