org.hl7.fhir.r4.model.StringType Java Examples

The following examples show how to use org.hl7.fhir.r4.model.StringType. 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: Element.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
	public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
  	if (isPrimitive() && (hash == "value".hashCode()) && !Utilities.noString(value)) {
//  		String tn = getType();
//  		throw new Error(tn+" not done yet");
  	  Base[] b = new Base[1];
  	  b[0] = new StringType(value);
  	  return b;
  	}
  		
  	List<Base> result = new ArrayList<Base>();
  	if (children != null) {
  	for (Element child : children) {
  		if (child.getName().equals(name))
  			result.add(child);
  		if (child.getName().startsWith(name) && child.getProperty().isChoice() && child.getProperty().getName().equals(name+"[x]"))
  			result.add(child);
  	}
  	}
  	if (result.isEmpty() && checkValid) {
//  		throw new FHIRException("not determined yet");
  	}
  	return result.toArray(new Base[result.size()]);
	}
 
Example #2
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static String readStringExtension(DomainResource c, String uri) {
  Extension ex = getExtension(c, uri);
  if (ex == null)
    return null;
  if ((ex.getValue() instanceof StringType))
    return ((StringType) ex.getValue()).getValue();
  if ((ex.getValue() instanceof UriType))
    return ((UriType) ex.getValue()).getValue();
  if (ex.getValue() instanceof CodeType)
    return ((CodeType) ex.getValue()).getValue();
  if (ex.getValue() instanceof IntegerType)
    return ((IntegerType) ex.getValue()).asStringValue();
  if ((ex.getValue() instanceof MarkdownType))
    return ((MarkdownType) ex.getValue()).getValue();
  return null;
}
 
Example #3
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static String readStringExtension(Element c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return null;
  if (ex.getValue() instanceof UriType)
    return ((UriType) ex.getValue()).getValue();
  if (ex.getValue() instanceof CanonicalType)
    return ((CanonicalType) ex.getValue()).getValue();
  if (ex.getValue() instanceof CodeType)
    return ((CodeType) ex.getValue()).getValue();
  if (ex.getValue() instanceof IntegerType)
    return ((IntegerType) ex.getValue()).asStringValue();
  if ((ex.getValue() instanceof MarkdownType))
    return ((MarkdownType) ex.getValue()).getValue();
  if (!(ex.getValue() instanceof StringType))
    return null;
  return ((StringType) ex.getValue()).getValue();
}
 
Example #4
Source File: Element.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public void setChildValue(String name, String value) {
  if (children == null)
    children = new ArrayList<Element>();
  for (Element child : children) {
    if (name.equals(child.getName())) {
      if (!child.isPrimitive())
        throw new Error("Cannot set a value of a non-primitive type ("+name+" on "+this.getName()+")");
      child.setValue(value);
    }
  }
  try {
    setProperty(name.hashCode(), name, new StringType(value));
  } catch (FHIRException e) {
    throw new Error(e);
  }
}
 
Example #5
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String, String> params) {
  List<Header> headers = null;
  Parameters p = expParams == null ? new Parameters() : expParams.copy();
  p.addParameter().setName("valueSet").setResource(source);
  for (String n : params.keySet())
    p.addParameter().setName(n).setValue(new StringType(params.get(n)));
  ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params), 
      utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
  result.addErrorStatus(410);//gone
  result.addErrorStatus(404);//unknown
  result.addErrorStatus(405);
  result.addErrorStatus(422);//Unprocessable Entity
  result.addSuccessStatus(200);
  result.addSuccessStatus(201);
  if(result.isUnsuccessfulRequest()) {
    throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
  }
  return (ValueSet) result.getPayload();
}
 
Example #6
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ConceptMap initializeClosure(String name) {
  Parameters params = new Parameters();
  params.addParameter().setName("name").setValue(new StringType(name));
  List<Header> headers = null;
  ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
      utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
  result.addErrorStatus(410);//gone
  result.addErrorStatus(404);//unknown
  result.addErrorStatus(405);
  result.addErrorStatus(422);//Unprocessable Entity
  result.addSuccessStatus(200);
  result.addSuccessStatus(201);
  if(result.isUnsuccessfulRequest()) {
    throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
  }
  return (ConceptMap) result.getPayload();
}
 
