001package gov.nist.secauto.oscal.lib.model; 002 003import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly; 004import gov.nist.secauto.metaschema.binding.model.annotations.BoundField; 005import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue; 006import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag; 007import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs; 008import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly; 009import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior; 010import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter; 011import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline; 012import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter; 013import gov.nist.secauto.metaschema.model.common.util.ObjectUtils; 014import java.lang.Override; 015import java.lang.String; 016import java.util.LinkedList; 017import java.util.List; 018import java.util.UUID; 019import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle; 020import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 021 022/** 023 * Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log. 024 */ 025@MetaschemaAssembly( 026 formalName = "Assessment Subject Placeholder", 027 description = "Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.", 028 name = "assessment-subject-placeholder", 029 metaschema = OscalAssessmentCommonMetaschema.class 030) 031public class AssessmentSubjectPlaceholder { 032 @BoundFlag( 033 formalName = "Assessment Subject Placeholder Universally Unique Identifier", 034 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier for a set of assessment subjects that will be identified by a task or an activity that is part of a task. The locally defined *UUID* of the `assessment subject placeholder` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.", 035 useName = "uuid", 036 required = true, 037 typeAdapter = UuidAdapter.class 038 ) 039 private UUID _uuid; 040 041 /** 042 * "A human-readable description of intent of this assessment subject placeholder." 043 */ 044 @BoundField( 045 formalName = "Assessment Subject Placeholder Description", 046 description = "A human-readable description of intent of this assessment subject placeholder.", 047 useName = "description" 048 ) 049 @BoundFieldValue( 050 typeAdapter = MarkupMultilineAdapter.class 051 ) 052 private MarkupMultiline _description; 053 054 /** 055 * "Assessment subjects will be identified while conducting the referenced activity-instance." 056 */ 057 @BoundAssembly( 058 formalName = "Assessment Subject Source", 059 description = "Assessment subjects will be identified while conducting the referenced activity-instance.", 060 useName = "source", 061 minOccurs = 1, 062 maxOccurs = -1 063 ) 064 @GroupAs( 065 name = "sources", 066 inJson = JsonGroupAsBehavior.LIST 067 ) 068 private List<Source> _sources; 069 070 @BoundAssembly( 071 formalName = "Property", 072 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 073 useName = "prop", 074 maxOccurs = -1 075 ) 076 @GroupAs( 077 name = "props", 078 inJson = JsonGroupAsBehavior.LIST 079 ) 080 private List<Property> _props; 081 082 @BoundAssembly( 083 formalName = "Link", 084 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 085 useName = "link", 086 maxOccurs = -1 087 ) 088 @GroupAs( 089 name = "links", 090 inJson = JsonGroupAsBehavior.LIST 091 ) 092 private List<Link> _links; 093 094 @BoundField( 095 formalName = "Remarks", 096 description = "Additional commentary about the containing object.", 097 useName = "remarks" 098 ) 099 @BoundFieldValue( 100 typeAdapter = MarkupMultilineAdapter.class 101 ) 102 private MarkupMultiline _remarks; 103 104 public AssessmentSubjectPlaceholder() { 105 } 106 107 public UUID getUuid() { 108 return _uuid; 109 } 110 111 public void setUuid(UUID value) { 112 _uuid = value; 113 } 114 115 public MarkupMultiline getDescription() { 116 return _description; 117 } 118 119 public void setDescription(MarkupMultiline value) { 120 _description = value; 121 } 122 123 public List<Source> getSources() { 124 return _sources; 125 } 126 127 public void setSources(List<Source> value) { 128 _sources = value; 129 } 130 131 /** 132 * Add a new {@link Source} item to the underlying collection. 133 * @param item the item to add 134 * @return {@code true} 135 */ 136 public boolean addSource(Source item) { 137 Source value = ObjectUtils.requireNonNull(item,"item cannot be null"); 138 if (_sources == null) { 139 _sources = new LinkedList<>(); 140 } 141 return _sources.add(value); 142 } 143 144 /** 145 * Remove the first matching {@link Source} item from the underlying collection. 146 * @param item the item to remove 147 * @return {@code true} if the item was removed or {@code false} otherwise 148 */ 149 public boolean removeSource(Source item) { 150 Source value = ObjectUtils.requireNonNull(item,"item cannot be null"); 151 return _sources == null ? false : _sources.remove(value); 152 } 153 154 public List<Property> getProps() { 155 return _props; 156 } 157 158 public void setProps(List<Property> value) { 159 _props = value; 160 } 161 162 /** 163 * Add a new {@link Property} item to the underlying collection. 164 * @param item the item to add 165 * @return {@code true} 166 */ 167 public boolean addProp(Property item) { 168 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 169 if (_props == null) { 170 _props = new LinkedList<>(); 171 } 172 return _props.add(value); 173 } 174 175 /** 176 * Remove the first matching {@link Property} item from the underlying collection. 177 * @param item the item to remove 178 * @return {@code true} if the item was removed or {@code false} otherwise 179 */ 180 public boolean removeProp(Property item) { 181 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 182 return _props == null ? false : _props.remove(value); 183 } 184 185 public List<Link> getLinks() { 186 return _links; 187 } 188 189 public void setLinks(List<Link> value) { 190 _links = value; 191 } 192 193 /** 194 * Add a new {@link Link} item to the underlying collection. 195 * @param item the item to add 196 * @return {@code true} 197 */ 198 public boolean addLink(Link item) { 199 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 200 if (_links == null) { 201 _links = new LinkedList<>(); 202 } 203 return _links.add(value); 204 } 205 206 /** 207 * Remove the first matching {@link Link} item from the underlying collection. 208 * @param item the item to remove 209 * @return {@code true} if the item was removed or {@code false} otherwise 210 */ 211 public boolean removeLink(Link item) { 212 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 213 return _links == null ? false : _links.remove(value); 214 } 215 216 public MarkupMultiline getRemarks() { 217 return _remarks; 218 } 219 220 public void setRemarks(MarkupMultiline value) { 221 _remarks = value; 222 } 223 224 @Override 225 public String toString() { 226 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString(); 227 } 228 229 /** 230 * Assessment subjects will be identified while conducting the referenced activity-instance. 231 */ 232 @MetaschemaAssembly( 233 formalName = "Assessment Subject Source", 234 description = "Assessment subjects will be identified while conducting the referenced activity-instance.", 235 name = "source", 236 metaschema = OscalAssessmentCommonMetaschema.class 237 ) 238 public static class Source { 239 @BoundFlag( 240 formalName = "Task Universally Unique Identifier", 241 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference (in this or other OSCAL instances) an assessment activity to be performed as part of the event. The locally defined *UUID* of the `task` can be used to reference the data item locally or globally (e.g., in an [imported OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope)). This UUID should be assigned *per-subject*, which means it should be consistently used to identify the same subject across revisions of the document.", 242 useName = "task-uuid", 243 required = true, 244 typeAdapter = UuidAdapter.class 245 ) 246 private UUID _taskUuid; 247 248 public Source() { 249 } 250 251 public UUID getTaskUuid() { 252 return _taskUuid; 253 } 254 255 public void setTaskUuid(UUID value) { 256 _taskUuid = value; 257 } 258 259 @Override 260 public String toString() { 261 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString(); 262 } 263 } 264}