Java Code Examples for org.hl7.fhir.r4.model.CanonicalType#getValue()

The following examples show how to use org.hl7.fhir.r4.model.CanonicalType#getValue() . 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: XLSXWriter.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String canonicalList(List<CanonicalType> list) {
  CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("|");
  for (CanonicalType c : list) {
    String v = c.getValue();
    if (v.startsWith("http://hl7.org/fhir/StructureDefinition/"))
      v = v.substring(40);
    b.append(v);
  }
  return b.toString();
}
 
Example 2
Source File: CanonicalHelper.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public static String getId(CanonicalType canonical) {
    if (canonical.hasValue()) {
        String id = canonical.getValue();
        String temp = id.contains("/") ? id.substring(id.lastIndexOf("/") + 1) : id;
        return temp.split("\\|")[0];
    }

    throw new RuntimeException("CanonicalType must have a value for id extraction");
}
 
Example 3
Source File: CanonicalHelper.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public static String getResourceName(CanonicalType canonical) {
    if (canonical.hasValue()) {
        String id = canonical.getValue();
        if (id.contains("/")) {
            id = id.replace(id.substring(id.lastIndexOf("/")), "");
            return id.contains("/") ? id.substring(id.lastIndexOf("/") + 1) : id;
        }
        return null;
    }

    throw new RuntimeException("CanonicalType must have a value for resource name extraction");
}
 
Example 4
Source File: VersionConvertor_14_40.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
static public Reference convertCanonicalToReference(CanonicalType src) throws FHIRException {
    Reference dst = new Reference(src.getValue());
    copyElement(src, dst);
    return dst;
}