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.BoundAssembly;
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.binding.model.annotations.ValueConstraints;
10 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
11 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
12 import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
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 org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
19 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20
21
22
23
24 @MetaschemaAssembly(
25 formalName = "Insert Controls",
26 description = "Specifies which controls to use in the containing context.",
27 name = "insert-controls",
28 metaschema = OscalProfileMetaschema.class,
29 remarks = "To be schema-valid, this element must contain either (but not both) a single `include-all` directive, or a sequence of `include-controls` directives.\n"
30 + "\n"
31 + "If this directive is not provided, then no controls are to be inserted; i.e., all controls are included explicitly."
32 )
33 public class InsertControls {
34 @BoundFlag(
35 formalName = "Order",
36 description = "A designation of how a selection of controls in a profile is to be ordered.",
37 useName = "order",
38 typeAdapter = TokenAdapter.class
39 )
40 @ValueConstraints(
41 allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "keep", description = ""), @AllowedValue(value = "ascending", description = ""), @AllowedValue(value = "descending", description = "")})
42 )
43 private String _order;
44
45 @BoundAssembly(
46 formalName = "Include All",
47 description = "Include all controls from the imported catalog or profile resources.",
48 useName = "include-all",
49 minOccurs = 1
50 )
51 private IncludeAll _includeAll;
52
53 @BoundAssembly(
54 formalName = "Select Control",
55 description = "Select a control or controls from an imported control set.",
56 useName = "include-controls",
57 minOccurs = 1,
58 maxOccurs = -1
59 )
60 @GroupAs(
61 name = "include-controls",
62 inJson = JsonGroupAsBehavior.LIST
63 )
64 private List<ProfileSelectControlById> _includeControls;
65
66 @BoundAssembly(
67 formalName = "Select Control",
68 description = "Select a control or controls from an imported control set.",
69 useName = "exclude-controls",
70 maxOccurs = -1,
71 remarks = "Identifies which controls to exclude, or eliminate, from the set of matching includes."
72 )
73 @GroupAs(
74 name = "exclude-controls",
75 inJson = JsonGroupAsBehavior.LIST
76 )
77 private List<ProfileSelectControlById> _excludeControls;
78
79 public InsertControls() {
80 }
81
82 public String getOrder() {
83 return _order;
84 }
85
86 public void setOrder(String value) {
87 _order = value;
88 }
89
90 public IncludeAll getIncludeAll() {
91 return _includeAll;
92 }
93
94 public void setIncludeAll(IncludeAll value) {
95 _includeAll = value;
96 }
97
98 public List<ProfileSelectControlById> getIncludeControls() {
99 return _includeControls;
100 }
101
102 public void setIncludeControls(List<ProfileSelectControlById> value) {
103 _includeControls = value;
104 }
105
106
107
108
109
110
111 public boolean addIncludeControls(ProfileSelectControlById item) {
112 ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
113 if (_includeControls == null) {
114 _includeControls = new LinkedList<>();
115 }
116 return _includeControls.add(value);
117 }
118
119
120
121
122
123
124 public boolean removeIncludeControls(ProfileSelectControlById item) {
125 ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
126 return _includeControls == null ? false : _includeControls.remove(value);
127 }
128
129 public List<ProfileSelectControlById> getExcludeControls() {
130 return _excludeControls;
131 }
132
133 public void setExcludeControls(List<ProfileSelectControlById> value) {
134 _excludeControls = value;
135 }
136
137
138
139
140
141
142 public boolean addExcludeControls(ProfileSelectControlById item) {
143 ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
144 if (_excludeControls == null) {
145 _excludeControls = new LinkedList<>();
146 }
147 return _excludeControls.add(value);
148 }
149
150
151
152
153
154
155 public boolean removeExcludeControls(ProfileSelectControlById item) {
156 ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
157 return _excludeControls == null ? false : _excludeControls.remove(value);
158 }
159
160 @Override
161 public String toString() {
162 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
163 }
164 }