Example #7
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ConceptMap updateClosure(String name, Coding coding) {
  Parameters params = new Parameters();
  params.addParameter().setName("name").setValue(new StringType(name));
  params.addParameter().setName("concept").setValue(coding);
  List<Header> headers = null;
  ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
      utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
  result.addErrorStatus(410);//gone
  result.addErrorStatus(404);//unknown
  result.addErrorStatus(405);
  result.addErrorStatus(422);//Unprocessable Entity
  result.addSuccessStatus(200);
  result.addSuccessStatus(201);
  if(result.isUnsuccessfulRequest()) {
    throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
  }
  return (ConceptMap) result.getPayload();
}
 
Example #8
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws FHIRException {
  ResolvedGroup rg = resolveGroupReference(map, group, dependent.getName());

	if (rg.target.getInput().size() != dependent.getVariable().size()) {
		throw new FHIRException("Rule '"+dependent.getName()+"' has "+Integer.toString(rg.target.getInput().size())+" but the invocation has "+Integer.toString(dependent.getVariable().size())+" variables");
	}
	Variables v = new Variables();
	for (int i = 0; i < rg.target.getInput().size(); i++) {
		StructureMapGroupInputComponent input = rg.target.getInput().get(i);
		StringType rdp = dependent.getVariable().get(i);
     String var = rdp.asStringValue();
		VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT :   VariableMode.OUTPUT; 
		Base vv = vin.get(mode, var);
     if (vv == null && mode == VariableMode.INPUT) //* once source, always source. but target can be treated as source at user convenient
       vv = vin.get(VariableMode.OUTPUT, var);
		if (vv == null)
			throw new FHIRException("Rule '"+dependent.getName()+"' "+mode.toString()+" variable '"+input.getName()+"' named as '"+var+"' has no value (vars = "+vin.summary()+")");
		v.add(mode, input.getName(), vv);    	
	}
	executeGroup(indent+"  ", context, rg.targetMap, v, rg.target, false);
}
 
Example #9
Source File: Communication40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent();
    copyElement(src, tgt);
    if (src.hasContent()) {
        if (src.getContent() instanceof StringType) {
            CodeableConcept tgtc = new CodeableConcept();
            copyElement(src.getContent(), tgtc);
            tgtc.setText(src.getContentStringType().getValue());
            tgt.setContent(tgtc);
        } else {
            if (src.hasContent())
                tgt.setContent(convertType(src.getContent()));
        }
    }
    return tgt;
}
 
Example #10
Source File: Communication40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent();
    copyElement(src, tgt);
    if (src.hasContent()) {
        if (src.hasContentCodeableConcept()) {
            StringType tgts = new StringType();
            copyElement(src.getContent(), tgts);
            tgts.setValue(src.getContentCodeableConcept().getText());
            tgt.setContent(tgts);
        } else {
            if (src.hasContent())
                tgt.setContent(convertType(src.getContent()));
        }
    }
    return tgt;
}
 
Example #11
Source File: VersionConvertorPrimitiveType40_50Test.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static Stream<Arguments> r4PrimitiveTypes() {
  return Stream.of(
    Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()),
    Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()),
    Arguments.arguments(DateType.class.getSimpleName(), new DateType()),
    Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()),
    Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()),
    Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()),
    Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()),
    Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()),
    Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()),
    Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()),
    Arguments.arguments(OidType.class.getSimpleName(), new OidType()),
    Arguments.arguments(StringType.class.getSimpleName(), new StringType()),
    Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()),
    Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()),
    Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()),
    Arguments.arguments(UriType.class.getSimpleName(), new UriType()));
}
 
Example #12
Source File: VersionConvertorPrimitiveType40_50Test.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static Stream<Arguments> r5PrimitiveTypes() {
  return Stream.of(
    Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()),
    Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()),
    Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()),
    Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()),
    Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()),
    Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()),
    Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()),
    Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()),
    Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()),
    Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType()));
}
 
