001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_ssp_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.Index; 017import dev.metaschema.databind.model.annotations.IsUnique; 018import dev.metaschema.databind.model.annotations.KeyField; 019import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 020import edu.umd.cs.findbugs.annotations.NonNull; 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 * Describes how the system satisfies a set of controls. 028 */ 029@MetaschemaAssembly( 030 formalName = "Control Implementation", 031 description = "Describes how the system satisfies a set of controls.", 032 name = "control-implementation", 033 moduleClass = OscalSspModule.class, 034 remarks = "Use of `set-parameter` in this context, sets the parameter for all controls referenced by any `implemented-requirement` contained in this context. Any `set-parameter` defined in a child context will override this value. If not overridden by a child, this value applies in the child context.", 035 modelConstraints = @AssemblyConstraints(index = @Index(id = "oscal-by-component-export-provided-uuid-index", level = IConstraint.Level.ERROR, target = "implemented-requirement//by-component/export/provided", name = "by-component-export-provided-uuid", keyFields = @KeyField(target = "@uuid")), unique = @IsUnique(id = "oscal-unique-ssp-control-implementation-set-parameter", level = IConstraint.Level.ERROR, target = "set-parameter", keyFields = @KeyField(target = "@param-id"), remarks = "Since multiple `set-parameter` entries can be provided, each parameter must be set only once.")) 036) 037public class ControlImplementation implements IBoundObject { 038 private final IMetaschemaData __metaschemaData; 039 040 /** 041 * A statement describing important things to know about how this set of control satisfaction documentation is approached. 042 */ 043 @BoundField( 044 formalName = "Control Implementation Description", 045 description = "A statement describing important things to know about how this set of control satisfaction documentation is approached.", 046 useName = "description", 047 minOccurs = 1, 048 typeAdapter = MarkupMultilineAdapter.class 049 ) 050 private MarkupMultiline _description; 051 052 /** 053 * Identifies the parameter that will be set by the enclosed value. 054 */ 055 @BoundAssembly( 056 formalName = "Set Parameter Value", 057 description = "Identifies the parameter that will be set by the enclosed value.", 058 useName = "set-parameter", 059 maxOccurs = -1, 060 groupAs = @GroupAs(name = "set-parameters", inJson = JsonGroupAsBehavior.LIST) 061 ) 062 private List<SetParameter> _setParameters; 063 064 /** 065 * Describes how the system satisfies the requirements of an individual control. 066 */ 067 @BoundAssembly( 068 formalName = "Control-based Requirement", 069 description = "Describes how the system satisfies the requirements of an individual control.", 070 useName = "implemented-requirement", 071 minOccurs = 1, 072 maxOccurs = -1, 073 groupAs = @GroupAs(name = "implemented-requirements", inJson = JsonGroupAsBehavior.LIST) 074 ) 075 private List<ImplementedRequirement> _implementedRequirements; 076 077 /** 078 * Constructs a new {@code dev.metaschema.oscal.lib.model.ControlImplementation} instance with no metadata. 079 */ 080 public ControlImplementation() { 081 this(null); 082 } 083 084 /** 085 * Constructs a new {@code dev.metaschema.oscal.lib.model.ControlImplementation} instance with the specified metadata. 086 * 087 * @param data 088 * the metaschema data, or {@code null} if none 089 */ 090 public ControlImplementation(IMetaschemaData data) { 091 this.__metaschemaData = data; 092 } 093 094 @Override 095 public IMetaschemaData getMetaschemaData() { 096 return __metaschemaData; 097 } 098 099 /** 100 * Get the "{@literal Control Implementation Description}". 101 * 102 * <p> 103 * A statement describing important things to know about how this set of control satisfaction documentation is approached. 104 * 105 * @return the description value 106 */ 107 @NonNull 108 public MarkupMultiline getDescription() { 109 return _description; 110 } 111 112 /** 113 * Set the "{@literal Control Implementation Description}". 114 * 115 * <p> 116 * A statement describing important things to know about how this set of control satisfaction documentation is approached. 117 * 118 * @param value 119 * the description value to set 120 */ 121 public void setDescription(@NonNull MarkupMultiline value) { 122 _description = value; 123 } 124 125 /** 126 * Get the "{@literal Set Parameter Value}". 127 * 128 * <p> 129 * Identifies the parameter that will be set by the enclosed value. 130 * 131 * @return the set-parameter value 132 */ 133 @NonNull 134 public List<SetParameter> getSetParameters() { 135 if (_setParameters == null) { 136 _setParameters = new LinkedList<>(); 137 } 138 return ObjectUtils.notNull(_setParameters); 139 } 140 141 /** 142 * Set the "{@literal Set Parameter Value}". 143 * 144 * <p> 145 * Identifies the parameter that will be set by the enclosed value. 146 * 147 * @param value 148 * the set-parameter value to set 149 */ 150 public void setSetParameters(@NonNull List<SetParameter> value) { 151 _setParameters = value; 152 } 153 154 /** 155 * Add a new {@link SetParameter} item to the underlying collection. 156 * @param item the item to add 157 * @return {@code true} 158 */ 159 public boolean addSetParameter(SetParameter item) { 160 SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 161 if (_setParameters == null) { 162 _setParameters = new LinkedList<>(); 163 } 164 return _setParameters.add(value); 165 } 166 167 /** 168 * Remove the first matching {@link SetParameter} item from the underlying collection. 169 * @param item the item to remove 170 * @return {@code true} if the item was removed or {@code false} otherwise 171 */ 172 public boolean removeSetParameter(SetParameter item) { 173 SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null"); 174 return _setParameters != null && _setParameters.remove(value); 175 } 176 177 /** 178 * Get the "{@literal Control-based Requirement}". 179 * 180 * <p> 181 * Describes how the system satisfies the requirements of an individual control. 182 * 183 * @return the implemented-requirement value 184 */ 185 @NonNull 186 public List<ImplementedRequirement> getImplementedRequirements() { 187 if (_implementedRequirements == null) { 188 _implementedRequirements = new LinkedList<>(); 189 } 190 return ObjectUtils.notNull(_implementedRequirements); 191 } 192 193 /** 194 * Set the "{@literal Control-based Requirement}". 195 * 196 * <p> 197 * Describes how the system satisfies the requirements of an individual control. 198 * 199 * @param value 200 * the implemented-requirement value to set 201 */ 202 public void setImplementedRequirements(@NonNull List<ImplementedRequirement> value) { 203 _implementedRequirements = value; 204 } 205 206 /** 207 * Add a new {@link ImplementedRequirement} item to the underlying collection. 208 * @param item the item to add 209 * @return {@code true} 210 */ 211 public boolean addImplementedRequirement(ImplementedRequirement item) { 212 ImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null"); 213 if (_implementedRequirements == null) { 214 _implementedRequirements = new LinkedList<>(); 215 } 216 return _implementedRequirements.add(value); 217 } 218 219 /** 220 * Remove the first matching {@link ImplementedRequirement} item from the underlying collection. 221 * @param item the item to remove 222 * @return {@code true} if the item was removed or {@code false} otherwise 223 */ 224 public boolean removeImplementedRequirement(ImplementedRequirement item) { 225 ImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null"); 226 return _implementedRequirements != null && _implementedRequirements.remove(value); 227 } 228 229 @Override 230 public String toString() { 231 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 232 } 233}