@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
public static Object fromInteger(Class<?> theType, IntegerDt theArgument) { if (theArgument == null) { return null; } if (theType.equals(Integer.class)) { return theArgument.getValue(); } IPrimitiveType<?> retVal = (IPrimitiveType<?>) ReflectionUtil.newInstance(theType); retVal.setValueAsString(theArgument.getValueAsString()); return retVal; }
@Override public Object outgoingClient(Object theObject) { IQueryParameterType obj = (IQueryParameterType) theObject; IPrimitiveType<?> retVal = (IPrimitiveType<?>) myContext.getElementDefinition("string").newInstance(); retVal.setValueAsString(obj.getValueAsQueryToken(myContext)); return retVal; }
@Override public Object outgoingClient(Object theObject) { IQueryParameterType obj = (IQueryParameterType) theObject; IPrimitiveType<?> retVal = (IPrimitiveType<?>) myContext.getElementDefinition("string").newInstance(); retVal.setValueAsString(obj.getValueAsQueryToken(myContext)); return retVal; }
if (versionIdValues.size() > 0) { IPrimitiveType<?> versionId = (IPrimitiveType<?>) versionIdValues.get(0); versionId.setValueAsString(versionIdPart);
RuntimePrimitiveDatatypeDefinition def = (RuntimePrimitiveDatatypeDefinition) ctx.getElementDefinition(myParameterType.asSubclass(IBase.class)); IPrimitiveType<?> instance = def.newInstance(); instance.setValueAsString(nextValue); matchingParamValues.add(instance);
private static void populatePrimitiveValue(FhirContext theContext, IBaseResource theSubscription, String theChildName, String theValue) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theSubscription); Validate.isTrue(def.getName().equals("Subscription"), "theResource is not a subscription"); BaseRuntimeChildDefinition statusChild = def.getChildByName(theChildName); List<IBase> entries = statusChild.getAccessor().getValues(theSubscription); IPrimitiveType<?> instance; if (entries.size() == 0) { BaseRuntimeElementDefinition<?> statusElement = statusChild.getChildByName(theChildName); instance = (IPrimitiveType<?>) statusElement.newInstance(statusChild.getInstanceConstructorArguments()); statusChild.getMutator().addValue(theSubscription, instance); } else { instance = (IPrimitiveType<?>) entries.get(0); } instance.setValueAsString(theValue); }
((IPrimitiveType<?>) theTarget).setValueAsString(((IPrimitiveType<?>) theSource).getValueAsString()); return theSource;
value.setValueAsString("Subscription triggering job submitted as JOB ID: " + jobDetails.myJobId); ParametersUtil.addParameterToParameters(myFhirContext, retVal, "information", value); return retVal;
private static void populateDetails(FhirContext theCtx, IBase theIssue, String theSeverity, String theDetails, String theLocation, String theCode) { BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(theIssue.getClass()); BaseRuntimeChildDefinition detailsChild; detailsChild = issueElement.getChildByName("diagnostics"); BaseRuntimeChildDefinition codeChild = issueElement.getChildByName("code"); IPrimitiveType<?> codeElem = (IPrimitiveType<?>) codeChild.getChildByName("code").newInstance(codeChild.getInstanceConstructorArguments()); codeElem.setValueAsString(theCode); codeChild.getMutator().addValue(theIssue, codeElem); BaseRuntimeElementDefinition<?> stringDef = detailsChild.getChildByName(detailsChild.getElementName()); BaseRuntimeChildDefinition severityChild = issueElement.getChildByName("severity"); BaseRuntimeChildDefinition locationChild = issueElement.getChildByName("location"); IPrimitiveType<?> severityElem = (IPrimitiveType<?>) severityChild.getChildByName("severity").newInstance(severityChild.getInstanceConstructorArguments()); severityElem.setValueAsString(theSeverity); severityChild.getMutator().addValue(theIssue, severityElem); IPrimitiveType<?> string = (IPrimitiveType<?>) stringDef.newInstance(); string.setValueAsString(theDetails); detailsChild.getMutator().setValue(theIssue, string); if (isNotBlank(theLocation)) { IPrimitiveType<?> locationElem = (IPrimitiveType<?>) locationChild.getChildByName("location").newInstance(locationChild.getInstanceConstructorArguments()); locationElem.setValueAsString(theLocation); locationChild.getMutator().addValue(theIssue, locationElem); } }
@SuppressWarnings("unchecked") private T readHtmlResponse(InputStream theResponseInputStream) { RuntimeResourceDefinition resDef = getFhirContext().getResourceDefinition(myReturnType); IBaseResource instance = resDef.newInstance(); BaseRuntimeChildDefinition textChild = resDef.getChildByName("text"); BaseRuntimeElementCompositeDefinition<?> textElement = (BaseRuntimeElementCompositeDefinition<?>) textChild.getChildByName("text"); IBase textInstance = textElement.newInstance(); textChild.getMutator().addValue(instance, textInstance); BaseRuntimeChildDefinition divChild = textElement.getChildByName("div"); BaseRuntimeElementDefinition<?> divElement = divChild.getChildByName("div"); IPrimitiveType<?> divInstance = (IPrimitiveType<?>) divElement.newInstance(); try { divInstance.setValueAsString(IOUtils.toString(theResponseInputStream, Charsets.UTF_8)); } catch (Exception e) { throw new InvalidResponseException(400, "Failed to process HTML response from server: " + e.getMessage(), e); } divChild.getMutator().addValue(textInstance, divInstance); return (T) instance; }
IIdType newId = theIdSubstitutions.get(nextUriString); ourLog.debug(" * Replacing resource ref {} with {}", nextUriString, newId); nextRef.setValueAsString(newId.getValue()); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextUriString);
@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
public static Object fromInteger(Class<?> theType, IntegerDt theArgument) { if (theArgument == null) { return null; } if (theType.equals(Integer.class)) { return theArgument.getValue(); } IPrimitiveType<?> retVal = (IPrimitiveType<?>) ReflectionUtil.newInstance(theType); retVal.setValueAsString(theArgument.getValueAsString()); return retVal; }
@Override public Object outgoingClient(Object theObject) { IQueryParameterType obj = (IQueryParameterType) theObject; IPrimitiveType<?> retVal = (IPrimitiveType<?>) myContext.getElementDefinition("string").newInstance(); retVal.setValueAsString(obj.getValueAsQueryToken(myContext)); return retVal; }
@Override public Object outgoingClient(Object theObject) { IQueryParameterType obj = (IQueryParameterType) theObject; IPrimitiveType<?> retVal = (IPrimitiveType<?>) myContext.getElementDefinition("string").newInstance(); retVal.setValueAsString(obj.getValueAsQueryToken(myContext)); return retVal; }
private static void populatePrimitiveValue(FhirContext theContext, IBaseResource theSubscription, String theChildName, String theValue) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theSubscription); Validate.isTrue(def.getName().equals("Subscription"), "theResource is not a subscription"); BaseRuntimeChildDefinition statusChild = def.getChildByName(theChildName); List<IBase> entries = statusChild.getAccessor().getValues(theSubscription); IPrimitiveType<?> instance; if (entries.size() == 0) { BaseRuntimeElementDefinition<?> statusElement = statusChild.getChildByName(theChildName); instance = (IPrimitiveType<?>) statusElement.newInstance(statusChild.getInstanceConstructorArguments()); statusChild.getMutator().addValue(theSubscription, instance); } else { instance = (IPrimitiveType<?>) entries.get(0); } instance.setValueAsString(theValue); }
if (versionIdValues.size() > 0) { IPrimitiveType<?> versionId = (IPrimitiveType<?>) versionIdValues.get(0); versionId.setValueAsString(versionIdPart);
private static void populateDetails(FhirContext theCtx, IBase theIssue, String theSeverity, String theDetails, String theLocation, String theCode) { BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(theIssue.getClass()); BaseRuntimeChildDefinition detailsChild; detailsChild = issueElement.getChildByName("diagnostics"); BaseRuntimeChildDefinition codeChild = issueElement.getChildByName("code"); IPrimitiveType<?> codeElem = (IPrimitiveType<?>) codeChild.getChildByName("code").newInstance(codeChild.getInstanceConstructorArguments()); codeElem.setValueAsString(theCode); codeChild.getMutator().addValue(theIssue, codeElem); BaseRuntimeElementDefinition<?> stringDef = detailsChild.getChildByName(detailsChild.getElementName()); BaseRuntimeChildDefinition severityChild = issueElement.getChildByName("severity"); BaseRuntimeChildDefinition locationChild = issueElement.getChildByName("location"); IPrimitiveType<?> severityElem = (IPrimitiveType<?>) severityChild.getChildByName("severity").newInstance(severityChild.getInstanceConstructorArguments()); severityElem.setValueAsString(theSeverity); severityChild.getMutator().addValue(theIssue, severityElem); IPrimitiveType<?> string = (IPrimitiveType<?>) stringDef.newInstance(); string.setValueAsString(theDetails); detailsChild.getMutator().setValue(theIssue, string); if (isNotBlank(theLocation)) { IPrimitiveType<?> locationElem = (IPrimitiveType<?>) locationChild.getChildByName("location").newInstance(locationChild.getInstanceConstructorArguments()); locationElem.setValueAsString(theLocation); locationChild.getMutator().addValue(theIssue, locationElem); } }
@SuppressWarnings("unchecked") private T readHtmlResponse(InputStream theResponseInputStream) { RuntimeResourceDefinition resDef = getFhirContext().getResourceDefinition(myReturnType); IBaseResource instance = resDef.newInstance(); BaseRuntimeChildDefinition textChild = resDef.getChildByName("text"); BaseRuntimeElementCompositeDefinition<?> textElement = (BaseRuntimeElementCompositeDefinition<?>) textChild.getChildByName("text"); IBase textInstance = textElement.newInstance(); textChild.getMutator().addValue(instance, textInstance); BaseRuntimeChildDefinition divChild = textElement.getChildByName("div"); BaseRuntimeElementDefinition<?> divElement = divChild.getChildByName("div"); IPrimitiveType<?> divInstance = (IPrimitiveType<?>) divElement.newInstance(); try { divInstance.setValueAsString(IOUtils.toString(theResponseInputStream, Charsets.UTF_8)); } catch (Exception e) { throw new InvalidResponseException(400, "Failed to process HTML response from server: " + e.getMessage(), e); } divChild.getMutator().addValue(textInstance, divInstance); return (T) instance; }