public WorkspaceConfigImpl build() { return new WorkspaceConfigImpl( name, description, defaultEnvName, commands, projects, environments, attributes); }
this.workspaceConfig = new WorkspaceConfigImpl(workspaceConfig);
/** * Updates an existing workspace with a new configuration. * * <p> * * <p>Replace strategy is used for workspace update, it means that existing workspace data will be * replaced with given {@code update}. * * @param update workspace update * @return updated instance of the workspace * @throws NullPointerException when either {@code workspaceId} or {@code update} is null * @throws NotFoundException when workspace with given id doesn't exist * @throws ConflictException when any conflict occurs (e.g Workspace with such name already exists * in {@code namespace}) * @throws ServerException when any other error occurs */ public WorkspaceImpl updateWorkspace(String id, Workspace update) throws ConflictException, ServerException, NotFoundException, ValidationException { requireNonNull(id, "Required non-null workspace id"); requireNonNull(update, "Required non-null workspace update"); requireNonNull(update.getConfig(), "Required non-null workspace configuration update"); validator.validateConfig(update.getConfig()); validator.validateAttributes(update.getAttributes()); WorkspaceImpl workspace = workspaceDao.get(id); workspace.setConfig(new WorkspaceConfigImpl(update.getConfig())); workspace.setAttributes(update.getAttributes()); workspace.getAttributes().put(UPDATED_ATTRIBUTE_NAME, Long.toString(currentTimeMillis())); workspace.setTemporary(update.isTemporary()); return normalizeState(workspaceDao.update(workspace), true); }
public WorkspaceImpl( String id, Account account, WorkspaceConfig config, Runtime runtime, Map<String, String> attributes, boolean isTemporary, WorkspaceStatus status) { this.id = id; if (account != null) { this.account = new AccountImpl(account); } if (config != null) { this.config = new WorkspaceConfigImpl(config); } if (runtime != null) { this.runtime = new RuntimeImpl( runtime.getActiveEnv(), runtime.getMachines(), runtime.getOwner(), runtime.getCommands(), runtime.getWarnings()); } if (attributes != null) { this.attributes = new HashMap<>(attributes); } this.isTemporary = isTemporary; this.status = status; }