View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.AssemblyConstraints;
4   import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
5   import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
6   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
7   import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
8   import gov.nist.secauto.metaschema.binding.model.annotations.IsUnique;
9   import gov.nist.secauto.metaschema.binding.model.annotations.KeyField;
10  import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
11  import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
12  import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
13  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
14  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
15  import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
16  import java.lang.Override;
17  import java.lang.String;
18  import java.util.LinkedList;
19  import java.util.List;
20  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
21  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
22  
23  /**
24   * A description of this system's authorization boundary, optionally supplemented by diagrams that illustrate the authorization boundary.
25   */
26  @MetaschemaAssembly(
27      formalName = "Authorization Boundary",
28      description = "A description of this system's authorization boundary, optionally supplemented by diagrams that illustrate the authorization boundary.",
29      name = "authorization-boundary",
30      metaschema = OscalSspMetaschema.class
31  )
32  @AssemblyConstraints(
33      isUnique = @IsUnique(id = "unique-ssp-authorization-boundary-diagram", level = IConstraint.Level.ERROR, target = "diagram", keyFields = @KeyField(target = "@uuid"), remarks = "A given `uuid` must be assigned only once to a diagram.")
34  )
35  public class AuthorizationBoundary {
36    /**
37     * "A summary of the system's authorization boundary."
38     */
39    @BoundField(
40        formalName = "Authorization Boundary Description",
41        description = "A summary of the system's authorization boundary.",
42        useName = "description",
43        minOccurs = 1
44    )
45    @BoundFieldValue(
46        typeAdapter = MarkupMultilineAdapter.class
47    )
48    private MarkupMultiline _description;
49  
50    @BoundAssembly(
51        formalName = "Property",
52        description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
53        useName = "prop",
54        maxOccurs = -1
55    )
56    @GroupAs(
57        name = "props",
58        inJson = JsonGroupAsBehavior.LIST
59    )
60    private List<Property> _props;
61  
62    @BoundAssembly(
63        formalName = "Link",
64        description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
65        useName = "link",
66        maxOccurs = -1
67    )
68    @GroupAs(
69        name = "links",
70        inJson = JsonGroupAsBehavior.LIST
71    )
72    private List<Link> _links;
73  
74    @BoundAssembly(
75        formalName = "Diagram",
76        description = "A graphic that provides a visual representation the system, or some aspect of it.",
77        useName = "diagram",
78        maxOccurs = -1,
79        remarks = "A visual depiction of the system's authorization boundary."
80    )
81    @GroupAs(
82        name = "diagrams",
83        inJson = JsonGroupAsBehavior.LIST
84    )
85    private List<Diagram> _diagrams;
86  
87    @BoundField(
88        formalName = "Remarks",
89        description = "Additional commentary about the containing object.",
90        useName = "remarks"
91    )
92    @BoundFieldValue(
93        typeAdapter = MarkupMultilineAdapter.class
94    )
95    private MarkupMultiline _remarks;
96  
97    public AuthorizationBoundary() {
98    }
99  
100   public MarkupMultiline getDescription() {
101     return _description;
102   }
103 
104   public void setDescription(MarkupMultiline value) {
105     _description = value;
106   }
107 
108   public List<Property> getProps() {
109     return _props;
110   }
111 
112   public void setProps(List<Property> value) {
113     _props = value;
114   }
115 
116   /**
117    * Add a new {@link Property} item to the underlying collection.
118    * @param item the item to add
119    * @return {@code true}
120    */
121   public boolean addProp(Property item) {
122     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
123     if (_props == null) {
124       _props = new LinkedList<>();
125     }
126     return _props.add(value);
127   }
128 
129   /**
130    * Remove the first matching {@link Property} item from the underlying collection.
131    * @param item the item to remove
132    * @return {@code true} if the item was removed or {@code false} otherwise
133    */
134   public boolean removeProp(Property item) {
135     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
136     return _props == null ? false : _props.remove(value);
137   }
138 
139   public List<Link> getLinks() {
140     return _links;
141   }
142 
143   public void setLinks(List<Link> value) {
144     _links = value;
145   }
146 
147   /**
148    * Add a new {@link Link} item to the underlying collection.
149    * @param item the item to add
150    * @return {@code true}
151    */
152   public boolean addLink(Link item) {
153     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
154     if (_links == null) {
155       _links = new LinkedList<>();
156     }
157     return _links.add(value);
158   }
159 
160   /**
161    * Remove the first matching {@link Link} item from the underlying collection.
162    * @param item the item to remove
163    * @return {@code true} if the item was removed or {@code false} otherwise
164    */
165   public boolean removeLink(Link item) {
166     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
167     return _links == null ? false : _links.remove(value);
168   }
169 
170   public List<Diagram> getDiagrams() {
171     return _diagrams;
172   }
173 
174   public void setDiagrams(List<Diagram> value) {
175     _diagrams = value;
176   }
177 
178   /**
179    * Add a new {@link Diagram} item to the underlying collection.
180    * @param item the item to add
181    * @return {@code true}
182    */
183   public boolean addDiagram(Diagram item) {
184     Diagram value = ObjectUtils.requireNonNull(item,"item cannot be null");
185     if (_diagrams == null) {
186       _diagrams = new LinkedList<>();
187     }
188     return _diagrams.add(value);
189   }
190 
191   /**
192    * Remove the first matching {@link Diagram} item from the underlying collection.
193    * @param item the item to remove
194    * @return {@code true} if the item was removed or {@code false} otherwise
195    */
196   public boolean removeDiagram(Diagram item) {
197     Diagram value = ObjectUtils.requireNonNull(item,"item cannot be null");
198     return _diagrams == null ? false : _diagrams.remove(value);
199   }
200 
201   public MarkupMultiline getRemarks() {
202     return _remarks;
203   }
204 
205   public void setRemarks(MarkupMultiline value) {
206     _remarks = value;
207   }
208 
209   @Override
210   public String toString() {
211     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
212   }
213 }