private void buildFixedExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { Type fixed = criteriaElement.getFixed(); if (fixed instanceof CodeableConcept) { CodeableConcept cc = (CodeableConcept) fixed; buildCodeableConceptExpression(ed, expression, discriminator, cc); } else { expression.append(" and (" + discriminator + " = "); if (fixed instanceof StringType) { Gson gson = new Gson(); String json = gson.toJson((StringType)fixed); String escapedString = json.substring(json.indexOf(":")+2); escapedString = escapedString.substring(0, escapedString.indexOf(",\"myStringValue")-1); expression.append("'" + escapedString + "'"); } else if (fixed instanceof UriType) { expression.append("'" + ((UriType)fixed).asStringValue() + "'"); } else if (fixed instanceof IntegerType) { expression.append(((IntegerType)fixed).asStringValue()); } else if (fixed instanceof DecimalType) { expression.append(((IntegerType)fixed).asStringValue()); } else if (fixed instanceof BooleanType) { expression.append(((BooleanType)fixed).asStringValue()); } else throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); expression.append(")"); } }
private String summarizeSlicing(ElementDefinitionSlicingComponent slice) { StringBuilder b = new StringBuilder(); boolean first = true; for (ElementDefinitionSlicingDiscriminatorComponent d : slice.getDiscriminator()) { if (first) first = false; else b.append(", "); b.append(d); } b.append("("); if (slice.hasOrdered()) b.append(slice.getOrderedElement().asStringValue()); b.append("/"); if (slice.hasRules()) b.append(slice.getRules().toCode()); b.append(")"); if (slice.hasDescription()) { b.append(" \""); b.append(slice.getDescription()); b.append("\""); } return b.toString(); }
private static void renderTransformParam(StringBuilder b, StructureMapGroupRuleTargetParameterComponent rtp) { try { if (rtp.hasValueBooleanType()) b.append(rtp.getValueBooleanType().asStringValue()); else if (rtp.hasValueDecimalType()) b.append(rtp.getValueDecimalType().asStringValue()); else if (rtp.hasValueIdType()) b.append(rtp.getValueIdType().asStringValue()); else if (rtp.hasValueDecimalType()) b.append(rtp.getValueDecimalType().asStringValue()); else if (rtp.hasValueIntegerType()) b.append(rtp.getValueIntegerType().asStringValue()); else b.append("'"+Utilities.escapeJava(rtp.getValueStringType().asStringValue())+"'"); } catch (FHIRException e) { e.printStackTrace(); b.append("error!"); } }
String value = focus.primitiveValue(); if (fixed instanceof org.hl7.fhir.r4.model.BooleanType) rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue(), value), "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue() + "'"); else if (fixed instanceof org.hl7.fhir.r4.model.IntegerType) rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue(), value),
private void buildFixedExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { Type fixed = criteriaElement.getFixed(); if (fixed instanceof CodeableConcept) { CodeableConcept cc = (CodeableConcept) fixed; buildCodeableConceptExpression(ed, expression, discriminator, cc); } else { expression.append(" and (" + discriminator + " = "); if (fixed instanceof StringType) { Gson gson = new Gson(); String json = gson.toJson((StringType)fixed); String escapedString = json.substring(json.indexOf(":")+2); escapedString = escapedString.substring(0, escapedString.indexOf(",\"myStringValue")-1); expression.append("'" + escapedString + "'"); } else if (fixed instanceof UriType) { expression.append("'" + ((UriType)fixed).asStringValue() + "'"); } else if (fixed instanceof IntegerType) { expression.append(((IntegerType)fixed).asStringValue()); } else if (fixed instanceof DecimalType) { expression.append(((IntegerType)fixed).asStringValue()); } else if (fixed instanceof BooleanType) { expression.append(((BooleanType)fixed).asStringValue()); } else throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); expression.append(")"); } }
if (!Base.compareDeep(derived.getIsSummaryElement(), base.getIsSummaryElement(), false)) { if (base.hasIsSummary()) throw new Error("Error in profile "+pn+" at "+derived.getPath()+": Base isSummary = "+base.getIsSummaryElement().asStringValue()+", derived isSummary = "+derived.getIsSummaryElement().asStringValue()); base.setIsSummaryElement(derived.getIsSummaryElement().copy()); } else if (trimDifferential)
private String summarizeSlicing(ElementDefinitionSlicingComponent slice) { StringBuilder b = new StringBuilder(); boolean first = true; for (ElementDefinitionSlicingDiscriminatorComponent d : slice.getDiscriminator()) { if (first) first = false; else b.append(", "); b.append(d); } b.append("("); if (slice.hasOrdered()) b.append(slice.getOrderedElement().asStringValue()); b.append("/"); if (slice.hasRules()) b.append(slice.getRules().toCode()); b.append(")"); if (slice.hasDescription()) { b.append(" \""); b.append(slice.getDescription()); b.append("\""); } return b.toString(); }
private static void renderTransformParam(StringBuilder b, StructureMapGroupRuleTargetParameterComponent rtp) { try { if (rtp.hasValueBooleanType()) b.append(rtp.getValueBooleanType().asStringValue()); else if (rtp.hasValueDecimalType()) b.append(rtp.getValueDecimalType().asStringValue()); else if (rtp.hasValueIdType()) b.append(rtp.getValueIdType().asStringValue()); else if (rtp.hasValueDecimalType()) b.append(rtp.getValueDecimalType().asStringValue()); else if (rtp.hasValueIntegerType()) b.append(rtp.getValueIntegerType().asStringValue()); else b.append("'"+Utilities.escapeJava(rtp.getValueStringType().asStringValue())+"'"); } catch (FHIRException e) { e.printStackTrace(); b.append("error!"); } }
String value = focus.primitiveValue(); if (fixed instanceof org.hl7.fhir.r4.model.BooleanType) rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue(), value), "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue() + "'"); else if (fixed instanceof org.hl7.fhir.r4.model.IntegerType) rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue(), value),
if (!Base.compareDeep(derived.getIsSummaryElement(), base.getIsSummaryElement(), false)) { if (base.hasIsSummary()) throw new Error("Error in profile "+pn+" at "+derived.getPath()+": Base isSummary = "+base.getIsSummaryElement().asStringValue()+", derived isSummary = "+derived.getIsSummaryElement().asStringValue()); base.setIsSummaryElement(derived.getIsSummaryElement().copy()); } else if (trimDifferential)