Package gov.nist.checklists.xccdf.x12

Examples of gov.nist.checklists.xccdf.x12.TestResultDocument


  public void appendSetValue(Value value, LiteralValue literal) {
    Collection<String> values = literal.getValues();

    if (literal.isComplex()) {
      // use complex value
      ProfileSetComplexValueType setValue = data.addNewSetComplexValue();
      setValue.setIdref(value.getId());

      if (values.isEmpty()) {
        setValue.setNil();
      } else {
        for (String item : values) {
          setValue.addItem(item);
        }
      }
    } else {
      ProfileSetValueType setValue = data.addNewSetValue();
      setValue.setIdref(value.getId());

      if (values.size() > 1) {
        throw new UnsupportedOperationException("Value '"+value.getId()+"' has '"+values.size()+"' values.");
      } else if (values.size() == 1) {
        setValue.setStringValue(values.iterator().next());
      } else { // empty
        setValue.setNil();
      }
    }
  }
View Full Code Here


              selector.setSeverity(RuleImpl.mapSeverity(nodeData.getSeverity()));
              selector.setRole(RuleImpl.mapRole(nodeData.getRole()));

              result.add(selector);
            } else if (ProfileSetValueType.type.isAssignableFrom(xmlObject.schemaType())) {
              ProfileSetValueType nodeData = (ProfileSetValueType)xmlObject;

              SetValueProfileSelector selector = new SetValueProfileSelectorImpl(this, nodeData.getIdref(), nodeData.getStringValue());
              result.add(selector);
            } else if (ProfileSetComplexValueType.type.isAssignableFrom(xmlObject.schemaType())) {
              ProfileSetComplexValueType nodeData = (ProfileSetComplexValueType)xmlObject;

              SetComplexValueProfileSelector selector = new SetComplexValueProfileSelectorImpl(this, nodeData.getIdref(), nodeData.getItemList());
              result.add(selector);
            }
        } while (cursor.toNextSibling());
        return result;
  }
View Full Code Here

        for (String item : values) {
          setValue.addItem(item);
        }
      }
    } else {
      ProfileSetValueType setValue = data.addNewSetValue();
      setValue.setIdref(value.getId());

      if (values.size() > 1) {
        throw new UnsupportedOperationException("Value '"+value.getId()+"' has '"+values.size()+"' values.");
      } else if (values.size() == 1) {
        setValue.setStringValue(values.iterator().next());
      } else { // empty
        setValue.setNil();
      }
    }
  }
View Full Code Here

    // Attribute: id
    // Operation: None

    // Attribute: prohibitChanges, optional, default=false
    // Operation: Replace
    ProfileType extendedData = extendedProfile.data;
   
    if (extendedData.isSetProhibitChanges() && !data.isSetProhibitChanges()) {
      data.setProhibitChanges(extendedData.getProhibitChanges());
    }

    // Attribute: abstract
    // Operation: None

    // Attribute: note-tag, optional
    // Operation: Replace
    if (extendedData.isSetNoteTag() && !data.isSetNoteTag()) {
      data.setNoteTag(extendedData.getNoteTag());
    }

    // Attribute: extends
    // Operation: None

    // Attribute: xml:base
    // Operation: ???None

    // Attribute: Id
    // Operation: None???

    // Element: status
    // Operation: None

    // Element: version, optional
    // Operation: Replace
    if (extendedData.isSetVersion() && !data.isSetVersion()) {
      data.setVersion((VersionType) extendedData.getVersion()
          .copy());
    }

    // Element: title
    // Operation: Override
    PropertyExtensionResolver.getTextWithSubTypeResolver().resolve(
        data.getTitleList(), extendedData.getTitleList(),
        PropertyExtensionResolver.Action.OVERRIDE);

    // Element: description
    // Operation: Override
    PropertyExtensionResolver.getHtmlTextWithSubTypeResolver().resolve(
        data.getDescriptionList(),
        extendedData.getDescriptionList(),
        PropertyExtensionResolver.Action.OVERRIDE);

    // Element: reference
    // Operation: ???Override (What is the key for the override?)
    PropertyExtensionResolver.getReferenceTypeResolver().resolve(
        data.getReferenceList(),
        extendedData.getReferenceList(),
        PropertyExtensionResolver.Action.OVERRIDE);

    // Element: platform
    // Operation: ???Override (Why is this an override?)
    PropertyExtensionResolver.getURIIdRefTypeResolver().resolve(
        data.getPlatformList(),
        extendedData.getPlatformList(),
        PropertyExtensionResolver.Action.OVERRIDE);

    // Element: select, set-value, refine-value and refine-rule
    new ProfileSelectorResolver(data, extendedData).resolve();