Example #13
Source File: FhirR4.java    From synthea with Apache License 2.0 6 votes vote down vote up
static Type mapValueToFHIRType(Object value, String unit) {
  if (value == null) {
    return null;
  } else if (value instanceof Condition) {
    Code conditionCode = ((HealthRecord.Entry) value).codes.get(0);
    return mapCodeToCodeableConcept(conditionCode, SNOMED_URI);
  } else if (value instanceof Code) {
    return mapCodeToCodeableConcept((Code) value, SNOMED_URI);
  } else if (value instanceof String) {
    return new StringType((String) value);
  } else if (value instanceof Number) {
    double dblVal = ((Number) value).doubleValue();
    PlainBigDecimal bigVal = new PlainBigDecimal(dblVal);
    return new Quantity().setValue(bigVal)
        .setCode(unit).setSystem(UNITSOFMEASURE_URI)
        .setUnit(unit);
  } else if (value instanceof Components.SampledData) {
    return mapValueToSampledData((Components.SampledData) value, unit);
  } else {
    throw new IllegalArgumentException("unexpected observation value class: "
        + value.getClass().toString() + "; " + value);
  }
}
 
Example #14
Source File: LibraryOperationsProvider.java    From cqf-ruler with Apache License 2.0 6 votes vote down vote up
@Operation(name = "$get-elm", idempotent = true, type = Library.class)
public Parameters getElm(@IdParam IdType theId, @OptionalParam(name="format") String format) {
    Library theResource = this.libraryResourceProvider.getDao().read(theId);
    // this.formatCql(theResource);

    ModelManager modelManager = this.getModelManager();
    LibraryManager libraryManager = this.getLibraryManager(modelManager);

    String elm = "";
    CqlTranslator translator = this.dataRequirementsProvider.getTranslator(theResource, libraryManager, modelManager);
    if (translator != null) {
        if (format.equals("json")) {
            elm = translator.toJson();
        }
        else {
            elm = translator.toXml();
        }
    }
    Parameters p = new Parameters();
    p.addParameter().setValue(new StringType(elm));
    return p;
}
 
Example #15
Source File: IContactHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public List<Address> getAddresses(IContact contact){
	List<Address> ret = new ArrayList<>();
	
	// main address data
	Address address = new Address();
	address.setUse(AddressUse.HOME);
	address.setCity(contact.getCity());
	address.setPostalCode(contact.getZip());
	address.setCountry((contact.getCountry() != null) ? contact.getCountry().name() : null);
	List<StringType> lines = new ArrayList<>();
	lines.add(new StringType(contact.getStreet()));
	address.setLine(lines);
	ret.add(address);
	
	return ret;
}
 
Example #16
Source File: LibraryOperationsProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
@Operation(name = "$get-narrative", idempotent = true, type = Library.class)
public Parameters getNarrative(@IdParam IdType theId) {
    Library theResource = this.libraryResourceProvider.getDao().read(theId);
    Narrative n = this.narrativeProvider.getNarrative(this.libraryResourceProvider.getContext(), theResource);
    Parameters p = new Parameters();
    p.addParameter().setValue(new StringType(n.getDivAsString()));
    return p;
}
 
Example #17
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
@Operation(name = "$get-narrative", idempotent = true, type = Measure.class)
public Parameters getNarrative(@IdParam IdType theId) {
    Measure theResource = this.measureResourceProvider.getDao().read(theId);
    CqfMeasure cqfMeasure = this.dataRequirementsProvider.createCqfMeasure(theResource, this.libraryResolutionProvider);
    Narrative n = this.narrativeProvider.getNarrative(this.measureResourceProvider.getContext(), cqfMeasure);
    Parameters p = new Parameters();
    p.addParameter().setValue(new StringType(n.getDivAsString()));
    return p;
}
 
Example #18
Source File: StructuredMapRuleTargetBuilder.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public StructuredMapRuleTargetBuilder buildTransformCopy(String source) {
    complexProperty.setTransform(StructureMap.StructureMapTransform.COPY);
    StructureMap.StructureMapGroupRuleTargetParameterComponent structureMapGroupRuleTargetParameterComponent =
            new StructureMap.StructureMapGroupRuleTargetParameterComponent();
    structureMapGroupRuleTargetParameterComponent.setValue(new StringType(source));
    complexProperty.addParameter(structureMapGroupRuleTargetParameterComponent);
    return this;
}
 
Example #19
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addLanguageTranslation(Element element, String lang, String value) {
  if (Utilities.noString(lang) || Utilities.noString(value))
    return;
  
  Extension extension = new Extension().setUrl(EXT_TRANSLATION);
  extension.addExtension().setUrl("lang").setValue(new CodeType(lang));
  extension.addExtension().setUrl("content").setValue(new StringType(value));
  element.getExtension().add(extension);
}
 
