View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
4   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
5   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
6   import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
7   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
8   import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
9   import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
10  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
11  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
12  import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
13  import java.lang.Override;
14  import java.lang.String;
15  import java.util.LinkedList;
16  import java.util.List;
17  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
18  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
19  
20  /**
21   * Identifies the parameter that will be set by the enclosed value.
22   */
23  @MetaschemaAssembly(
24      formalName = "Set Parameter Value",
25      description = "Identifies the parameter that will be set by the enclosed value.",
26      name = "set-parameter",
27      metaschema = OscalImplementationCommonMetaschema.class
28  )
29  public class SetParameter {
30    @BoundFlag(
31        formalName = "Parameter ID",
32        description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) reference to a `parameter` within a control, who's catalog has been imported into the current implementation context.",
33        useName = "param-id",
34        required = true,
35        typeAdapter = TokenAdapter.class
36    )
37    private String _paramId;
38  
39    /**
40     * "A parameter value or set of values."
41     */
42    @BoundField(
43        formalName = "Parameter Value",
44        description = "A parameter value or set of values.",
45        useName = "value",
46        minOccurs = 1,
47        maxOccurs = -1
48    )
49    @GroupAs(
50        name = "values",
51        inJson = JsonGroupAsBehavior.LIST
52    )
53    private List<String> _values;
54  
55    @BoundField(
56        formalName = "Remarks",
57        description = "Additional commentary about the containing object.",
58        useName = "remarks"
59    )
60    @BoundFieldValue(
61        typeAdapter = MarkupMultilineAdapter.class
62    )
63    private MarkupMultiline _remarks;
64  
65    public SetParameter() {
66    }
67  
68    public String getParamId() {
69      return _paramId;
70    }
71  
72    public void setParamId(String value) {
73      _paramId = value;
74    }
75  
76    public List<String> getValues() {
77      return _values;
78    }
79  
80    public void setValues(List<String> value) {
81      _values = value;
82    }
83  
84    /**
85     * Add a new {@link String} item to the underlying collection.
86     * @param item the item to add
87     * @return {@code true}
88     */
89    public boolean addValue(String item) {
90      String value = ObjectUtils.requireNonNull(item,"item cannot be null");
91      if (_values == null) {
92        _values = new LinkedList<>();
93      }
94      return _values.add(value);
95    }
96  
97    /**
98     * Remove the first matching {@link String} item from the underlying collection.
99     * @param item the item to remove
100    * @return {@code true} if the item was removed or {@code false} otherwise
101    */
102   public boolean removeValue(String item) {
103     String value = ObjectUtils.requireNonNull(item,"item cannot be null");
104     return _values == null ? false : _values.remove(value);
105   }
106 
107   public MarkupMultiline getRemarks() {
108     return _remarks;
109   }
110 
111   public void setRemarks(MarkupMultiline value) {
112     _remarks = value;
113   }
114 
115   @Override
116   public String toString() {
117     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
118   }
119 }