ResourceRequestBuilder<? extends JavaScriptObject> createResourceRequestBuilder(
      TableCompareDto tableCompareDto, JsArray<VariableDto> variables) {
    TableDto compared = tableCompareDto.getCompared();
    if (!tableCompareDto.hasWithTable()) {
      // new table
      TableDto newTableDto = TableDto.create();
      newTableDto.setName(compared.getName());
      newTableDto.setEntityType(compared.getEntityType());
      newTableDto.setVariablesArray(variables);
      UriBuilder ub = UriBuilder.create().segment("datasource", targetDatasourceName, "tables");
      return ResourceRequestBuilderFactory.newBuilder()
          .post()
          .forResource(ub.build())
          .withResourceBody(stringify(newTableDto));
    }

    UriBuilder uriBuilder =
        tableCompareDto.getWithTable().hasViewLink() //
            ? UriBuilders.DATASOURCE_VIEW_VARIABLES.create() //
            : UriBuilders.DATASOURCE_TABLE_VARIABLES.create();

    return ResourceRequestBuilderFactory.newBuilder() //
        .forResource(uriBuilder.build(targetDatasourceName, compared.getName())) //
        .withResourceBody(stringify(variables)) //
        .post();
  }
Ejemplo n.º 2
0
 @Override
 public void onDownloadIdentifiers() {
   fireEvent(
       new FileDownloadRequestEvent(
           UriBuilder.create()
               .segment("identifiers", "mappings", "_export")
               .query("type", table.getEntityType())
               .build()));
 }