Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.RuntimeResourceDefinition


  public void encodeResourceToWriter(IResource theResource, Writer theWriter) throws IOException {
    Validate.notNull(theResource, "Resource can not be null");

    JsonGenerator eventWriter = createJsonGenerator(theWriter);

    RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
    encodeResourceToJsonStreamWriter(resDef, theResource, eventWriter, null, false);
    eventWriter.flush();
  }
View Full Code Here


    JsonValue resourceTypeObj = object.get("resourceType");
    assertObjectOfType(resourceTypeObj, JsonValue.ValueType.STRING, "resourceType");
    String resourceType = ((JsonString) resourceTypeObj).getString();

    RuntimeResourceDefinition def;
    if (theResourceType != null) {
      def = myContext.getResourceDefinition(theResourceType);
    } else {
      def = myContext.getResourceDefinition(resourceType);
    }

    ParserState<? extends IResource> state = ParserState.getPreResourceInstance(def.getImplementingClass(), myContext, true);
    state.enteringNewElement(null, def.getName());

    parseChildren(object, state);

    state.endingElement();
View Full Code Here

          String resourceName = foundMethodBinding.getResourceName();
          ResourceBinding resourceBinding;
          if (resourceName == null) {
            resourceBinding = myNullResourceBinding;
          } else {
            RuntimeResourceDefinition definition = myFhirContext.getResourceDefinition(resourceName);
            if (myResourceNameToProvider.containsKey(definition.getName())) {
              resourceBinding = myResourceNameToProvider.get(definition.getName());
            } else {
              resourceBinding = new ResourceBinding();
              resourceBinding.setResourceName(resourceName);
              myResourceNameToProvider.put(resourceName, resourceBinding);
            }
View Full Code Here

    if (tl == null) {
      tl = new TagList();
      ResourceMetadataKeyEnum.TAG_LIST.put(theResource, tl);
    }

    RuntimeResourceDefinition nextDef = theContext.getResourceDefinition(theResource);
    String profile = nextDef.getResourceProfile();
    if (isNotBlank(profile)) {
      tl.add(new Tag(Tag.HL7_ORG_PROFILE_TAG, profile, null));
    }
  }
View Full Code Here

    }

    if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) {
      for (int i = 0; i < resourceList.size(); i++) {
        IResource nextRes = resourceList.get(i);
        RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes);
        if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) {
          addProfileToBundleEntry(theServer.getFhirContext(), nextRes);
        }
      }
    }
View Full Code Here

      String fullId = theResource.getId().withServerBase(theServerBase, resName);
      theHttpResponse.addHeader(Constants.HEADER_CONTENT_LOCATION, fullId);
    }

    if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) {
      RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(theResource);
      if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) {
        addProfileToBundleEntry(theServer.getFhirContext(), theResource);
      }
    }

    if (theResource instanceof Binary) {
View Full Code Here

      }
      myId = getPreferredId(myResource, myId);

      BaseHttpClientInvocation invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myId, myContext);

      RuntimeResourceDefinition def = myContext.getResourceDefinition(myResource);
      final String resourceName = def.getName();

      OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);

      Map<String, List<String>> params = new HashMap<String, List<String>>();
      return invoke(params, binding, invocation);
View Full Code Here

        throw new InvalidRequestException("No ID supplied for resource to update, can not invoke server");
      }

      BaseHttpClientInvocation invocation = MethodUtil.createUpdateInvocation(myResource, myResourceBody, myId, myContext);

      RuntimeResourceDefinition def = myContext.getResourceDefinition(myResource);
      final String resourceName = def.getName();

      OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);

      Map<String, List<String>> params = new HashMap<String, List<String>>();
      return invoke(params, binding, invocation);
View Full Code Here

      return this;
    }

    private void setType(Class<? extends IResource> theResourceType) {
      myResourceType = theResourceType;
      RuntimeResourceDefinition definition = myContext.getResourceDefinition(theResourceType);
      myResourceName = definition.getName();
    }
View Full Code Here

  }

  private FhirContext myContext;

  public BaseRuntimeChildDefinition getDefinition(Class<? extends IResource> theResourceType, String thePath) {
    RuntimeResourceDefinition def = myContext.getResourceDefinition(theResourceType);

    BaseRuntimeElementCompositeDefinition<?> currentDef = def;

    List<String> parts = Arrays.asList(thePath.split("\\."));
    List<String> subList = parts.subList(1, parts.size());
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.context.RuntimeResourceDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.