Exemplo n.º 1
0
 private void submitJob(ImportCommandOptionsDto dto) {
   ResourceRequestBuilderFactory.newBuilder() //
       .forResource(
           UriBuilder.create()
               .segment("datasource", dto.getDestination(), "commands", "_import")
               .build()) //
       .post() //
       .withResourceBody(ImportCommandOptionsDto.stringify(dto)) //
       .withCallback(
           new SubmitJobResponseCodeCallBack(),
           SC_CREATED,
           SC_BAD_REQUEST,
           SC_INTERNAL_SERVER_ERROR) //
       .send();
 }
Exemplo n.º 2
0
 private ImportCommandOptionsDto createImportCommandOptionsDto(@Nullable String selectedFile) {
   ImportCommandOptionsDto dto = ImportCommandOptionsDto.create();
   dto.setDestination(importConfig.getDestinationDatasourceName());
   if (importConfig.isArchiveMove()) {
     dto.setArchive(importConfig.getArchiveDirectory());
     JsArrayString selectedFiles = JavaScriptObject.createArray().cast();
     selectedFiles.push(selectedFile);
     dto.setFilesArray(selectedFiles);
   }
   if (importConfig.isIdentifierSharedWithUnit()) {
     dto.setUnit(importConfig.getUnit());
     dto.setForce(false);
     dto.setIgnore(true);
   }
   JsArrayString selectedTables = JavaScriptObject.createArray().cast();
   for (String tableName : comparedDatasourcesReportPresenter.getSelectedTables()) {
     selectedTables.push(importConfig.getTransientDatasourceName() + "." + tableName);
   }
   dto.setTablesArray(selectedTables);
   return dto;
 }