protected void throwUnknownResourceTypeException(String theResourceName) { throw new ResourceNotFoundException("Unknown resource type '" + theResourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet()); }
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId, IBaseOperationOutcome theOperationOutcome) { super(STATUS_CODE, createErrorMessage(theClass, theId), theOperationOutcome); }
@History public List<T> historyInstance(@IdParam IIdType theId) { LinkedList<T> retVal = myIdToHistory.get(theId.getIdPart()); if (retVal == null) { throw new ResourceNotFoundException(theId); } return retVal; }
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId) { super(STATUS_CODE, createErrorMessage(theClass, theId)); }
@Read public Patient find(@IdParam final IdType theId) { if (patients.containsKey(theId.getIdPart())) { return patients.get(theId.getIdPart()); } else { throw new ResourceNotFoundException(theId); } }
public ResourceNotFoundException(IdDt theId) { super(STATUS_CODE, createErrorMessage(theId)); }
@Read(type = OperationDefinition.class) public OperationDefinition readOperationDefinition(@IdParam IdType theId) { if (theId == null || theId.hasIdPart() == false) { throw new ResourceNotFoundException(theId); } List<OperationMethodBinding> operationBindings = myOperationNameToBindings.get(theId.getIdPart()); if (operationBindings != null && !operationBindings.isEmpty()) { return readOperationDefinitionForOperation(operationBindings); } List<SearchMethodBinding> searchBindings = mySearchNameToBindings.get(theId.getIdPart()); if (searchBindings != null && !searchBindings.isEmpty()) { return readOperationDefinitionForNamedSearch(searchBindings); } throw new ResourceNotFoundException(theId); }
public ResourceNotFoundException(Class<? extends IResource> theClass, IIdType theId) { super(STATUS_CODE, createErrorMessage(theClass, theId)); }
@Read(version = true) public IBaseResource read(@IdParam IIdType theId) { TreeMap<Long, T> versions = myIdToVersionToResourceMap.get(theId.getIdPart()); if (versions == null || versions.isEmpty()) { throw new ResourceNotFoundException(theId); } T retVal; if (theId.hasVersionIdPart()) { Long versionId = theId.getVersionIdPartAsLong(); if (!versions.containsKey(versionId)) { throw new ResourceNotFoundException(theId); } else { T resource = versions.get(versionId); if (resource == null) { throw new ResourceGoneException(theId); } retVal = resource; } } else { retVal = versions.lastEntry().getValue(); } myReadCount.incrementAndGet(); return retVal; }
public ResourceNotFoundException(Class<? extends IResource> theClass, IIdType theId, IBaseOperationOutcome theOperationOutcome) { super(STATUS_CODE, createErrorMessage(theClass, theId), theOperationOutcome); }
protected ResourceTable readEntityLatestVersion(IIdType theId) { ResourceTable entity = myEntityManager.find(ResourceTable.class, myIdHelperService.translateForcedIdToPid(getResourceName(), theId.getIdPart())); if (entity == null) { throw new ResourceNotFoundException(theId); } validateGivenIdIsAppropriateToRetrieveResource(theId, entity); return entity; }
public ResourceNotFoundException(IIdType theId) { super(STATUS_CODE, createErrorMessage(theId)); }
public void throwNotFoundIfAppropriate() { if (isFound() == false) { throw new ResourceNotFoundException("Unable to find code[" + getSearchedForCode() + "] in system[" + getSearchedForSystem() + "]"); } }
public ResourceNotFoundException(IIdType theId, IBaseOperationOutcome theOperationOutcome) { super(STATUS_CODE, createErrorMessage(theId), theOperationOutcome); }
public static void validateResourceType(BaseHasResource theEntity, String theResourceName) { if (!theResourceName.equals(theEntity.getResourceType())) { throw new ResourceNotFoundException( "Resource with ID " + theEntity.getIdDt().getIdPart() + " exists but it is not of type " + theResourceName + ", found resource of type " + theEntity.getResourceType()); } } }
public ResourceNotFoundException(Class<? extends IResource> theClass, IIdType theId) { super(STATUS_CODE, createErrorMessage(theClass, theId)); }
@Delete() public void deletePatient(@IdParam IdType theId) { // .. Delete the patient .. if (couldntFindThisId) { throw new ResourceNotFoundException("Unknown version"); } if (conflictHappened) { throw new ResourceVersionConflictException("Couldn't delete because [foo]"); } // otherwise, delete was successful return; // can also return MethodOutcome } //END SNIPPET: delete
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId) { super(STATUS_CODE, createErrorMessage(theClass, theId)); }
private void validateGivenIdIsAppropriateToRetrieveResource(IIdType theId, BaseHasResource entity) { if (entity.getForcedId() != null) { if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) { if (theId.isIdPartValidLong()) { // This means that the resource with the given numeric ID exists, but it has a "forced ID", meaning that // as far as the outside world is concerned, the given ID doesn't exist (it's just an internal pointer // to the // forced ID) throw new ResourceNotFoundException(theId); } } } }
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId, IBaseOperationOutcome theOperationOutcome) { super(STATUS_CODE, createErrorMessage(theClass, theId), theOperationOutcome); }