List<? extends IBase> values = nextDef.getAccessor().getValues(theCurrentObj);
private void extractDeclaredExtensions(IBase theResource, BaseRuntimeElementDefinition<?> resDef, List<HeldExtension> extensions, List<HeldExtension> modifierExtensions, CompositeChildElement theChildElem) { for (RuntimeChildDeclaredExtensionDefinition nextDef : resDef.getExtensionsNonModifier()) { for (IBase nextValue : nextDef.getAccessor().getValues(theResource)) { if (nextValue != null) { if (nextValue.isEmpty()) { continue; } extensions.add(new HeldExtension(nextDef, nextValue, theChildElem)); } } } for (RuntimeChildDeclaredExtensionDefinition nextDef : resDef.getExtensionsModifier()) { for (IBase nextValue : nextDef.getAccessor().getValues(theResource)) { if (nextValue != null) { if (nextValue.isEmpty()) { continue; } modifierExtensions.add(new HeldExtension(nextDef, nextValue, theChildElem)); } } } }
/** * Extract all of the resources of a given type from a given bundle */ @SuppressWarnings("unchecked") public static <T extends IBaseResource> List<T> toListOfResourcesOfType(FhirContext theContext, IBaseBundle theBundle, Class<T> theTypeToInclude) { List<T> retVal = new ArrayList<>(); RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle); BaseRuntimeChildDefinition entryChild = def.getChildByName("entry"); List<IBase> entries = entryChild.getAccessor().getValues(theBundle); BaseRuntimeElementCompositeDefinition<?> entryChildElem = (BaseRuntimeElementCompositeDefinition<?>) entryChild.getChildByName("entry"); BaseRuntimeChildDefinition resourceChild = entryChildElem.getChildByName("resource"); for (IBase nextEntry : entries) { for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) { if (theTypeToInclude != null && !theTypeToInclude.isAssignableFrom(next.getClass())) { continue; } retVal.add((T) next); } } return retVal; }
private static String getFirstIssueStringPart(FhirContext theCtx, IBaseOperationOutcome theOutcome, String name) { if (theOutcome == null) { return null; } RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome); BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue"); List<IBase> issues = issueChild.getAccessor().getValues(theOutcome); if (issues.isEmpty()) { return null; } IBase issue = issues.get(0); BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(issue.getClass()); BaseRuntimeChildDefinition detailsChild = issueElement.getChildByName(name); List<IBase> details = detailsChild.getAccessor().getValues(issue); if (details.isEmpty()) { return null; } return ((IPrimitiveType<?>) details.get(0)).getValueAsString(); }
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); }
public static List<String> getBaseAsStrings(FhirContext theContext, IBaseResource theResource) { Validate.notNull(theContext, "theContext must not be null"); Validate.notNull(theResource, "theResource must not be null"); RuntimeResourceDefinition def = theContext.getResourceDefinition(theResource); BaseRuntimeChildDefinition base = def.getChildByName("base"); List<IBase> baseValues = base.getAccessor().getValues(theResource); List<String> retVal = new ArrayList<>(); for (IBase next : baseValues) { IPrimitiveType<?> nextPrimitive = (IPrimitiveType<?>) next; retVal.add(nextPrimitive.getValueAsString()); } return retVal; }
public static Integer getTotal(FhirContext theContext, IBaseBundle theBundle) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle); BaseRuntimeChildDefinition entryChild = def.getChildByName("total"); List<IBase> entries = entryChild.getAccessor().getValues(theBundle); if (entries.size() > 0) { IPrimitiveType<Number> typeElement = (IPrimitiveType<Number>) entries.get(0); if (typeElement != null && typeElement.getValue() != null) { return typeElement.getValue().intValue(); } } return null; }
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; }
/** * 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 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; }
List<IBase> entries = entryChild.getAccessor().getValues(retVal); if (entries != null) { for (IBase nextEntry : entries) { continue; // TODO: remove this once the data model in tinder plugin catches up to 1.2 List<IBase> fullUrl = fullUrlChild.getAccessor().getValues(nextEntry); if (fullUrl != null && !fullUrl.isEmpty()) { IPrimitiveType<?> value = (IPrimitiveType<?>) fullUrl.get(0); if (value.isEmpty() == false) { List<IBase> entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry); if (entryResources != null && entryResources.size() > 0) { IBaseResource res = (IBaseResource) entryResources.get(0);
List<? extends IBase> values = nextChild.getAccessor().getValues(theElement); values = super.preProcessValues(nextChild, theResource, values, nextChildElem);
BaseRuntimeElementCompositeDefinition<?> childDef = (BaseRuntimeElementCompositeDefinition<?>) theDefinition; for (BaseRuntimeChildDefinition nextChild : childDef.getChildrenAndExtension()) { List<? extends IBase> values = nextChild.getAccessor().getValues(theElement); if (values != null) { for (IBase nextValue : values) {
for (BaseRuntimeChildDefinition nextChild : childDef.getChildrenAndExtension()) { List<?> values = nextChild.getAccessor().getValues(theElement); if (values != null) { for (Object nextValueObject : values) {
BaseRuntimeElementCompositeDefinition<?> entryDef = (BaseRuntimeElementCompositeDefinition<?>) entryChildDef.getChildByName("entry"); for (IBase nextEntry1 : entryChildDef.getAccessor().getValues(parsed)) { List<IBase> resources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry1); if (resources == null) { continue;
BaseRuntimeElementCompositeDefinition<?> entryDef = (BaseRuntimeElementCompositeDefinition<?>) entryChildDef.getChildByName("entry"); for (IBase nextEntry1 : entryChildDef.getAccessor().getValues(parsed)) { List<IBase> resources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry1); if (resources == null) { continue;
} else { List<? extends IBase> values = nextChild.getAccessor().getValues(theElement); values = super.preProcessValues(nextChild, theResource, values, nextChildElem);
BaseRuntimeElementCompositeDefinition<?> entryDef = (BaseRuntimeElementCompositeDefinition<?>) entryChildDef.getChildByName("entry"); for (IBase nextEntry1 : entryChildDef.getAccessor().getValues(parsed)) { List<IBase> resources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry1); if (resources == null) { continue;
List<IBase> entries = entryChild.getAccessor().getValues(retVal); if (entries != null) { for (IBase nextEntry : entries) { List<IBase> fullUrl = fullUrlChild.getAccessor().getValues(nextEntry); if (fullUrl != null && !fullUrl.isEmpty()) { IPrimitiveType<?> value = (IPrimitiveType<?>) fullUrl.get(0); if (value.isEmpty() == false) { List<IBase> entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry); if (entryResources != null && entryResources.size() > 0) { IBaseResource res = (IBaseResource) entryResources.get(0);
for (BaseRuntimeChildDefinition nextChildDef : cdef.getChildren()) { List<IBase> values = nextChildDef.getAccessor().getValues(theElement); if (values == null || values.isEmpty()) { continue;