Interface BaseReadOnlyService<O extends Identifiable>

    • Method Detail

      • getElementClass

        Class<? extends O> getElementClass()
      • find

        @Nullable
        @CheckReturnValue
        O find​(O entity)
        Does a search for the entity in the persistent storage
        Parameters:
        entity - the entity to be searched for
        Returns:
        the version of entity retrieved from the persistent storage, if found, otherwise null.
      • load

        Collection<O> load​(Collection<Long> ids)
        Loads objects with given ids.
        Parameters:
        ids - the ids of objects to be loaded.
        Returns:
        collection containing object with given IDs.
      • load

        @Nullable
        O load​(Long id)
        Loads object with given ID.
        Parameters:
        id - the ID of entity to be loaded.
        Returns:
        the entity with matching ID, or null if the entity does not exist or if the passed ID was null
      • loadOrFail

        @Nonnull
        <T extends ExceptionO loadOrFail​(Long id,
                                           Supplier<T> exceptionSupplier)
                                    throws T extends Exception
        Load an entity or fail with the supplied exception.
        Throws:
        T - if the entity does not exist in the persistent storage
        T extends Exception
      • loadOrFail

        @Nonnull
        <T extends ExceptionO loadOrFail​(Long id,
                                           Function<String,​T> exceptionSupplier)
                                    throws T extends Exception
        Load an entity or fail with the supplied exception; the message is generated automatically.
        Throws:
        T - if the entity does not exist in the persistent storage
        T extends Exception
      • loadOrFail

        @Nonnull
        <T extends ExceptionO loadOrFail​(Long id,
                                           Function<String,​T> exceptionSupplier,
                                           String message)
                                    throws T extends Exception
        Load an entity or fail with the supplied exception and message.
        Throws:
        T - if the entity does not exist in the persistent storage
        T extends Exception
      • loadAll

        Collection<O> loadAll()
        Loads all the entities of specific type.
        Returns:
        collection of all entities currently available in the persistent storage.
      • countAll

        long countAll()