@@ -176,7 +176,7 @@ public List<SearchResult> search(@Context SecurityContext sc,
176
176
@ PathParam ("search" ) String search , @ QueryParam ("limit" ) Integer limit ) throws Exception {
177
177
178
178
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
179
- Table m = db .tables . get (table );
179
+ Table m = db .table (table );
180
180
ACLContainerRequestFilter .check (sc , db , m );
181
181
return db .search (sc , m , search , limit );
182
182
}
@@ -345,9 +345,7 @@ QueryAndParams getAnalytics(SecurityContext sc, AbstractDatabase db, Analytics a
345
345
ACLContainerRequestFilter .check (sc , info );
346
346
}
347
347
348
- Table m = db .tables .get (a .table );
349
- if (m == null )
350
- throw new IllegalArgumentException ("Unknown table: " + a .table );
348
+ Table m = db .table (a .table );
351
349
ACLContainerRequestFilter .check (sc , db , m );
352
350
353
351
for (ColInfo e : a .cols ) {
@@ -441,11 +439,7 @@ public List<Map<String, Object>> all(@Context SecurityContext sc,
441
439
@ QueryParam ("sort" ) String sort , @ QueryParam ("descending" ) boolean descending ,
442
440
Map <String , Object > arguments ) throws Exception {
443
441
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
444
- Table m = db .tables .get (table );
445
-
446
- if (m == null )
447
- throw new IllegalArgumentException ("Unknown table: " + table );
448
-
442
+ Table m = db .table (table );
449
443
ACLContainerRequestFilter .check (sc , db , m );
450
444
db .cast (m , arguments );
451
445
return db .all (m , offset , limit , sort , descending ,
@@ -484,7 +478,7 @@ public List<Choice> keys(@Context SecurityContext sc,
484
478
example = "EMPLOYEES" ) @ PathParam ("table" ) String table ,
485
479
@ QueryParam ("prefix" ) String prefix , @ QueryParam ("limit" ) Integer limit ) throws Exception {
486
480
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
487
- Table m = db .tables . get (table );
481
+ Table m = db .table (table );
488
482
ACLContainerRequestFilter .check (sc , db , m );
489
483
490
484
if (m .properties != null ) {
@@ -566,7 +560,7 @@ public Resource createInternal(@Context SecurityContext sc,
566
560
Map <String , Object > object ) throws Exception {
567
561
MapUtil .clean (object );
568
562
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
569
- Table m = db .tables . get (table );
563
+ Table m = db .table (table );
570
564
ACLContainerRequestFilter .check (sc , db , m , CREATE );
571
565
ACLContainerRequestFilter .checkRow (sc , m , object );
572
566
@@ -679,7 +673,7 @@ public Object traverse(SecurityContext sc, String database, String table, List<S
679
673
String fk ) throws Exception {
680
674
Map <String , Object > o = read (sc , database , table , objectId );
681
675
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
682
- Table m = db .tables . get (table );
676
+ Table m = db .table (table );
683
677
Property p = m .properties .get (fk );
684
678
if (p != null && p .ref != null ) {
685
679
// fk is an outgoing fk
@@ -805,7 +799,7 @@ public Map<String, Object> read(@Context SecurityContext sc,
805
799
public Map <String , Object > read (@ Context SecurityContext sc , String database , String table ,
806
800
List <String > objectId ) throws Exception {
807
801
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
808
- Table m = db .tables . get (table );
802
+ Table m = db .table (table );
809
803
ACLContainerRequestFilter .check (sc , db , m );
810
804
Map <String , Object > search = key (m , objectId );
811
805
db .cast (m , search );
@@ -1062,7 +1056,7 @@ public List<Origin> incoming(@Context SecurityContext sc, String database, Strin
1062
1056
Integer timeout = services .getConfig ().getAllTimeoutMs ();
1063
1057
1064
1058
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
1065
- Table m = db .tables . get (table );
1059
+ Table m = db .table (table );
1066
1060
ACLContainerRequestFilter .check (sc , db , m );
1067
1061
String objectId = objectIds .get (0 );
1068
1062
@@ -1106,7 +1100,7 @@ public Map<String, Map<String, Object>> list(@Context SecurityContext sc,
1106
1100
if (Boolean .TRUE .equals (ignoreMissing )) {
1107
1101
// record not found - add the {pk=search} to the result
1108
1102
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
1109
- Table m = db .tables . get (table );
1103
+ Table m = db .table (table );
1110
1104
Map <String , Object > search = key (m , Arrays .asList (objectId ));
1111
1105
db .cast (m , search );
1112
1106
res .put (objectId , search );
@@ -1200,7 +1194,7 @@ public void update(SecurityContext sc, String database, String table, List<Strin
1200
1194
Map <String , Object > object ) throws Exception {
1201
1195
MapUtil .clean (object );
1202
1196
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
1203
- Table m = db .tables . get (table );
1197
+ Table m = db .table (table );
1204
1198
1205
1199
if (m .tenantColumn != null )
1206
1200
read (sc , database , table , objectId );
@@ -1300,7 +1294,7 @@ public void delete(@Context SecurityContext sc,
1300
1294
public void delete (SecurityContext sc , String database , String table , List <String > objectId )
1301
1295
throws Exception {
1302
1296
AbstractDatabase db = services .getConfig ().getDatabase (dj (database ));
1303
- Table m = db .tables . get (table );
1297
+ Table m = db .table (table );
1304
1298
1305
1299
if (m .tenantColumn != null )
1306
1300
read (sc , database , table , objectId );
0 commit comments