/** * Add project on WS-master side. * * @param project project to add * @throws ServerException */ protected void addProject(ProjectConfig project) throws ServerException { final String href = UriBuilder.fromUri(apiEndpoint) .path(WorkspaceService.class) .path(WorkspaceService.class, "addProject") .build(workspaceId) .toString(); try { httpJsonRequestFactory.fromUrl(href).usePostMethod().setBody(asDto(project)).request(); } catch (IOException | ApiException e) { throw new ServerException(e.getMessage()); } }
protected void removeProject(ProjectConfig project) throws ServerException { final String href = UriBuilder.fromUri(apiEndpoint) .path(WorkspaceService.class) .path(WorkspaceService.class, "deleteProject") .build(workspaceId, project.getPath()) .toString(); try { httpJsonRequestFactory.fromUrl(href).useDeleteMethod().request(); } catch (IOException | ApiException e) { throw new ServerException(e.getMessage()); } }
/** * @param wsId * @return * @throws ServerException */ private WorkspaceDto workspaceDto(String wsId) throws ServerException { final String href = UriBuilder.fromUri(apiEndpoint) .path(WorkspaceService.class) .path(WorkspaceService.class, "getByKey") .build(wsId) .toString(); try { return httpJsonRequestFactory .fromUrl(href) .useGetMethod() .request() .asDto(WorkspaceDto.class); } catch (IOException | ApiException e) { throw new ServerException(e); } }