@@ -39,6 +39,12 @@ public class GenericHandlerGroupBuilder<P extends BasicJpa, J extends BasicJson,
39
39
private List <GetListInterceptor > getListInterceptors = new ArrayList <>();
40
40
private ExecutorService executorService ;
41
41
42
+ private String tenantIdRowName ;
43
+ private String tenantRowName ;
44
+ private String tenantFieldRowName ;
45
+ private BasicDao <? extends BasicJpa , E > tenantDao ;
46
+ private Class <? extends BasicJpa > tenantJpaType ;
47
+
42
48
HandlerExtensions <P , J , E > extensions = new HandlerExtensions <>();
43
49
private LinkedHashMap <Endpoint , Role []> accessRoles = new LinkedHashMap <>();
44
50
@@ -51,7 +57,8 @@ public HttpServer add() {
51
57
executorService = server .executorService ;
52
58
GenericHandlerGroup <P , J , E > handlerGroupInstance = new GenericHandlerGroup <>(dao , jpaType , jsonType ,
53
59
daoTransactionManager , jsonMapper , orikaFactory .getMapperFacade (), path , endpoints , getListInterceptors ,
54
- extensions , accessRoles , executorService );
60
+ extensions , accessRoles , executorService , tenantIdRowName , tenantDao , tenantJpaType , tenantFieldRowName ,
61
+ tenantRowName );
55
62
server .addHandlerGroup (handlerGroupInstance );
56
63
return server ;
57
64
}
@@ -65,6 +72,21 @@ public GenericHandlerGroupBuilder<P, J, E> addRoleFor(final Endpoint endpoint, f
65
72
return this ;
66
73
}
67
74
75
+ public GenericHandlerGroupBuilder <P , J , E > isMultiTenantEnabledByIdRow (final String tenantIdRowName ) {
76
+ this .tenantIdRowName = tenantIdRowName ;
77
+ return this ;
78
+ }
79
+
80
+ public <TP extends BasicJpa > GenericHandlerGroupBuilder <P , J , E > isMultiTenantEnabledByTable (
81
+ final BasicDao <TP , E > tenantDao , final Class <TP > tenantJpaType , final String fieldRowName ,
82
+ final String tenantRowName ) {
83
+ this .tenantDao = tenantDao ;
84
+ this .tenantJpaType = tenantJpaType ;
85
+ this .tenantFieldRowName = fieldRowName ;
86
+ this .tenantRowName = tenantRowName ;
87
+ return this ;
88
+ }
89
+
68
90
public GenericHandlerGroupBuilder <P , J , E > dao (final BasicDao <P , E > dao ) {
69
91
this .dao = dao ;
70
92
return this ;
0 commit comments