001package gov.nist.secauto.oscal.lib.model; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter; 005import gov.nist.secauto.metaschema.core.datatype.adapter.UriAdapter; 006import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter; 007import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline; 008import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter; 009import gov.nist.secauto.metaschema.core.model.IBoundObject; 010import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 011import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 012import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 013import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 014import gov.nist.secauto.metaschema.databind.model.annotations.BoundField; 015import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 016import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly; 017import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 018import gov.nist.secauto.oscal.lib.model.metadata.AbstractProperty; 019import java.lang.Override; 020import java.lang.String; 021import java.net.URI; 022import java.util.UUID; 023import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 024import org.apache.commons.lang3.builder.ToStringStyle; 025 026/** 027 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 028 */ 029@MetaschemaAssembly( 030 formalName = "Property", 031 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 032 name = "property", 033 moduleClass = OscalMetadataModule.class, 034 remarks = "Properties permit the deployment and management of arbitrary controlled values, within OSCAL objects. A property can be included for any purpose useful to an application or implementation. Typically, properties will be used to sort, filter, select, order, and arrange OSCAL content objects, to relate OSCAL objects to one another, or to associate an OSCAL object to class hierarchies, taxonomies, or external authorities. Thus, the lexical composition of properties may be constrained by external processes to ensure consistency.\n" 035 + "\n" 036 + "Property allows for associated remarks that describe why the specific property value was applied to the containing object, or the significance of the value in the context of the containing object.", 037 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, target = ".[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = @AllowedValue(value = "marking", description = "A label or descriptor that is tied to a sensitivity or classification marking system. An optional class can be used to define the specific marking system used for the associated value."))) 038) 039public class Property extends AbstractProperty implements IBoundObject { 040 private final IMetaschemaData __metaschemaData; 041 042 /** 043 * "A textual label, within a namespace, that identifies a specific attribute, characteristic, or quality of the property's containing object." 044 */ 045 @BoundFlag( 046 formalName = "Property Name", 047 description = "A textual label, within a namespace, that identifies a specific attribute, characteristic, or quality of the property's containing object.", 048 name = "name", 049 required = true, 050 typeAdapter = TokenAdapter.class 051 ) 052 private String _name; 053 054 /** 055 * "A unique identifier for a property." 056 */ 057 @BoundFlag( 058 formalName = "Property Universally Unique Identifier", 059 description = "A unique identifier for a property.", 060 name = "uuid", 061 typeAdapter = UuidAdapter.class 062 ) 063 private UUID _uuid; 064 065 /** 066 * "A namespace qualifying the property's name. This allows different organizations to associate distinct semantics with the same name." 067 */ 068 @BoundFlag( 069 formalName = "Property Namespace", 070 description = "A namespace qualifying the property's name. This allows different organizations to associate distinct semantics with the same name.", 071 name = "ns", 072 defaultValue = "http://csrc.nist.gov/ns/oscal", 073 typeAdapter = UriAdapter.class, 074 remarks = "This value must be an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that serves as a [naming system identifier](https://pages.nist.gov/OSCAL/concepts/uri-use/#use-as-a-naming-system-identifier).\n" 075 + "\n" 076 + "When a `ns` is not provided, its value should be assumed to be `http://csrc.nist.gov/ns/oscal` and the name should be a name defined by the associated OSCAL model." 077 ) 078 private URI _ns; 079 080 /** 081 * "Indicates the value of the attribute, characteristic, or quality." 082 */ 083 @BoundFlag( 084 formalName = "Property Value", 085 description = "Indicates the value of the attribute, characteristic, or quality.", 086 name = "value", 087 required = true, 088 typeAdapter = StringAdapter.class 089 ) 090 private String _value; 091 092 /** 093 * "A textual label that provides a sub-type or characterization of the property's <code>name</code>." 094 */ 095 @BoundFlag( 096 formalName = "Property Class", 097 description = "A textual label that provides a sub-type or characterization of the property's `name`.", 098 name = "class", 099 typeAdapter = TokenAdapter.class, 100 remarks = "This can be used to further distinguish or discriminate between the semantics of multiple properties of the same object with the same `name` and `ns`, or to group properties into categories.\n" 101 + "\n" 102 + "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value. It is available for grouping, but unlike `group` is not expected specifically to designate any group membership as such." 103 ) 104 private String _clazz; 105 106 /** 107 * "An identifier for relating distinct sets of properties." 108 */ 109 @BoundFlag( 110 formalName = "Property Group", 111 description = "An identifier for relating distinct sets of properties.", 112 name = "group", 113 typeAdapter = TokenAdapter.class, 114 remarks = "Different sets of properties may relate to separate contexts. Declare a group on a property to associate it with one or more other properties in a given context." 115 ) 116 private String _group; 117 118 @BoundField( 119 formalName = "Remarks", 120 description = "Additional commentary about the containing object.", 121 useName = "remarks", 122 typeAdapter = MarkupMultilineAdapter.class 123 ) 124 private MarkupMultiline _remarks; 125 126 public Property() { 127 this(null); 128 } 129 130 public Property(IMetaschemaData data) { 131 this.__metaschemaData = data; 132 } 133 134 @Override 135 public IMetaschemaData getMetaschemaData() { 136 return __metaschemaData; 137 } 138 139 public String getName() { 140 return _name; 141 } 142 143 public void setName(String value) { 144 _name = value; 145 } 146 147 public UUID getUuid() { 148 return _uuid; 149 } 150 151 public void setUuid(UUID value) { 152 _uuid = value; 153 } 154 155 public URI getNs() { 156 return _ns; 157 } 158 159 public void setNs(URI value) { 160 _ns = value; 161 } 162 163 public String getValue() { 164 return _value; 165 } 166 167 public void setValue(String value) { 168 _value = value; 169 } 170 171 public String getClazz() { 172 return _clazz; 173 } 174 175 public void setClazz(String value) { 176 _clazz = value; 177 } 178 179 public String getGroup() { 180 return _group; 181 } 182 183 public void setGroup(String value) { 184 _group = value; 185 } 186 187 public MarkupMultiline getRemarks() { 188 return _remarks; 189 } 190 191 public void setRemarks(MarkupMultiline value) { 192 _remarks = value; 193 } 194 195 @Override 196 public String toString() { 197 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 198 } 199}