/** Returns the list of workspaces names that belongs to the user. */ @Override public List<String> getAll() throws Exception { List<WorkspaceDto> workspaces = requestFactory.fromUrl(getBaseUrl()).request().asList(WorkspaceDto.class); return workspaces.stream().map(ws -> ws.getConfig().getName()).collect(Collectors.toList()); }
@PUT @Path("/{id}") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) @ApiOperation( value = "Update the workspace by replacing all the existing data with update", notes = "This operation can be performed only by the workspace owner") @ApiResponses({ @ApiResponse(code = 200, message = "The workspace successfully updated"), @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"), @ApiResponse(code = 403, message = "The user does not have access to update the workspace"), @ApiResponse( code = 409, message = "Conflict error occurred during workspace update" + "(e.g. Workspace with such name already exists)"), @ApiResponse(code = 500, message = "Internal server error occurred") }) public WorkspaceDto update( @ApiParam("The workspace id") @PathParam("id") String id, @ApiParam(value = "The workspace update", required = true) WorkspaceDto update) throws BadRequestException, ServerException, ForbiddenException, NotFoundException, ConflictException { requiredNotNull(update, "Workspace configuration"); relativizeRecipeLinks(update.getConfig()); return asDtoWithLinksAndToken(doUpdate(id, update)); }
public WorkspaceDtoImpl(org.eclipse.che.api.workspace.shared.dto.WorkspaceDto origin) { java.util.Map<java.lang.String, java.lang.String> linksIn = origin.getLinks(); if (linksIn != null) { java.util.Map<java.lang.String, java.lang.String> linksOut = new java.util.HashMap<java.lang.String, java.lang.String>(); for (java.util.Map.Entry<String, java.lang.String> entry0 : linksIn.entrySet()) { java.lang.String linksIn_ = entry0.getValue(); linksOut.put(entry0.getKey(), linksIn_); } this.links = linksOut; } java.util.Map<java.lang.String, java.lang.String> attributesIn = origin.getAttributes(); if (attributesIn != null) { java.util.Map<java.lang.String, java.lang.String> attributesOut = new java.util.HashMap<java.lang.String, java.lang.String>(); for (java.util.Map.Entry<String, java.lang.String> entry0 : attributesIn.entrySet()) { java.lang.String attributesIn_ = entry0.getValue(); attributesOut.put(entry0.getKey(), attributesIn_); } this.attributes = attributesOut; } this.namespace = origin.getNamespace(); this.temporary = origin.isTemporary(); this.id = origin.getId(); this.status = origin.getStatus(); org.eclipse.che.api.workspace.shared.dto.RuntimeDto runtimeIn = origin.getRuntime(); this.runtime = runtimeIn == null ? null : new RuntimeDtoImpl(runtimeIn); org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto configIn = origin.getConfig(); this.config = configIn == null ? null : new WorkspaceConfigDtoImpl(configIn); }
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); }