use of org.hl7.fhir.r4b.model.StringType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method executeTypeName.
private List<Base> executeTypeName(ExecutionContext context, List<Base> focus, ExpressionNode next, boolean atEntry) {
List<Base> result = new ArrayList<Base>();
result.add(new StringType(next.getName()));
return result;
}
use of org.hl7.fhir.r4b.model.StringType in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public void generate(CompartmentDefinition cpd) {
StringBuilder in = new StringBuilder();
StringBuilder out = new StringBuilder();
for (CompartmentDefinitionResourceComponent cc : cpd.getResource()) {
CommaSeparatedStringBuilder rules = new CommaSeparatedStringBuilder();
if (!cc.hasParam()) {
out.append(" <li><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></li>\r\n");
} else if (!rules.equals("{def}")) {
for (StringType p : cc.getParam()) rules.append(p.asStringValue());
in.append(" <tr><td><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></td><td>").append(rules.toString()).append("</td></tr>\r\n");
}
}
XhtmlNode x;
try {
x = new XhtmlParser().parseFragment("<div><p>\r\nThe following resources may be in this compartment:\r\n</p>\r\n" + "<table class=\"grid\">\r\n" + " <tr><td><b>Resource</b></td><td><b>Inclusion Criteria</b></td></tr>\r\n" + in.toString() + "</table>\r\n" + "<p>\r\nA resource is in this compartment if the nominated search parameter (or chain) refers to the patient resource that defines the compartment.\r\n</p>\r\n" + "<p>\r\n\r\n</p>\r\n" + "<p>\r\nThe following resources are never in this compartment:\r\n</p>\r\n" + "<ul>\r\n" + out.toString() + "</ul></div>\r\n");
inject(cpd, x, NarrativeStatus.GENERATED);
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.hl7.fhir.r4b.model.StringType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method opPlus.
private List<Base> opPlus(List<Base> left, List<Base> right) throws PathEngineException {
if (left.size() == 0)
throw new PathEngineException("Error performing +: left operand has no value");
if (left.size() > 1)
throw new PathEngineException("Error performing +: left operand has more than one value");
if (!left.get(0).isPrimitive())
throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
if (right.size() == 0)
throw new PathEngineException("Error performing +: right operand has no value");
if (right.size() > 1)
throw new PathEngineException("Error performing +: right operand has more than one value");
if (!right.get(0).isPrimitive())
throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType()));
List<Base> result = new ArrayList<Base>();
Base l = left.get(0);
Base r = right.get(0);
if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri"))
result.add(new StringType(l.primitiveValue() + r.primitiveValue()));
else if (l.hasType("integer") && r.hasType("integer"))
result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer"))
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
else
throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
return result;
}
use of org.hl7.fhir.r4b.model.StringType in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method opConcatenate.
private List<Base> opConcatenate(List<Base> left, List<Base> right) {
List<Base> result = new ArrayList<Base>();
result.add(new StringType(convertToString(left) + convertToString((right))));
return result;
}
use of org.hl7.fhir.r4b.model.StringType in project org.hl7.fhir.core by hapifhir.
the class ValueSet method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
// UriType
this.url = castToUri(value);
else if (name.equals("identifier"))
// Identifier
this.identifier = castToIdentifier(value);
else if (name.equals("version"))
// StringType
this.version = castToString(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("status"))
// Enumeration<ConformanceResourceStatus>
this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
else if (name.equals("experimental"))
// BooleanType
this.experimental = castToBoolean(value);
else if (name.equals("publisher"))
// StringType
this.publisher = castToString(value);
else if (name.equals("contact"))
this.getContact().add((ValueSetContactComponent) value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("lockedDate"))
// DateType
this.lockedDate = castToDate(value);
else if (name.equals("description"))
// StringType
this.description = castToString(value);
else if (name.equals("useContext"))
this.getUseContext().add(castToCodeableConcept(value));
else if (name.equals("immutable"))
// BooleanType
this.immutable = castToBoolean(value);
else if (name.equals("requirements"))
// StringType
this.requirements = castToString(value);
else if (name.equals("copyright"))
// StringType
this.copyright = castToString(value);
else if (name.equals("extensible"))
// BooleanType
this.extensible = castToBoolean(value);
else if (name.equals("compose"))
// ValueSetComposeComponent
this.compose = (ValueSetComposeComponent) value;
else if (name.equals("expansion"))
// ValueSetExpansionComponent
this.expansion = (ValueSetExpansionComponent) value;
else
super.setProperty(name, value);
}
Aggregations