Package ca.uhn.fhir.model.api

Examples of ca.uhn.fhir.model.api.IResource


  }

  @Override
  public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse) throws BaseServerResponseException, IOException {
    IResource resource;
    if (requestContainsResource()) {
      resource = parseIncomingServerResource(theRequest);
      TagList tagList = new TagList();
      for (Enumeration<String> enumeration = theRequest.getServletRequest().getHeaders(Constants.HEADER_CATEGORY); enumeration.hasMoreElements();) {
        String nextTagComplete = enumeration.nextElement();
        parseTagValue(tagList, nextTagComplete);
      }
      if (tagList.isEmpty() == false) {
        resource.getResourceMetadata().put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
      }
    } else {
      resource = null;
    }
View Full Code Here


   * @throws IOException 
   */
  protected IResource parseIncomingServerResource(Request theRequest) throws IOException {
    EncodingEnum encoding = RestfulServer.determineRequestEncoding(theRequest);
    IParser parser = encoding.newParser(getContext());
    IResource resource = parser.parseResource(theRequest.getServletRequest().getReader());
    return resource;
  }
View Full Code Here

          reader = null;
        }

        if (reader != null) {
          IParser parser = ct.newParser(theContext);
          IResource outcome = parser.parseResource(reader);
          if (outcome instanceof OperationOutcome) {
            retVal.setOperationOutcome((OperationOutcome) outcome);
          }
        }
View Full Code Here

        if (!nextEntry.getLinkAlternate().isEmpty()) {
          writeAtomLink(eventWriter, "alternate", nextEntry.getLinkAlternate());
        }

        IResource resource = nextEntry.getResource();
        if (resource != null && !resource.isEmpty()) {
          eventWriter.writeStartElement("content");
          eventWriter.writeAttribute("type", "text/xml");
          encodeResourceToXmlStreamWriter(resource, eventWriter, false);
          eventWriter.writeEndElement(); // content
        } else {
View Full Code Here

      pop();
    }

    @Override
    public void wereBack() {
      IResource res = getCurrentElement();
      assert res != null;
      if (res.getId() == null || res.getId().isEmpty()) {
        ourLog.debug("Discarding contained resource with no ID!");
      } else {
        getPreResourceState().getContainedResources().put(res.getId().getValueAsString(), res);
      }
      getPreResourceState().getCurrentElement().getContained().getContainedResources().add(res);
    }
View Full Code Here

      for (ResourceReferenceDt nextRef : myResourceReferences) {
        String ref = nextRef.getReference().getValue();
        if (isNotBlank(ref)) {
          if (ref.startsWith("#")) {
            IResource target = myContainedResources.get(ref.substring(1));
            if (target != null) {
              nextRef.setResource(target);
            } else {
              ourLog.warn("Resource contains unknown local ref: " + ref);
            }
View Full Code Here

   
  }

  @Override
  public Object translateQueryParametersIntoServerArgument(Request theRequest, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
    IResource resource = (IResource) theRequestContents;
    return resource;
  }
View Full Code Here

    List<ResourceReferenceDt> allElements = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, ResourceReferenceDt.class);

    Set<String> allIds = new HashSet<String>();

    for (ResourceReferenceDt next : allElements) {
      IResource resource = next.getResource();
      if (resource != null) {
        if (resource.getId().isEmpty()) {
          resource.setId(new IdDt(myNextContainedId++));
//          resource.setId(new IdDt(UUID.randomUUID().toString()));
        }

        if (!allIds.contains(resource.getId().getValue())) {
          theTarget.getContained().getContainedResources().add(resource);
          allIds.add(resource.getId().getValue());
        }

        next.setReference("#" + resource.getId().getValue());
       
        containResourcesForEncoding(resource, theTarget);
      }
    }
View Full Code Here

        throw new IllegalStateException("Return type of " + IBundleProvider.class.getSimpleName() + " is not supported in clients");
      }
      break;
    }
    case RESOURCE: {
      IResource resource;
      if (myResourceType != null) {
        resource = parser.parseResource(myResourceType, theResponseReader);
      } else {
        resource = parser.parseResource(theResponseReader);
      }
View Full Code Here

        throw new ResourceNotFoundException(theRequest.getId());
      } else if (result.size() > 1) {
        throw new InternalErrorException("Method returned multiple resources");
      }

      IResource resource = result.getResources(0, 1).get(0);

      for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
        IServerInterceptor next = theServer.getInterceptors().get(i);
        boolean continueProcessing = next.outgoingResponse(theRequest, resource, theRequest.getServletRequest(), theRequest.getServletResponse());
        if (!continueProcessing) {
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.api.IResource

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.