Package ca.uhn.fhir.model.api

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


    return myResourceName;
  }

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

    BaseHttpClientInvocation retVal = createClientInvocation(theArgs, resource);
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

    return Collections.singleton(RequestType.POST);
  }

  @Override
  protected IResource parseIncomingServerResource(Request theRequest) throws IOException {
    IResource retVal = super.parseIncomingServerResource(theRequest);
   
    if (theRequest.getId() != null && theRequest.getId().hasIdPart()) {
      retVal.setId(theRequest.getId());
    }
   
    return retVal;
  }
View Full Code Here

    return retVal;
  }

  @Override
  public IBundleProvider invokeServer(Request theRequest, Object[] theMethodParams) throws BaseServerResponseException {
    IResource conf = (IResource) invokeServerMethod(theMethodParams);
    return new SimpleBundleProvider(conf);
  }
View Full Code Here

      id = new IdDt(entry.getLinkSelf().getValue());
    } else {
      id = entry.getId();
    }

    IResource resource = entry.getResource();
    if (resource == null && id != null && isNotBlank(id.getResourceType())) {
      String resourceType = id.getResourceType();
      RuntimeResourceDefinition def = myContext.getResourceDefinition(resourceType);
      if (def == null) {
        throw new DataFormatException("Entry references unknown resource type: " + resourceType);
      }
      resource = def.newInstance();
      resource.setId(id);
      entry.setResource(resource);
    }

    if (resource != null) {
      resource.getResourceMetadata().put(ResourceMetadataKeyEnum.DELETED_AT, entry.getDeletedAt());
      resource.getResourceMetadata().put(ResourceMetadataKeyEnum.VERSION_ID, id);
    }
  }
View Full Code Here

        ourLog.trace("No narrative generator specified");
      }

      List<ResourceReferenceDt> references = theContext.newTerser().getAllPopulatedChildElementsOfType(next, ResourceReferenceDt.class);
      for (ResourceReferenceDt nextRef : references) {
        IResource nextRes = nextRef.getResource();
        if (nextRes != null) {
          if (nextRes.getId().hasIdPart()) {
            IdDt id = nextRes.getId().toVersionless();
            if (id.hasResourceType()==false) {
              String resName = theContext.getResourceDefinition(nextRes).getName();
              id = id.withResourceType(resName);
            }
           
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

        if (!nextEntry.getLinkSearch().isEmpty()) {
          writeAtomLink(eventWriter, "search", nextEntry.getLinkSearch());
        }

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

    }
   
    List<IResource> retResources = retVal.getResources(0, retVal.size());
    for (int i =0; i < resources.size(); i++) {
      IdDt oldId = oldIds.get(i);
      IResource newRes = retResources.get(i);
      if (newRes.getId() == null || newRes.getId().isEmpty()) {
        throw new InternalErrorException("Transaction method returned resource at index " + i + " with no id specified - IResource#setId(IdDt)");
      }
     
      if (oldId != null && !oldId.isEmpty()) {
        if (!oldId.getId().equals(newRes.getId())) {
          newRes.getResourceMetadata().put(ResourceMetadataKeyEnum.PREVIOUS_ID, oldId.getId());
        }
      }
    }
   
    return retVal;
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

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.