mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-03 01:29:33 +00:00
bug5809: initial commit; not working yet; some refactoring towards StoredDataMiningReportDTO
This commit is contained in:
1 parent
8ee3b43e8b
commit
6b2ce60b3e
11 files changed
+41
-31
No files matched your search
+7
-5
@@ -39,10 +39,12 @@ import com.sap.sse.datamining.shared.data.ReportParameterToDimensionFilterBindin
|
||||
import com.sap.sse.datamining.shared.dto.DataMiningReportDTO;
|
||||
import com.sap.sse.datamining.shared.dto.FilterDimensionParameter;
|
||||
import com.sap.sse.datamining.shared.dto.StatisticQueryDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.dto.StoredDataMiningReportDTO;
|
||||
import com.sap.sse.datamining.shared.impl.UUIDDataMiningSession;
|
||||
import com.sap.sse.datamining.shared.impl.dto.ModifiableDataMiningReportDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.ModifiableStatisticQueryDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.QueryResultDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.StoredDataMiningReportDTOImpl;
|
||||
import com.sap.sse.datamining.ui.client.AnchorDataMiningSettingsControl;
|
||||
import com.sap.sse.datamining.ui.client.CompositeResultsPresenter;
|
||||
import com.sap.sse.datamining.ui.client.DataMiningService;
|
||||
@@ -253,7 +255,7 @@ public class DataMiningEntryPoint extends AbstractSailingReadEntryPoint implemen
|
||||
* report with the query and the corresponding parameter bindings. So will removing a panel from the result
|
||||
* presenter that has a query associated with it.
|
||||
*/
|
||||
private DataMiningReportDTO currentReport;
|
||||
private StoredDataMiningReportDTO currentReport;
|
||||
|
||||
private Integer resultsPresenterSouthHeight = 350;
|
||||
private Integer resultsPresenterEastWidth = 750;
|
||||
@@ -290,7 +292,7 @@ public class DataMiningEntryPoint extends AbstractSailingReadEntryPoint implemen
|
||||
|
||||
@Override
|
||||
public Widget get() {
|
||||
currentReport = new ModifiableDataMiningReportDTO();
|
||||
currentReport = new StoredDataMiningReportDTOImpl(UUID.randomUUID(), /* name */ null, new ModifiableDataMiningReportDTO());
|
||||
mainPanel = new LayoutPanel();
|
||||
DataMiningSettingsControl settingsControl = new AnchorDataMiningSettingsControl(null, null);
|
||||
resultsPresenter = new TabbedSailingResultsPresenter(/* parent */ null, /* context */ null,
|
||||
@@ -311,7 +313,7 @@ public class DataMiningEntryPoint extends AbstractSailingReadEntryPoint implemen
|
||||
// removing a tab from the result presenter shall remove its query from the current report
|
||||
resultsPresenter.addPresenterRemovedListener((String presenterId, int presenterIndex, StatisticQueryDefinitionDTO queryDefinition) -> {
|
||||
if (queryDefinition != null) {
|
||||
currentReport.removeQueryDefinition(queryDefinition);
|
||||
currentReport.getReport().removeQueryDefinition(queryDefinition);
|
||||
}
|
||||
});
|
||||
queryDefinitionProvider = new QueryDefinitionProviderWithControls(null, null, session,
|
||||
@@ -394,12 +396,12 @@ public class DataMiningEntryPoint extends AbstractSailingReadEntryPoint implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataMiningReportDTO getCurrentReport() {
|
||||
public StoredDataMiningReportDTO getCurrentReport() {
|
||||
return currentReport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentReport(DataMiningReportDTO report) {
|
||||
public void setCurrentReport(StoredDataMiningReportDTO report) {
|
||||
this.currentReport = report;
|
||||
}
|
||||
|
||||
|
||||
+17
-13
@@ -13,6 +13,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
@@ -125,17 +126,20 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
@UiHandler("saveReportButtonUi")
|
||||
void onSaveClick(ClickEvent e) {
|
||||
final String name = suggestBoxUi.getValue().trim();
|
||||
final DataMiningReportDTO report = buildReport();
|
||||
if (report == null) {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportNoQueriesWereFound(),
|
||||
NotificationType.ERROR);
|
||||
} else if (reportsProvider.addOrUpdateReport(name, report)) {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportUpdateSuccessful(name),
|
||||
NotificationType.SUCCESS);
|
||||
} else {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportCreationSuccessful(name),
|
||||
NotificationType.SUCCESS);
|
||||
}
|
||||
final StoredDataMiningReportDTO report = buildReport();
|
||||
final boolean wouldOverwriteDifferentReport = reportsProvider.findReportByName(name).map(existingEqualNamedReport->existingEqualNamedReport.getId().equals(report.getId())).orElse(false);
|
||||
if (!wouldOverwriteDifferentReport || Window.confirm(StringMessages.INSTANCE.overwriteExistingReportBySameName(name))) {
|
||||
if (report == null) {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportNoQueriesWereFound(),
|
||||
NotificationType.ERROR);
|
||||
} else if (reportsProvider.addOrUpdateReport(name, report.getReport())) {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportUpdateSuccessful(name),
|
||||
NotificationType.SUCCESS);
|
||||
} else {
|
||||
Notification.notify(StringMessages.INSTANCE.dataMiningStoredReportCreationSuccessful(name),
|
||||
NotificationType.SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("loadReportButtonUi")
|
||||
@@ -165,14 +169,14 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
* Compiles a new {@link DataMiningReportDTO} report based on a the queries from all available tabs in the
|
||||
* {@link #resultsPresenter}.
|
||||
*/
|
||||
private DataMiningReportDTO buildReport() {
|
||||
private StoredDataMiningReportDTO buildReport() {
|
||||
return reportProvider.getCurrentReport();
|
||||
}
|
||||
|
||||
private StoredDataMiningReportDTO applyReport(StoredDataMiningReportDTO storedReport) {
|
||||
showBusyIndicator(true);
|
||||
final DataMiningReportDTO report = storedReport.getReport();
|
||||
reportProvider.setCurrentReport(report);
|
||||
reportProvider.setCurrentReport(storedReport);
|
||||
final Iterable<StatisticQueryDefinitionDTO> reportQueries = report.getQueryDefinitions();
|
||||
final SequentialQueryExecutor executor = new SequentialQueryExecutor(reportQueries);
|
||||
executor.run(results -> {
|
||||
|
||||
+4
-4
@@ -34,10 +34,11 @@ public class StoredDataMiningReportsProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new stored report with the {@link name} or updates an existing one.
|
||||
* Creates a new stored report with the {@code name} or updates an existing one by that name
|
||||
* (see {@link #findReportByName(String)}).
|
||||
*
|
||||
* @return true, if stored report was present and this is an update<br/>
|
||||
* false, if a new stored report was created
|
||||
* @return {@code true}, if stored report was present and this is an update<br/>
|
||||
* {@code false}, if a new stored report was created
|
||||
*/
|
||||
public boolean addOrUpdateReport(String name, final DataMiningReportDTO report) {
|
||||
Optional<StoredDataMiningReportDTO> existingStoredReport = findReportByName(name);
|
||||
@@ -65,7 +66,6 @@ public class StoredDataMiningReportsProvider {
|
||||
if (!existingStoredReport.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dataMiningWriteService.removeStoredReport((StoredDataMiningReportDTOImpl) existingStoredReport.get(),
|
||||
new AsyncCallback<StoredDataMiningReportDTOImpl>() {
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@ import com.sap.sse.common.Renamable;
|
||||
|
||||
/**
|
||||
* Annotates a {@link DataMiningReportDTO} with a {@link UUID} and a name. Objects of this
|
||||
* type are managed in the repository of data mining reports in the user preferences.
|
||||
* type are managed in the repository of data mining reports in the user preferences. Equality
|
||||
* and hash code are decided solely based on the {@link #getId() ID}.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.sap.sse.datamining.ui.client;
|
||||
|
||||
import com.sap.sse.datamining.shared.dto.DataMiningReportDTO;
|
||||
import com.sap.sse.datamining.shared.dto.StoredDataMiningReportDTO;
|
||||
|
||||
public interface ReportProvider {
|
||||
DataMiningReportDTO getCurrentReport();
|
||||
void setCurrentReport(DataMiningReportDTO report);
|
||||
StoredDataMiningReportDTO getCurrentReport();
|
||||
void setCurrentReport(StoredDataMiningReportDTO report);
|
||||
}
|
||||
+1
@@ -111,4 +111,5 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages {
|
||||
String parameterNamesMustBeUniqueInReport(String name, String typeName);
|
||||
String newParameterName();
|
||||
String parameterNameMustNotBeEmpty();
|
||||
String overwriteExistingReportBySameName(String name);
|
||||
}
|
||||
+2
-1
@@ -94,4 +94,5 @@ pickOrCreateReportParameter=Pick or Create Report Parameter
|
||||
pickOrCreateReportParameterMessage=Pick one of the existing report parameters or create a new one with a unique name
|
||||
parameterNamesMustBeUniqueInReport=Parameter name {0} of parameter with type {1} is not unique within report.
|
||||
newParameterName=Name for New Parameter
|
||||
parameterNameMustNotBeEmpty=Parameter name must not be empty.
|
||||
parameterNameMustNotBeEmpty=Parameter name must not be empty.
|
||||
overwriteExistingReportBySameName=Overwrite existing report by same name {0}?
|
||||
+2
-1
@@ -83,4 +83,5 @@ pickOrCreateReportParameter=Parameter auswählen oder neuen erstellen
|
||||
pickOrCreateReportParameterMessage=Bestehenden Parameter auswählen oder einen neuen mit eindeutigem Namen anlegen
|
||||
parameterNamesMustBeUniqueInReport=Parameter-Name {0} des Parameters mit Typ {1} existiert bereits innerhalb des Berichts.
|
||||
newParameterName=Name des neuen Parameters
|
||||
parameterNameMustNotBeEmpty=Leere Parameternamen sind nicht erlaubt.
|
||||
parameterNameMustNotBeEmpty=Leere Parameternamen sind nicht erlaubt.
|
||||
overwriteExistingReportBySameName=Bestehenden Bericht {0} überschreiben?
|
||||
+1
-1
@@ -131,7 +131,7 @@ public class SimpleQueryRunner extends AbstractDataMiningComponent<QueryRunnerSe
|
||||
final Iterable<String> errorMessages = queryDefinitionProvider.validateQueryDefinition(queryDefinition);
|
||||
final String presenterId = resultsPresenter.getCurrentPresenterId();
|
||||
final StatisticQueryDefinitionDTO oldPresenterQuery = resultsPresenter.getCurrentQueryDefinition();
|
||||
reportProvider.getCurrentReport().replaceQueryDefinition(oldPresenterQuery, queryDefinition, reportParameterBindings);
|
||||
reportProvider.getCurrentReport().getReport().replaceQueryDefinition(oldPresenterQuery, queryDefinition, reportParameterBindings);
|
||||
if (errorMessages == null || !errorMessages.iterator().hasNext()) {
|
||||
counter.increase();
|
||||
resultsPresenter.showBusyIndicator(presenterId);
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ public class DimensionFilterSelectionProvider extends AbstractDataMiningComponen
|
||||
headerPanel.setCellHorizontalAlignment(headerLabel, HasHorizontalAlignment.ALIGN_CENTER);
|
||||
parameterSettingsButton.addClickHandler(e -> {
|
||||
if (this.parameter == null) {
|
||||
final DataMiningReportDTO currentReport = reportProvider.getCurrentReport();
|
||||
final DataMiningReportDTO currentReport = reportProvider.getCurrentReport().getReport();
|
||||
final Set<FilterDimensionParameter> reportParametersBeforeDialogShown = Util.asNewSet(currentReport.getParameters());
|
||||
new PickOrCreateReportParameterDialog(currentReport, dimension.getReturnTypeName(), getDataMiningStringMessages(),
|
||||
new DialogCallback<FilterDimensionParameter>() {
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ public class QueryDefinitionProviderWithControls extends AbstractQueryDefinition
|
||||
* editor UI in {@link #getQueryDefinition()}.
|
||||
*/
|
||||
private void setQueryDefinition(StatisticQueryDefinitionDTO queryDefinition) {
|
||||
final ReportParameterToDimensionFilterBindings parameterUsages = reportProvider.getCurrentReport().getParameterUsages(queryDefinition);
|
||||
final ReportParameterToDimensionFilterBindings parameterUsages = reportProvider.getCurrentReport().getReport().getParameterUsages(queryDefinition);
|
||||
reportParameterBindings.set(parameterUsages);
|
||||
if (parameterUsages == null) {
|
||||
GWT.log("No parameter usages found for query");
|
||||
|
||||
Reference in new issue
Block a user