1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
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.MetaschemaAssembly;
9 import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
10 import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
11 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
12 import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
13 import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
14 import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
15 import java.lang.Override;
16 import java.lang.String;
17 import java.util.LinkedList;
18 import java.util.List;
19 import java.util.UUID;
20 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
21 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
22
23
24
25
26 @MetaschemaAssembly(
27 formalName = "Originating Actor",
28 description = "The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.",
29 name = "origin-actor",
30 metaschema = OscalAssessmentCommonMetaschema.class
31 )
32 public class OriginActor {
33 @BoundFlag(
34 formalName = "Actor Type",
35 description = "The kind of actor.",
36 useName = "type",
37 required = true,
38 typeAdapter = TokenAdapter.class
39 )
40 @ValueConstraints(
41 allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "tool", description = "A reference to a tool component defined with the assessment assets."), @AllowedValue(value = "assessment-platform", description = "A reference to an assessment-platform defined with the assessment assets."), @AllowedValue(value = "party", description = "A reference to a party defined within the document metadata.")})
42 )
43 private String _type;
44
45 @BoundFlag(
46 formalName = "Actor Universally Unique Identifier Reference",
47 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to the tool or person based on the associated type.",
48 useName = "actor-uuid",
49 required = true,
50 typeAdapter = UuidAdapter.class
51 )
52 private UUID _actorUuid;
53
54 @BoundFlag(
55 formalName = "Actor Role",
56 description = "For a party, this can optionally be used to specify the role the actor was performing.",
57 useName = "role-id",
58 typeAdapter = TokenAdapter.class
59 )
60 private String _roleId;
61
62 @BoundAssembly(
63 formalName = "Property",
64 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
65 useName = "prop",
66 maxOccurs = -1
67 )
68 @GroupAs(
69 name = "props",
70 inJson = JsonGroupAsBehavior.LIST
71 )
72 private List<Property> _props;
73
74 @BoundAssembly(
75 formalName = "Link",
76 description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
77 useName = "link",
78 maxOccurs = -1
79 )
80 @GroupAs(
81 name = "links",
82 inJson = JsonGroupAsBehavior.LIST
83 )
84 private List<Link> _links;
85
86 public OriginActor() {
87 }
88
89 public String getType() {
90 return _type;
91 }
92
93 public void setType(String value) {
94 _type = value;
95 }
96
97 public UUID getActorUuid() {
98 return _actorUuid;
99 }
100
101 public void setActorUuid(UUID value) {
102 _actorUuid = value;
103 }
104
105 public String getRoleId() {
106 return _roleId;
107 }
108
109 public void setRoleId(String value) {
110 _roleId = value;
111 }
112
113 public List<Property> getProps() {
114 return _props;
115 }
116
117 public void setProps(List<Property> value) {
118 _props = value;
119 }
120
121
122
123
124
125
126 public boolean addProp(Property item) {
127 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
128 if (_props == null) {
129 _props = new LinkedList<>();
130 }
131 return _props.add(value);
132 }
133
134
135
136
137
138
139 public boolean removeProp(Property item) {
140 Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
141 return _props == null ? false : _props.remove(value);
142 }
143
144 public List<Link> getLinks() {
145 return _links;
146 }
147
148 public void setLinks(List<Link> value) {
149 _links = value;
150 }
151
152
153
154
155
156
157 public boolean addLink(Link item) {
158 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
159 if (_links == null) {
160 _links = new LinkedList<>();
161 }
162 return _links.add(value);
163 }
164
165
166
167
168
169
170 public boolean removeLink(Link item) {
171 Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
172 return _links == null ? false : _links.remove(value);
173 }
174
175 @Override
176 public String toString() {
177 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
178 }
179 }