17
17
import com .phocassoftware .graphql .database .manager .util .BackupItem ;
18
18
import com .phocassoftware .graphql .database .manager .util .HistoryBackupItem ;
19
19
import com .phocassoftware .graphql .database .manager .util .TableCoreUtil ;
20
+
20
21
import java .util .ArrayList ;
21
22
import java .util .Arrays ;
22
23
import java .util .Collections ;
32
33
import java .util .function .Function ;
33
34
import java .util .stream .Collectors ;
34
35
import java .util .stream .Stream ;
36
+
35
37
import org .dataloader .DataLoader ;
36
- import org .dataloader .DataLoaderFactory ;
37
38
import org .dataloader .DataLoaderOptions ;
38
39
39
40
@ SuppressWarnings ("unchecked" )
@@ -60,29 +61,32 @@ public class Database {
60
61
this .submitted = new AtomicInteger ();
61
62
62
63
items = new TableDataLoader <>(
63
- DataLoaderFactory
64
- .newDataLoader (
65
- driver ::get ,
66
- DataLoaderOptions .newOptions ().setMaxBatchSize (driver .maxBatchSize ()).build ()
67
- ),
64
+ new DataLoader <DatabaseKey <Table >, Table >(
65
+ keys -> {
66
+ return driver .get (keys );
67
+ },
68
+ DataLoaderOptions .newOptions ().setMaxBatchSize (driver .maxBatchSize ())
69
+ ),
68
70
this ::handleFuture
69
71
); // will auto call global
70
72
71
73
queries = new TableDataLoader <>(
72
- DataLoaderFactory
73
- .newDataLoader (
74
- keys -> merge (keys .stream ().map (driver ::query )),
75
- DataLoaderOptions .newOptions ().setBatchingEnabled (false ).build ()
76
- ),
74
+ new DataLoader <DatabaseQueryKey <Table >, List <Table >>(
75
+ keys -> {
76
+ return merge (keys .stream ().map (driver ::query ));
77
+ },
78
+ DataLoaderOptions .newOptions ().setBatchingEnabled (false )
79
+ ),
77
80
this ::handleFuture
78
81
); // will auto call global
79
82
80
83
queryHistories = new TableDataLoader <>(
81
- DataLoaderFactory
82
- .newDataLoader (
83
- keys -> merge (keys .stream ().map (driver ::queryHistory )),
84
- DataLoaderOptions .newOptions ().setBatchingEnabled (false ).build ()
85
- ),
84
+ new DataLoader <DatabaseQueryHistoryKey <Table >, List <Table >>(
85
+ keys -> {
86
+ return merge (keys .stream ().map (driver ::queryHistory ));
87
+ },
88
+ DataLoaderOptions .newOptions ().setBatchingEnabled (false )
89
+ ),
86
90
this ::handleFuture
87
91
); // will auto call global
88
92
@@ -254,8 +258,7 @@ public CompletableFuture<Boolean> destroyOrganisation(final String organisationI
254
258
*
255
259
* @param <T> database entity type to update
256
260
* @param entity revision must match database or request will fail
257
- * @return updated entity with the revision incremented by one
258
- * CompletableFuture will fail with a RevisionMismatchException
261
+ * @return updated entity with the revision incremented by one CompletableFuture will fail with a RevisionMismatchException
259
262
*/
260
263
public <T extends Table > CompletableFuture <T > put (T entity ) {
261
264
return put (entity , true );
@@ -265,8 +268,7 @@ public <T extends Table> CompletableFuture<T> put(T entity) {
265
268
* @param <T> database entity type to update
266
269
* @param entity revision must match database or request will fail
267
270
* @param check Will only pass if the entity revision matches what is currently in the database
268
- * @return updated entity with the revision incremented by one
269
- * CompletableFuture will fail with a RevisionMismatchException
271
+ * @return updated entity with the revision incremented by one CompletableFuture will fail with a RevisionMismatchException
270
272
*/
271
273
public <T extends Table > CompletableFuture <T > put (T entity , boolean check ) {
272
274
return putAllow
0 commit comments