001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
004import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
005import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
006import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
007import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
008import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
009import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
010import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
011import gov.nist.secauto.metaschema.model.common.datatype.adapter.StringAdapter;
012import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
013import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriAdapter;
014import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
015import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
016import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
017import gov.nist.secauto.oscal.lib.model.metadata.AbstractProperty;
018import java.lang.Override;
019import java.lang.String;
020import java.net.URI;
021import java.util.UUID;
022import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
023import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
024
025/**
026 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
027 */
028@MetaschemaAssembly(
029    formalName = "Property",
030    description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
031    name = "property",
032    metaschema = OscalMetadataMetaschema.class,
033    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"
034            + "\n"
035            + "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."
036)
037@ValueConstraints(
038    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."))
039)
040public class Property extends AbstractProperty {
041  @BoundFlag(
042      formalName = "Property Name",
043      description = "A textual label, within a namespace, that uniquely identifies a specific attribute, characteristic, or quality of the property's containing object.",
044      useName = "name",
045      required = true,
046      typeAdapter = TokenAdapter.class
047  )
048  private String _name;
049
050  @BoundFlag(
051      formalName = "Property Universally Unique Identifier",
052      description = "A unique identifier for a property.",
053      useName = "uuid",
054      typeAdapter = UuidAdapter.class
055  )
056  private UUID _uuid;
057
058  @BoundFlag(
059      formalName = "Property Namespace",
060      description = "A namespace qualifying the property's name. This allows different organizations to associate distinct semantics with the same name.",
061      useName = "ns",
062      typeAdapter = UriAdapter.class,
063      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"
064              + "\n"
065              + "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."
066  )
067  private URI _ns;
068
069  @BoundFlag(
070      formalName = "Property Value",
071      description = "Indicates the value of the attribute, characteristic, or quality.",
072      useName = "value",
073      required = true,
074      typeAdapter = StringAdapter.class
075  )
076  private String _value;
077
078  @BoundFlag(
079      formalName = "Property Class",
080      description = "A textual label that provides a sub-type or characterization of the property's `name`.",
081      useName = "class",
082      typeAdapter = TokenAdapter.class,
083      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"
084              + "\n"
085              + "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."
086  )
087  private String _clazz;
088
089  @BoundFlag(
090      formalName = "Property Group",
091      description = "An identifier for relating distinct sets of properties.",
092      useName = "group",
093      typeAdapter = TokenAdapter.class,
094      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."
095  )
096  private String _group;
097
098  @BoundField(
099      formalName = "Remarks",
100      description = "Additional commentary about the containing object.",
101      useName = "remarks"
102  )
103  @BoundFieldValue(
104      typeAdapter = MarkupMultilineAdapter.class
105  )
106  private MarkupMultiline _remarks;
107
108  public Property() {
109  }
110
111  public String getName() {
112    return _name;
113  }
114
115  public void setName(String value) {
116    _name = value;
117  }
118
119  public UUID getUuid() {
120    return _uuid;
121  }
122
123  public void setUuid(UUID value) {
124    _uuid = value;
125  }
126
127  public URI getNs() {
128    return _ns;
129  }
130
131  public void setNs(URI value) {
132    _ns = value;
133  }
134
135  public String getValue() {
136    return _value;
137  }
138
139  public void setValue(String value) {
140    _value = value;
141  }
142
143  public String getClazz() {
144    return _clazz;
145  }
146
147  public void setClazz(String value) {
148    _clazz = value;
149  }
150
151  public String getGroup() {
152    return _group;
153  }
154
155  public void setGroup(String value) {
156    _group = value;
157  }
158
159  public MarkupMultiline getRemarks() {
160    return _remarks;
161  }
162
163  public void setRemarks(MarkupMultiline value) {
164    _remarks = value;
165  }
166
167  @Override
168  public String toString() {
169    return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
170  }
171}