Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.RuntimeResourceDefinition


  private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IResource theResource, JsonGenerator theEventWriter, String theObjectNameOrNull, boolean theIsSubElementWithinResource) throws IOException {
    if (!theIsSubElementWithinResource) {
      super.containResourcesForEncoding(theResource);
    }

    RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);

    if (theObjectNameOrNull == null) {
      theEventWriter.writeStartObject();
    } else {
      theEventWriter.writeStartObject(theObjectNameOrNull);
    }

    theEventWriter.write("resourceType", resDef.getName());
    if (theIsSubElementWithinResource && theResource.getId() != null && isNotBlank(theResource.getId().getValue())) {
      theEventWriter.write("id", theResource.getId().getValue());
    }

    if (theResource instanceof Binary) {
View Full Code Here


  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

  }

  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

      return getDefinition(cmp, theSubList.subList(1, theSubList.size()));
    }
  }

  public List<Object> getValues(IResource theResource, String thePath) {
    RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);

    BaseRuntimeElementCompositeDefinition<?> currentDef = def;
    Object currentObj = theResource;

    List<String> parts = Arrays.asList(thePath.split("\\."));
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

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.