001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter;
004import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
005import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter;
006import gov.nist.secauto.metaschema.core.model.IBoundObject;
007import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
008import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
009import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue;
010import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
011import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
012import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
013import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
014import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
015import java.lang.Override;
016import java.lang.String;
017import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
018import org.apache.commons.lang3.builder.ToStringStyle;
019
020/**
021 * Describes requirements, incompatibilities and gaps that are identified between a target and source in a mapping item.
022 */
023@MetaschemaAssembly(
024    formalName = "Relationship Qualifier",
025    description = "Describes requirements, incompatibilities and gaps that are identified between a target and source in a mapping item.",
026    name = "qualifier-item",
027    moduleClass = OscalMappingCommonModule.class
028)
029public class QualifierItem implements IBoundObject {
030  private final IMetaschemaData __metaschemaData;
031
032  /**
033   * "The focus of the qualifier."
034   */
035  @BoundFlag(
036      formalName = "Subject",
037      description = "The focus of the qualifier.",
038      name = "subject",
039      required = true,
040      typeAdapter = StringAdapter.class,
041      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "source", description = "This qualifier is related to the source in the mapped relationship."), @AllowedValue(value = "target", description = "This qualifier is related to the target in the mapped relationship."), @AllowedValue(value = "both", description = "This qualifier is related to both the source and target in the mapped relationship.")}))
042  )
043  private String _subject;
044
045  /**
046   * "The predicate describes how the qualifer applies to the subject."
047   */
048  @BoundFlag(
049      formalName = "Predicate",
050      description = "The predicate describes how the qualifer applies to the subject.",
051      name = "predicate",
052      required = true,
053      typeAdapter = StringAdapter.class,
054      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "has-requirement", description = "The subject has a requirement that must be met for the relationship to be satisfied."), @AllowedValue(value = "has-incompatibility", description = "The subject has an incompatibility which impacts the relationship.")}))
055  )
056  private String _predicate;
057
058  /**
059   * "The category expresses the resolvable nature of the predicate."
060   */
061  @BoundFlag(
062      formalName = "Category",
063      description = "The category expresses the resolvable nature of the predicate.",
064      name = "category",
065      required = true,
066      typeAdapter = StringAdapter.class,
067      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "restricted", description = "A restriction exists, and is defined in the description."), @AllowedValue(value = "addressable", description = "The qualifier is addressable, and is outlined in the description."), @AllowedValue(value = "blocked", description = "The mapping is blocked due to the reason noted in the description.")}))
068  )
069  private String _category;
070
071  @BoundField(
072      formalName = "Description of the qualifier",
073      description = "Details that outline what requirements must be met, or cannot be met. If the qualifier identifies a gap, this should idenfity the gap, and any incompatibilities.",
074      useName = "description",
075      minOccurs = 1,
076      typeAdapter = MarkupMultilineAdapter.class
077  )
078  private MarkupMultiline _description;
079
080  @BoundField(
081      formalName = "Remarks",
082      description = "Additional commentary about the containing object.",
083      useName = "remarks",
084      typeAdapter = MarkupMultilineAdapter.class
085  )
086  private MarkupMultiline _remarks;
087
088  public QualifierItem() {
089    this(null);
090  }
091
092  public QualifierItem(IMetaschemaData data) {
093    this.__metaschemaData = data;
094  }
095
096  @Override
097  public IMetaschemaData getMetaschemaData() {
098    return __metaschemaData;
099  }
100
101  public String getSubject() {
102    return _subject;
103  }
104
105  public void setSubject(String value) {
106    _subject = value;
107  }
108
109  public String getPredicate() {
110    return _predicate;
111  }
112
113  public void setPredicate(String value) {
114    _predicate = value;
115  }
116
117  public String getCategory() {
118    return _category;
119  }
120
121  public void setCategory(String value) {
122    _category = value;
123  }
124
125  public MarkupMultiline getDescription() {
126    return _description;
127  }
128
129  public void setDescription(MarkupMultiline value) {
130    _description = value;
131  }
132
133  public MarkupMultiline getRemarks() {
134    return _remarks;
135  }
136
137  public void setRemarks(MarkupMultiline value) {
138    _remarks = value;
139  }
140
141  @Override
142  public String toString() {
143    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
144  }
145}