Skip to content

Commit b705107

Browse files
committed
Implement dirty based on equality
1 parent 824d170 commit b705107

File tree

115 files changed

+1689
-2560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1689
-2560
lines changed

stroom-app/src/test/java/stroom/analytics/AnalyticsDataSetup.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,14 @@ final void setup() {
138138

139139
// Add view.
140140
final DocRef viewDocRef = viewStore.createDocument("index_view");
141-
final ViewDoc viewDoc = viewStore.readDocument(viewDocRef);
142-
viewDoc.setDataSource(indexDocRef);
143-
viewDoc.setPipeline(searchResultPipeline);
144-
viewDoc.setFilter(ExpressionOperator.builder()
145-
.addTextTerm(MetaFields.TYPE, ExpressionTerm.Condition.EQUALS, StreamTypeNames.EVENTS)
146-
.build());
141+
final ViewDoc viewDoc = viewStore.readDocument(viewDocRef)
142+
.copy()
143+
.dataSource(indexDocRef)
144+
.pipeline(searchResultPipeline)
145+
.filter(ExpressionOperator.builder()
146+
.addTextTerm(MetaFields.TYPE, ExpressionTerm.Condition.EQUALS, StreamTypeNames.EVENTS)
147+
.build())
148+
.build();
147149
viewStore.writeDocument(viewDoc);
148150

149151
// Create somewhere to put the alerts.

stroom-app/src/test/java/stroom/contentindex/TestLuceneContentIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class TestLuceneContentIndex extends AbstractCoreIntegrationTest {
5656
<xsl:apply-templates/>
5757
</referenceData>
5858
</xsl:template>
59-
59+
6060
<xsl:template match="record">
6161
<reference>
6262
<map>FILENO_TO_LOCATION_MAP</map>

stroom-app/src/test/java/stroom/dashboard/TestDashboardStoreImpl.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ void test() {
8484
final TabLayoutConfig tabLayoutConfig = TabLayoutConfig.builder().tabs(tabConfigList).build();
8585
down2List.add(tabLayoutConfig);
8686
}
87-
final SplitLayoutConfig down2 = SplitLayoutConfig.builder().dimension(Dimension.Y).children(down2List).build();
87+
final SplitLayoutConfig down2 = SplitLayoutConfig
88+
.builder()
89+
.dimension(Dimension.Y)
90+
.children(down2List)
91+
.build();
8892
acrossList.add(down2);
8993
}
9094
final SplitLayoutConfig across = SplitLayoutConfig
@@ -121,8 +125,10 @@ private VisComponentSettings getVisSettings() {
121125
scriptStore.writeDocument(script);
122126

123127
final DocRef visRef = visualisationStore.createDocument("Test");
124-
final VisualisationDoc vis = visualisationStore.readDocument(visRef);
125-
vis.setScriptRef(scriptRef);
128+
final VisualisationDoc vis = visualisationStore.readDocument(visRef)
129+
.copy()
130+
.scriptRef(scriptRef)
131+
.build();
126132
visualisationStore.writeDocument(vis);
127133

128134
return VisComponentSettings.builder()

stroom-app/src/test/java/stroom/importexport/TestImportExportDashboards.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ private void test(final boolean skipVisCreation, final boolean skipVisExport, fi
152152
"Test Vis",
153153
folder2,
154154
null);
155-
final VisualisationDoc vis = visualisationStore.readDocument(visNode.getDocRef());
156-
vis.setScriptRef(scriptNode.getDocRef());
155+
final VisualisationDoc vis = visualisationStore.readDocument(visNode.getDocRef())
156+
.copy()
157+
.scriptRef(scriptNode.getDocRef())
158+
.build();
157159
visualisationStore.writeDocument(vis);
158160
assertThat(visualisationStore.list().size()).isEqualTo(1);
159161
}

stroom-app/src/test/java/stroom/statistics/impl/hbase/TestStroomStatsStoreImportExportSerializer.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ void testStatisticsDataSource() {
6565
"StatName1",
6666
null,
6767
null);
68-
final StroomStatsStoreDoc entity = stroomStatsStoreStore.readDocument(statNode.getDocRef());
69-
entity.setDescription("My Description");
70-
entity.setStatisticType(StatisticType.COUNT);
71-
entity.setConfig(new StroomStatsStoreEntityData());
72-
entity.getConfig().addStatisticField(new StatisticField("tag1"));
73-
entity.getConfig().addStatisticField(new StatisticField("tag2"));
68+
final StroomStatsStoreDoc entity = stroomStatsStoreStore.readDocument(statNode.getDocRef())
69+
.copy()
70+
.description("My Description")
71+
.statisticType(StatisticType.COUNT)
72+
.config(StroomStatsStoreEntityData
73+
.builder()
74+
.fields(List.of(
75+
new StatisticField("tag1"),
76+
new StatisticField("tag2")))
77+
.build())
78+
.build();
7479
stroomStatsStoreStore.writeDocument(entity);
7580

7681
assertThat(stroomStatsStoreStore.list().size()).isEqualTo(1);
@@ -104,7 +109,7 @@ void testStatisticsDataSource() {
104109

105110
assertThat(dataSources.size()).isEqualTo(1);
106111

107-
final StroomStatsStoreDoc importedDataSource = stroomStatsStoreStore.readDocument(dataSources.get(0));
112+
final StroomStatsStoreDoc importedDataSource = stroomStatsStoreStore.readDocument(dataSources.getFirst());
108113

109114
assertThat(importedDataSource.getName()).isEqualTo(entity.getName());
110115
assertThat(importedDataSource.getStatisticType()).isEqualTo(entity.getStatisticType());
@@ -124,12 +129,17 @@ void testStatisticsDataSourceV2() {
124129
"StatName1",
125130
null,
126131
null);
127-
final StroomStatsStoreDoc entity = stroomStatsStoreStore.readDocument(statNode.getDocRef());
128-
entity.setDescription("My Description");
129-
entity.setStatisticType(StatisticType.COUNT);
130-
entity.setConfig(new StroomStatsStoreEntityData());
131-
entity.getConfig().addStatisticField(new StatisticField("tag1"));
132-
entity.getConfig().addStatisticField(new StatisticField("tag2"));
132+
final StroomStatsStoreDoc entity = stroomStatsStoreStore.readDocument(statNode.getDocRef())
133+
.copy()
134+
.description("My Description")
135+
.statisticType(StatisticType.COUNT)
136+
.config(StroomStatsStoreEntityData
137+
.builder()
138+
.fields(List.of(
139+
new StatisticField("tag1"),
140+
new StatisticField("tag2")))
141+
.build())
142+
.build();
133143
stroomStatsStoreStore.writeDocument(entity);
134144

135145
assertThat(stroomStatsStoreStore.list().size()).isEqualTo(1);
@@ -163,7 +173,7 @@ void testStatisticsDataSourceV2() {
163173

164174
assertThat(dataSources.size()).isEqualTo(1);
165175

166-
final StroomStatsStoreDoc importedDataSource = stroomStatsStoreStore.readDocument(dataSources.get(0));
176+
final StroomStatsStoreDoc importedDataSource = stroomStatsStoreStore.readDocument(dataSources.getFirst());
167177

168178
assertThat(importedDataSource.getName()).isEqualTo(entity.getName());
169179
assertThat(importedDataSource.getStatisticType()).isEqualTo(entity.getStatisticType());

stroom-app/src/test/java/stroom/statistics/impl/sql/TestStatisticsDataSourceImportExportSerializer.java

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ private Set<DocRef> buildFindFolderCriteria() {
7474
@Test
7575
void testStatisticsDataSource() {
7676
final ExplorerNode statNode = explorerService.create(StatisticStoreDoc.TYPE, "StatName1", null, null);
77-
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(statNode.getDocRef());
78-
statisticsDataSource.setDescription("My Description");
79-
statisticsDataSource.setStatisticType(StatisticType.COUNT);
80-
statisticsDataSource.setConfig(new StatisticsDataSourceData());
81-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag1"));
82-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag2"));
77+
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(statNode.getDocRef())
78+
.copy()
79+
.description("My Description")
80+
.statisticType(StatisticType.COUNT)
81+
.config(StatisticsDataSourceData
82+
.builder()
83+
.fields(List.of(
84+
new StatisticField("tag1"),
85+
new StatisticField("tag2")))
86+
.build())
87+
.build();
8388
statisticStoreStore.writeDocument(statisticsDataSource);
8489

8590
assertThat(statisticStoreStore.list().size()).isEqualTo(1);
@@ -113,7 +118,7 @@ void testStatisticsDataSource() {
113118

114119
assertThat(dataSources.size()).isEqualTo(1);
115120

116-
final StatisticStoreDoc importedDataSource = statisticStoreStore.readDocument(dataSources.get(0));
121+
final StatisticStoreDoc importedDataSource = statisticStoreStore.readDocument(dataSources.getFirst());
117122

118123
assertThat(importedDataSource.getName()).isEqualTo(statisticsDataSource.getName());
119124
assertThat(importedDataSource.getStatisticType()).isEqualTo(statisticsDataSource.getStatisticType());
@@ -130,12 +135,17 @@ void testStatisticsDataSource() {
130135
@Test
131136
void testStatisticsDataSourceV2() {
132137
final ExplorerNode statNode = explorerService.create(StatisticStoreDoc.TYPE, "StatName1", null, null);
133-
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(statNode.getDocRef());
134-
statisticsDataSource.setDescription("My Description");
135-
statisticsDataSource.setStatisticType(StatisticType.COUNT);
136-
statisticsDataSource.setConfig(new StatisticsDataSourceData());
137-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag1"));
138-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag2"));
138+
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(statNode.getDocRef())
139+
.copy()
140+
.description("My Description")
141+
.statisticType(StatisticType.COUNT)
142+
.config(StatisticsDataSourceData
143+
.builder()
144+
.fields(List.of(
145+
new StatisticField("tag1"),
146+
new StatisticField("tag2")))
147+
.build())
148+
.build();
139149
statisticStoreStore.writeDocument(statisticsDataSource);
140150

141151
assertThat(statisticStoreStore.list().size()).isEqualTo(1);
@@ -169,7 +179,7 @@ void testStatisticsDataSourceV2() {
169179

170180
assertThat(dataSources.size()).isEqualTo(1);
171181

172-
final StatisticStoreDoc importedDataSource = statisticStoreStore.readDocument(dataSources.get(0));
182+
final StatisticStoreDoc importedDataSource = statisticStoreStore.readDocument(dataSources.getFirst());
173183

174184
assertThat(importedDataSource.getName()).isEqualTo(statisticsDataSource.getName());
175185
assertThat(importedDataSource.getStatisticType()).isEqualTo(statisticsDataSource.getStatisticType());
@@ -181,17 +191,20 @@ void testStatisticsDataSourceV2() {
181191
@Test
182192
void testDeSerialiseOnLoad() {
183193
final DocRef docRef = statisticStoreStore.createDocument("StatName1");
184-
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(docRef);
185-
statisticsDataSource.setDescription("My Description");
186-
statisticsDataSource.setStatisticType(StatisticType.COUNT);
187-
188-
statisticsDataSource.setConfig(new StatisticsDataSourceData());
189-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag1"));
190-
statisticsDataSource.getConfig().addStatisticField(new StatisticField("tag2"));
191-
194+
final StatisticStoreDoc statisticsDataSource = statisticStoreStore.readDocument(docRef)
195+
.copy()
196+
.description("My Description")
197+
.statisticType(StatisticType.COUNT)
198+
.config(StatisticsDataSourceData
199+
.builder()
200+
.fields(List.of(
201+
new StatisticField("tag1"),
202+
new StatisticField("tag2")))
203+
.build())
204+
.build();
192205
statisticStoreStore.writeDocument(statisticsDataSource);
193206

194-
final DocRef statisticStoreRef = statisticStoreStore.list().get(0);
207+
final DocRef statisticStoreRef = statisticStoreStore.list().getFirst();
195208
final StatisticStoreDoc statisticsDataSource2 = statisticStoreStore.readDocument(statisticStoreRef);
196209
assertThat(statisticsDataSource2).isNotNull();
197210

stroom-app/src/test/java/stroom/statistics/impl/sql/TestStatisticsQueryServiceImpl.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,17 @@ void localSetup() {
157157
// commonTestControl.setup(tempDir);
158158

159159
final DocRef statisticStoreRef = statisticStoreStore.createDocument(STAT_NAME);
160-
final StatisticStoreDoc statisticStoreDoc = statisticStoreStore.readDocument(statisticStoreRef);
161-
statisticStoreDoc.setDescription("My Description");
162-
statisticStoreDoc.setStatisticType(StatisticType.VALUE);
163-
statisticStoreDoc.setConfig(new StatisticsDataSourceData());
164-
statisticStoreDoc.getConfig().addStatisticField(new StatisticField(TAG1));
165-
statisticStoreDoc.getConfig().addStatisticField(new StatisticField(TAG2));
160+
final StatisticStoreDoc statisticStoreDoc = statisticStoreStore.readDocument(statisticStoreRef)
161+
.copy()
162+
.description("My Description")
163+
.statisticType(StatisticType.VALUE)
164+
.config(StatisticsDataSourceData
165+
.builder()
166+
.fields(List.of(
167+
new StatisticField(TAG1),
168+
new StatisticField(TAG2)))
169+
.build())
170+
.build();
166171
statisticStoreStore.writeDocument(statisticStoreDoc);
167172
this.statisticStoreDoc = statisticStoreDoc;
168173
}
@@ -301,7 +306,7 @@ void testSearchStatisticsData_TwoTagsOneHasNastyChars() throws SQLException {
301306

302307
// only search on the first tag
303308
final List<StatisticTag> searchTags = new ArrayList<>();
304-
searchTags.add(tags.get(0));
309+
searchTags.add(tags.getFirst());
305310

306311
final Map<String, Set<String>> expectedValuesMap = ImmutableMap.of(
307312
TAG1, Collections.singleton(nastyVal),

stroom-core-client/src/main/java/stroom/analytics/client/presenter/AbstractQueryEditPresenter.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ public List<Widget> getToolbars() {
5151
@Override
5252
protected void onBind() {
5353
super.onBind();
54-
registerHandler(queryEditPresenter.addDirtyHandler(event -> {
55-
if (event.isDirty()) {
56-
onChange();
57-
}
58-
}));
54+
registerHandler(queryEditPresenter.addChangeHandler(this::onChange));
5955
registerHandler(queryEditPresenter.addValueChangeHandler(event -> onChange()));
6056
}
6157

stroom-core-client/src/main/java/stroom/annotation/client/AnnotationEditPresenter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import stroom.data.client.presenter.ShowDataEvent;
4848
import stroom.dispatch.client.DefaultErrorHandler;
4949
import stroom.docref.DocRef;
50-
import stroom.entity.client.presenter.DocumentEditPresenter;
50+
import stroom.entity.client.presenter.DocPresenter;
5151
import stroom.entity.shared.ExpressionCriteria;
5252
import stroom.hyperlink.client.Hyperlink;
5353
import stroom.hyperlink.client.HyperlinkEvent;
@@ -100,7 +100,7 @@
100100
import java.util.function.Consumer;
101101

102102
public class AnnotationEditPresenter
103-
extends DocumentEditPresenter<AnnotationEditView, Annotation>
103+
extends DocPresenter<AnnotationEditView, Annotation>
104104
implements AnnotationEditUiHandlers {
105105

106106
private static final String EMPTY_VALUE = "' '";

stroom-core-client/src/main/java/stroom/annotation/client/AnnotationLinkPresenter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import stroom.annotation.shared.SingleAnnotationChangeRequest;
2323
import stroom.annotation.shared.UnlinkAnnotations;
2424
import stroom.docref.DocRef;
25-
import stroom.entity.client.presenter.DocumentEditPresenter;
25+
import stroom.entity.client.presenter.DocPresenter;
2626
import stroom.explorer.client.presenter.AbstractFindPresenter.FindView;
2727
import stroom.explorer.client.presenter.FindDocResultListHandler;
2828
import stroom.explorer.client.presenter.FindUiHandlers;
@@ -38,7 +38,7 @@
3838
import java.util.Collections;
3939

4040
public class AnnotationLinkPresenter
41-
extends DocumentEditPresenter<FindView, Annotation>
41+
extends DocPresenter<FindView, Annotation>
4242
implements FindUiHandlers, FindDocResultListHandler<Annotation> {
4343

4444
private final AnnotationResourceClient annotationResourceClient;

0 commit comments

Comments
 (0)