001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_profile_metaschema.xml 002// Do not edit - changes will be lost when regenerated. 003package dev.metaschema.oscal.lib.model; 004 005import dev.metaschema.core.datatype.adapter.UuidAdapter; 006import dev.metaschema.core.model.IBoundObject; 007import dev.metaschema.core.model.IMetaschemaData; 008import dev.metaschema.core.model.JsonGroupAsBehavior; 009import dev.metaschema.core.model.constraint.IConstraint; 010import dev.metaschema.core.util.ObjectUtils; 011import dev.metaschema.databind.model.annotations.AssemblyConstraints; 012import dev.metaschema.databind.model.annotations.BoundAssembly; 013import dev.metaschema.databind.model.annotations.BoundFlag; 014import dev.metaschema.databind.model.annotations.GroupAs; 015import dev.metaschema.databind.model.annotations.IsUnique; 016import dev.metaschema.databind.model.annotations.KeyField; 017import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 018import edu.umd.cs.findbugs.annotations.NonNull; 019import edu.umd.cs.findbugs.annotations.Nullable; 020import java.util.LinkedList; 021import java.util.List; 022import java.util.UUID; 023import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 024import org.apache.commons.lang3.builder.ToStringStyle; 025 026/** 027 * Each OSCAL profile is defined by a <code>profile</code> element. 028 */ 029@MetaschemaAssembly( 030 formalName = "Profile", 031 description = "Each OSCAL profile is defined by a `profile` element.", 032 name = "profile", 033 moduleClass = OscalProfileModule.class, 034 rootName = "profile", 035 remarks = "An OSCAL document that describes a tailoring of controls from one or more catalogs, with possible modification of multiple controls. It provides mechanisms by which controls may be selected (`import`), merged or (re)structured (`merge`), and amended (`modify`). OSCAL profiles may select subsets of controls, set parameter values for them in application, and even adjust the representation of controls as given in and by a catalog. They may also serve as sources for further modification in and by other profiles, that import them.", 036 modelConstraints = @AssemblyConstraints(unique = {@IsUnique(id = "oscal-unique-document-id", formalName = "Unique Document Identifier", description = "Ensure all document identifiers have a unique combination of @scheme and value.", level = IConstraint.Level.ERROR, target = "document-id", keyFields = {@KeyField(target = "@scheme"), @KeyField}), @IsUnique(id = "oscal-unique-property-in-context-location", formalName = "Unique Properties", description = "Ensure all properties are unique for a given location using a unique combination of @ns, @name, @class. @group. and @value.", level = IConstraint.Level.ERROR, target = ".//prop", keyFields = {@KeyField(target = "path(..)"), @KeyField(target = "@name"), @KeyField(target = "@ns"), @KeyField(target = "@class"), @KeyField(target = "@group"), @KeyField(target = "@value")}), @IsUnique(id = "oscal-unique-link-in-context-location", formalName = "Unique Links", description = "Ensure all links are unique for a given location using a unique combination of @href, @rel, and @media-type.", level = IConstraint.Level.ERROR, target = ".//link", keyFields = {@KeyField(target = "path(..)"), @KeyField(target = "@href"), @KeyField(target = "@rel"), @KeyField(target = "@media-type"), @KeyField(target = "@resource-fragment")}), @IsUnique(id = "oscal-unique-responsibility-in-context-location", formalName = "Unique Responsibilities", description = "Ensure all responsible-roles and responsible-parties are unique for a given location using a unique combination of @role-id and the combination of @party-uuid values.", level = IConstraint.Level.ERROR, target = ".//(responsible-party|responsible-role)", keyFields = {@KeyField(target = "path(..)"), @KeyField(target = "@role-id"), @KeyField(target = "@party-uuid")}, remarks = "Since `responsible-party` and `responsible-role` associate multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once.")}) 037) 038public class Profile extends AbstractOscalInstance implements IBoundObject { 039 private final IMetaschemaData __metaschemaData; 040 041 /** 042 * Provides a globally unique means to identify a given profile instance. 043 */ 044 @BoundFlag( 045 formalName = "Profile Universally Unique Identifier", 046 description = "Provides a globally unique means to identify a given profile instance.", 047 name = "uuid", 048 required = true, 049 typeAdapter = UuidAdapter.class 050 ) 051 private UUID _uuid; 052 053 /** 054 * Provides information about the containing document, and defines concepts that are shared across the document. 055 */ 056 @BoundAssembly( 057 formalName = "Document Metadata", 058 description = "Provides information about the containing document, and defines concepts that are shared across the document.", 059 useName = "metadata", 060 minOccurs = 1 061 ) 062 private Metadata _metadata; 063 064 /** 065 * Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline. 066 */ 067 @BoundAssembly( 068 formalName = "Import Resource", 069 description = "Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline.", 070 useName = "import", 071 minOccurs = 1, 072 maxOccurs = -1, 073 groupAs = @GroupAs(name = "imports", inJson = JsonGroupAsBehavior.LIST) 074 ) 075 private List<ProfileImport> _imports; 076 077 /** 078 * Provides structuring directives that instruct how controls are organized after profile resolution. 079 */ 080 @BoundAssembly( 081 formalName = "Merge Controls", 082 description = "Provides structuring directives that instruct how controls are organized after profile resolution.", 083 useName = "merge" 084 ) 085 private Merge _merge; 086 087 /** 088 * Set parameters or amend controls in resolution. 089 */ 090 @BoundAssembly( 091 formalName = "Modify Controls", 092 description = "Set parameters or amend controls in resolution.", 093 useName = "modify" 094 ) 095 private Modify _modify; 096 097 /** 098 * A collection of resources that may be referenced from within the OSCAL document instance. 099 */ 100 @BoundAssembly( 101 formalName = "Back matter", 102 description = "A collection of resources that may be referenced from within the OSCAL document instance.", 103 useName = "back-matter" 104 ) 105 private BackMatter _backMatter; 106 107 /** 108 * Constructs a new {@code dev.metaschema.oscal.lib.model.Profile} instance with no metadata. 109 */ 110 public Profile() { 111 this(null); 112 } 113 114 /** 115 * Constructs a new {@code dev.metaschema.oscal.lib.model.Profile} instance with the specified metadata. 116 * 117 * @param data 118 * the metaschema data, or {@code null} if none 119 */ 120 public Profile(IMetaschemaData data) { 121 this.__metaschemaData = data; 122 } 123 124 @Override 125 public IMetaschemaData getMetaschemaData() { 126 return __metaschemaData; 127 } 128 129 /** 130 * Get the "{@literal Profile Universally Unique Identifier}". 131 * 132 * <p> 133 * Provides a globally unique means to identify a given profile instance. 134 * 135 * @return the uuid value 136 */ 137 @NonNull 138 public UUID getUuid() { 139 return _uuid; 140 } 141 142 /** 143 * Set the "{@literal Profile Universally Unique Identifier}". 144 * 145 * <p> 146 * Provides a globally unique means to identify a given profile instance. 147 * 148 * @param value 149 * the uuid value to set 150 */ 151 public void setUuid(@NonNull UUID value) { 152 _uuid = value; 153 } 154 155 /** 156 * Get the "{@literal Document Metadata}". 157 * 158 * <p> 159 * Provides information about the containing document, and defines concepts that are shared across the document. 160 * 161 * @return the metadata value 162 */ 163 @NonNull 164 public Metadata getMetadata() { 165 return _metadata; 166 } 167 168 /** 169 * Set the "{@literal Document Metadata}". 170 * 171 * <p> 172 * Provides information about the containing document, and defines concepts that are shared across the document. 173 * 174 * @param value 175 * the metadata value to set 176 */ 177 public void setMetadata(@NonNull Metadata value) { 178 _metadata = value; 179 } 180 181 /** 182 * Get the "{@literal Import Resource}". 183 * 184 * <p> 185 * Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline. 186 * 187 * @return the import value 188 */ 189 @NonNull 190 public List<ProfileImport> getImports() { 191 if (_imports == null) { 192 _imports = new LinkedList<>(); 193 } 194 return ObjectUtils.notNull(_imports); 195 } 196 197 /** 198 * Set the "{@literal Import Resource}". 199 * 200 * <p> 201 * Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline. 202 * 203 * @param value 204 * the import value to set 205 */ 206 public void setImports(@NonNull List<ProfileImport> value) { 207 _imports = value; 208 } 209 210 /** 211 * Add a new {@link ProfileImport} item to the underlying collection. 212 * @param item the item to add 213 * @return {@code true} 214 */ 215 public boolean addImport(ProfileImport item) { 216 ProfileImport value = ObjectUtils.requireNonNull(item,"item cannot be null"); 217 if (_imports == null) { 218 _imports = new LinkedList<>(); 219 } 220 return _imports.add(value); 221 } 222 223 /** 224 * Remove the first matching {@link ProfileImport} item from the underlying collection. 225 * @param item the item to remove 226 * @return {@code true} if the item was removed or {@code false} otherwise 227 */ 228 public boolean removeImport(ProfileImport item) { 229 ProfileImport value = ObjectUtils.requireNonNull(item,"item cannot be null"); 230 return _imports != null && _imports.remove(value); 231 } 232 233 /** 234 * Get the "{@literal Merge Controls}". 235 * 236 * <p> 237 * Provides structuring directives that instruct how controls are organized after profile resolution. 238 * 239 * @return the merge value, or {@code null} if not set 240 */ 241 @Nullable 242 public Merge getMerge() { 243 return _merge; 244 } 245 246 /** 247 * Set the "{@literal Merge Controls}". 248 * 249 * <p> 250 * Provides structuring directives that instruct how controls are organized after profile resolution. 251 * 252 * @param value 253 * the merge value to set, or {@code null} to clear 254 */ 255 public void setMerge(@Nullable Merge value) { 256 _merge = value; 257 } 258 259 /** 260 * Get the "{@literal Modify Controls}". 261 * 262 * <p> 263 * Set parameters or amend controls in resolution. 264 * 265 * @return the modify value, or {@code null} if not set 266 */ 267 @Nullable 268 public Modify getModify() { 269 return _modify; 270 } 271 272 /** 273 * Set the "{@literal Modify Controls}". 274 * 275 * <p> 276 * Set parameters or amend controls in resolution. 277 * 278 * @param value 279 * the modify value to set, or {@code null} to clear 280 */ 281 public void setModify(@Nullable Modify value) { 282 _modify = value; 283 } 284 285 /** 286 * Get the "{@literal Back matter}". 287 * 288 * <p> 289 * A collection of resources that may be referenced from within the OSCAL document instance. 290 * 291 * @return the back-matter value, or {@code null} if not set 292 */ 293 @Nullable 294 public BackMatter getBackMatter() { 295 return _backMatter; 296 } 297 298 /** 299 * Set the "{@literal Back matter}". 300 * 301 * <p> 302 * A collection of resources that may be referenced from within the OSCAL document instance. 303 * 304 * @param value 305 * the back-matter value to set, or {@code null} to clear 306 */ 307 public void setBackMatter(@Nullable BackMatter value) { 308 _backMatter = value; 309 } 310 311 @Override 312 public String toString() { 313 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 314 } 315}