001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_metadata_metaschema.xml 002// Do not edit - changes will be lost when regenerated. 003package dev.metaschema.oscal.lib.model; 004 005import dev.metaschema.core.datatype.adapter.TokenAdapter; 006import dev.metaschema.core.datatype.adapter.UuidAdapter; 007import dev.metaschema.core.datatype.markup.MarkupMultiline; 008import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 009import dev.metaschema.core.model.IBoundObject; 010import dev.metaschema.core.model.IMetaschemaData; 011import dev.metaschema.core.model.JsonGroupAsBehavior; 012import dev.metaschema.core.model.constraint.IConstraint; 013import dev.metaschema.core.util.ObjectUtils; 014import dev.metaschema.databind.model.annotations.BoundAssembly; 015import dev.metaschema.databind.model.annotations.BoundField; 016import dev.metaschema.databind.model.annotations.BoundFlag; 017import dev.metaschema.databind.model.annotations.GroupAs; 018import dev.metaschema.databind.model.annotations.IndexHasKey; 019import dev.metaschema.databind.model.annotations.KeyField; 020import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 021import dev.metaschema.databind.model.annotations.ValueConstraints; 022import edu.umd.cs.findbugs.annotations.NonNull; 023import edu.umd.cs.findbugs.annotations.Nullable; 024import java.util.LinkedList; 025import java.util.List; 026import java.util.UUID; 027import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 028import org.apache.commons.lang3.builder.ToStringStyle; 029 030/** 031 * 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. 032 */ 033@MetaschemaAssembly( 034 formalName = "Responsible Party", 035 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.", 036 name = "responsible-party", 037 moduleClass = OscalMetadataModule.class, 038 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" 039 + "\n" 040 + "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.", 041 valueConstraints = @ValueConstraints(indexHasKey = @IndexHasKey(id = "oscal-metadata-responsible-party-index-metadata-role-id", level = IConstraint.Level.ERROR, indexName = "index-metadata-role-id", keyFields = @KeyField(target = "@role-id"))) 042) 043public class ResponsibleParty implements IBoundObject { 044 private final IMetaschemaData __metaschemaData; 045 046 /** 047 * A reference to a <code>role</code> performed by a <code>party</code>. 048 */ 049 @BoundFlag( 050 formalName = "Responsible Role", 051 description = "A reference to a `role` performed by a `party`.", 052 name = "role-id", 053 required = true, 054 typeAdapter = TokenAdapter.class 055 ) 056 private String _roleId; 057 058 /** 059 * Specifies one or more parties responsible for performing the associated <code>role</code>. 060 */ 061 @BoundField( 062 formalName = "Party Universally Unique Identifier Reference", 063 description = "Specifies one or more parties responsible for performing the associated `role`.", 064 useName = "party-uuid", 065 minOccurs = 1, 066 maxOccurs = -1, 067 groupAs = @GroupAs(name = "party-uuids", inJson = JsonGroupAsBehavior.LIST), 068 typeAdapter = UuidAdapter.class, 069 valueConstraints = @ValueConstraints(indexHasKey = @IndexHasKey(id = "oscal-index-metadata-party-uuid", level = IConstraint.Level.ERROR, indexName = "index-metadata-party-uuid", keyFields = @KeyField)) 070 ) 071 private List<UUID> _partyUuids; 072 073 /** 074 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 075 */ 076 @BoundAssembly( 077 formalName = "Property", 078 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 079 useName = "prop", 080 maxOccurs = -1, 081 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 082 ) 083 private List<Property> _props; 084 085 /** 086 * A reference to a local or remote resource, that has a specific relation to the containing object. 087 */ 088 @BoundAssembly( 089 formalName = "Link", 090 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 091 useName = "link", 092 maxOccurs = -1, 093 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 094 ) 095 private List<Link> _links; 096 097 /** 098 * Additional commentary about the containing object. 099 */ 100 @BoundField( 101 formalName = "Remarks", 102 description = "Additional commentary about the containing object.", 103 useName = "remarks", 104 typeAdapter = MarkupMultilineAdapter.class 105 ) 106 private MarkupMultiline _remarks; 107 108 /** 109 * Constructs a new {@code dev.metaschema.oscal.lib.model.ResponsibleParty} instance with no metadata. 110 */ 111 public ResponsibleParty() { 112 this(null); 113 } 114 115 /** 116 * Constructs a new {@code dev.metaschema.oscal.lib.model.ResponsibleParty} instance with the specified metadata. 117 * 118 * @param data 119 * the metaschema data, or {@code null} if none 120 */ 121 public ResponsibleParty(IMetaschemaData data) { 122 this.__metaschemaData = data; 123 } 124 125 @Override 126 public IMetaschemaData getMetaschemaData() { 127 return __metaschemaData; 128 } 129 130 /** 131 * Get the "{@literal Responsible Role}". 132 * 133 * <p> 134 * A reference to a <code>role</code> performed by a <code>party</code>. 135 * 136 * @return the role-id value 137 */ 138 @NonNull 139 public String getRoleId() { 140 return _roleId; 141 } 142 143 /** 144 * Set the "{@literal Responsible Role}". 145 * 146 * <p> 147 * A reference to a <code>role</code> performed by a <code>party</code>. 148 * 149 * @param value 150 * the role-id value to set 151 */ 152 public void setRoleId(@NonNull String value) { 153 _roleId = value; 154 } 155 156 /** 157 * Get the "{@literal Party Universally Unique Identifier Reference}". 158 * 159 * <p> 160 * Specifies one or more parties responsible for performing the associated <code>role</code>. 161 * 162 * @return the party-uuid value 163 */ 164 @NonNull 165 public List<UUID> getPartyUuids() { 166 if (_partyUuids == null) { 167 _partyUuids = new LinkedList<>(); 168 } 169 return ObjectUtils.notNull(_partyUuids); 170 } 171 172 /** 173 * Set the "{@literal Party Universally Unique Identifier Reference}". 174 * 175 * <p> 176 * Specifies one or more parties responsible for performing the associated <code>role</code>. 177 * 178 * @param value 179 * the party-uuid value to set 180 */ 181 public void setPartyUuids(@NonNull List<UUID> value) { 182 _partyUuids = value; 183 } 184 185 /** 186 * Add a new {@link UUID} item to the underlying collection. 187 * @param item the item to add 188 * @return {@code true} 189 */ 190 public boolean addPartyUuid(UUID item) { 191 UUID value = ObjectUtils.requireNonNull(item,"item cannot be null"); 192 if (_partyUuids == null) { 193 _partyUuids = new LinkedList<>(); 194 } 195 return _partyUuids.add(value); 196 } 197 198 /** 199 * Remove the first matching {@link UUID} item from the underlying collection. 200 * @param item the item to remove 201 * @return {@code true} if the item was removed or {@code false} otherwise 202 */ 203 public boolean removePartyUuid(UUID item) { 204 UUID value = ObjectUtils.requireNonNull(item,"item cannot be null"); 205 return _partyUuids != null && _partyUuids.remove(value); 206 } 207 208 /** 209 * Get the "{@literal Property}". 210 * 211 * <p> 212 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 213 * 214 * @return the prop value 215 */ 216 @NonNull 217 public List<Property> getProps() { 218 if (_props == null) { 219 _props = new LinkedList<>(); 220 } 221 return ObjectUtils.notNull(_props); 222 } 223 224 /** 225 * Set the "{@literal Property}". 226 * 227 * <p> 228 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 229 * 230 * @param value 231 * the prop value to set 232 */ 233 public void setProps(@NonNull List<Property> value) { 234 _props = value; 235 } 236 237 /** 238 * Add a new {@link Property} item to the underlying collection. 239 * @param item the item to add 240 * @return {@code true} 241 */ 242 public boolean addProp(Property item) { 243 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 244 if (_props == null) { 245 _props = new LinkedList<>(); 246 } 247 return _props.add(value); 248 } 249 250 /** 251 * Remove the first matching {@link Property} item from the underlying collection. 252 * @param item the item to remove 253 * @return {@code true} if the item was removed or {@code false} otherwise 254 */ 255 public boolean removeProp(Property item) { 256 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 257 return _props != null && _props.remove(value); 258 } 259 260 /** 261 * Get the "{@literal Link}". 262 * 263 * <p> 264 * A reference to a local or remote resource, that has a specific relation to the containing object. 265 * 266 * @return the link value 267 */ 268 @NonNull 269 public List<Link> getLinks() { 270 if (_links == null) { 271 _links = new LinkedList<>(); 272 } 273 return ObjectUtils.notNull(_links); 274 } 275 276 /** 277 * Set the "{@literal Link}". 278 * 279 * <p> 280 * A reference to a local or remote resource, that has a specific relation to the containing object. 281 * 282 * @param value 283 * the link value to set 284 */ 285 public void setLinks(@NonNull List<Link> value) { 286 _links = value; 287 } 288 289 /** 290 * Add a new {@link Link} item to the underlying collection. 291 * @param item the item to add 292 * @return {@code true} 293 */ 294 public boolean addLink(Link item) { 295 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 296 if (_links == null) { 297 _links = new LinkedList<>(); 298 } 299 return _links.add(value); 300 } 301 302 /** 303 * Remove the first matching {@link Link} item from the underlying collection. 304 * @param item the item to remove 305 * @return {@code true} if the item was removed or {@code false} otherwise 306 */ 307 public boolean removeLink(Link item) { 308 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 309 return _links != null && _links.remove(value); 310 } 311 312 /** 313 * Get the "{@literal Remarks}". 314 * 315 * <p> 316 * Additional commentary about the containing object. 317 * 318 * @return the remarks value, or {@code null} if not set 319 */ 320 @Nullable 321 public MarkupMultiline getRemarks() { 322 return _remarks; 323 } 324 325 /** 326 * Set the "{@literal Remarks}". 327 * 328 * <p> 329 * Additional commentary about the containing object. 330 * 331 * @param value 332 * the remarks value to set, or {@code null} to clear 333 */ 334 public void setRemarks(@Nullable MarkupMultiline value) { 335 _remarks = value; 336 } 337 338 @Override 339 public String toString() { 340 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 341 } 342}