public CsvDatasource( DatasourceModel datasourceModel, IXulAsyncDSWDatasourceService datasourceService, ICsvDatasourceServiceAsync csvDatasourceService) { this.datasourceModel = datasourceModel; this.datasourceService = datasourceService; this.csvDatasourceService = csvDatasourceService; ServiceDefTarget endpoint = (ServiceDefTarget) this.csvDatasourceService; endpoint.setServiceEntryPoint(getDatasourceURL()); csvStep = new CsvPhysicalStep(datasourceModel, this, csvDatasourceService); stageStep = new StageDataStep(datasourceModel, this, csvDatasourceService); csvDatasourceService.gwtWorkaround( new BogoPojo(), new AsyncCallback<BogoPojo>() { @Override public void onFailure(Throwable throwable) {} @Override public void onSuccess(BogoPojo bogoPojo) { bogoPojo.getAggType(); } }); }
@Override public void onFinish(final XulServiceCallback<IDatasourceSummary> callback) { datasourceModel.getGuiStateModel().setDataStagingComplete(false); setColumnIdsToColumnNames(); String name = datasourceModel.getDatasourceName().replace(".", "_").replace(" ", "_"); // set the modelInfo.stageTableName to the database table name generated from the datasourceName datasourceModel.getModelInfo().setStageTableName(datasourceModel.generateTableName()); String tmpFileName = datasourceModel.getModelInfo().getFileInfo().getTmpFilename(); String fileName = datasourceModel.getModelInfo().getFileInfo().getFilename(); if (fileName == null && tmpFileName != null && tmpFileName.endsWith(".tmp")) { tmpFileName = tmpFileName.substring(0, tmpFileName.lastIndexOf(".tmp")); datasourceModel.getModelInfo().getFileInfo().setFilename(tmpFileName); } datasourceModel.getModelInfo().setDatasourceName(datasourceModel.getDatasourceName()); csvDatasourceService.generateDomain( DatasourceDTOUtil.generateDTO(datasourceModel), new AsyncCallback<IDatasourceSummary>() { public void onFailure(Throwable th) { MessageHandler.getInstance().closeWaitingDialog(); if (th instanceof CsvTransformGeneratorException) { MessageHandler.getInstance() .showErrorDetailsDialog( MessageHandler.getString("ERROR"), th.getMessage(), ((CsvTransformGeneratorException) th).getCauseMessage() + ((CsvTransformGeneratorException) th).getCauseStackTrace()); } else { MessageHandler.getInstance() .showErrorDialog(MessageHandler.getString("ERROR"), th.getMessage()); } th.printStackTrace(); } public void onSuccess(IDatasourceSummary stats) { CsvDatasource.this.stats = (FileTransformStats) stats; MessageHandler.getInstance().closeWaitingDialog(); callback.success(stats); } }); }