public void modifyEnvironments(Username username, HttpOperationResult operationResult, List<String> uuids, List<TriStateSelection> selections) { if (!hasOperatePermission(username, operationResult)) { return; } List<AgentInstance> agents = new ArrayList<>(); if (!populateAgentInstancesForUUIDs(operationResult, uuids, agents)) { return; } try { environmentConfigService.modifyEnvironments(agents, selections); operationResult.ok(String.format("Environment(s) modified on %s agent(s)", uuids.size())); } catch (Exception e) { operationResult.notAcceptable("Could not modify environments:" + e.getMessage(), HealthStateType.general(HealthStateScope.GLOBAL)); } }