@Override public int hashCode() { int hash = 7; hash = hash * 31 + (error != null ? error.hashCode() : 0); hash = hash * 31 + (status != null ? status.hashCode() : 0); hash = hash * 31 + (prevStatus != null ? prevStatus.hashCode() : 0); hash = hash * 31 + (workspaceId != null ? workspaceId.hashCode() : 0); return hash; }
@GET @Path("/namespace/{namespace:.*}") @Produces(APPLICATION_JSON) @ApiOperation( value = "Get workspaces by given namespace", notes = "This operation can be performed only by authorized user", response = WorkspaceDto.class, responseContainer = "List") @ApiResponses({ @ApiResponse(code = 200, message = "The workspaces successfully fetched"), @ApiResponse(code = 500, message = "Internal server error occurred during workspaces fetching") }) public List<WorkspaceDto> getByNamespace( @ApiParam("Workspace status") @QueryParam("status") String status, @ApiParam("The namespace") @PathParam("namespace") String namespace) throws ServerException, BadRequestException { return withLinks( Pages.stream( (maxItems, skipCount) -> workspaceManager.getByNamespace(namespace, false, maxItems, skipCount)) .filter(ws -> status == null || status.equalsIgnoreCase(ws.getStatus().toString())) .map(DtoConverter::asDto) .collect(toList())); }
/** {@inheritDoc} */ @Override public final void update(@NotNull ActionEvent event) { Presentation presentation = event.getPresentation(); boolean isWorkspaceRunning = false; if (appContext.get() != null) { Workspace workspace = appContext.get().getWorkspace(); isWorkspaceRunning = workspace != null && WorkspaceStatus.RUNNING.equals(workspace.getStatus()); } boolean inPerspective = perspectives == null || perspectives.isEmpty() ? true : perspectives.contains(perspectiveManager.get().getPerspectiveId()); presentation.setEnabledAndVisible(inPerspective && isWorkspaceRunning); if (inPerspective && isWorkspaceRunning) { updateInPerspective(event); } }
@Override public int hashCode() { int hash = 7; ensureLinks(); hash = hash * 31 + (links != null ? links.hashCode() : 0); ensureAttributes(); hash = hash * 31 + (attributes != null ? attributes.hashCode() : 0); hash = hash * 31 + (namespace != null ? namespace.hashCode() : 0); hash = hash * 31 + java.lang.Boolean.valueOf(temporary).hashCode(); hash = hash * 31 + (id != null ? id.hashCode() : 0); hash = hash * 31 + (status != null ? status.hashCode() : 0); hash = hash * 31 + (runtime != null ? runtime.hashCode() : 0); hash = hash * 31 + (config != null ? config.hashCode() : 0); return hash; }
.getItems() .stream() .filter(ws -> status == null || status.equalsIgnoreCase(ws.getStatus().toString())) .map(DtoConverter::asDto) .collect(toList()))
@Override public void onEvent(WorkspaceStatusEvent event) { if (WorkspaceStatus.STOPPED.equals(event.getStatus())) { tokenRegistry.removeTokens(event.getWorkspaceId()); } }
if (!this.status.equals(other.status)) { return false;
long currentlyUsedRamMB = 0; for (WorkspaceImpl activeWorkspace : activeWorkspaces) { if (WorkspaceStatus.STARTING.equals(activeWorkspace.getStatus())) {
@Override public Path getProjectsRoot() { // default root (backward compatible solution) Path projectsRoot = Path.valueOf("/projects"); if (workspace != null && workspace.getStatus().equals(WorkspaceStatus.RUNNING)) { String machineName = wsAgentServerUtilProvider.get().getWsAgentServerMachine().get().getName(); String activeEnv = workspace.getRuntime().getActiveEnv(); EnvironmentImpl environment = workspace.getConfig().getEnvironments().get(activeEnv); VolumeImpl vol = null; if (environment != null) { vol = environment.getMachines().get(machineName).getVolume("projects"); } // if voulme exists return its path, otherwise use backward compatible path (/projects) if (vol != null) { projectsRoot = Path.valueOf(vol.getPath()); } } Log.debug( AppContextImpl.class, "Project Root: " + projectsRoot + " workspace: " + workspace.getConfig().getName()); return projectsRoot; }