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 * A local definition of a control objective. Uses catalog syntax for control objective and assessment activities. 024 */ 025@MetaschemaAssembly( 026 formalName = "Assessment Method", 027 description = "A local definition of a control objective. Uses catalog syntax for control objective and assessment activities.", 028 name = "assessment-method", 029 metaschema = OscalAssessmentCommonMetaschema.class 030) 031public class AssessmentMethod { 032 @BoundFlag( 033 formalName = "Assessment Method 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 with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this assessment method elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `assessment method` can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). 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 this assessment method." 043 */ 044 @BoundField( 045 formalName = "Assessment Method Description", 046 description = "A human-readable description of this assessment method.", 047 useName = "description" 048 ) 049 @BoundFieldValue( 050 typeAdapter = MarkupMultilineAdapter.class 051 ) 052 private MarkupMultiline _description; 053 054 @BoundAssembly( 055 formalName = "Property", 056 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 057 useName = "prop", 058 maxOccurs = -1 059 ) 060 @GroupAs( 061 name = "props", 062 inJson = JsonGroupAsBehavior.LIST 063 ) 064 private List<Property> _props; 065 066 @BoundAssembly( 067 formalName = "Link", 068 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 069 useName = "link", 070 maxOccurs = -1 071 ) 072 @GroupAs( 073 name = "links", 074 inJson = JsonGroupAsBehavior.LIST 075 ) 076 private List<Link> _links; 077 078 @BoundAssembly( 079 formalName = "Assessment Part", 080 description = "A partition of an assessment plan or results or a child of another part.", 081 useName = "part", 082 minOccurs = 1 083 ) 084 private AssessmentPart _part; 085 086 @BoundField( 087 formalName = "Remarks", 088 description = "Additional commentary about the containing object.", 089 useName = "remarks" 090 ) 091 @BoundFieldValue( 092 typeAdapter = MarkupMultilineAdapter.class 093 ) 094 private MarkupMultiline _remarks; 095 096 public AssessmentMethod() { 097 } 098 099 public UUID getUuid() { 100 return _uuid; 101 } 102 103 public void setUuid(UUID value) { 104 _uuid = value; 105 } 106 107 public MarkupMultiline getDescription() { 108 return _description; 109 } 110 111 public void setDescription(MarkupMultiline value) { 112 _description = value; 113 } 114 115 public List<Property> getProps() { 116 return _props; 117 } 118 119 public void setProps(List<Property> value) { 120 _props = value; 121 } 122 123 /** 124 * Add a new {@link Property} item to the underlying collection. 125 * @param item the item to add 126 * @return {@code true} 127 */ 128 public boolean addProp(Property item) { 129 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 130 if (_props == null) { 131 _props = new LinkedList<>(); 132 } 133 return _props.add(value); 134 } 135 136 /** 137 * Remove the first matching {@link Property} item from the underlying collection. 138 * @param item the item to remove 139 * @return {@code true} if the item was removed or {@code false} otherwise 140 */ 141 public boolean removeProp(Property item) { 142 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 143 return _props == null ? false : _props.remove(value); 144 } 145 146 public List<Link> getLinks() { 147 return _links; 148 } 149 150 public void setLinks(List<Link> value) { 151 _links = value; 152 } 153 154 /** 155 * Add a new {@link Link} item to the underlying collection. 156 * @param item the item to add 157 * @return {@code true} 158 */ 159 public boolean addLink(Link item) { 160 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 161 if (_links == null) { 162 _links = new LinkedList<>(); 163 } 164 return _links.add(value); 165 } 166 167 /** 168 * Remove the first matching {@link Link} item from the underlying collection. 169 * @param item the item to remove 170 * @return {@code true} if the item was removed or {@code false} otherwise 171 */ 172 public boolean removeLink(Link item) { 173 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 174 return _links == null ? false : _links.remove(value); 175 } 176 177 public AssessmentPart getPart() { 178 return _part; 179 } 180 181 public void setPart(AssessmentPart value) { 182 _part = value; 183 } 184 185 public MarkupMultiline getRemarks() { 186 return _remarks; 187 } 188 189 public void setRemarks(MarkupMultiline value) { 190 _remarks = value; 191 } 192 193 @Override 194 public String toString() { 195 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString(); 196 } 197}