Class AbstractTranslatableService

    • Method Detail

      • existsByIdAndLocale

         Boolean existsByIdAndLocale(ID id, String locale)

        Checks if a translatable entity exists by its ID and locale.

        Parameters:
        id - The ID of the entity.
        locale - The locale to check for.
        Returns:

        True if the entity exists with the given locale, false otherwise.

      • findByIdAndLocale

         T findByIdAndLocale(ID id, String locale)

        Finds a translatable entity by its ID and locale.

        Parameters:
        id - The ID of the entity.
        locale - The locale of the translation.
        Returns:

        T? The translatable entity, or null if not found.

      • findAllByLocale

         List<T> findAllByLocale(String locale)

        Finds all translatable entities that have a translation with the given locale.

        Parameters:
        locale - The locale to filter by.
        Returns:

        List of translatable entities.

      • findAllByLocale

         Page<T> findAllByLocale(String locale, Pageable pageable)

        Finds all translatable entities that have a translation with the given locale, with pagination.

        Parameters:
        locale - The locale to filter by.
        pageable - Pagination information.
        Returns:

        Page of translatable entities.

      • findTranslationsById

         List<TR> findTranslationsById(ID id)

        Finds all translations for a specific translatable entity by its ID.

        Parameters:
        id - The ID of the entity.
        Returns:

        List of translations for the entity.

      • findTranslationsById

         Page<TR> findTranslationsById(ID id, Pageable pageable)

        Finds all translations for a specific translatable entity by its ID, with pagination.

        Parameters:
        id - The ID of the entity.
        pageable - Pagination information.
        Returns:

        Page of translations for the entity.

      • save

         T save(T entity)

        Saves a translatable entity.

        Parameters:
        entity - The entity to save.
        Returns:

        The saved entity.

      • deleteByLocale

         Integer deleteByLocale(String locale)

        Deletes all translatable entities that have a translation with the given locale.

        Parameters:
        locale - The locale of the translations to delete.
        Returns:

        The number of deleted entities.

      • deleteByIdAndLocale

         Integer deleteByIdAndLocale(ID id, String locale)

        Deletes a translatable entity if it has a translation with the given ID and locale.

        Parameters:
        id - The ID of the entity.
        locale - The locale of the translation.
        Returns:

        The number of deleted entities (usually 0 or 1).