001package com.example.metaschema;
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.markup.MarkupLine;
006import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter;
007import gov.nist.secauto.metaschema.core.model.IBoundObject;
008import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
009import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
010import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
011import gov.nist.secauto.metaschema.core.util.ObjectUtils;
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.BoundAssembly;
015import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
016import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
017import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
018import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
019import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
020import java.lang.Override;
021import java.lang.String;
022import java.util.LinkedList;
023import java.util.List;
024import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
025import org.apache.commons.lang3.builder.ToStringStyle;
026
027@MetaschemaAssembly(
028    formalName = "Expect Condition Constraint",
029    name = "flag-expect",
030    moduleClass = MetaschemaModelModule.class
031)
032public class FlagExpect implements IBoundObject {
033  private final IMetaschemaData __metaschemaData;
034
035  @BoundFlag(
036      formalName = "Constraint Identifier",
037      name = "id",
038      typeAdapter = TokenAdapter.class
039  )
040  private String _id;
041
042  @BoundFlag(
043      formalName = "Constraint Severity Level",
044      name = "level",
045      defaultValue = "ERROR",
046      typeAdapter = TokenAdapter.class,
047      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "CRITICAL", description = "A violation of the constraint represents a serious fault in the content that will prevent typical use of the content."), @AllowedValue(value = "ERROR", description = "A violation of the constraint represents a fault in the content. This may include issues around compatibility, integrity, consistency, etc."), @AllowedValue(value = "WARNING", description = "A violation of the constraint represents a potential issue with the content."), @AllowedValue(value = "INFORMATIONAL", description = "A violation of the constraint represents a point of interest."), @AllowedValue(value = "DEBUG", description = "A violation of the constraint represents a fault in the content that may warrant review by a developer when performing model or tool development.")}))
048  )
049  private String _level;
050
051  @BoundFlag(
052      formalName = "Expect Test Condition",
053      name = "test",
054      required = true,
055      typeAdapter = StringAdapter.class
056  )
057  private String _test;
058
059  @BoundField(
060      formalName = "Formal Name",
061      description = "A formal name for the data construct, to be presented in documentation.",
062      useName = "formal-name"
063  )
064  private String _formalName;
065
066  @BoundField(
067      formalName = "Description",
068      description = "A short description of the data construct's purpose, describing the constructs semantics.",
069      useName = "description",
070      typeAdapter = MarkupLineAdapter.class
071  )
072  private MarkupLine _description;
073
074  @BoundAssembly(
075      formalName = "Property",
076      useName = "prop",
077      maxOccurs = -1,
078      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
079  )
080  private List<Property> _props;
081
082  @BoundField(
083      formalName = "Constraint Condition Violation Message",
084      useName = "message"
085  )
086  private String _message;
087
088  @BoundField(
089      formalName = "Remarks",
090      description = "Any explanatory or helpful information to be provided about the remarks parent.",
091      useName = "remarks"
092  )
093  private Remarks _remarks;
094
095  public FlagExpect() {
096    this(null);
097  }
098
099  public FlagExpect(IMetaschemaData data) {
100    this.__metaschemaData = data;
101  }
102
103  @Override
104  public IMetaschemaData getMetaschemaData() {
105    return __metaschemaData;
106  }
107
108  public String getId() {
109    return _id;
110  }
111
112  public void setId(String value) {
113    _id = value;
114  }
115
116  public String getLevel() {
117    return _level;
118  }
119
120  public void setLevel(String value) {
121    _level = value;
122  }
123
124  public String getTest() {
125    return _test;
126  }
127
128  public void setTest(String value) {
129    _test = value;
130  }
131
132  public String getFormalName() {
133    return _formalName;
134  }
135
136  public void setFormalName(String value) {
137    _formalName = value;
138  }
139
140  public MarkupLine getDescription() {
141    return _description;
142  }
143
144  public void setDescription(MarkupLine value) {
145    _description = value;
146  }
147
148  public List<Property> getProps() {
149    return _props;
150  }
151
152  public void setProps(List<Property> value) {
153    _props = value;
154  }
155
156  /**
157   * Add a new {@link Property} item to the underlying collection.
158   * @param item the item to add
159   * @return {@code true}
160   */
161  public boolean addProp(Property item) {
162    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
163    if (_props == null) {
164      _props = new LinkedList<>();
165    }
166    return _props.add(value);
167  }
168
169  /**
170   * Remove the first matching {@link Property} item from the underlying collection.
171   * @param item the item to remove
172   * @return {@code true} if the item was removed or {@code false} otherwise
173   */
174  public boolean removeProp(Property item) {
175    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
176    return _props != null && _props.remove(value);
177  }
178
179  public String getMessage() {
180    return _message;
181  }
182
183  public void setMessage(String value) {
184    _message = value;
185  }
186
187  public Remarks getRemarks() {
188    return _remarks;
189  }
190
191  public void setRemarks(Remarks value) {
192    _remarks = value;
193  }
194
195  @Override
196  public String toString() {
197    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
198  }
199}