View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5   import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
6   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
7   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
8   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
9   import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
10  import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
11  import gov.nist.secauto.metaschema.model.common.datatype.adapter.StringAdapter;
12  import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter;
13  import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriAdapter;
14  import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
15  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
16  import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
17  import gov.nist.secauto.oscal.lib.model.metadata.AbstractProperty;
18  import java.lang.Override;
19  import java.lang.String;
20  import java.net.URI;
21  import java.util.UUID;
22  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
23  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
24  
25  /**
26   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
27   */
28  @MetaschemaAssembly(
29      formalName = "Property",
30      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
31      name = "property",
32      metaschema = OscalMetadataMetaschema.class,
33      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"
34              + "\n"
35              + "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."
36  )
37  @ValueConstraints(
38      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."))
39  )
40  public class Property extends AbstractProperty {
41    @BoundFlag(
42        formalName = "Property Name",
43        description = "A textual label, within a namespace, that uniquely identifies a specific attribute, characteristic, or quality of the property's containing object.",
44        useName = "name",
45        required = true,
46        typeAdapter = TokenAdapter.class
47    )
48    private String _name;
49  
50    @BoundFlag(
51        formalName = "Property Universally Unique Identifier",
52        description = "A unique identifier for a property.",
53        useName = "uuid",
54        typeAdapter = UuidAdapter.class
55    )
56    private UUID _uuid;
57  
58    @BoundFlag(
59        formalName = "Property Namespace",
60        description = "A namespace qualifying the property's name. This allows different organizations to associate distinct semantics with the same name.",
61        useName = "ns",
62        typeAdapter = UriAdapter.class,
63        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"
64                + "\n"
65                + "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."
66    )
67    private URI _ns;
68  
69    @BoundFlag(
70        formalName = "Property Value",
71        description = "Indicates the value of the attribute, characteristic, or quality.",
72        useName = "value",
73        required = true,
74        typeAdapter = StringAdapter.class
75    )
76    private String _value;
77  
78    @BoundFlag(
79        formalName = "Property Class",
80        description = "A textual label that provides a sub-type or characterization of the property's `name`.",
81        useName = "class",
82        typeAdapter = TokenAdapter.class,
83        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"
84                + "\n"
85                + "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."
86    )
87    private String _clazz;
88  
89    @BoundFlag(
90        formalName = "Property Group",
91        description = "An identifier for relating distinct sets of properties.",
92        useName = "group",
93        typeAdapter = TokenAdapter.class,
94        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."
95    )
96    private String _group;
97  
98    @BoundField(
99        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 }