@SuppressWarnings("unchecked") private void addUpdateVariablesResourceRequest( ConclusionStepPresenter conclusionStepPresenter, TableCompareDto tableCompareDto) { JsArray<VariableDto> newVariables = JsArrays.toSafeArray(tableCompareDto.getNewVariablesArray()); JsArray<VariableDto> modifiedVariables = JsArrays.toSafeArray(tableCompareDto.getModifiedVariablesArray()); JsArray<VariableDto> variablesToStringify = (JsArray<VariableDto>) JsArray.createArray(); JsArrays.pushAll(variablesToStringify, newVariables); if (!getView().ignoreAllModifications()) { JsArrays.pushAll(variablesToStringify, modifiedVariables); } if (variablesToStringify.length() > 0) { conclusionStepPresenter.setTargetDatasourceName(targetDatasourceName); conclusionStepPresenter.addResourceRequest( tableCompareDto.getCompared().getName(), "/datasource/" + targetDatasourceName + "/table/" + tableCompareDto.getCompared().getName(), createResourceRequestBuilder(tableCompareDto, variablesToStringify)); } }
@Override public void onResource(Response response, JsArray<TableIndexStatusDto> resource) { // Hide contingency table and show only if up to date or outdated getView().hideContingencyTable(); if (response.getStatusCode() == SC_OK) { getView().setIndexStatusVisible(true); statusDto = TableIndexStatusDto.get(JsArrays.toSafeArray(resource)); getView().setIndexStatusAlert(statusDto); // Refetch if in progress if (statusDto.getStatus().getName().equals(TableIndexationStatus.IN_PROGRESS.getName())) { // Hide the Cancel button if progress is 100% getView().setCancelVisible(Double.compare(statusDto.getProgress(), 1d) < 0); indexProgressTimer = new Timer() { @Override public void run() { updateIndexStatus(); } }; // Schedule the timer to run once in X seconds. indexProgressTimer.schedule(DELAY_MILLIS); } else if (statusDto.getStatus().isTableIndexationStatus(TableIndexationStatus.UPTODATE) || statusDto.getStatus().isTableIndexationStatus(TableIndexationStatus.OUTDATED)) { updateContingencyTableVariables(); } } }
private void redrawVocabularies(TaxonomyDto taxonomy, FlowPanel panelTaxonomy) { JsArrayString vocabularies = JsArrays.toSafeArray(taxonomy.getVocabulariesArray()); if (vocabularies.length() > 0) { panelTaxonomy.add(new Heading(5, translations.vocabulariesLabel())); FlowPanel vocabulariesPanel = new FlowPanel(); for (int i = 0; i < vocabularies.length(); i++) { vocabulariesPanel.add(getVocabularyLink(getUiHandlers(), taxonomy, vocabularies.get(i))); } panelTaxonomy.add(vocabulariesPanel); } }
@Override public void onResource(Response response, DatasourceCompareDto resource) { Set<TableCompareDto> comparedTables = sortComparedTables(JsArrays.toSafeArray(resource.getTableComparisonsArray())); conflictsExist = false; for (TableCompareDto tableComparison : comparedTables) { ComparisonResult comparisonResult = getTableComparisonResult(tableComparison); addTableCompareTab(tableComparison, comparisonResult); if (comparisonResult == ComparisonResult.CONFLICT) { conflictsExist = true; } else if (tableComparison.getModifiedVariablesArray() != null) { modificationsExist = true; } } getView().setIgnoreAllModificationsEnabled(conflictsExist || modificationsExist); if (datasourceCreatedCallback != null) { datasourceCreatedCallback.onSuccess(factory, datasourceResource); } }
private ComparisonResult getTableComparisonResult(TableCompareDto tableComparison) { if (JsArrays.toSafeArray(tableComparison.getConflictsArray()).length() > 0 // || JsArrays.toSafeArray(tableComparison.getModifiedVariablesArray()).length() + JsArrays.toSafeArray(tableComparison.getUnmodifiedVariablesArray()).length() + JsArrays.toSafeArray(tableComparison.getNewVariablesArray()).length() == 0) { return ComparisonResult.CONFLICT; } if (!tableComparison.hasWithTable()) { return ComparisonResult.CREATION; } if (JsArrays.toSafeArray(tableComparison.getModifiedVariablesArray()).length() > 0 || JsArrays.toSafeArray(tableComparison.getNewVariablesArray()).length() > 0) { return ComparisonResult.MODIFICATION; } return ComparisonResult.SAME; }
@Override public void renderRows(JsArray<TableDto> rows) { dataProvider.setList(JsArrays.toList(JsArrays.toSafeArray(rows))); pager.firstPage(); }
@Override public void onResource(Response response, JsArray<ViewDto> resource) { ViewDto viewDto = ViewDto.get(JsArrays.toSafeArray(resource)); getView().setFromTables(viewDto.getFromArray()); getView().setWhereScript(viewDto.hasWhere() ? viewDto.getWhere() : null); }