Package ca.uhn.fhir.model.api

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


    return myResourceName;
  }

  @Override
  public BaseClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException {
    IResource resource = (IResource) theArgs[myResourceParameterIndex];
    if (resource == null) {
      throw new NullPointerException("Resource can not be null");
    }

    RuntimeResourceDefinition def = getContext().getResourceDefinition(resource);
View Full Code Here


        }
      }
      break;
    }
    case RESOURCE: {
      IResource resource = parser.parseResource(theResponseReader);
      switch (getMethodReturnType()) {
      case BUNDLE:
        return Bundle.withSingleResource(resource);
      case LIST_OF_RESOURCES:
        return Collections.singletonList(resource);
View Full Code Here

      writeOptionalTagWithTextNode(eventWriter, "updated", nextEntry.getUpdated());
      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
    }
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

        }

        eventWriter.writeStartElement("content");
        eventWriter.writeAttribute("type", "text/xml");

        IResource resource = nextEntry.getResource();
        encodeResourceToXmlStreamWriter(resource, eventWriter, false);

        eventWriter.writeEndElement(); // content
        eventWriter.writeEndElement(); // entry
      }
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 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

    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

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.