001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_poam_metaschema.xml
002// Do not edit - changes will be lost when regenerated.
003package dev.metaschema.oscal.lib.model;
004
005import dev.metaschema.core.datatype.markup.MarkupMultiline;
006import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
007import dev.metaschema.core.model.IBoundObject;
008import dev.metaschema.core.model.IMetaschemaData;
009import dev.metaschema.core.model.JsonGroupAsBehavior;
010import dev.metaschema.core.model.constraint.IConstraint;
011import dev.metaschema.core.util.ObjectUtils;
012import dev.metaschema.databind.model.annotations.AssemblyConstraints;
013import dev.metaschema.databind.model.annotations.BoundAssembly;
014import dev.metaschema.databind.model.annotations.BoundField;
015import dev.metaschema.databind.model.annotations.GroupAs;
016import dev.metaschema.databind.model.annotations.IsUnique;
017import dev.metaschema.databind.model.annotations.KeyField;
018import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
019import edu.umd.cs.findbugs.annotations.NonNull;
020import edu.umd.cs.findbugs.annotations.Nullable;
021import java.util.LinkedList;
022import java.util.List;
023import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
024import org.apache.commons.lang3.builder.ToStringStyle;
025
026/**
027 * 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.
028 */
029@MetaschemaAssembly(
030    formalName = "Local Definitions",
031    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.",
032    name = "local-definitions",
033    moduleClass = OscalPoamModule.class,
034    modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-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`."))
035)
036public class LocalDefinitions implements IBoundObject {
037  private final IMetaschemaData __metaschemaData;
038
039  /**
040   * A defined component that can be part of an implemented system.
041   */
042  @BoundAssembly(
043      formalName = "Component",
044      description = "A defined component that can be part of an implemented system.",
045      useName = "component",
046      remarks = "Used to add any components, not defined via the System Security Plan (AR-\\>AP-\\>SSP)",
047      maxOccurs = -1,
048      groupAs = @GroupAs(name = "components", inJson = JsonGroupAsBehavior.LIST)
049  )
050  private List<SystemComponent> _components;
051
052  /**
053   * A single managed inventory item within the system.
054   */
055  @BoundAssembly(
056      formalName = "Inventory Item",
057      description = "A single managed inventory item within the system.",
058      useName = "inventory-item",
059      remarks = "Used to add any inventory-items, not defined via the System Security Plan (AR-\\>AP-\\>SSP)",
060      maxOccurs = -1,
061      groupAs = @GroupAs(name = "inventory-items", inJson = JsonGroupAsBehavior.LIST)
062  )
063  private List<InventoryItem> _inventoryItems;
064
065  /**
066   * Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.
067   */
068  @BoundAssembly(
069      formalName = "Assessment Assets",
070      description = "Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.",
071      useName = "assessment-assets",
072      remarks = "Specifies components or assessment-platforms used in the assessment."
073  )
074  private AssessmentAssets _assessmentAssets;
075
076  /**
077   * Additional commentary about the containing object.
078   */
079  @BoundField(
080      formalName = "Remarks",
081      description = "Additional commentary about the containing object.",
082      useName = "remarks",
083      typeAdapter = MarkupMultilineAdapter.class
084  )
085  private MarkupMultiline _remarks;
086
087  /**
088   * Constructs a new {@code dev.metaschema.oscal.lib.model.LocalDefinitions} instance with no metadata.
089   */
090  public LocalDefinitions() {
091    this(null);
092  }
093
094  /**
095   * Constructs a new {@code dev.metaschema.oscal.lib.model.LocalDefinitions} instance with the specified metadata.
096   *
097   * @param data
098   *           the metaschema data, or {@code null} if none
099   */
100  public LocalDefinitions(IMetaschemaData data) {
101    this.__metaschemaData = data;
102  }
103
104  @Override
105  public IMetaschemaData getMetaschemaData() {
106    return __metaschemaData;
107  }
108
109  /**
110   * Get the "{@literal Component}".
111   *
112   * <p>
113   * A defined component that can be part of an implemented system.
114   *
115   * @return the component value
116   */
117  @NonNull
118  public List<SystemComponent> getComponents() {
119    if (_components == null) {
120      _components = new LinkedList<>();
121    }
122    return ObjectUtils.notNull(_components);
123  }
124
125  /**
126   * Set the "{@literal Component}".
127   *
128   * <p>
129   * A defined component that can be part of an implemented system.
130   *
131   * @param value
132   *           the component value to set
133   */
134  public void setComponents(@NonNull List<SystemComponent> value) {
135    _components = value;
136  }
137
138  /**
139   * Add a new {@link SystemComponent} item to the underlying collection.
140   * @param item the item to add
141   * @return {@code true}
142   */
143  public boolean addComponent(SystemComponent item) {
144    SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
145    if (_components == null) {
146      _components = new LinkedList<>();
147    }
148    return _components.add(value);
149  }
150
151  /**
152   * Remove the first matching {@link SystemComponent} item from the underlying collection.
153   * @param item the item to remove
154   * @return {@code true} if the item was removed or {@code false} otherwise
155   */
156  public boolean removeComponent(SystemComponent item) {
157    SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
158    return _components != null && _components.remove(value);
159  }
160
161  /**
162   * Get the "{@literal Inventory Item}".
163   *
164   * <p>
165   * A single managed inventory item within the system.
166   *
167   * @return the inventory-item value
168   */
169  @NonNull
170  public List<InventoryItem> getInventoryItems() {
171    if (_inventoryItems == null) {
172      _inventoryItems = new LinkedList<>();
173    }
174    return ObjectUtils.notNull(_inventoryItems);
175  }
176
177  /**
178   * Set the "{@literal Inventory Item}".
179   *
180   * <p>
181   * A single managed inventory item within the system.
182   *
183   * @param value
184   *           the inventory-item value to set
185   */
186  public void setInventoryItems(@NonNull List<InventoryItem> value) {
187    _inventoryItems = value;
188  }
189
190  /**
191   * Add a new {@link InventoryItem} item to the underlying collection.
192   * @param item the item to add
193   * @return {@code true}
194   */
195  public boolean addInventoryItem(InventoryItem item) {
196    InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
197    if (_inventoryItems == null) {
198      _inventoryItems = new LinkedList<>();
199    }
200    return _inventoryItems.add(value);
201  }
202
203  /**
204   * Remove the first matching {@link InventoryItem} item from the underlying collection.
205   * @param item the item to remove
206   * @return {@code true} if the item was removed or {@code false} otherwise
207   */
208  public boolean removeInventoryItem(InventoryItem item) {
209    InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
210    return _inventoryItems != null && _inventoryItems.remove(value);
211  }
212
213  /**
214   * Get the "{@literal Assessment Assets}".
215   *
216   * <p>
217   * Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.
218   *
219   * @return the assessment-assets value, or {@code null} if not set
220   */
221  @Nullable
222  public AssessmentAssets getAssessmentAssets() {
223    return _assessmentAssets;
224  }
225
226  /**
227   * Set the "{@literal Assessment Assets}".
228   *
229   * <p>
230   * Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.
231   *
232   * @param value
233   *           the assessment-assets value to set, or {@code null} to clear
234   */
235  public void setAssessmentAssets(@Nullable AssessmentAssets value) {
236    _assessmentAssets = value;
237  }
238
239  /**
240   * Get the "{@literal Remarks}".
241   *
242   * <p>
243   * Additional commentary about the containing object.
244   *
245   * @return the remarks value, or {@code null} if not set
246   */
247  @Nullable
248  public MarkupMultiline getRemarks() {
249    return _remarks;
250  }
251
252  /**
253   * Set the "{@literal Remarks}".
254   *
255   * <p>
256   * Additional commentary about the containing object.
257   *
258   * @param value
259   *           the remarks value to set, or {@code null} to clear
260   */
261  public void setRemarks(@Nullable MarkupMultiline value) {
262    _remarks = value;
263  }
264
265  @Override
266  public String toString() {
267    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
268  }
269}