class RuntimeManagementServiceCDI implements RuntimeManagementService {

    @Override
    public Collection<Container> getContainersByServerInstance(final String serverTemplateId,
                                                               final String serverInstanceId) {
        final ServerTemplate serverTemplate = specManagementService.getServerTemplate(serverTemplateId);
        if (serverTemplate == null) {
            throw new RuntimeException("Server template with id " + serverTemplateId + " not found");
        }
        return serverTemplate.getServerInstanceKeys().stream()
                .filter(serverInstanceKey -> serverInstanceKey.getServerInstanceId().equalsIgnoreCase(serverInstanceId))
                .findFirst()
                .map(serverInstanceKey -> Arrays.asList(service.getContainers(serverInstanceKey).getContainers()))
                .orElse(Collections.emptyList());
    }

}