private ConfigRepoConfig repoFromRequest(Request req) { String repoId = req.queryParams("repoId"); if (null == repoId) { return null; } ConfigRepoConfig repo = service.getConfigRepo(repoId); if (null == repo) { throw HaltApiResponses.haltBecauseNotFound("Could not find a config-repo with id `%s`", repoId); } return repo; } }
private ConfigRepoConfig repoFromRequest(Request req) { ConfigRepoConfig repo = service.getConfigRepo(req.params(":id")); if (null == repo) { throw HaltApiResponses.haltBecauseNotFound(); } return repo; }
private ConfigRepoWithResult repoWithResultFromRequest(Request req) { ConfigRepoConfig repo = service.getConfigRepo(req.params(":id")); if (null == repo) { throw HaltApiResponses.haltBecauseNotFound(); } PartialConfigParseResult result = dataSource.getLastParseResult(repo.getMaterialConfig()); return new ConfigRepoWithResult(repo, result, isMaterialUpdateInProgress(repo)); }
throw HaltApiResponses.haltBecauseNotFound(e.getMessage()); } catch (InvalidPartialConfigException e) { result.update(Collections.singletonList(e.getErrors()), false);
public String patchUser(Request req, Response res) throws Exception { String username = req.params("login_name"); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); User userFromRequest = buildUserEntityFromRequestBody(req, true); User existingUser = userService.findUserByName(username); if (existingUser.equals(new NullUser())) { throw haltBecauseNotFound(); } if (isRenameAttempted(req, userFromRequest)) { throw haltBecauseRenameOfEntityIsNotSupported("User"); } return saveUserAndRenderResult(req, res, result, existingUser, userFromRequest, username); }