@Override
    public PageData<WidgetsBundle> findAllTenantWidgetsBundlesByTenantId(WidgetsBundleFilter widgetsBundleFilter, PageLink pageLink) {
        return findTenantWidgetsBundlesByTenantIds(Arrays.asList(widgetsBundleFilter.getTenantId().getId(), NULL_UUID), widgetsBundleFilter, pageLink);
    }
@Test
    public void testFindAllWidgetsBundlesByTenantIdFullSearchScadaFirst() {
        UUID tenantId1 = Uuids.timeBased();
        UUID tenantId2 = Uuids.timeBased();
        for (int i = 0; i < 10; i++) {
            createWidgetBundles(5, tenantId1, "WB1_" + i + "_");
            createWidgetBundles(2, tenantId1, "WB1_SCADA_" + i + "_", true);
            createWidgetBundles(3, tenantId2, "WB2_" + i + "_");
            createWidgetBundles(3, tenantId2, "WB2_SCADA_" + i + "_", true);
            createSystemWidgetBundles(2, "WB_SYS_" + i + "_");
            createSystemWidgetBundles(1, "WB_SYS_SCADA_" + i + "_", true);
        }
        widgetsBundles = widgetsBundleDao.find(TenantId.SYS_TENANT_ID).stream().sorted(Comparator.comparing(WidgetsBundle::getTitle)).collect(Collectors.toList());;
        assertEquals(160, widgetsBundles.size());

        PageLink pageLink = new PageLink(50, 0, "WB", new SortOrder("title"));
        PageData<WidgetsBundle> widgetsBundles1 =
                widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(
                        WidgetsBundleFilter.builder().tenantId(TenantId.fromUUID(tenantId1)).fullSearch(true).scadaFirst(true).build(),  pageLink);

        for (int i =0; i < 30; i++) {
            var widgetsBundle = widgetsBundles1.getData().get(i);
            assertTrue(widgetsBundle.isScada());
        }

        for (int i = 30; i < 50; i++) {
            var widgetsBundle = widgetsBundles1.getData().get(i);
            assertFalse(widgetsBundle.isScada());
        }

        pageLink = new PageLink(50, 0, "WB", new SortOrder("title"));
        PageData<WidgetsBundle> widgetsBundles2 =
                widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(
                        WidgetsBundleFilter.builder().tenantId(TenantId.fromUUID(tenantId2)).fullSearch(true).scadaFirst(true).build(), pageLink);

        for (int i =0; i < 40; i++) {
            var widgetsBundle = widgetsBundles2.getData().get(i);
            assertTrue(widgetsBundle.isScada());
        }

        for (int i = 40; i < 50; i++) {
            var widgetsBundle = widgetsBundles2.getData().get(i);
            assertFalse(widgetsBundle.isScada());
        }
    }