001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.DecimalAdapter;
004import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter;
005import gov.nist.secauto.metaschema.core.model.IBoundObject;
006import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
007import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
008import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue;
009import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
010import gov.nist.secauto.metaschema.databind.model.annotations.BoundFieldValue;
011import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
012import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField;
013import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
014import java.lang.Override;
015import java.lang.String;
016import java.math.BigDecimal;
017import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
018import org.apache.commons.lang3.builder.ToStringStyle;
019
020/**
021 * This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence that this mapping is correct and accurate.
022 */
023@MetaschemaField(
024    formalName = "Confidence Score",
025    description = "This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence that this mapping is correct and accurate.",
026    name = "confidence-score",
027    moduleClass = OscalMappingCommonModule.class
028)
029public class ConfidenceScore implements IBoundObject {
030  private final IMetaschemaData __metaschemaData;
031
032  @BoundFlag(
033      name = "category",
034      typeAdapter = StringAdapter.class,
035      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "unspecified", description = "No category is specified for the confidence score."), @AllowedValue(value = "high", description = "High confidence in the mapping."), @AllowedValue(value = "medium", description = "Medium confidence in the mapping."), @AllowedValue(value = "low", description = "Low confidence in the mapping.")}))
036  )
037  private String _category;
038
039  @BoundFlag(
040      name = "percentage",
041      typeAdapter = DecimalAdapter.class
042  )
043  private BigDecimal _percentage;
044
045  @BoundFieldValue(
046      valueKeyName = "STRVALUE"
047  )
048  private String _value;
049
050  public ConfidenceScore() {
051    this(null);
052  }
053
054  public ConfidenceScore(IMetaschemaData data) {
055    this.__metaschemaData = data;
056  }
057
058  @Override
059  public IMetaschemaData getMetaschemaData() {
060    return __metaschemaData;
061  }
062
063  public String getCategory() {
064    return _category;
065  }
066
067  public void setCategory(String value) {
068    _category = value;
069  }
070
071  public BigDecimal getPercentage() {
072    return _percentage;
073  }
074
075  public void setPercentage(BigDecimal value) {
076    _percentage = value;
077  }
078
079  public String getValue() {
080    return _value;
081  }
082
083  public void setValue(String value) {
084    _value = value;
085  }
086
087  @Override
088  public String toString() {
089    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
090  }
091}