Class DefaultApplicationService<P extends Application,D extends com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable & com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware>
- java.lang.Object
-
- com.broadleafcommerce.auth.tenant.service.DefaultApplicationService<P,D>
-
- All Implemented Interfaces:
ApplicationService<P>
public class DefaultApplicationService<P extends Application,D extends com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable & com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware> extends Object implements ApplicationService<P>
-
-
Constructor Summary
Constructors Constructor Description DefaultApplicationService(ApplicationRepository<D> repository, SimplePayloadMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description P
create(P payload)
void
delete(String id)
List<P>
findApplicationsForCustomerContext(String customerContextId)
Returns the application, or applications for a particular customer context.List<P>
findApplicationsForTenant(String tenantId)
Returns the application or applications for a particular tenant.Optional<P>
findById(String id)
List<P>
findByIdIn(Collection<String> ids)
protected SimplePayloadMapper
getMapper()
protected ApplicationRepository<D>
getRepository()
Optional<P>
readByIdentifier(String identifierType, String identifierValue)
P
replace(String id, P payload)
P
save(P payload)
-
-
-
Constructor Detail
-
DefaultApplicationService
public DefaultApplicationService(ApplicationRepository<D> repository, SimplePayloadMapper mapper)
-
-
Method Detail
-
create
public P create(P payload)
- Specified by:
create
in interfaceApplicationService<P extends Application>
-
delete
@CacheEvict(cacheNames="authCacheApplicationUrlByApplicationId") public void delete(String id)
- Specified by:
delete
in interfaceApplicationService<P extends Application>
-
replace
@NonNull @CacheEvict(cacheNames="authCacheApplicationUrlByApplicationId", key="#p0") public P replace(String id, P payload)
- Specified by:
replace
in interfaceApplicationService<P extends Application>
-
readByIdentifier
public Optional<P> readByIdentifier(String identifierType, String identifierValue)
- Specified by:
readByIdentifier
in interfaceApplicationService<P extends Application>
-
findApplicationsForCustomerContext
public List<P> findApplicationsForCustomerContext(String customerContextId)
Description copied from interface:ApplicationService
Returns the application, or applications for a particular customer context. If no applications exist for the customer context, the list returned will be empty.Note that the primary usage for this call is assigning newly created customers to the correct
authorization server
viaAuthorizedClient
. In the case that this returns a list with multiple Applications, these applications should all share the same authorization server, so it is safe to simply use the value at index 0.- Specified by:
findApplicationsForCustomerContext
in interfaceApplicationService<P extends Application>
- Parameters:
customerContextId
- The customer context ID.- Returns:
- A list of
Applications
or an empty list if no applications are found for this customer context. - See Also:
AuthorizedClientService.findApplicationClient(String, String)
,AuthorizedClient.getServerId()
-
findApplicationsForTenant
public List<P> findApplicationsForTenant(String tenantId)
Description copied from interface:ApplicationService
Returns the application or applications for a particular tenant. If no applications exist for the supplied tenant id, the list returned will be empty.- Specified by:
findApplicationsForTenant
in interfaceApplicationService<P extends Application>
- Parameters:
tenantId
- The tenant ID- Returns:
- A list of applications for the supplied tenant ID.
-
findById
public Optional<P> findById(String id)
- Specified by:
findById
in interfaceApplicationService<P extends Application>
-
findByIdIn
public List<P> findByIdIn(Collection<String> ids)
- Specified by:
findByIdIn
in interfaceApplicationService<P extends Application>
-
save
public P save(P payload)
- Specified by:
save
in interfaceApplicationService<P extends Application>
-
getRepository
protected ApplicationRepository<D> getRepository()
-
getMapper
protected SimplePayloadMapper getMapper()
-
-