private void updateProjectConfigs( String newProjectPath, ProjectTemplateDescriptor projectTemplate) { final List<ProjectConfigDto> configDtoList = projectTemplate.getProjects(); if (newProjectPath.equals("/")) { return; } final String templatePath = projectTemplate.getPath(); final List<NewProjectConfig> updatedConfigs = new ArrayList<>(configDtoList.size()); for (ProjectConfigDto configDto : configDtoList) { final NewProjectConfig newConfig = new NewProjectConfigImpl(configDto); final String projectPath = configDto.getPath(); if (projectPath.startsWith(templatePath)) { final String path = projectPath.replaceFirst(templatePath, newProjectPath); newConfig.setPath(path); } updatedConfigs.add(newConfig); } dataObject.setProjects(updatedConfigs); }
org.eclipse.che.api.workspace.shared.dto.SourceStorageDto sourceIn = origin.getSource(); this.source = sourceIn == null ? null : new SourceStorageDtoImpl(sourceIn); this.path = origin.getPath(); this.description = origin.getDescription(); java.util.List<org.eclipse.che.api.workspace.shared.dto.ProjectProblemDto> problemsIn = origin.getProblems();
/** 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()); }
if (Path.valueOf(config.getPath()).segmentCount() == 1) { final Project project = resourceFactory.newProjectImpl(config, ResourceManager.this);
updatedConfiguration -> { for (ProjectConfigDto projectConfigDto : configList) { if (projectConfigDto.getPath().equals(path.toString())) { final Project newResource = resourceFactory.newProjectImpl(
/** * Updates the project with the new {@code configuration} or creates the new one from existed * folder on server side. * * @param configuration configuration which be applied to the existed project * @return {@link Promise} with the applied {@link ProjectConfigDto} * @see ProjectConfigDto * @since 4.4.0 */ public Promise<ProjectConfigDto> updateProject(ProjectConfigDto configuration) { return Promises.create( (resolve, reject) -> requestTransmitter .newRequest() .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID) .methodName(PROJECT_UPDATE) .paramsAsDto( dtoFactory .createDto(UpdateRequestDto.class) .withWsPath(configuration.getPath()) .withConfig(configuration)) .sendAndReceiveResultAsDto(ProjectConfigDto.class) .onSuccess(resolve::apply) .onFailure(error -> reject.apply(getPromiseError(error)))); }