Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.RuntimeResourceDefinition


      }

      writeAuthor(nextEntry, eventWriter);

      IResource resource = nextEntry.getResource();
      RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource);
      encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content");

      eventWriter.writeEnd(); // entry object
    }
    eventWriter.writeEnd(); // entry array
View Full Code Here


  }

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

    RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);

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

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

    extractAndWriteExtensionsAsDirectChild(theResource, theEventWriter, resDef, theResDef, theResource);
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);
    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 void findResourceMethods(IResourceProvider theProvider) throws Exception {

    Class<? extends IResource> resourceType = theProvider.getResourceType();
    RuntimeResourceDefinition definition = myFhirContext.getResourceDefinition(resourceType);

    ResourceBinding r = new ResourceBinding();
    r.setResourceProvider(theProvider);
    r.setResourceName(definition.getName());
    myResourceNameToProvider.put(definition.getName(), r);

    ourLog.info("Scanning type for RESTful methods: {}", theProvider.getClass());

    Class<?> clazz = theProvider.getClass();
    for (Method m : clazz.getDeclaredMethods()) {
View Full Code Here

    IResource resource = (IResource) theArgs[myResourceParameterIndex];
    if (resource == null) {
      throw new NullPointerException("Resource can not be null");
    }

    RuntimeResourceDefinition def = getContext().getResourceDefinition(resource);
    String resourceName = def.getName();

    return createClientInvocation(theArgs, resource, resourceName);
  }
View Full Code Here

      BundleEntry entry = new BundleEntry();
      bundle.getEntries().add(entry);

      entry.setResource(next);

      RuntimeResourceDefinition def = getContext().getResourceDefinition(next);

      if (next.getId() != null && StringUtils.isNotBlank(next.getId().getValue())) {
        entry.getId().setValue(next.getId().getValue());
        entry.getTitle().setValue(def.getName() + " " + next.getId().getValue());

        StringBuilder b = new StringBuilder();
        b.append(theServerBase);
        b.append('/');
        b.append(def.getName());
        b.append('/');
        String resId = next.getId().getValue();
        b.append(resId);

        /*
 
View Full Code Here

      Set<RestfulOperationTypeEnum> resourceOps = new HashSet<RestfulOperationTypeEnum>();
      RestResource resource = rest.addResource();

      Class<? extends IResource> resourceType = next.getResourceProvider().getResourceType();
      RuntimeResourceDefinition def = myRestfulServer.getFhirContext().getResourceDefinition(resourceType);
      resource.getType().setValue(def.getName());
      resource.getProfile().setId(new IdDt(def.getResourceProfile()));

      Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String, Conformance.RestResourceSearchParam>();
      for (BaseMethodBinding nextMethodBinding : next.getMethodBindings()) {
        RestfulOperationTypeEnum resOp = nextMethodBinding.getResourceOperationType();
        if (resOp != null) {
View Full Code Here

    return Profile.class;
  }
 
  @Read()
  public Profile getProfileById(@IdParam IdDt theId) {
    RuntimeResourceDefinition retVal = myContext.getResourceDefinitionById(theId.getValue());
    if (retVal==null) {
      return null;
    }
    return retVal.toProfile();
  }
View Full Code Here

      writeOptionalTagWithTextNode(eventWriter, "published", nextEntry.getPublished());

      writeAuthor(nextEntry, eventWriter);

      IResource resource = nextEntry.getResource();
      RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource);
      encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content");

      eventWriter.writeEnd(); // entry object
    }
    eventWriter.writeEnd(); // entry array
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.