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   * Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.
24   */
25  @MetaschemaAssembly(
26      formalName = "Assessment Subject Placeholder",
27      description = "Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.",
28      name = "assessment-subject-placeholder",
29      metaschema = OscalAssessmentCommonMetaschema.class
30  )
31  public class AssessmentSubjectPlaceholder {
32    @BoundFlag(
33        formalName = "Assessment Subject Placeholder 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 for a set of assessment subjects that will be identified by a task or an activity that is part of a task. The locally defined *UUID* of the `assessment subject placeholder` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). 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 intent of this assessment subject placeholder."
43     */
44    @BoundField(
45        formalName = "Assessment Subject Placeholder Description",
46        description = "A human-readable description of intent of this assessment subject placeholder.",
47        useName = "description"
48    )
49    @BoundFieldValue(
50        typeAdapter = MarkupMultilineAdapter.class
51    )
52    private MarkupMultiline _description;
53  
54    /**
55     * "Assessment subjects will be identified while conducting the referenced activity-instance."
56     */
57    @BoundAssembly(
58        formalName = "Assessment Subject Source",
59        description = "Assessment subjects will be identified while conducting the referenced activity-instance.",
60        useName = "source",
61        minOccurs = 1,
62        maxOccurs = -1
63    )
64    @GroupAs(
65        name = "sources",
66        inJson = JsonGroupAsBehavior.LIST
67    )
68    private List<Source> _sources;
69  
70    @BoundAssembly(
71        formalName = "Property",
72        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
73        useName = "prop",
74        maxOccurs = -1
75    )
76    @GroupAs(
77        name = "props",
78        inJson = JsonGroupAsBehavior.LIST
79    )
80    private List<Property> _props;
81  
82    @BoundAssembly(
83        formalName = "Link",
84        description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
85        useName = "link",
86        maxOccurs = -1
87    )
88    @GroupAs(
89        name = "links",
90        inJson = JsonGroupAsBehavior.LIST
91    )
92    private List<Link> _links;
93  
94    @BoundField(
95        formalName = "Remarks",
96        description = "Additional commentary about the containing object.",
97        useName = "remarks"
98    )
99    @BoundFieldValue(
100       typeAdapter = MarkupMultilineAdapter.class
101   )
102   private MarkupMultiline _remarks;
103 
104   public AssessmentSubjectPlaceholder() {
105   }
106 
107   public UUID getUuid() {
108     return _uuid;
109   }
110 
111   public void setUuid(UUID value) {
112     _uuid = value;
113   }
114 
115   public MarkupMultiline getDescription() {
116     return _description;
117   }
118 
119   public void setDescription(MarkupMultiline value) {
120     _description = value;
121   }
122 
123   public List<Source> getSources() {
124     return _sources;
125   }
126 
127   public void setSources(List<Source> value) {
128     _sources = value;
129   }
130 
131   /**
132    * Add a new {@link Source} item to the underlying collection.
133    * @param item the item to add
134    * @return {@code true}
135    */
136   public boolean addSource(Source item) {
137     Source value = ObjectUtils.requireNonNull(item,"item cannot be null");
138     if (_sources == null) {
139       _sources = new LinkedList<>();
140     }
141     return _sources.add(value);
142   }
143 
144   /**
145    * Remove the first matching {@link Source} item from the underlying collection.
146    * @param item the item to remove
147    * @return {@code true} if the item was removed or {@code false} otherwise
148    */
149   public boolean removeSource(Source item) {
150     Source value = ObjectUtils.requireNonNull(item,"item cannot be null");
151     return _sources == null ? false : _sources.remove(value);
152   }
153 
154   public List<Property> getProps() {
155     return _props;
156   }
157 
158   public void setProps(List<Property> value) {
159     _props = value;
160   }
161 
162   /**
163    * Add a new {@link Property} item to the underlying collection.
164    * @param item the item to add
165    * @return {@code true}
166    */
167   public boolean addProp(Property item) {
168     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
169     if (_props == null) {
170       _props = new LinkedList<>();
171     }
172     return _props.add(value);
173   }
174 
175   /**
176    * Remove the first matching {@link Property} item from the underlying collection.
177    * @param item the item to remove
178    * @return {@code true} if the item was removed or {@code false} otherwise
179    */
180   public boolean removeProp(Property item) {
181     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
182     return _props == null ? false : _props.remove(value);
183   }
184 
185   public List<Link> getLinks() {
186     return _links;
187   }
188 
189   public void setLinks(List<Link> value) {
190     _links = value;
191   }
192 
193   /**
194    * Add a new {@link Link} item to the underlying collection.
195    * @param item the item to add
196    * @return {@code true}
197    */
198   public boolean addLink(Link item) {
199     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
200     if (_links == null) {
201       _links = new LinkedList<>();
202     }
203     return _links.add(value);
204   }
205 
206   /**
207    * Remove the first matching {@link Link} item from the underlying collection.
208    * @param item the item to remove
209    * @return {@code true} if the item was removed or {@code false} otherwise
210    */
211   public boolean removeLink(Link item) {
212     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
213     return _links == null ? false : _links.remove(value);
214   }
215 
216   public MarkupMultiline getRemarks() {
217     return _remarks;
218   }
219 
220   public void setRemarks(MarkupMultiline value) {
221     _remarks = value;
222   }
223 
224   @Override
225   public String toString() {
226     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
227   }
228 
229   /**
230    * Assessment subjects will be identified while conducting the referenced activity-instance.
231    */
232   @MetaschemaAssembly(
233       formalName = "Assessment Subject Source",
234       description = "Assessment subjects will be identified while conducting the referenced activity-instance.",
235       name = "source",
236       metaschema = OscalAssessmentCommonMetaschema.class
237   )
238   public static class Source {
239     @BoundFlag(
240         formalName = "Task Universally Unique Identifier",
241         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 (in this or other OSCAL instances) an assessment activity to be performed as part of the event. The locally defined *UUID* of the `task` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). This UUID should be assigned *per-subject*, which means it should be consistently used to identify the same subject across revisions of the document.",
242         useName = "task-uuid",
243         required = true,
244         typeAdapter = UuidAdapter.class
245     )
246     private UUID _taskUuid;
247 
248     public Source() {
249     }
250 
251     public UUID getTaskUuid() {
252       return _taskUuid;
253     }
254 
255     public void setTaskUuid(UUID value) {
256       _taskUuid = value;
257     }
258 
259     @Override
260     public String toString() {
261       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
262     }
263   }
264 }