View Full Code Here

    this.testResultData = testResultData;
  }

  @Override
  protected RuleResultType generateRuleResultBase(RuleResult result) {
    RuleResultType retval = testResultData.addNewRuleResult();

    Rule rule = result.getRule();

        // Attributes
    retval.setIdref(rule.getId());
    retval.setRole(RuleImpl.mapRole(rule.getRole()));
    retval.setSeverity(RuleImpl.mapSeverity(rule.getSeverity()));
    retval.setTime(Calendar.getInstance());

    Version version = rule.getVersion();
    if (version != null) {
      retval.setVersion(version.getValue());
    }

    retval.setWeight(rule.getWeight());

    for (Ident ident : rule.getIdents()) {
      IdentType node = retval.addNewIdent();
      node.setSystem(ident.getSystem().toString());
      node.setStringValue(ident.getValue());
    }

        // TODO: P5: support fix
View Full Code Here

                    if (item instanceof GroupType) {
                        GroupType node = (GroupType) item;
                  GroupImpl group = new GroupImpl(node, this);
                  addGroupInternal(group);
                    } else if (item instanceof RuleType) {
                      RuleType node = (RuleType) item;
                  RuleImpl rule = new RuleImpl(node, this);
                  addRuleInternal(rule);
                    }
                }
            } while (cursor.toNextSibling());
View Full Code Here

                    if (item instanceof GroupType) {
                        GroupType node = (GroupType) item;
                  GroupImpl group = new GroupImpl(node, this);
                  addGroupInternal(group);
                    } else if (item instanceof RuleType) {
                      RuleType node = (RuleType) item;
                  RuleImpl rule = new RuleImpl(node, this);
                  addRuleInternal(rule);
                    }
                }
            } while (cursor.toNextSibling());
View Full Code Here

          throw e;
        }
  }

  public void appendScore(Score score) {
    ScoreType scoreType = data.addNewScore();

    scoreType.setSystem(score.getScoringModel().getSystem());
    scoreType.setMaximum(score.getMaximumScore());
    scoreType.setBigDecimalValue(score.getScore());
  }
View Full Code Here

              node.getSelector(),
              Collections.singletonList(node.getStringValue()),
              false);
          found = true;
        } else if (obj instanceof SelComplexValueType) {
          SelComplexValueType node = (SelComplexValueType)obj;
          literal = new DefaultLiteralValue(
              node.getSelector(),
              node.getItemList(),
              true);
          found = true;
        } else {
          if (!found) {
            continue;
View Full Code Here

      // Build a map of elements using the selector as the key
      do {
        LiteralValue literal;
        XmlObject obj = cursor.getObject();
        if (obj instanceof SelStringType) {
          SelStringType node = (SelStringType)obj;
          literal = new DefaultLiteralValue(
              node.getSelector(),
              Collections.singletonList(node.getStringValue()),
              false);
          found = true;
        } else if (obj instanceof SelComplexValueType) {
          SelComplexValueType node = (SelComplexValueType)obj;
          literal = new DefaultLiteralValue(
              node.getSelector(),
              node.getItemList(),
              true);
          found = true;
        } else {
          if (!found) {
            continue;
View Full Code Here

TOP

Related Classes of gov.nist.checklists.xccdf.x12.TestResultDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.