Example #20
Source File: StructuredMapRuleTargetBuilder.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public StructuredMapRuleTargetBuilder buildTransform(String context, String targetField, StructureMap.StructureMapTransform transform, String...parameters)
{
    complexProperty.setTransform(transform);
    for (String param: parameters){
        StructureMap.StructureMapGroupRuleTargetParameterComponent structureMapGroupRuleTargetParameterComponent =
                new StructureMap.StructureMapGroupRuleTargetParameterComponent();
        structureMapGroupRuleTargetParameterComponent.setValue(new StringType(param));
        complexProperty.addParameter(structureMapGroupRuleTargetParameterComponent);
    }

    return buildContext(context)
            .buildContextType(StructureMap.StructureMapContextType.VARIABLE)
            .buildElement(targetField);
}
 
Example #21
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static String getLanguageTranslation(Element element, String lang) {
  for (Extension e : element.getExtension()) {
    if (e.getUrl().equals(EXT_TRANSLATION)) {
      Extension e1 = ExtensionHelper.getExtension(e, "lang");

      if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) {
        e1 = ExtensionHelper.getExtension(e, "content");
        return ((StringType) e.getValue()).getValue();
      }
    }
  }
  return null;
}
 
Example #22
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void setStringExtension(Element resource, String uri, String value) {
  if (Utilities.noString(value))
    return;
      Extension ext = getExtension(resource, uri);
  if (ext != null)
    ext.setValue(new StringType(value));
  else
    resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
 
Example #23
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean findStringExtension(Element c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return false;
  if (!(ex.getValue() instanceof StringType))
    return false;
  return !StringUtils.isBlank(((StringType) ex.getValue()).getValue());
}
 
Example #24
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addStringExtension(DomainResource e, String url, String content) {
  if (!StringUtils.isBlank(content)) {
    Extension ex = getExtension(e, url);
    if (ex != null)
      ex.setValue(new StringType(content));
    else
      e.getExtension().add(Factory.newExtension(url, new StringType(content), true));   
  }
}
 
Example #25
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addStringExtension(Element e, String url, String content) {
  if (!StringUtils.isBlank(content)) {
    Extension ex = getExtension(e, url);
    if (ex != null)
      ex.setValue(new StringType(content));
    else
      e.getExtension().add(Factory.newExtension(url, new StringType(content), true));   
  }
}
 
Example #26
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addMarkdownExtension(DomainResource dr, String url, String content) {
  if (!StringUtils.isBlank(content)) {
    Extension ex = getExtension(dr, url);
    if (ex != null)
      ex.setValue(new StringType(content));
    else
      dr.getExtension().add(Factory.newExtension(url, new MarkdownType(content), true));   
  }
}
 
Example #27
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void setStringExtension(DomainResource resource, String uri, String value) {
  if (Utilities.noString(value))
    return;
      Extension ext = getExtension(resource, uri);
  if (ext != null)
    ext.setValue(new StringType(value));
  else
    resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
 
Example #28
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private Type readConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
	if (Utilities.isInteger(s))
		return new IntegerType(s);
	else if (Utilities.isDecimal(s, false))
		return new DecimalType(s);
	else if (Utilities.existsInList(s, "true", "false"))
		return new BooleanType(s.equals("true"));
	else 
		return new StringType(lexer.processConstant(s));        
}
 
Example #29
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError {
	if (!lexer.isConstant()) {
		target.addParameter().setValue(new IdType(lexer.take()));
	} else if (lexer.isStringConstant())
		target.addParameter().setValue(new StringType(lexer.readConstant("??")));
	else {
		target.addParameter().setValue(readConstant(lexer.take(), lexer));
	}
}
 
Example #30
Source File: ProfileComparer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private List<StringType> mergeStrings(List<StringType> left, List<StringType> right) {
  List<StringType> result = new ArrayList<StringType>();
  result.addAll(left);
  for (StringType c : right) {
    boolean found = false;
    for (StringType ct : left)
      if (Utilities.equals(c.getValue(), ct.getValue()))
        found = true;
    if (!found)
      result.add(c);
  }
  return result;
}