Class DefaultApplicationService<P extends Application>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.tenant.service.DefaultApplicationService<P>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>,ApplicationService<P>
public class DefaultApplicationService<P extends Application>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements ApplicationService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultApplicationService(ApplicationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, TenantApplicationProperties applicationProperties, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionprotected PcreateForApplicationCustomerContext(P businessInstance, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.APPLICATION.protected PcreateForTenantCustomerContext(P businessInstance, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.TENANT.protected TenantApplicationPropertiesprotected ApplicationRepository<com.broadleafcommerce.data.tracking.core.Trackable>readActiveByApplicationIdentifierAndIdentifierType(String identifier, String identifierType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the application by itsApplication.getIdentifierValue()and, optionally, byApplication.getIdentifierType().org.springframework.data.domain.Page<P>readAllActive(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allApplicationswhereApplication.isDeactivated()is false.org.springframework.data.domain.Page<P>readAllByApplicationIdIn(Collection<String> applicationIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<P>readByActiveStatus(boolean isActive, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds and returns allApplicationswhereApplication.isDeactivated()satisfies theisActiveparameter.org.springframework.data.domain.Page<P>readByActiveStatusAndApplicationIdIn(Collection<String> applicationIds, boolean active, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readByToken(String applicationToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds and returns the application associated with the provided application token.org.springframework.data.domain.Page<ApplicationCatalogRef>readCatalogsForAdd(String id, @NonNull org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finds and returns the catalog's for the given owning application that are available to be added when selecting a catalog for add operations.readOptionalByContextId(@NonNull String contextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Similar toCrudEntityService.readByContextId(String, ContextInfo), but returns anOptionalinstead.replace(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) update(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Constructor Details
-
DefaultApplicationService
public DefaultApplicationService(ApplicationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, TenantApplicationProperties applicationProperties, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
-
-
Method Details
-
create
public P create(@NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
createin interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>- Overrides:
createin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Application>
-
update
public P update(String id, @NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
updatein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>- Overrides:
updatein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Application>
-
replace
public P replace(String id, @NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
replacein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>- Overrides:
replacein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Application>
-
readOptionalByContextId
public Optional<P> readOptionalByContextId(@NonNull @NonNull String contextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ApplicationServiceSimilar toCrudEntityService.readByContextId(String, ContextInfo), but returns anOptionalinstead.- Specified by:
readOptionalByContextIdin interfaceApplicationService<P extends Application>- Parameters:
contextId- the ID of the application to findcontextInfo- context information surrounding multitenant state- Returns:
- an
Optionalcontaining the entity if found,Optional.empty()otherwise
-
readByToken
public Optional<P> readByToken(String applicationToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ApplicationServiceFinds and returns the application associated with the provided application token.- Specified by:
readByTokenin interfaceApplicationService<P extends Application>- Parameters:
applicationToken- the application tokencontextInfo- the context info- Returns:
- the application
-
readCatalogsForAdd
public org.springframework.data.domain.Page<ApplicationCatalogRef> readCatalogsForAdd(String id, @NonNull @NonNull org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ApplicationServiceFinds and returns the catalog's for the given owning application that are available to be added when selecting a catalog for add operations.- Specified by:
readCatalogsForAddin interfaceApplicationService<P extends Application>- Parameters:
id- the application's id for which to return catalogs for addingpageable- the requested page of results from the databasecontext- context information surrounding sandboxing and multitenant state- Returns:
- catalogs available for add operations for the given application
- See Also:
-
readAllActive
public org.springframework.data.domain.Page<P> readAllActive(@Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ApplicationServiceReads allApplicationswhereApplication.isDeactivated()is false.- Specified by:
readAllActivein interfaceApplicationService<P extends Application>- Parameters:
filters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.pageable- the requested page of results from the databasecontext- context information surrounding sandboxing and multitenant state- Returns:
- all
ApplicationswhereApplication.isDeactivated()is false.
-
readByActiveStatus
public org.springframework.data.domain.Page<P> readByActiveStatus(boolean isActive, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ApplicationServiceFinds and returns allApplicationswhereApplication.isDeactivated()satisfies theisActiveparameter.- Specified by:
readByActiveStatusin interfaceApplicationService<P extends Application>- Parameters:
isActive- true if only active applications should be returned, false if only deactivated applications should be returnedfilters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.pageable- the requested page of results from the databasecontext- context information surrounding sandboxing and multitenant state- Returns:
- all
ApplicationswhereApplication.isDeactivated()satisfies theisActiveparameter
-
readActiveByApplicationIdentifierAndIdentifierType
public Optional<P> readActiveByApplicationIdentifierAndIdentifierType(String identifier, @Nullable String identifierType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ApplicationServiceReads the application by itsApplication.getIdentifierValue()and, optionally, byApplication.getIdentifierType(). If not provided, identifier will default toResolutionIdentifierType.DOMAIN.- Specified by:
readActiveByApplicationIdentifierAndIdentifierTypein interfaceApplicationService<P extends Application>- Parameters:
identifier- theApplication.getIdentifierValue()identifierType- theApplication.getIdentifierType()contextInfo- context information surrounding sandboxing and multitenant state- Returns:
- the
Applicationwith the matchingApplication.getIdentifierValue()
-
getRepositoryDomain
- Specified by:
getRepositoryDomainin interfaceApplicationService<P extends Application>
-
readAllByApplicationIdIn
public org.springframework.data.domain.Page<P> readAllByApplicationIdIn(Collection<String> applicationIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
readAllByApplicationIdInin interfaceApplicationService<P extends Application>
-
readByActiveStatusAndApplicationIdIn
public org.springframework.data.domain.Page<P> readByActiveStatusAndApplicationIdIn(Collection<String> applicationIds, boolean active, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
readByActiveStatusAndApplicationIdInin interfaceApplicationService<P extends Application>
-
createForTenantCustomerContext
protected P createForTenantCustomerContext(@NonNull P businessInstance, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.TENANT.- Parameters:
businessInstance- Instance to be persistedcontext- context information surrounding sandboxing and multitenant state- Returns:
- The new entity instance in the form of a projection type instance.
-
createForApplicationCustomerContext
protected P createForApplicationCustomerContext(@NonNull P businessInstance, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.APPLICATION.- Parameters:
businessInstance- Instance to be persistedcontext- context information surrounding sandboxing and multitenant state- Returns:
- The new entity instance in the form of a projection type instance.
-
getRepository
- Overrides:
getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Application>
-
getApplicationProperties
-