1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
4 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
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.markup.MarkupLine;
9 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
10 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
11 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
12 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
13 import java.lang.Override;
14 import java.lang.String;
15 import java.util.LinkedList;
16 import java.util.List;
17 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
18 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
19
20
21
22
23 @MetaschemaAssembly(
24 formalName = "Privilege",
25 description = "Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.",
26 name = "authorized-privilege",
27 metaschema = OscalImplementationCommonMetaschema.class
28 )
29 public class AuthorizedPrivilege {
30
31
32
33 @BoundField(
34 formalName = "Privilege Title",
35 description = "A human readable name for the privilege.",
36 useName = "title",
37 minOccurs = 1
38 )
39 @BoundFieldValue(
40 typeAdapter = MarkupLineAdapter.class
41 )
42 private MarkupLine _title;
43
44
45
46
47 @BoundField(
48 formalName = "Privilege Description",
49 description = "A summary of the privilege's purpose within the system.",
50 useName = "description"
51 )
52 @BoundFieldValue(
53 typeAdapter = MarkupMultilineAdapter.class
54 )
55 private MarkupMultiline _description;
56
57 @BoundField(
58 formalName = "Functions Performed",
59 description = "Describes a function performed for a given authorized privilege by this user class.",
60 useName = "function-performed",
61 minOccurs = 1,
62 maxOccurs = -1
63 )
64 @GroupAs(
65 name = "functions-performed",
66 inJson = JsonGroupAsBehavior.LIST
67 )
68 private List<String> _functionsPerformed;
69
70 public AuthorizedPrivilege() {
71 }
72
73 public MarkupLine getTitle() {
74 return _title;
75 }
76
77 public void setTitle(MarkupLine value) {
78 _title = value;
79 }
80
81 public MarkupMultiline getDescription() {
82 return _description;
83 }
84
85 public void setDescription(MarkupMultiline value) {
86 _description = value;
87 }
88
89 public List<String> getFunctionsPerformed() {
90 return _functionsPerformed;
91 }
92
93 public void setFunctionsPerformed(List<String> value) {
94 _functionsPerformed = value;
95 }
96
97
98
99
100
101
102 public boolean addFunctionPerformed(String item) {
103 String value = ObjectUtils.requireNonNull(item,"item cannot be null");
104 if (_functionsPerformed == null) {
105 _functionsPerformed = new LinkedList<>();
106 }
107 return _functionsPerformed.add(value);
108 }
109
110
111
112
113
114
115 public boolean removeFunctionPerformed(String item) {
116 String value = ObjectUtils.requireNonNull(item,"item cannot be null");
117 return _functionsPerformed == null ? false : _functionsPerformed.remove(value);
118 }
119
120 @Override
121 public String toString() {
122 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
123 }
124 }