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.BoundField;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
6 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
7 import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
8 import gov.nist.secauto.metaschema.binding.model.annotations.IndexHasKey;
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.binding.model.annotations.ValueConstraints;
12 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
13 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
14 import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
15 import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
16 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
17 import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
18 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
19 import java.lang.Override;
20 import java.lang.String;
21 import java.util.LinkedList;
22 import java.util.List;
23 import java.util.UUID;
24 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
25 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
26
27
28
29
30 @MetaschemaAssembly(
31 formalName = "Responsible Party",
32 description = "A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.",
33 name = "responsible-party",
34 metaschema = OscalMetadataMetaschema.class,
35 remarks = "A `responsible-party` requires one or more `party-uuid` references creating a strong relationship arc between the referenced `role-id` and the reference parties. This differs in semantics from `responsible-role` which doesn't require that a `party-uuid` is referenced.\n"
36 + "\n"
37 + "The scope of use of this object determines if the responsibility has been performed or will be performed in the future. The containing object will describe the intent."
38 )
39 @ValueConstraints(
40 indexHasKey = @IndexHasKey(level = IConstraint.Level.ERROR, indexName = "index-metadata-role-id", keyFields = @KeyField(target = "@role-id"))
41 )
42 public class ResponsibleParty {
43 @BoundFlag(
44 formalName = "Responsible Role",
45 description = "A reference to a `role` performed by a `party`.",
46 useName = "role-id",
47 required = true,
48 typeAdapter = TokenAdapter.class
49 )
50 private String _roleId;
51
52
53
54
55 @BoundField(
56 formalName = "Party Universally Unique Identifier Reference",
57 description = "Specifies one or more parties responsible for performing the associated `role`.",
58 useName = "party-uuid",
59 minOccurs = 1,
60 maxOccurs = -1
61 )
62 @BoundFieldValue(
63 typeAdapter = UuidAdapter.class
64 )
65 @ValueConstraints(
66 indexHasKey = @IndexHasKey(level = IConstraint.Level.ERROR, indexName = "index-metadata-party-uuid", keyFields = @KeyField)
67 )
68 @GroupAs(
69 name = "party-uuids",
70 inJson = JsonGroupAsBehavior.LIST
71 )
72 private List<UUID> _partyUuids;
73
74 @BoundAssembly(
75 formalName = "Property",
76 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
77 useName = "prop",
78 maxOccurs = -1
79 )
80 @GroupAs(
81 name = "props",
82 inJson = JsonGroupAsBehavior.LIST
83 )
84 private List<Property> _props;
85
86 @BoundAssembly(
87 formalName = "Link",
88 description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
89 useName = "link",
90 maxOccurs = -1
91 )
92 @GroupAs(
93 name = "links",
94 inJson = JsonGroupAsBehavior.LIST
95 )
96 private List<Link> _links;
97
98 @BoundField(
99 formalName = "Remarks",
100 description = "Additional commentary about the containing object.",
101 useName = "remarks"
102 )
103 @BoundFieldValue(
104 typeAdapter = MarkupMultilineAdapter.class
105 )
106 private MarkupMultiline _remarks;
107
108 public ResponsibleParty() {
109 }
110
111 public String getRoleId() {
112 return _roleId;
113 }
114
115 public void setRoleId(String value) {
116 _roleId = value;
117 }
118
119 public List<UUID> getPartyUuids() {
120 return _partyUuids;
121 }
122
123 public void setPartyUuids(List<UUID> value) {
124 _partyUuids = value;
125 }
126
127
128
129
130
131
132 public boolean addPartyUuid(UUID item) {
133 UUID value = ObjectUtils.requireNonNull(item,"item cannot be null");
134 if (_partyUuids == null) {
135 _partyUuids = new LinkedList<>();
136 }
137 return _partyUuids.add(value);
138 }
139
140
141
142
143
144
145 public boolean removePartyUuid(UUID item) {
146 UUID value = ObjectUtils.requireNonNull(item,"item cannot be null");
147 return _partyUuids == null ? false : _partyUuids.remove(value);
148 }
149
150 public List<Property> getProps() {
151 return _props;
152 }
153
154 public void setProps(List<Property> value) {
155 _props = value;
156 }
157
158
159
160
161
162
163 public boolean addProp(Property item) {
164 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
165 if (_props == null) {
166 _props = new LinkedList<>();
167 }
168 return _props.add(value);
169 }
170
171
172
173
174
175
176 public boolean removeProp(Property item) {
177 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
178 return _props == null ? false : _props.remove(value);
179 }
180
181 public List<Link> getLinks() {
182 return _links;
183 }
184
185 public void setLinks(List<Link> value) {
186 _links = value;
187 }
188
189
190
191
192
193
194 public boolean addLink(Link item) {
195 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
196 if (_links == null) {
197 _links = new LinkedList<>();
198 }
199 return _links.add(value);
200 }
201
202
203
204
205
206
207 public boolean removeLink(Link item) {
208 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
209 return _links == null ? false : _links.remove(value);
210 }
211
212 public MarkupMultiline getRemarks() {
213 return _remarks;
214 }
215
216 public void setRemarks(MarkupMultiline value) {
217 _remarks = value;
218 }
219
220 @Override
221 public String toString() {
222 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
223 }
224 }