View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5   import gov.nist.secauto.metaschema.binding.model.annotations.AssemblyConstraints;
6   import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
7   import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
8   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
9   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
10  import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
11  import gov.nist.secauto.metaschema.binding.model.annotations.HasCardinality;
12  import gov.nist.secauto.metaschema.binding.model.annotations.IsUnique;
13  import gov.nist.secauto.metaschema.binding.model.annotations.KeyField;
14  import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
15  import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
16  import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
17  import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
18  import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
19  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLine;
20  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
21  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
22  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
23  import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
24  import java.lang.Override;
25  import java.lang.String;
26  import java.util.LinkedList;
27  import java.util.List;
28  import java.util.UUID;
29  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
30  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
31  
32  /**
33   * Identifies an assessment or related process that can be performed. In the assessment plan, this is an intended activity which may be associated with an assessment task. In the assessment results, this an activity that was actually performed as part of an assessment.
34   */
35  @MetaschemaAssembly(
36      formalName = "Activity",
37      description = "Identifies an assessment or related process that can be performed. In the assessment plan, this is an intended activity which may be associated with an assessment task. In the assessment results, this an activity that was actually performed as part of an assessment.",
38      name = "activity",
39      metaschema = OscalAssessmentCommonMetaschema.class
40  )
41  @ValueConstraints(
42      allowedValues = {
43          @AllowedValues(level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = @AllowedValue(value = "method", description = "The assessment method to use. This typically appears on parts with the name \"assessment\".")),
44          @AllowedValues(level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='method']/@value", values = {@AllowedValue(value = "INTERVIEW", description = "The process of holding discussions with individuals or groups of individuals within an organization to once again, facilitate assessor understanding, achieve clarification, or obtain evidence."), @AllowedValue(value = "EXAMINE", description = "The process of reviewing, inspecting, observing, studying, or analyzing one or more assessment objects (i.e., specifications, mechanisms, or activities)."), @AllowedValue(value = "TEST", description = "The process of exercising one or more assessment objects (i.e., activities or mechanisms) under specified conditions to compare actual with expected behavior.")})
45      }
46  )
47  @AssemblyConstraints(
48      isUnique = @IsUnique(id = "unique-activity-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once."),
49      hasCardinality = @HasCardinality(level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='method']", minOccurs = 1)
50  )
51  public class Activity {
52    @BoundFlag(
53        formalName = "Assessment Activity Universally Unique Identifier",
54        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 activity elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `activity` 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.",
55        useName = "uuid",
56        required = true,
57        typeAdapter = UuidAdapter.class
58    )
59    private UUID _uuid;
60  
61    /**
62     * "The title for this included activity."
63     */
64    @BoundField(
65        formalName = "Included Activity Title",
66        description = "The title for this included activity.",
67        useName = "title"
68    )
69    @BoundFieldValue(
70        typeAdapter = MarkupLineAdapter.class
71    )
72    private MarkupLine _title;
73  
74    /**
75     * "A human-readable description of this included activity."
76     */
77    @BoundField(
78        formalName = "Included Activity Description",
79        description = "A human-readable description of this included activity.",
80        useName = "description",
81        minOccurs = 1
82    )
83    @BoundFieldValue(
84        typeAdapter = MarkupMultilineAdapter.class
85    )
86    private MarkupMultiline _description;
87  
88    @BoundAssembly(
89        formalName = "Property",
90        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
91        useName = "prop",
92        maxOccurs = -1
93    )
94    @GroupAs(
95        name = "props",
96        inJson = JsonGroupAsBehavior.LIST
97    )
98    private List<Property> _props;
99  
100   @BoundAssembly(
101       formalName = "Link",
102       description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
103       useName = "link",
104       maxOccurs = -1
105   )
106   @GroupAs(
107       name = "links",
108       inJson = JsonGroupAsBehavior.LIST
109   )
110   private List<Link> _links;
111 
112   /**
113    * "Identifies an individual step in a series of steps related to an activity, such as an assessment test or examination procedure."
114    */
115   @BoundAssembly(
116       formalName = "Step",
117       description = "Identifies an individual step in a series of steps related to an activity, such as an assessment test or examination procedure.",
118       useName = "step",
119       maxOccurs = -1
120   )
121   @GroupAs(
122       name = "steps",
123       inJson = JsonGroupAsBehavior.LIST
124   )
125   private List<Step> _steps;
126 
127   @BoundAssembly(
128       formalName = "Reviewed Controls and Control Objectives",
129       description = "Identifies the controls being assessed and their control objectives.",
130       useName = "related-controls",
131       remarks = "This can be optionally used to define the set of controls and control objectives that are assessed or remediated by this activity."
132   )
133   private ReviewedControls _relatedControls;
134 
135   @BoundAssembly(
136       formalName = "Responsible Role",
137       description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.",
138       useName = "responsible-role",
139       maxOccurs = -1,
140       remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once."
141   )
142   @GroupAs(
143       name = "responsible-roles",
144       inJson = JsonGroupAsBehavior.LIST
145   )
146   private List<ResponsibleRole> _responsibleRoles;
147 
148   @BoundField(
149       formalName = "Remarks",
150       description = "Additional commentary about the containing object.",
151       useName = "remarks"
152   )
153   @BoundFieldValue(
154       typeAdapter = MarkupMultilineAdapter.class
155   )
156   private MarkupMultiline _remarks;
157 
158   public Activity() {
159   }
160 
161   public UUID getUuid() {
162     return _uuid;
163   }
164 
165   public void setUuid(UUID value) {
166     _uuid = value;
167   }
168 
169   public MarkupLine getTitle() {
170     return _title;
171   }
172 
173   public void setTitle(MarkupLine value) {
174     _title = value;
175   }
176 
177   public MarkupMultiline getDescription() {
178     return _description;
179   }
180 
181   public void setDescription(MarkupMultiline value) {
182     _description = value;
183   }
184 
185   public List<Property> getProps() {
186     return _props;
187   }
188 
189   public void setProps(List<Property> value) {
190     _props = value;
191   }
192 
193   /**
194    * Add a new {@link Property} item to the underlying collection.
195    * @param item the item to add
196    * @return {@code true}
197    */
198   public boolean addProp(Property item) {
199     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
200     if (_props == null) {
201       _props = new LinkedList<>();
202     }
203     return _props.add(value);
204   }
205 
206   /**
207    * Remove the first matching {@link Property} 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 removeProp(Property item) {
212     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
213     return _props == null ? false : _props.remove(value);
214   }
215 
216   public List<Link> getLinks() {
217     return _links;
218   }
219 
220   public void setLinks(List<Link> value) {
221     _links = value;
222   }
223 
224   /**
225    * Add a new {@link Link} item to the underlying collection.
226    * @param item the item to add
227    * @return {@code true}
228    */
229   public boolean addLink(Link item) {
230     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
231     if (_links == null) {
232       _links = new LinkedList<>();
233     }
234     return _links.add(value);
235   }
236 
237   /**
238    * Remove the first matching {@link Link} item from the underlying collection.
239    * @param item the item to remove
240    * @return {@code true} if the item was removed or {@code false} otherwise
241    */
242   public boolean removeLink(Link item) {
243     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
244     return _links == null ? false : _links.remove(value);
245   }
246 
247   public List<Step> getSteps() {
248     return _steps;
249   }
250 
251   public void setSteps(List<Step> value) {
252     _steps = value;
253   }
254 
255   /**
256    * Add a new {@link Step} item to the underlying collection.
257    * @param item the item to add
258    * @return {@code true}
259    */
260   public boolean addStep(Step item) {
261     Step value = ObjectUtils.requireNonNull(item,"item cannot be null");
262     if (_steps == null) {
263       _steps = new LinkedList<>();
264     }
265     return _steps.add(value);
266   }
267 
268   /**
269    * Remove the first matching {@link Step} item from the underlying collection.
270    * @param item the item to remove
271    * @return {@code true} if the item was removed or {@code false} otherwise
272    */
273   public boolean removeStep(Step item) {
274     Step value = ObjectUtils.requireNonNull(item,"item cannot be null");
275     return _steps == null ? false : _steps.remove(value);
276   }
277 
278   public ReviewedControls getRelatedControls() {
279     return _relatedControls;
280   }
281 
282   public void setRelatedControls(ReviewedControls value) {
283     _relatedControls = value;
284   }
285 
286   public List<ResponsibleRole> getResponsibleRoles() {
287     return _responsibleRoles;
288   }
289 
290   public void setResponsibleRoles(List<ResponsibleRole> value) {
291     _responsibleRoles = value;
292   }
293 
294   /**
295    * Add a new {@link ResponsibleRole} item to the underlying collection.
296    * @param item the item to add
297    * @return {@code true}
298    */
299   public boolean addResponsibleRole(ResponsibleRole item) {
300     ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
301     if (_responsibleRoles == null) {
302       _responsibleRoles = new LinkedList<>();
303     }
304     return _responsibleRoles.add(value);
305   }
306 
307   /**
308    * Remove the first matching {@link ResponsibleRole} item from the underlying collection.
309    * @param item the item to remove
310    * @return {@code true} if the item was removed or {@code false} otherwise
311    */
312   public boolean removeResponsibleRole(ResponsibleRole item) {
313     ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
314     return _responsibleRoles == null ? false : _responsibleRoles.remove(value);
315   }
316 
317   public MarkupMultiline getRemarks() {
318     return _remarks;
319   }
320 
321   public void setRemarks(MarkupMultiline value) {
322     _remarks = value;
323   }
324 
325   @Override
326   public String toString() {
327     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
328   }
329 
330   /**
331    * Identifies an individual step in a series of steps related to an activity, such as an assessment test or examination procedure.
332    */
333   @MetaschemaAssembly(
334       formalName = "Step",
335       description = "Identifies an individual step in a series of steps related to an activity, such as an assessment test or examination procedure.",
336       name = "step",
337       metaschema = OscalAssessmentCommonMetaschema.class
338   )
339   @AssemblyConstraints(
340       isUnique = @IsUnique(id = "unique-step-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since multiple `party-uuid` entries can be provided, each role-id must be referenced only once.")
341   )
342   public static class Step {
343     @BoundFlag(
344         formalName = "Step Universally Unique Identifier",
345         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 step elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `step` (in a series of steps) 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.",
346         useName = "uuid",
347         required = true,
348         typeAdapter = UuidAdapter.class
349     )
350     private UUID _uuid;
351 
352     /**
353      * "The title for this step."
354      */
355     @BoundField(
356         formalName = "Step Title",
357         description = "The title for this step.",
358         useName = "title"
359     )
360     @BoundFieldValue(
361         typeAdapter = MarkupLineAdapter.class
362     )
363     private MarkupLine _title;
364 
365     /**
366      * "A human-readable description of this step."
367      */
368     @BoundField(
369         formalName = "Step Description",
370         description = "A human-readable description of this step.",
371         useName = "description",
372         minOccurs = 1
373     )
374     @BoundFieldValue(
375         typeAdapter = MarkupMultilineAdapter.class
376     )
377     private MarkupMultiline _description;
378 
379     @BoundAssembly(
380         formalName = "Property",
381         description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
382         useName = "prop",
383         maxOccurs = -1
384     )
385     @GroupAs(
386         name = "props",
387         inJson = JsonGroupAsBehavior.LIST
388     )
389     private List<Property> _props;
390 
391     @BoundAssembly(
392         formalName = "Link",
393         description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
394         useName = "link",
395         maxOccurs = -1
396     )
397     @GroupAs(
398         name = "links",
399         inJson = JsonGroupAsBehavior.LIST
400     )
401     private List<Link> _links;
402 
403     @BoundAssembly(
404         formalName = "Reviewed Controls and Control Objectives",
405         description = "Identifies the controls being assessed and their control objectives.",
406         useName = "reviewed-controls",
407         remarks = "This can be optionally used to define the set of controls and control objectives that are assessed by this step."
408     )
409     private ReviewedControls _reviewedControls;
410 
411     @BoundAssembly(
412         formalName = "Responsible Role",
413         description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.",
414         useName = "responsible-role",
415         maxOccurs = -1,
416         remarks = "Identifies the roles, and optionally the parties, associated with this step that is part of an assessment activity."
417     )
418     @GroupAs(
419         name = "responsible-roles",
420         inJson = JsonGroupAsBehavior.LIST
421     )
422     private List<ResponsibleRole> _responsibleRoles;
423 
424     @BoundField(
425         formalName = "Remarks",
426         description = "Additional commentary about the containing object.",
427         useName = "remarks"
428     )
429     @BoundFieldValue(
430         typeAdapter = MarkupMultilineAdapter.class
431     )
432     private MarkupMultiline _remarks;
433 
434     public Step() {
435     }
436 
437     public UUID getUuid() {
438       return _uuid;
439     }
440 
441     public void setUuid(UUID value) {
442       _uuid = value;
443     }
444 
445     public MarkupLine getTitle() {
446       return _title;
447     }
448 
449     public void setTitle(MarkupLine value) {
450       _title = value;
451     }
452 
453     public MarkupMultiline getDescription() {
454       return _description;
455     }
456 
457     public void setDescription(MarkupMultiline value) {
458       _description = value;
459     }
460 
461     public List<Property> getProps() {
462       return _props;
463     }
464 
465     public void setProps(List<Property> value) {
466       _props = value;
467     }
468 
469     /**
470      * Add a new {@link Property} item to the underlying collection.
471      * @param item the item to add
472      * @return {@code true}
473      */
474     public boolean addProp(Property item) {
475       Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
476       if (_props == null) {
477         _props = new LinkedList<>();
478       }
479       return _props.add(value);
480     }
481 
482     /**
483      * Remove the first matching {@link Property} item from the underlying collection.
484      * @param item the item to remove
485      * @return {@code true} if the item was removed or {@code false} otherwise
486      */
487     public boolean removeProp(Property item) {
488       Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
489       return _props == null ? false : _props.remove(value);
490     }
491 
492     public List<Link> getLinks() {
493       return _links;
494     }
495 
496     public void setLinks(List<Link> value) {
497       _links = value;
498     }
499 
500     /**
501      * Add a new {@link Link} item to the underlying collection.
502      * @param item the item to add
503      * @return {@code true}
504      */
505     public boolean addLink(Link item) {
506       Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
507       if (_links == null) {
508         _links = new LinkedList<>();
509       }
510       return _links.add(value);
511     }
512 
513     /**
514      * Remove the first matching {@link Link} item from the underlying collection.
515      * @param item the item to remove
516      * @return {@code true} if the item was removed or {@code false} otherwise
517      */
518     public boolean removeLink(Link item) {
519       Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
520       return _links == null ? false : _links.remove(value);
521     }
522 
523     public ReviewedControls getReviewedControls() {
524       return _reviewedControls;
525     }
526 
527     public void setReviewedControls(ReviewedControls value) {
528       _reviewedControls = value;
529     }
530 
531     public List<ResponsibleRole> getResponsibleRoles() {
532       return _responsibleRoles;
533     }
534 
535     public void setResponsibleRoles(List<ResponsibleRole> value) {
536       _responsibleRoles = value;
537     }
538 
539     /**
540      * Add a new {@link ResponsibleRole} item to the underlying collection.
541      * @param item the item to add
542      * @return {@code true}
543      */
544     public boolean addResponsibleRole(ResponsibleRole item) {
545       ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
546       if (_responsibleRoles == null) {
547         _responsibleRoles = new LinkedList<>();
548       }
549       return _responsibleRoles.add(value);
550     }
551 
552     /**
553      * Remove the first matching {@link ResponsibleRole} item from the underlying collection.
554      * @param item the item to remove
555      * @return {@code true} if the item was removed or {@code false} otherwise
556      */
557     public boolean removeResponsibleRole(ResponsibleRole item) {
558       ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
559       return _responsibleRoles == null ? false : _responsibleRoles.remove(value);
560     }
561 
562     public MarkupMultiline getRemarks() {
563       return _remarks;
564     }
565 
566     public void setRemarks(MarkupMultiline value) {
567       _remarks = value;
568     }
569 
570     @Override
571     public String toString() {
572       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
573     }
574   }
575 }