Class AbstractGenericEntityService<E extends GenericEntity, R extends org.springframework.data.jpa.repository.JpaRepository<E,Long>>
java.lang.Object
com.bluebell.greenhouse.radicle.services.AbstractGenericEntityService<E,R>
- Type Parameters:
E- entity typeR- repository type
- Direct Known Subclasses:
AccountLedgerService, AccountService, ConfiguredIndicatorService, ForgottenPasswordInstanceService, IndicatorCalculationInstanceService, JobService, MarketPriceFetchRequestService, MarketPriceService, PortfolioService, PositionOrderService, PositionService, PositionTransactionService, RecurringNotificationService, StrategyImplementationService, StrategyService, SymbolAliasService, SymbolEnrichmentService, SymbolService, TransactionService, UserService, WatchlistItemService, WatchlistService
public abstract class AbstractGenericEntityService<E extends GenericEntity, R extends org.springframework.data.jpa.repository.JpaRepository<E,Long>>
extends Object
Generic service-layer helper for entity services.
- Version:
- 3.0.5
- Author:
- Stephen Prizio
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGenericEntityService(R entityRepository) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionrefreshEntity(E entity) Refreshes the given entity from persistence when it has an id.protected EresolveEntity(E entity, String notFoundMessage) Resolves the given entity into the managed persistence instance when it has an id.protected EresolveEntity(E entity, Supplier<? extends RuntimeException> notFoundExceptionFactory) Resolves the given entity into the managed persistence instance when it has an id.protected <T extends GenericEntity>
TresolveEntity(T entity, org.springframework.data.jpa.repository.JpaRepository<T, Long> repository, Supplier<? extends RuntimeException> notFoundExceptionFactory) Resolves the given related entity into the managed persistence instance when it has an id.
-
Constructor Details
-
AbstractGenericEntityService
-
-
Method Details
-
refreshEntity
-
resolveEntity
Resolves the given entity into the managed persistence instance when it has an id. -
resolveEntity
-
resolveEntity
protected <T extends GenericEntity> T resolveEntity(T entity, org.springframework.data.jpa.repository.JpaRepository<T, Long> repository, Supplier<? extends RuntimeException> notFoundExceptionFactory) Resolves the given related entity into the managed persistence instance when it has an id.- Type Parameters:
T- related entity type- Parameters:
entity- related entityrepository- repository for the related entity typenotFoundExceptionFactory- factory for the exception thrown when the entity no longer exists- Returns:
- managed related entity
-