@@ -39,6 +39,12 @@ public class GenericHandlerGroupBuilder<P extends BasicJpa, J extends BasicJson,
3939 private List <GetListInterceptor > getListInterceptors = new ArrayList <>();
4040 private ExecutorService executorService ;
4141
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+
4248 HandlerExtensions <P , J , E > extensions = new HandlerExtensions <>();
4349 private LinkedHashMap <Endpoint , Role []> accessRoles = new LinkedHashMap <>();
4450
@@ -51,7 +57,8 @@ public HttpServer add() {
5157 executorService = server .executorService ;
5258 GenericHandlerGroup <P , J , E > handlerGroupInstance = new GenericHandlerGroup <>(dao , jpaType , jsonType ,
5359 daoTransactionManager , jsonMapper , orikaFactory .getMapperFacade (), path , endpoints , getListInterceptors ,
54- extensions , accessRoles , executorService );
60+ extensions , accessRoles , executorService , tenantIdRowName , tenantDao , tenantJpaType , tenantFieldRowName ,
61+ tenantRowName );
5562 server .addHandlerGroup (handlerGroupInstance );
5663 return server ;
5764 }
@@ -65,6 +72,21 @@ public GenericHandlerGroupBuilder<P, J, E> addRoleFor(final Endpoint endpoint, f
6572 return this ;
6673 }
6774
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+
6890 public GenericHandlerGroupBuilder <P , J , E > dao (final BasicDao <P , E > dao ) {
6991 this .dao = dao ;
7092 return this ;
0 commit comments