public WorkspaceImpl(WorkspaceDto workspace) { this( workspace.getId(), workspace.getNamespace(), workspace.getConfig(), workspace.getRuntime(), workspace.getAttributes(), workspace.isTemporary(), workspace.getStatus(), workspace.getLinks(), workspace.getRuntime() != null ? workspace.getRuntime().getMachineToken() : null); }
public RuntimeIdentityDtoImpl(org.eclipse.che.api.workspace.shared.dto.RuntimeIdentityDto origin) { this.ownerId = origin.getOwnerId(); this.envName = origin.getEnvName(); this.workspaceId = origin.getWorkspaceId(); }
public WarningDtoImpl(org.eclipse.che.api.workspace.shared.dto.WarningDto origin) { this.message = origin.getMessage(); this.code = origin.getCode(); }
/** Converts {@link ProjectConfig} to {@link ProjectConfigDto}. */ public static ProjectConfigDto asDto(ProjectConfig projectCfg) { final ProjectConfigDto projectConfigDto = newDto(ProjectConfigDto.class) .withName(projectCfg.getName()) .withDescription(projectCfg.getDescription()) .withPath(projectCfg.getPath()) .withType(projectCfg.getType()) .withAttributes(projectCfg.getAttributes()) .withMixins(projectCfg.getMixins()); final SourceStorage source = projectCfg.getSource(); if (source != null) { projectConfigDto.withSource( newDto(SourceStorageDto.class) .withLocation(source.getLocation()) .withType(source.getType()) .withParameters(source.getParameters())); } return projectConfigDto; }
/** Constructor for creating configuration from DTO object */ public NewProjectConfigImpl(ProjectConfigDto dto) { this( dto.getName(), dto.getPath(), dto.getDescription(), dto.getType(), dto.getSource(), dto.getMixins(), dto.getAttributes(), emptyMap()); }
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 (!"true" .equals(server.getAttributes().get(ServerConfig.INTERNAL_SERVER_ATTRIBUTE))) { filteredServers.put(name, server); } }); machine.withServers(filteredServers); } return workspace; } }
/** Converts {@link ServerConfig} to {@link ServerConfigDto}. */ public static ServerConfigDto asDto(ServerConfig serverConf) { return newDto(ServerConfigDto.class) .withPort(serverConf.getPort()) .withProtocol(serverConf.getProtocol()) .withPath(serverConf.getPath()) .withAttributes(serverConf.getAttributes()); }
/** Converts {@link Command} to {@link CommandDto}. */ public static CommandDto asDto(Command command) { return newDto(CommandDto.class) .withName(command.getName()) .withCommandLine(command.getCommandLine()) .withType(command.getType()) .withAttributes(command.getAttributes()); }
private void relativizeRecipeLinks(EnvironmentDto environment) { if (environment != null) { RecipeDto recipe = environment.getRecipe(); if (recipe != null) { if ("dockerfile".equals(recipe.getType())) { String location = recipe.getLocation(); if (location != null && location.startsWith(apiEndpoint)) { recipe.setLocation(location.substring(apiEndpoint.length())); } } } } }
public RecipeDtoImpl(org.eclipse.che.api.workspace.shared.dto.RecipeDto origin) { this.location = origin.getLocation(); this.type = origin.getType(); this.content = origin.getContent(); this.contentType = origin.getContentType(); }
/** Gets workspace status by id. */ @Override public WorkspaceStatus getStatus(String workspaceId) throws Exception { return getById(workspaceId).getStatus(); }
private void relativizeRecipeLinks(WorkspaceConfigDto config) { if (config != null) { Map<String, EnvironmentDto> environments = config.getEnvironments(); if (environments != null && !environments.isEmpty()) { for (EnvironmentDto environment : environments.values()) { relativizeRecipeLinks(environment); } } } }
/** Converts {@link Server} to {@link ServerDto}. */ public static ServerDto asDto(Server server) { return newDto(ServerDto.class) .withUrl(server.getUrl()) .withStatus(server.getStatus()) .withAttributes(server.getAttributes()); }
/** Converts {@link RuntimeIdentity} to {@link RuntimeIdentityDto}. */ public static RuntimeIdentityDto asDto(RuntimeIdentity identity) { return newDto(RuntimeIdentityDto.class) .withWorkspaceId(identity.getWorkspaceId()) .withEnvName(identity.getEnvName()) .withOwnerId(identity.getOwnerId()); }
public ProjectProblemDtoImpl(org.eclipse.che.api.workspace.shared.dto.ProjectProblemDto origin) { this.message = origin.getMessage(); this.code = origin.getCode(); }
/** Converts {@link Warning} to {@link WarningDto}. */ public static WarningDto asDto(Warning warning) { return newDto(WarningDto.class).withCode(warning.getCode()).withMessage(warning.getMessage()); }
public VolumeDtoImpl(org.eclipse.che.api.workspace.shared.dto.VolumeDto origin) { this.path = origin.getPath(); }
@Override public int hashCode() { int hash = 7; hash = hash * 31 + (error != null ? error.hashCode() : 0); hash = hash * 31 + (runtimeId != null ? runtimeId.hashCode() : 0); hash = hash * 31 + (status != null ? status.hashCode() : 0); hash = hash * 31 + (tooling != null ? tooling.hashCode() : 0); return hash; }
/** Converts {@link Volume} to {@link VolumeDto}. */ public static VolumeDto asDto(Volume volume) { return newDto(VolumeDto.class).withPath(volume.getPath()); }
/** Converts {@link ServerConfig} to {@link ServerConfigDto}. */ public static ServerConfigDto asDto(ServerConfig serverConf) { return newDto(ServerConfigDto.class) .withPort(serverConf.getPort()) .withProtocol(serverConf.getProtocol()) .withPath(serverConf.getPath()) .withAttributes(serverConf.getAttributes()); }