Exemplo n.º 1
0
  /**
   * 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());
    }
  }
Exemplo n.º 2
0
  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());
    }
  }
Exemplo n.º 3
0
 /**
  * @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);
   }
 }