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

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


      for (Object next : ((Collection<?>) response)) {
        retVal.add((IResource) next);
      }
      return retVal;
    } else {
      throw new InternalErrorException("Unexpected return type: " + response.getClass().getCanonicalName());
    }
  }
View Full Code Here


      break;
    case RESOURCE:
      if (result.size() == 0) {
        throw new ResourceNotFoundException(theRequest.getId());
      } else if (result.size() > 1) {
        throw new InternalErrorException("Method returned multiple resources");
      }
      streamResponseAsResource(theServer, theResponse, result.get(0), responseEncoding, prettyPrint, requestIsBrowser, narrativeMode);
      break;
    }
  }
View Full Code Here

        return null;
      } else {
        return (IdDt) retValObj;
      }
    }
    throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + IdDt.class.getCanonicalName());
  }
View Full Code Here

        return null;
      } else {
        return (InstantDt) retValObj;
      }
    }
    throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName());
  }
View Full Code Here

        return null;
      } else {
        return (TagList) retValObj;
      }
    }
    throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + TagList.class.getCanonicalName());
  }
View Full Code Here

            b.append('/');
            b.append(Constants.PARAM_HISTORY);
            b.append('/');
            b.append(versionId.getValue());
          } else {
            throw new InternalErrorException("Server did not provide a VERSION_ID in the resource metadata for resource with ID " + resId);
          }
        }

        InstantDt published = getInstantFromMetadataOrNullIfNone(next.getResourceMetadata(), ResourceMetadataKeyEnum.PUBLISHED);
        if (published == null) {
View Full Code Here

    List<IResource> resources = toResourceList(response);
    int index=0;
    for (IResource nextResource : resources) {
      if (nextResource.getId() == null || nextResource.getId().isEmpty()) {
        throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))");
      }
      IdDt versionId = getIdFromMetadataOrNullIfNone(nextResource.getResourceMetadata(),ResourceMetadataKeyEnum.VERSION_ID);
      if (versionId == null||versionId.isEmpty()) {
        throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#Resource.getResourceMetadata().put(ResourceMetadataKeyEnum.VERSION_ID, Object))");
      }
      index++;
    }
   
    return resources;
View Full Code Here

        throw new InvalidRequestException("Multiple values detected");
      }
     
      dt.setValueAsQueryToken(theString.get(0).get(0));
    } catch (InstantiationException e) {
      throw new InternalErrorException(e);
    } catch (IllegalAccessException e) {
      throw new InternalErrorException(e);
    } catch (SecurityException e) {
      throw new InternalErrorException(e);
    }
    return dt;
  }
View Full Code Here

    Collection<PathSpecification> retValCollection = null;
    if (myInstantiableCollectionType!=null) {
    try {
      retValCollection = myInstantiableCollectionType.newInstance();
    } catch (Exception e) {
      throw new InternalErrorException("Failed to instantiate " + myInstantiableCollectionType.getName(), e);
    }
    }
   
    for (List<String> nextParamList : theString) {
      if (nextParamList.isEmpty()) {
View Full Code Here

      return;
    }

    if (getResourceOperationType() == RestfulOperationTypeEnum.CREATE) {
      if (response == null) {
        throw new InternalErrorException("Method " + getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName() + " returned null, which is not allowed for create operation");
      }
      theResponse.setStatus(Constants.STATUS_HTTP_201_CREATED);
      addLocationHeader(theRequest, theResponse, response);
    } else if (response == null) {
      if (isReturnVoid() == false) {
        throw new InternalErrorException("Method " + getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName() + " returned null");
      }
      theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT);
    } else {
      if (response.getOperationOutcome() == null) {
        theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT);
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.