Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.RuntimeResourceDefinition


        ourLog.debug("Scanning public method: {}#{}", theProvider.getClass(), m.getName());

        BaseMethodBinding foundMethodBinding = BaseMethodBinding.bindMethod(m, myFhirContext, theProvider);
        if (foundMethodBinding != null) {
         
          RuntimeResourceDefinition definition = myFhirContext.getResourceDefinition(foundMethodBinding.getResourceName());
          ResourceBinding resourceBinding;
          if (myResourceNameToProvider.containsKey(definition.getName())) {
            resourceBinding = myResourceNameToProvider.get(definition.getName());
          } else {
            resourceBinding = new ResourceBinding();
            String resourceName = definition.getName();
            resourceBinding.setResourceName(resourceName);
            myResourceNameToProvider.put(resourceName, resourceBinding);
          }

          resourceBinding.addMethod(foundMethodBinding);
View Full Code Here


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

      String resourceName = next.getResourceName();
      RuntimeResourceDefinition def = myRestfulServer.getFhirContext().getResourceDefinition(resourceName);
      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

        theProvider);

    Delete deleteAnnotation = theMethod.getAnnotation(Delete.class);
    Class<? extends IResource> resourceType = deleteAnnotation.type();
    if (resourceType != IResource.class) {
      RuntimeResourceDefinition def = theContext.getResourceDefinition(resourceType);
      myResourceName = def.getName();
    } else {
      if (theProvider != null && theProvider instanceof IResourceProvider) {
        RuntimeResourceDefinition def = theContext.getResourceDefinition(((IResourceProvider) theProvider).getResourceType());
        myResourceName = def.getName();
      } else {
        throw new ConfigurationException("Can not determine resource type for method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getCanonicalName() + " - Did you forget to include the resourceType() value on the @"
            + Delete.class.getSimpleName() + " method annotation?");
      }
    }
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

      writeAuthor(nextEntry, eventWriter);

      IResource resource = nextEntry.getResource();
      if (resource != null && !resource.isEmpty()) {
        RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource);
        encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content", false);
      }

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

  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

    BaseHttpClientInvocation invocation = CreateMethodBinding.createCreateInvocation(theResource, myContext);
    if (isKeepResponses()) {
      myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding());
    }

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

    OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);

    MethodOutcome resp = invokeClient(binding, invocation, myLogRequestAndResponse);
    return resp;
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

    BaseHttpClientInvocation invocation = UpdateMethodBinding.createUpdateInvocation(theResource, theIdDt, null, myContext);
    if (isKeepResponses()) {
      myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding());
    }

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

    OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);
    MethodOutcome resp = invokeClient(binding, invocation, myLogRequestAndResponse);
    return resp;
  }
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.