Java Code Examples for org.hl7.fhir.dstu3.model.Coding#hasDisplay()

The following examples show how to use org.hl7.fhir.dstu3.model.Coding#hasDisplay() . 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: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
  if (tgt.getParameter().size() < 2)
    return null;
  Type p1 = tgt.getParameter().get(0).getValue();
  Type p2 = tgt.getParameter().get(1).getValue();
  if (p1 instanceof IdType || p2 instanceof IdType)
    return null;
  if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType))
    return null;
  String uri = ((PrimitiveType) p1).asStringValue();
  String code = ((PrimitiveType) p2).asStringValue();
  if (Utilities.noString(uri))
    throw new FHIRException("Describe Transform, but the uri is blank");
  if (Utilities.noString(code))
    throw new FHIRException("Describe Transform, but the code is blank");
  Coding c = buildCoding(uri, code);
  return NarrativeGenerator.describeSystem(c.getSystem())+"#"+c.getCode()+(c.hasDisplay() ? "("+c.getDisplay()+")" : "");
}
 
Example 2
Source File: ProfileUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private boolean hasDescription(Type fixed) {
  if (fixed instanceof Coding) {
    return ((Coding) fixed).hasDisplay();
  } else if (fixed instanceof CodeableConcept) {
    CodeableConcept cc = (CodeableConcept) fixed;
    if (cc.hasText())
      return true;
    for (Coding c : cc.getCoding())
      if (c.hasDisplay())
       return true;
  } // (fixed instanceof CodeType) || (fixed instanceof Quantity);
  return false;
}