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
ConstructorDescriptionDefaultApplicationService
(ApplicationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, TenantApplicationProperties applicationProperties, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionprotected P
createForApplicationCustomerContext
(P businessInstance, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.APPLICATION
.protected P
createForTenantCustomerContext
(P businessInstance, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the create operation forCustomerContextResolverMethod.TENANT
.protected TenantApplicationProperties
protected 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 allApplications
whereApplication.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 allApplications
whereApplication.isDeactivated()
satisfies theisActive
parameter.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 anOptional
instead.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, readAll
Methods 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, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods 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:
create
in interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>
- Overrides:
create
in 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:
update
in interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>
- Overrides:
update
in 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:
replace
in interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Application>
- Overrides:
replace
in 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:ApplicationService
Similar toCrudEntityService.readByContextId(String, ContextInfo)
, but returns anOptional
instead.- Specified by:
readOptionalByContextId
in interfaceApplicationService<P extends Application>
- Parameters:
contextId
- the ID of the application to findcontextInfo
- context information surrounding multitenant state- Returns:
- an
Optional
containing 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:ApplicationService
Finds and returns the application associated with the provided application token.- Specified by:
readByToken
in 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:ApplicationService
Finds 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:
readCatalogsForAdd
in 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:ApplicationService
Reads allApplications
whereApplication.isDeactivated()
is false.- Specified by:
readAllActive
in interfaceApplicationService<P extends Application>
- Parameters:
filters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.pageable
- the requested page of results from the databasecontext
- context information surrounding sandboxing and multitenant state- Returns:
- all
Applications
whereApplication.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:ApplicationService
Finds and returns allApplications
whereApplication.isDeactivated()
satisfies theisActive
parameter.- Specified by:
readByActiveStatus
in 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 beEmptyNode
if no additional filters should be applied.pageable
- the requested page of results from the databasecontext
- context information surrounding sandboxing and multitenant state- Returns:
- all
Applications
whereApplication.isDeactivated()
satisfies theisActive
parameter
-
readActiveByApplicationIdentifierAndIdentifierType
public Optional<P> readActiveByApplicationIdentifierAndIdentifierType(String identifier, @Nullable String identifierType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ApplicationService
Reads the application by itsApplication.getIdentifierValue()
and, optionally, byApplication.getIdentifierType()
. If not provided, identifier will default toResolutionIdentifierType.DOMAIN
.- Specified by:
readActiveByApplicationIdentifierAndIdentifierType
in interfaceApplicationService<P extends Application>
- Parameters:
identifier
- theApplication.getIdentifierValue()
identifierType
- theApplication.getIdentifierType()
contextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the
Application
with the matchingApplication.getIdentifierValue()
-
getRepositoryDomain
- Specified by:
getRepositoryDomain
in 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:
readAllByApplicationIdIn
in 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:
readByActiveStatusAndApplicationIdIn
in 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:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Application>
-
getApplicationProperties
-