congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BaseRuntimeChildDefinition$IAccessor.getValues
Code IndexAdd Tabnine to your IDE (free)

How to use
getValues
method
in
ca.uhn.fhir.context.BaseRuntimeChildDefinition$IAccessor

Best Java code snippets using ca.uhn.fhir.context.BaseRuntimeChildDefinition$IAccessor.getValues (Showing top 20 results out of 315)

origin: jamesagnew/hapi-fhir

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;
}
origin: jamesagnew/hapi-fhir

public static List<String> getNamedParameterValuesAsString(FhirContext theCtx, IBaseParameters theParameters, String theParameterName) {
  Validate.notNull(theParameters, "theParameters must not be null");
  RuntimeResourceDefinition resDef = theCtx.getResourceDefinition(theParameters.getClass());
  BaseRuntimeChildDefinition parameterChild = resDef.getChildByName("parameter");
  List<IBase> parameterReps = parameterChild.getAccessor().getValues(theParameters);
  List<String> retVal = new ArrayList<>();
  for (IBase nextParameter : parameterReps) {
    BaseRuntimeElementCompositeDefinition<?> nextParameterDef = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(nextParameter.getClass());
    BaseRuntimeChildDefinition nameChild = nextParameterDef.getChildByName("name");
    List<IBase> nameValues = nameChild.getAccessor().getValues(nextParameter);
    Optional<? extends IPrimitiveType<?>> nameValue = nameValues
      .stream()
      .filter(t -> t instanceof IPrimitiveType<?>)
      .map(t -> ((IPrimitiveType<?>) t))
      .findFirst();
    if (!nameValue.isPresent() || !theParameterName.equals(nameValue.get().getValueAsString())) {
      continue;
    }
    BaseRuntimeChildDefinition valueChild = nextParameterDef.getChildByName("value[x]");
    List<IBase> valueValues = valueChild.getAccessor().getValues(nextParameter);
    valueValues
      .stream()
      .filter(t->t instanceof IPrimitiveType<?>)
      .map(t->((IPrimitiveType<?>)t).getValueAsString())
      .filter(StringUtils::isNotBlank)
      .forEach(retVal::add);
  }
  return retVal;
}
origin: jamesagnew/hapi-fhir

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;
}
origin: jamesagnew/hapi-fhir

} else {
  BaseRuntimeChildDefinition metaChild = myFhirContext.getResourceDefinition(myResourceType).getChildByName("meta");
  List<IBase> metaValues = metaChild.getAccessor().getValues(theResource);
  if (metaValues.size() > 0) {
    IBase meta = metaValues.get(0);
    BaseRuntimeElementCompositeDefinition<?> metaDef = (BaseRuntimeElementCompositeDefinition<?>) myFhirContext.getElementDefinition(meta.getClass());
    BaseRuntimeChildDefinition versionIdDef = metaDef.getChildByName("versionId");
    List<IBase> versionIdValues = versionIdDef.getAccessor().getValues(meta);
    if (versionIdValues.size() > 0) {
      IPrimitiveType<?> versionId = (IPrimitiveType<?>) versionIdValues.get(0);
origin: jamesagnew/hapi-fhir

for (IBase nextValue : nextChild.getAccessor().getValues(theSource)) {
  String elementName = nextChild.getChildNameByDatatype(nextValue.getClass());
  BaseRuntimeChildDefinition targetChild = targetDef.getChildByName(elementName);
origin: jamesagnew/hapi-fhir

List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
  RequestTypeEnum requestType = null;
  for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) {
    resource = (IBaseResource) next;
  for (IBase nextRequest : requestChild.getAccessor().getValues(nextEntry)) {
    for (IBase nextUrl : urlChild.getAccessor().getValues(nextRequest)) {
      url = ((IPrimitiveType<?>)nextUrl).getValueAsString();
    for (IBase nextUrl : methodChild.getAccessor().getValues(nextRequest)) {
      String methodString = ((IPrimitiveType<?>)nextUrl).getValueAsString();
      if (isNotBlank(methodString)) {
origin: jamesagnew/hapi-fhir

List<? extends IBase> sourceValues = sourceChildEquivalent.getAccessor().getValues(theSource);
for (IBase nextElement : sourceValues) {
  boolean handled = false;
origin: jamesagnew/hapi-fhir

List<IBase> values = paramChildAccessor.getValues(requestContents);
for (IBase nextParameter : values) {
  List<IBase> nextNames = nameChild.getAccessor().getValues(nextParameter);
  if (nextNames != null && nextNames.size() > 0) {
    IPrimitiveType<?> nextName = (IPrimitiveType<?>) nextNames.get(0);
        matchingParamValues.add(nextParameter);
      } else {
        List<IBase> paramValues = valueChild.getAccessor().getValues(nextParameter);
        List<IBase> paramResources = resourceChild.getAccessor().getValues(nextParameter);
        if (paramValues != null && paramValues.size() > 0) {
          tryToAddValues(paramValues, matchingParamValues);
origin: jamesagnew/hapi-fhir

RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("link");
List<IBase> links = entryChild.getAccessor().getValues(theBundle);
for (IBase nextLink : links) {
  BaseRuntimeElementCompositeDefinition relDef = (BaseRuntimeElementCompositeDefinition) theContext.getElementDefinition(nextLink.getClass());
  BaseRuntimeChildDefinition relChild = relDef.getChildByName("relation");
  List<IBase> relValues = relChild.getAccessor().getValues(nextLink);
  for (IBase next : relValues) {
    IPrimitiveType<?> nextValue = (IPrimitiveType<?>)next;
  List<IBase> values = urlChild.getAccessor().getValues(nextLink);
  for (IBase nextUrl : values) {
    IPrimitiveType<?> nextValue = (IPrimitiveType<?>)nextUrl;
origin: jamesagnew/hapi-fhir

private <T extends IBaseBundle> IGetPageTyped<T> nextOrPrevious(String theWantRel, T theBundle) {
  RuntimeResourceDefinition def = myContext.getResourceDefinition(theBundle);
  List<IBase> links = def.getChildByName("link").getAccessor().getValues(theBundle);
  if (links == null || links.isEmpty()) {
    throw new IllegalArgumentException(myContext.getLocalizer().getMessage(GenericClient.class, "noPagingLinkFoundInBundle", theWantRel));
  }
  for (IBase nextLink : links) {
    BaseRuntimeElementCompositeDefinition linkDef = (BaseRuntimeElementCompositeDefinition) myContext.getElementDefinition(nextLink.getClass());
    List<IBase> rel = linkDef.getChildByName("relation").getAccessor().getValues(nextLink);
    if (rel == null || rel.isEmpty()) {
      continue;
    }
    String relation = ((IPrimitiveType<?>) rel.get(0)).getValueAsString();
    if (theWantRel.equals(relation) || (theWantRel == PREVIOUS && PREV.equals(relation))) {
      List<IBase> urls = linkDef.getChildByName("url").getAccessor().getValues(nextLink);
      if (urls == null || urls.isEmpty()) {
        continue;
      }
      String url = ((IPrimitiveType<?>) urls.get(0)).getValueAsString();
      if (isBlank(url)) {
        continue;
      }
      return (IGetPageTyped<T>) byUrl(url).andReturnBundle(theBundle.getClass());
    }
  }
  throw new IllegalArgumentException(myContext.getLocalizer().getMessage(GenericClient.class, "noPagingLinkFoundInBundle", theWantRel));
}
origin: jamesagnew/hapi-fhir

RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
  IBaseResource resource = null;
  for (IBase nextEntryValue : requestChild.getAccessor().getValues(nextEntry)) {
    for (IBase nextUrlValue : urlChild.getAccessor().getValues(nextEntryValue)) {
      url = ((IPrimitiveType<String>)nextUrlValue).getValue();
  for (IBase nextValue : resourceChild.getAccessor().getValues(nextEntry)) {
    resource = (IBaseResource) nextValue;
origin: jamesagnew/hapi-fhir

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));
      }
    }
  }
}
origin: jamesagnew/hapi-fhir

  private void addExtension(BaseRuntimeElementCompositeDefinition<?> theSourceDef, IBase theSource, IBase theTarget, RuntimeChildDeclaredExtensionDefinition nextExt, String url) {
    RuntimeChildDeclaredExtensionDefinition sourceDeclaredExt = theSourceDef.getDeclaredExtension(url, "");
    if (sourceDeclaredExt == null) {

      if (theSource instanceof IBaseHasExtensions) {
        for (IBaseExtension<?, ?> next : ((IBaseHasExtensions) theSource).getExtension()) {
          if (next.getUrl().equals(url)) {
            nextExt.getMutator().addValue(theTarget, next.getValue());
          }
        }
      }
      if (theSource instanceof IBaseHasModifierExtensions) {
        for (IBaseExtension<?, ?> next : ((IBaseHasModifierExtensions) theSource).getModifierExtension()) {
          if (next.getUrl().equals(url)) {
            nextExt.getMutator().addValue(theTarget, next.getValue());
          }
        }
      }

    } else {

      List<? extends IBase> values = sourceDeclaredExt.getAccessor().getValues(theSource);
      for (IBase nextElement : values) {
        nextExt.getMutator().addValue(theTarget, nextElement);
      }

    }
  }
}
origin: jamesagnew/hapi-fhir

  @SuppressWarnings("unchecked")
  @Override
  public T invokeClient(String theResponseMimeType, InputStream theResponseInputStream, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws BaseServerResponseException {
    EncodingEnum respType = EncodingEnum.forContentType(theResponseMimeType);
    if (respType == null) {
      throw NonFhirResponseException.newInstance(theResponseStatusCode, theResponseMimeType, theResponseInputStream);
    }
    IParser parser = respType.newParser(myContext);
    RuntimeResourceDefinition type = myContext.getResourceDefinition("Parameters");
    IBaseResource retVal = parser.parseResource(type.getImplementingClass(), theResponseInputStream);
    BaseRuntimeChildDefinition paramChild = type.getChildByName("parameter");
    BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter");
    List<IBase> parameter = paramChild.getAccessor().getValues(retVal);
    if (parameter == null || parameter.isEmpty()) {
      return (T) myContext.getElementDefinition(myType).newInstance();
    }
    IBase param = parameter.get(0);
    List<IBase> meta = paramChildElem.getChildByName("value[x]").getAccessor().getValues(param);
    if (meta.isEmpty()) {
      return (T) myContext.getElementDefinition(myType).newInstance();
    }
    return (T) meta.get(0);
  }
}
origin: jamesagnew/hapi-fhir

/**
 * 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;
}
origin: jamesagnew/hapi-fhir

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();
}
origin: jamesagnew/hapi-fhir

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);
}
origin: jamesagnew/hapi-fhir

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;
}
origin: jamesagnew/hapi-fhir

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;
}
origin: jamesagnew/hapi-fhir

/**
 * 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;
}
ca.uhn.fhir.contextBaseRuntimeChildDefinition$IAccessorgetValues

Popular methods of BaseRuntimeChildDefinition$IAccessor

    Popular in Java

    • Finding current android device location
    • getSharedPreferences (Context)
    • getResourceAsStream (ClassLoader)
    • getSystemService (Context)
    • BorderLayout (java.awt)
      A border layout lays out a container, arranging and resizing its components to fit in five regions:
    • BigDecimal (java.math)
      An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
    • BitSet (java.util)
      The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
    • Modifier (javassist)
      The Modifier class provides static methods and constants to decode class and member access modifiers
    • HttpServlet (javax.servlet.http)
      Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
    • JLabel (javax.swing)
    • Top Vim plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now