1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.AssemblyConstraints;
4 import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
6 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
7 import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
8 import gov.nist.secauto.metaschema.binding.model.annotations.IsUnique;
9 import gov.nist.secauto.metaschema.binding.model.annotations.KeyField;
10 import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
11 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
12 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
13 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
14 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
15 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
16 import java.lang.Override;
17 import java.lang.String;
18 import java.util.LinkedList;
19 import java.util.List;
20 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
21 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
22
23
24
25
26 @MetaschemaAssembly(
27 formalName = "Local Definitions",
28 description = "Allows components, and inventory-items to be defined within the POA\\&M for circumstances where no OSCAL-based SSP exists, or is not delivered with the POA\\&M.",
29 name = "local-definitions",
30 metaschema = OscalPoamMetaschema.class
31 )
32 @AssemblyConstraints(
33 isUnique = @IsUnique(id = "unique-poam-local-definitions-component", level = IConstraint.Level.ERROR, target = "component", keyFields = @KeyField(target = "@uuid"), remarks = "Since multiple `component` entries can be provided, each component must have a unique `uuid`.")
34 )
35 public class LocalDefinitions {
36 @BoundAssembly(
37 formalName = "Component",
38 description = "A defined component that can be part of an implemented system.",
39 useName = "component",
40 maxOccurs = -1,
41 remarks = "Used to add any components, not defined via the System Security Plan (AR-\\>AP-\\>SSP)"
42 )
43 @GroupAs(
44 name = "components",
45 inJson = JsonGroupAsBehavior.LIST
46 )
47 private List<SystemComponent> _components;
48
49 @BoundAssembly(
50 formalName = "Inventory Item",
51 description = "A single managed inventory item within the system.",
52 useName = "inventory-item",
53 maxOccurs = -1,
54 remarks = "Used to add any inventory-items, not defined via the System Security Plan (AR-\\>AP-\\>SSP)"
55 )
56 @GroupAs(
57 name = "inventory-items",
58 inJson = JsonGroupAsBehavior.LIST
59 )
60 private List<InventoryItem> _inventoryItems;
61
62 @BoundAssembly(
63 formalName = "Assessment Assets",
64 description = "Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.",
65 useName = "assessment-assets",
66 remarks = "Specifies components or assessment-platforms used in the assessment."
67 )
68 private AssessmentAssets _assessmentAssets;
69
70 @BoundField(
71 formalName = "Remarks",
72 description = "Additional commentary about the containing object.",
73 useName = "remarks"
74 )
75 @BoundFieldValue(
76 typeAdapter = MarkupMultilineAdapter.class
77 )
78 private MarkupMultiline _remarks;
79
80 public LocalDefinitions() {
81 }
82
83 public List<SystemComponent> getComponents() {
84 return _components;
85 }
86
87 public void setComponents(List<SystemComponent> value) {
88 _components = value;
89 }
90
91
92
93
94
95
96 public boolean addComponent(SystemComponent item) {
97 SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
98 if (_components == null) {
99 _components = new LinkedList<>();
100 }
101 return _components.add(value);
102 }
103
104
105
106
107
108
109 public boolean removeComponent(SystemComponent item) {
110 SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
111 return _components == null ? false : _components.remove(value);
112 }
113
114 public List<InventoryItem> getInventoryItems() {
115 return _inventoryItems;
116 }
117
118 public void setInventoryItems(List<InventoryItem> value) {
119 _inventoryItems = value;
120 }
121
122
123
124
125
126
127 public boolean addInventoryItem(InventoryItem item) {
128 InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
129 if (_inventoryItems == null) {
130 _inventoryItems = new LinkedList<>();
131 }
132 return _inventoryItems.add(value);
133 }
134
135
136
137
138
139
140 public boolean removeInventoryItem(InventoryItem item) {
141 InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
142 return _inventoryItems == null ? false : _inventoryItems.remove(value);
143 }
144
145 public AssessmentAssets getAssessmentAssets() {
146 return _assessmentAssets;
147 }
148
149 public void setAssessmentAssets(AssessmentAssets value) {
150 _assessmentAssets = value;
151 }
152
153 public MarkupMultiline getRemarks() {
154 return _remarks;
155 }
156
157 public void setRemarks(MarkupMultiline value) {
158 _remarks = value;
159 }
160
161 @Override
162 public String toString() {
163 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
164 }
165 }