Package ca.uhn.fhir.rest.server.exceptions

Examples of ca.uhn.fhir.rest.server.exceptions.InternalErrorException


      if (respEntity != null) {
      final byte[] bytes;
      try {
        bytes = IOUtils.toByteArray(respEntity.getContent());
      } catch (IllegalStateException e) {
        throw new InternalErrorException(e);
      }

      myLog.info("Client response body:\n{}", new String(bytes));
      theResponse.setEntity(new MyEntityWrapper(respEntity, bytes));
      } else {
View Full Code Here


   
    Object response= invokeServerMethod(theMethodParams);
    IBundleProvider retVal = toResourceList(response);
   
    if (retVal.size() != resources.size()) {
      throw new InternalErrorException("Transaction bundle contained " + resources.size() + " entries, but server method response contained " + retVal.size() + " entries (must be the same)");
    }
   
    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());
View Full Code Here

      public List<IResource> getResources(int theFromIndex, int theToIndex) {
        List<IResource> retVal = resources.getResources(theFromIndex, theToIndex);
        int index = theFromIndex;
        for (IResource nextResource : retVal) {
          if (nextResource.getId() == null || isBlank(nextResource.getId().getIdPart())) {
            throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))");
          }
          if (isBlank(nextResource.getId().getVersionIdPart())) {
            IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get(nextResource);
            if (versionId == null || versionId.isEmpty()) {
              throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#setId(IdDt))");
            }
          }
          index++;
        }
        return retVal;
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.rest.server.exceptions.InternalErrorException

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.