@Override public URI updateTestCase(String id, TestCase testCase) { try { testCaseStore.update(id, 0, testCase); return RestUtilities.createURI(resourceURI, id, versionQueryParam, 0); } catch (IResourceStore.ResourceStoreException e) { log.error(e.getLocalizedMessage(), e); throw new InternalServerErrorException(e); } catch (IResourceStore.ResourceNotFoundException e) { log.debug(e.getLocalizedMessage(), e); throw new NoLogWebApplicationException(Response.Status.NOT_FOUND); } catch (IResourceStore.ResourceModifiedException e) { log.debug(e.getLocalizedMessage(), e); throw new NoLogWebApplicationException(Response.Status.CONFLICT); } }
private static ResourceModifiedException createResourceAlreadyModifiedException(String id, Integer version) { String message = "Resource already modified. Local update is necessary. (id=%s, version=%s)"; message = String.format(message, id, version); return new IResourceStore.ResourceModifiedException(message); }
throw new NotFoundException(e.getLocalizedMessage()); } catch (IResourceStore.ResourceModifiedException e) { log.debug(e.getLocalizedMessage(), e); throw new BadRequestException(e.getLocalizedMessage());
@Override public void deleteTestCase(String id) { try { testCaseStore.delete(id, 0); } catch (IResourceStore.ResourceStoreException e) { log.error(e.getLocalizedMessage(), e); throw new InternalServerErrorException(e); } catch (IResourceStore.ResourceModifiedException e) { log.debug(e.getLocalizedMessage(), e); throw new NoLogWebApplicationException(Response.Status.CONFLICT); } catch (IResourceStore.ResourceNotFoundException e) { log.debug(e.getLocalizedMessage(), e); throw new NoLogWebApplicationException(Response.Status.NOT_FOUND); } } }
private Response throwConflictException(String id, IResourceStore.ResourceModifiedException e) { try { IResourceStore.IResourceId currentId = resourceStore.getCurrentResourceId(id); throw RestUtilities.createConflictException(resourceURI, currentId); } catch (IResourceStore.ResourceNotFoundException e1) { throw new NotFoundException(e.getLocalizedMessage(), e); } }