View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
4   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
5   import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
6   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
7   import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
8   import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
9   import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
10  import java.lang.Override;
11  import java.lang.String;
12  import java.util.LinkedList;
13  import java.util.List;
14  import java.util.UUID;
15  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
16  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
17  
18  /**
19   * Each OSCAL profile is defined by a <code>profile</code> element.
20   */
21  @MetaschemaAssembly(
22      formalName = "Profile",
23      description = "Each OSCAL profile is defined by a `profile` element.",
24      name = "profile",
25      metaschema = OscalProfileMetaschema.class,
26      rootName = "profile",
27      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."
28  )
29  public class Profile extends AbstractOscalInstance {
30    @BoundFlag(
31        formalName = "Profile Universally Unique Identifier",
32        description = "Provides a globally unique means to identify a given profile instance.",
33        useName = "uuid",
34        required = true,
35        typeAdapter = UuidAdapter.class
36    )
37    private UUID _uuid;
38  
39    @BoundAssembly(
40        formalName = "Document Metadata",
41        description = "Provides information about the containing document, and defines concepts that are shared across the document.",
42        useName = "metadata",
43        minOccurs = 1
44    )
45    private Metadata _metadata;
46  
47    @BoundAssembly(
48        formalName = "Import Resource",
49        description = "Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline.",
50        useName = "import",
51        minOccurs = 1,
52        maxOccurs = -1
53    )
54    @GroupAs(
55        name = "imports",
56        inJson = JsonGroupAsBehavior.LIST
57    )
58    private List<ProfileImport> _imports;
59  
60    @BoundAssembly(
61        formalName = "Merge Controls",
62        description = "Provides structuring directives that instruct how controls are organized after profile resolution.",
63        useName = "merge"
64    )
65    private Merge _merge;
66  
67    @BoundAssembly(
68        formalName = "Modify Controls",
69        description = "Set parameters or amend controls in resolution.",
70        useName = "modify"
71    )
72    private Modify _modify;
73  
74    @BoundAssembly(
75        formalName = "Back matter",
76        description = "A collection of resources that may be referenced from within the OSCAL document instance.",
77        useName = "back-matter"
78    )
79    private BackMatter _backMatter;
80  
81    public Profile() {
82    }
83  
84    public UUID getUuid() {
85      return _uuid;
86    }
87  
88    public void setUuid(UUID value) {
89      _uuid = value;
90    }
91  
92    public Metadata getMetadata() {
93      return _metadata;
94    }
95  
96    public void setMetadata(Metadata value) {
97      _metadata = value;
98    }
99  
100   public List<ProfileImport> getImports() {
101     return _imports;
102   }
103 
104   public void setImports(List<ProfileImport> value) {
105     _imports = value;
106   }
107 
108   /**
109    * Add a new {@link ProfileImport} item to the underlying collection.
110    * @param item the item to add
111    * @return {@code true}
112    */
113   public boolean addImport(ProfileImport item) {
114     ProfileImport value = ObjectUtils.requireNonNull(item,"item cannot be null");
115     if (_imports == null) {
116       _imports = new LinkedList<>();
117     }
118     return _imports.add(value);
119   }
120 
121   /**
122    * Remove the first matching {@link ProfileImport} item from the underlying collection.
123    * @param item the item to remove
124    * @return {@code true} if the item was removed or {@code false} otherwise
125    */
126   public boolean removeImport(ProfileImport item) {
127     ProfileImport value = ObjectUtils.requireNonNull(item,"item cannot be null");
128     return _imports == null ? false : _imports.remove(value);
129   }
130 
131   public Merge getMerge() {
132     return _merge;
133   }
134 
135   public void setMerge(Merge value) {
136     _merge = value;
137   }
138 
139   public Modify getModify() {
140     return _modify;
141   }
142 
143   public void setModify(Modify value) {
144     _modify = value;
145   }
146 
147   public BackMatter getBackMatter() {
148     return _backMatter;
149   }
150 
151   public void setBackMatter(BackMatter value) {
152     _backMatter = value;
153   }
154 
155   @Override
156   public String toString() {
157     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
158   }
159 }