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 Pcreate(P payload)voiddelete(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 SimplePayloadMappergetMapper()protected ApplicationRepository<D>getRepository()Optional<P>readByIdentifier(String identifierType, String identifierValue)Preplace(String id, P payload)Psave(P payload)
-
-
-
Constructor Detail
-
DefaultApplicationService
public DefaultApplicationService(ApplicationRepository<D> repository, SimplePayloadMapper mapper)
-
-
Method Detail
-
create
public P create(P payload)
- Specified by:
createin interfaceApplicationService<P extends Application>
-
delete
@CacheEvict(cacheNames="authCacheApplicationUrlByApplicationId") public void delete(String id)
- Specified by:
deletein interfaceApplicationService<P extends Application>
-
replace
@NonNull @CacheEvict(cacheNames="authCacheApplicationUrlByApplicationId", key="#p0") public P replace(String id, P payload)- Specified by:
replacein interfaceApplicationService<P extends Application>
-
readByIdentifier
public Optional<P> readByIdentifier(String identifierType, String identifierValue)
- Specified by:
readByIdentifierin interfaceApplicationService<P extends Application>
-
findApplicationsForCustomerContext
public List<P> findApplicationsForCustomerContext(String customerContextId)
Description copied from interface:ApplicationServiceReturns 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 serverviaAuthorizedClient. 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:
findApplicationsForCustomerContextin interfaceApplicationService<P extends Application>- Parameters:
customerContextId- The customer context ID.- Returns:
- A list of
Applicationsor 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:ApplicationServiceReturns 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:
findApplicationsForTenantin 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:
findByIdin interfaceApplicationService<P extends Application>
-
findByIdIn
public List<P> findByIdIn(Collection<String> ids)
- Specified by:
findByIdInin interfaceApplicationService<P extends Application>
-
save
public P save(P payload)
- Specified by:
savein interfaceApplicationService<P extends Application>
-
getRepository
protected ApplicationRepository<D> getRepository()
-
getMapper
protected SimplePayloadMapper getMapper()
-
-