@Override
    public PageData<WidgetTypeInfo> findSystemWidgetTypes(WidgetTypeFilter widgetTypeFilter, PageLink pageLink) {
        boolean deprecatedFilterEnabled = !DeprecatedFilter.ALL.equals(widgetTypeFilter.getDeprecatedFilter());
        boolean deprecatedFilterBool = DeprecatedFilter.DEPRECATED.equals(widgetTypeFilter.getDeprecatedFilter());
        boolean widgetTypesEmpty = widgetTypeFilter.getWidgetTypes() == null || widgetTypeFilter.getWidgetTypes().isEmpty();
        return DaoUtil.toPageData(
                widgetTypeInfoRepository
                        .findSystemWidgetTypes(
                                NULL_UUID,
                                pageLink.getTextSearch(),
                                widgetTypeFilter.isFullSearch(),
                                deprecatedFilterEnabled,
                                deprecatedFilterBool,
                                widgetTypesEmpty,
                                widgetTypeFilter.getWidgetTypes() == null ? Collections.emptyList() : widgetTypeFilter.getWidgetTypes(),
                                widgetTypeFilter.isScadaFirst(),
                                DaoUtil.toPageable(pageLink, WidgetTypeInfoEntity.SEARCH_COLUMNS_MAP)));
    }
@Test
    public void testFindSystemWidgetTypesForSameName() throws InterruptedException {
        List<WidgetTypeDetails> sameNameList = new ArrayList<>();

        for (int i = 0; i < 20; i++) {
            Thread.sleep(2);
            var widgetType = saveWidgetType(TenantId.SYS_TENANT_ID, "widgetName");
            sameNameList.add(widgetType);
            widgetTypeList.add(widgetType);
        }
        sameNameList.sort(Comparator.comparing(BaseWidgetType::getName).thenComparing((BaseWidgetType baseWidgetType) -> baseWidgetType.getId().getId()));
        List<WidgetTypeInfo> expected = sameNameList.stream().map(WidgetTypeInfo::new).collect(Collectors.toList());

        PageData<WidgetTypeInfo> widgetTypesFirstPage = widgetTypeDao.findSystemWidgetTypes(
                WidgetTypeFilter.builder()
                    .tenantId(TenantId.SYS_TENANT_ID)
                    .fullSearch(true)
                    .deprecatedFilter(DeprecatedFilter.ALL)
                    .widgetTypes(Collections.singletonList("static")).build(),
                new PageLink(10, 0, null, new SortOrder("name")));
        assertEquals(10, widgetTypesFirstPage.getData().size());
        assertThat(widgetTypesFirstPage.getData()).containsExactlyElementsOf(expected.subList(0, 10));

        PageData<WidgetTypeInfo> widgetTypesSecondPage = widgetTypeDao.findSystemWidgetTypes(WidgetTypeFilter.builder()
                        .tenantId(TenantId.SYS_TENANT_ID)
                        .fullSearch(true)
                        .deprecatedFilter(DeprecatedFilter.ALL)
                        .widgetTypes(Collections.singletonList("static")).build(),
                new PageLink(10, 1, null, new SortOrder("name")));
        assertEquals(10, widgetTypesSecondPage.getData().size());
        assertThat(widgetTypesSecondPage.getData()).containsExactlyElementsOf(expected.subList(10, 20));
    }