/** 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()); }
/** 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; }
public ProjectConfigDtoImpl(org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto origin) { java.util.List<org.eclipse.che.api.core.rest.shared.dto.Link> linksIn = origin.getLinks(); if (linksIn != null) { java.util.List<org.eclipse.che.api.core.rest.shared.dto.Link> linksOut = new java.util.ArrayList<org.eclipse.che.api.core.rest.shared.dto.Link>(); this.name = origin.getName(); java.util.Map<java.lang.String, java.util.List<java.lang.String>> attributesIn = origin.getAttributes(); if (attributesIn != null) { java.util.Map<java.lang.String, java.util.List<java.lang.String>> attributesOut = new java.util.HashMap<java.lang.String, java.util.List<java.lang.String>>(); this.type = origin.getType(); 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(); if (problemsIn != null) { java.util.List<org.eclipse.che.api.workspace.shared.dto.ProjectProblemDto> problemsOut = new java.util.ArrayList<org.eclipse.che.api.workspace.shared.dto.ProjectProblemDto>(); java.util.List<java.lang.String> mixinsIn = origin.getMixins(); if (mixinsIn != null) { java.util.List<java.lang.String> mixinsOut = new java.util.ArrayList<java.lang.String>();
.withSource(githubSourceStorageBuilder.build(githubUrl)) .withName(githubUrl.getRepository()) .withPath("/".concat(githubUrl.getRepository())); });
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); }
public List<String> getExternalLibraries(String workspaceId, String projectName) throws Exception { return requestFactory .fromUrl( workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "java/navigation/libraries") .useGetMethod() .addQueryParam("projectpath", "/" + projectName) .request() .asList(ProjectConfigDto.class) .stream() .map(e -> e.getName()) .collect(Collectors.toList()); }
if (Path.valueOf(config.getPath()).segmentCount() == 1) { final Project project = resourceFactory.newProjectImpl(config, ResourceManager.this);
infoBuilder.append("Project: ").append(notification.getProject().getName()).append(". ");
dtoFactory .createDto(ProjectConfigDto.class) .withName(projectConfig.getName()) .withPath(path.toString()) .withDescription(projectConfig.getDescription()) .withType(projectConfig.getType()) .withMixins(projectConfig.getMixins()) .withAttributes(projectConfig.getAttributes()) .withSource(sourceDto);
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)))); }