private void validateHaveBundleProvider(String thePagingAction, IBundleProvider theBundleProvider) { // Return an HTTP 410 if the search is not known if (theBundleProvider == null) { ourLog.info("Client requested unknown paging ID[{}]", thePagingAction); String msg = getContext().getLocalizer().getMessage(PageMethodBinding.class, "unknownSearchId", thePagingAction); throw new ResourceGoneException(msg); } }
@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; }
@Override public IBaseResource readByPid(Long thePid) { StopWatch w = new StopWatch(); Optional<ResourceTable> entity = myResourceTableDao.findById(thePid); if (!entity.isPresent()) { throw new ResourceNotFoundException("No resource found with PID " + thePid); } if (entity.get().getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.get().getDeleted()).getValueAsString()); } T retVal = toResource(myResourceType, entity.get(), null, false); ourLog.debug("Processed read on {} in {}ms", thePid, w.getMillis()); return retVal; }
ourLog.info("Client requested unknown paging ID[{}]", theUuid); String msg = myContext.getLocalizer().getMessage(PageMethodBinding.class, "unknownSearchId", theUuid); throw new ResourceGoneException(msg);
@Override public T read(IIdType theId, RequestDetails theRequestDetails, boolean theDeletedOk) { validateResourceTypeAndThrowIllegalArgumentException(theId); // Notify interceptors if (theRequestDetails != null) { ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), theId); RestOperationTypeEnum operationType = theId.hasVersionIdPart() ? RestOperationTypeEnum.VREAD : RestOperationTypeEnum.READ; notifyInterceptors(operationType, requestDetails); } StopWatch w = new StopWatch(); BaseHasResource entity = readEntity(theId); validateResourceType(entity); T retVal = toResource(myResourceType, entity, null, false); if (theDeletedOk == false) { if (entity.getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.getDeleted()).getValueAsString()); } } ourLog.debug("Processed read on {} in {}ms", theId.getValue(), w.getMillisAndRestart()); return retVal; }
private void validateHaveBundleProvider(String thePagingAction, IBundleProvider theBundleProvider) { // Return an HTTP 410 if the search is not known if (theBundleProvider == null) { ourLog.info("Client requested unknown paging ID[{}]", thePagingAction); String msg = getContext().getLocalizer().getMessage(PageMethodBinding.class, "unknownSearchId", thePagingAction); throw new ResourceGoneException(msg); } }
@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; }
@Override public IBaseResource readByPid(Long thePid) { StopWatch w = new StopWatch(); Optional<ResourceTable> entity = myResourceTableDao.findById(thePid); if (!entity.isPresent()) { throw new ResourceNotFoundException("No resource found with PID " + thePid); } if (entity.get().getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.get().getDeleted()).getValueAsString()); } T retVal = toResource(myResourceType, entity.get(), null, false); ourLog.debug("Processed read on {} in {}ms", thePid, w.getMillis()); return retVal; }
ourLog.info("Client requested unknown paging ID[{}]", theUuid); String msg = this.myContext.getLocalizer().getMessage(PageMethodBinding.class, "unknownSearchId", new Object[]{theUuid}); throw new ResourceGoneException(msg);
ourLog.info("Client requested unknown paging ID[{}]", theUuid); String msg = myContext.getLocalizer().getMessage(PageMethodBinding.class, "unknownSearchId", theUuid); throw new ResourceGoneException(msg);
@Override public T read(IIdType theId, RequestDetails theRequestDetails, boolean theDeletedOk) { validateResourceTypeAndThrowIllegalArgumentException(theId); // Notify interceptors if (theRequestDetails != null) { ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), theId); RestOperationTypeEnum operationType = theId.hasVersionIdPart() ? RestOperationTypeEnum.VREAD : RestOperationTypeEnum.READ; notifyInterceptors(operationType, requestDetails); } StopWatch w = new StopWatch(); BaseHasResource entity = readEntity(theId); validateResourceType(entity); T retVal = toResource(myResourceType, entity, null, false); if (theDeletedOk == false) { if (entity.getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.getDeleted()).getValueAsString()); } } ourLog.debug("Processed read on {} in {}ms", theId.getValue(), w.getMillisAndRestart()); return retVal; }