Search in sources :

Example 1 with ServerDto

use of org.eclipse.che.api.workspace.shared.dto.ServerDto in project che-server by eclipse-che.

the class WorkspaceService method filterServers.

private WorkspaceDto filterServers(WorkspaceDto workspace, boolean includeInternal) {
    // no runtime - nothing to filter
    if (workspace.getRuntime() == null) {
        return workspace;
    }
    // if it is needed to include internal there is nothing to filter
    if (includeInternal) {
        return workspace;
    }
    for (MachineDto machine : workspace.getRuntime().getMachines().values()) {
        Map<String, ServerDto> filteredServers = new HashMap<>();
        machine.getServers().forEach((name, server) -> {
            if (!ServerConfig.isInternal(server.getAttributes())) {
                filteredServers.put(name, server);
            }
        });
        machine.withServers(filteredServers);
    }
    return workspace;
}
Also used : ServerDto(org.eclipse.che.api.workspace.shared.dto.ServerDto) MachineDto(org.eclipse.che.api.workspace.shared.dto.MachineDto) HashMap(java.util.HashMap)

Example 2 with ServerDto

use of org.eclipse.che.api.workspace.shared.dto.ServerDto in project devspaces-images by redhat-developer.

the class WorkspaceService method filterServers.

private WorkspaceDto filterServers(WorkspaceDto workspace, boolean includeInternal) {
    // no runtime - nothing to filter
    if (workspace.getRuntime() == null) {
        return workspace;
    }
    // if it is needed to include internal there is nothing to filter
    if (includeInternal) {
        return workspace;
    }
    for (MachineDto machine : workspace.getRuntime().getMachines().values()) {
        Map<String, ServerDto> filteredServers = new HashMap<>();
        machine.getServers().forEach((name, server) -> {
            if (!ServerConfig.isInternal(server.getAttributes())) {
                filteredServers.put(name, server);
            }
        });
        machine.withServers(filteredServers);
    }
    return workspace;
}
Also used : ServerDto(org.eclipse.che.api.workspace.shared.dto.ServerDto) MachineDto(org.eclipse.che.api.workspace.shared.dto.MachineDto) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)2 MachineDto (org.eclipse.che.api.workspace.shared.dto.MachineDto)2 ServerDto (org.eclipse.che.api.workspace.shared.dto.ServerDto)2