Java Code Examples for org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity#NULL

The following examples show how to use org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity#NULL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CanonicalResourceComparer.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
protected void comparePrimitives(String name, PrimitiveType l, PrimitiveType r, Map<String, StructuralMatch<String>> comp, IssueSeverity level, CanonicalResourceComparison<? extends CanonicalResource> res) {
  StructuralMatch<String> match = null;
  if (l.isEmpty() && r.isEmpty()) {
    match = new StructuralMatch<>(null, null, null);
  } else if (l.isEmpty()) {
    match = new StructuralMatch<>(null, r.primitiveValue(), vmI(IssueSeverity.INFORMATION, "Added this item", fhirType()+"."+name));
  } else if (r.isEmpty()) {
    match = new StructuralMatch<>(l.primitiveValue(), null, vmI(IssueSeverity.INFORMATION, "Removed this item", fhirType()+"."+name));
  } else if (!l.hasValue() && !r.hasValue()) {
    match = new StructuralMatch<>(null, null, vmI(IssueSeverity.INFORMATION, "No Value", fhirType()+"."+name));
  } else if (!l.hasValue()) {
    match = new StructuralMatch<>(null, r.primitiveValue(), vmI(IssueSeverity.INFORMATION, "No Value on Left", fhirType()+"."+name));
  } else if (!r.hasValue()) {
    match = new StructuralMatch<>(l.primitiveValue(), null, vmI(IssueSeverity.INFORMATION, "No Value on Right", fhirType()+"."+name));
  } else if (l.getValue().equals(r.getValue())) {
    match = new StructuralMatch<>(l.primitiveValue(), r.primitiveValue(), null);
  } else {
    match = new StructuralMatch<>(l.primitiveValue(), r.primitiveValue(), vmI(level, "Values Differ", fhirType()+"."+name));
    if (level != IssueSeverity.NULL) {
      res.getMessages().add(new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, fhirType()+"."+name, "Values for "+name+" differ: '"+l.primitiveValue()+"' vs '"+r.primitiveValue()+"'", level));
    }
  } 
  comp.put(name, match);    
}
 
Example 2
Source File: CodeSystemComparer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void compareStrings(String path, List<ValidationMessage> msgs, String left, String right, String name, IssueSeverity level, CodeSystemComparison res) {
  if (!Utilities.noString(right)) {
    if (Utilities.noString(left)) {
      msgs.add(vmI(level, "Value for "+name+" added", path));
    } else if (!left.equals(right)) {
      if (level != IssueSeverity.NULL) {
        res.getMessages().add(new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, path+"."+name, "Changed value for "+name+": '"+left+"' vs '"+right+"'", level));
      }
      msgs.add(vmI(level, name+" changed from left to right", path));
    }
  } else if (!Utilities.noString(left)) {
    msgs.add(vmI(level, "Value for "+name+" removed", path));
  }
}
 
Example 3
Source File: ValueSetComparer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void compareStrings(String path, List<ValidationMessage> msgs, String left, String right, String name, IssueSeverity level, ValueSetComparison res) {
  if (!Utilities.noString(right)) {
    if (Utilities.noString(left)) {
      msgs.add(vmI(level, "Value for "+name+" added", path));
    } else if (!left.equals(right)) {
      if (level != IssueSeverity.NULL) {
        res.getMessages().add(new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, path+".name", "Changed value for "+name+": '"+left+"' vs '"+right+"'", level));
      }
      msgs.add(vmI(level, name+" changed from left to right", path));
    }
  } else if (!Utilities.noString(left)) {
    msgs.add(vmI(level, "Value for "+name+" removed", path));
  }
}
 
Example 4
Source File: ResourceComparer.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
protected ValidationMessage vmI(IssueSeverity level, String message, String path) {
  ValidationMessage vm = new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, path, message, level == IssueSeverity.NULL ? IssueSeverity.INFORMATION : level);
  return vm;    
}