Class DefaultAuthorizationServerService<P extends AuthorizationServer,D extends com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable & com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware>
- java.lang.Object
-
- com.broadleafcommerce.auth.server.service.DefaultAuthorizationServerService<P,D>
-
- All Implemented Interfaces:
AuthorizationServerService<P>
public class DefaultAuthorizationServerService<P extends AuthorizationServer,D extends com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable & com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware> extends Object implements AuthorizationServerService<P>
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_BY_SERVER_ID
-
Constructor Summary
Constructors Constructor Description DefaultAuthorizationServerService(AuthorizationServerRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator entityValidator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description P
create(P authorizationServer)
Create a new authorization servervoid
delete(P authorizationServer)
Delete an authorization servervoid
deleteById(String id)
Delete an authorization serverboolean
existsById(String id)
Check if an authorization server exists by its IDorg.springframework.data.domain.Page<P>
findAll(org.springframework.data.domain.Pageable pageable)
Find all authorization servers.org.springframework.data.domain.Page<P>
findAllByTenantId(String tenantId, org.springframework.data.domain.Pageable pageable)
Find all authorization servers for a tenant.Optional<P>
findById(String id)
Find an authorization server by its IDOptional<P>
findByName(String name)
Find an authorization server by its nameOptional<P>
findByNameAndTenantId(String name, String tenantId)
Find an authorization server by its name and tenant idprotected Optional<D>
findRepositoryDomainById(String id)
Find the repository domain by ID without converting to business domain.protected Optional<P>
fromRepositoryDomain(Optional<D> optionalDomain)
protected org.springframework.data.domain.Page<P>
fromRepositoryDomain(org.springframework.data.domain.Page<D> page)
protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
getEntityValidator()
protected SimplePayloadMapper
getMapper()
protected AuthorizationServerRepository<D>
getRepository()
P
replace(String id, P authorizationServer)
Replace an authorization serverP
save(P authorizationServer)
Save an authorization serverprotected void
validate(P authorizationServer)
-
-
-
Field Detail
-
CACHE_BY_SERVER_ID
public static final String CACHE_BY_SERVER_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultAuthorizationServerService
public DefaultAuthorizationServerService(AuthorizationServerRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator entityValidator)
-
-
Method Detail
-
findAll
public org.springframework.data.domain.Page<P> findAll(org.springframework.data.domain.Pageable pageable)
Description copied from interface:AuthorizationServerService
Find all authorization servers.- Specified by:
findAll
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
pageable
- the pageable- Returns:
- A page of authorization servers
-
findAllByTenantId
public org.springframework.data.domain.Page<P> findAllByTenantId(String tenantId, org.springframework.data.domain.Pageable pageable)
Description copied from interface:AuthorizationServerService
Find all authorization servers for a tenant.- Specified by:
findAllByTenantId
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
tenantId
- the tenant IDpageable
- the pageable- Returns:
- a page of authorization servers for the tenant
-
findById
@Cacheable(cacheNames="authCacheByServerId", key="#a0", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public Optional<P> findById(String id)
Description copied from interface:AuthorizationServerService
Find an authorization server by its ID- Specified by:
findById
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
id
- The authorization server ID- Returns:
- An optional of authorization server
-
existsById
public boolean existsById(String id)
Description copied from interface:AuthorizationServerService
Check if an authorization server exists by its ID- Specified by:
existsById
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
id
- The authorization server ID- Returns:
- whether or not the authorization server exists
-
findByName
public Optional<P> findByName(String name)
Description copied from interface:AuthorizationServerService
Find an authorization server by its name- Specified by:
findByName
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
name
- The name of the authorization service- Returns:
- An optional of authorization server
-
findByNameAndTenantId
public Optional<P> findByNameAndTenantId(String name, String tenantId)
Description copied from interface:AuthorizationServerService
Find an authorization server by its name and tenant id- Specified by:
findByNameAndTenantId
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
name
- The name of the authorization servicetenantId
- the tenant id that thisAuthorizationServer
belongs to- Returns:
- An optional of authorization server
-
replace
@CacheEvict(cacheNames="authCacheByServerId", key="#a0") public P replace(String id, P authorizationServer)
Description copied from interface:AuthorizationServerService
Replace an authorization server- Specified by:
replace
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
id
- The id of the server to replaceauthorizationServer
- The replacement- Returns:
- The replaced authorization server
-
create
@CachePut(cacheNames="authCacheByServerId", key="#result.id") public P create(P authorizationServer)
Description copied from interface:AuthorizationServerService
Create a new authorization server- Specified by:
create
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
authorizationServer
- The authorization server to create- Returns:
- The created authorization server.
-
delete
@CacheEvict(cacheNames="authCacheByServerId", key="#a0.id") public void delete(P authorizationServer)
Description copied from interface:AuthorizationServerService
Delete an authorization server- Specified by:
delete
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
authorizationServer
- The authorization server to delete.
-
deleteById
@CacheEvict(cacheNames="authCacheByServerId", key="#a0") public void deleteById(String id)
Description copied from interface:AuthorizationServerService
Delete an authorization server- Specified by:
deleteById
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
id
- The id of the authorization server to delete.
-
save
@CachePut(cacheNames="authCacheByServerId", key="#result.id") public P save(P authorizationServer)
Description copied from interface:AuthorizationServerService
Save an authorization server- Specified by:
save
in interfaceAuthorizationServerService<P extends AuthorizationServer>
- Parameters:
authorizationServer
- The authorization server to save- Returns:
- The saved authorization server
-
findRepositoryDomainById
protected Optional<D> findRepositoryDomainById(String id)
Find the repository domain by ID without converting to business domain.- Parameters:
id
- The entity ID- Returns:
- Optional of the entity.
-
fromRepositoryDomain
protected org.springframework.data.domain.Page<P> fromRepositoryDomain(org.springframework.data.domain.Page<D> page)
-
validate
protected void validate(P authorizationServer)
-
getRepository
protected AuthorizationServerRepository<D> getRepository()
-
getMapper
protected SimplePayloadMapper getMapper()
-
getEntityValidator
protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator getEntityValidator()
-
-