private static IBase createIssue(FhirContext theCtx, IBaseResource theOutcome) { RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome); BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue"); BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) issueChild.getChildByName("issue"); IBase issue = issueElement.newInstance(); issueChild.getMutator().addValue(theOutcome, issue); return issue; }
private void setType(Class<? extends IBaseResource> theResourceType) { myResourceType = theResourceType; RuntimeResourceDefinition definition = myContext.getResourceDefinition(theResourceType); myResourceName = definition.getName(); }
private boolean isOverrideResourceIdWithBundleEntryFullUrl() { Boolean overrideResourceIdWithBundleEntryFullUrl = myOverrideResourceIdWithBundleEntryFullUrl; if (overrideResourceIdWithBundleEntryFullUrl != null) { return overrideResourceIdWithBundleEntryFullUrl; } return myContext.getParserOptions().isOverrideResourceIdWithBundleEntryFullUrl(); }
@SuppressWarnings("unused") public void getResourceTags() { // START SNIPPET: context // Create a DSTU2 context, which will use DSTU2 semantics FhirContext ctx = FhirContext.forDstu2(); // This parser supports DSTU2 IParser parser = ctx.newJsonParser(); // This client supports DSTU2 IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu2"); // END SNIPPET: context }
/** * Returns true if the given OperationOutcome has 1 or more Operation.issue repetitions */ public static boolean hasIssues(FhirContext theCtx, IBaseOperationOutcome theOutcome) { if (theOutcome == null) { return false; } RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome); BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue"); return issueChild.getAccessor().getValues(theOutcome).size() > 0; }
public static void setSecurityContext(FhirContext theCtx, IBaseBinary theBinary, String theSecurityContext) { RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); BaseRuntimeElementDefinition<?> referenceDef = theCtx.getElementDefinition("reference"); IBaseReference reference = (IBaseReference) referenceDef.newInstance(); child.getMutator().addValue(theBinary, reference); reference.setReference(theSecurityContext); }
public static IBaseBinary newBinary(FhirContext theCtx) { return (IBaseBinary) theCtx.getResourceDefinition("Binary").newInstance(); }
private void setType(String theResourceName) { myResourceType = myContext.getResourceDefinition(theResourceName).getImplementingClass(); myResourceName = theResourceName; }
public static void deferModelScanning() { // START SNIPPET: deferModelScanning // Create a context and configure it for deferred child scanning FhirContext ctx = FhirContext.forDstu2(); ctx.setPerformanceOptions(PerformanceOptionsEnum.DEFERRED_MODEL_SCANNING); // Now create a client and use it String serverBase = "http://fhirtest.uhn.ca/baseDstu2"; IGenericClient client = ctx.newRestfulGenericClient(serverBase); // END SNIPPET: deferModelScanning }
private static IBase createParameterRepetition(FhirContext theContext, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition<?> paramChildElem, String theName) { IBase parameter = paramChildElem.newInstance(); paramChild.getMutator().addValue(theTargetResource, parameter); IPrimitiveType<?> value; value = createString(theContext, theName); paramChildElem.getChildByName("name").getMutator().addValue(parameter, value); return parameter; }
@Override public Object getInstanceConstructorArguments() { Object retVal = myBinder; if (retVal == null) { retVal = toEnumFactory(myEnumType); myBinder = retVal; } return retVal; }
@Override public void setValue(Object theTarget, IBase theValue) { addValue(theTarget, theValue); } }
public String toResourceName(Class<? extends IBaseResource> theResourceType) { return myContext.getResourceDefinition(theResourceType).getName(); } }
public static IBaseReference getSecurityContext(FhirContext theCtx, IBaseBinary theBinary) { RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); IBaseReference retVal = null; if (child != null) { List<IBase> values = child.getAccessor().getValues(theBinary); if (values.size() > 0) { retVal = (IBaseReference) values.get(0); } } return retVal; }
@Override public Object getInstanceConstructorArguments() { Object retVal = myInstanceConstructorArguments; if (retVal == null && myEnumerationType != null) { retVal = RuntimeChildPrimitiveEnumerationDatatypeDefinition.toEnumFactory(myEnumerationType); myInstanceConstructorArguments = retVal; } return retVal; }
String toResourceName(IBaseResource theResource) { return myContext.getResourceDefinition(theResource).getName(); }
public static String getBundleType(FhirContext theContext, IBaseBundle theBundle) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle); BaseRuntimeChildDefinition entryChild = def.getChildByName("type"); List<IBase> entries = entryChild.getAccessor().getValues(theBundle); if (entries.size() > 0) { IPrimitiveType<?> typeElement = (IPrimitiveType<?>) entries.get(0); return typeElement.getValueAsString(); } return null; }
private String toResourceName(Class<? extends IBaseResource> theType) { return myContext.getResourceDefinition(theType).getName(); }
protected String toResourceName(Class<? extends IBaseResource> theResourceType) { return myContext.getResourceDefinition(theResourceType).getName(); }
public String toResourceName(Class<? extends IBaseResource> theResourceType) { return myContext.getResourceDefinition(theResourceType).getName(); }