Class DefaultSandboxService<P extends Sandbox>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.sandbox.service.DefaultSandboxService<P>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>,SandboxService<P>
public class DefaultSandboxService<P extends Sandbox>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements SandboxService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSandboxService(SandboxRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, org.springframework.transaction.support.TransactionTemplate template) -
Method Summary
Modifier and TypeMethodDescriptioncreateWithIdIfDoesNotExist(P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This is a custom create method that will override the autogenerated context ID produced byCreateSetupDomainMapperMember, and instead use theSandbox.idthat is supplied in the givensandbox.voidDeletes the sandbox with specified id, archives all change summaries, change summary groups related to that sandbox, and sends theSandboxDeleteProducer.TYPEnotification.booleanexistsByApplication(String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether anySandboxesexist for the applicationprotected ChangeSummaryGroupService<ChangeSummaryGroup>protected ChangeSummaryService<ChangeSummary>protected com.broadleafcommerce.common.messaging.notification.NotificationManagerprotected com.broadleafcommerce.common.messaging.notification.NotificationStateServiceprotected SandboxRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected org.springframework.transaction.support.TransactionTemplateprotected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManagerorg.springframework.data.domain.Page<P>readAllByApplication(String applicationId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all the sandboxes for the current application.org.springframework.data.domain.Page<P>readAllByNameAndApplication(String name, String applicationId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all the sandboxes for the current application with the given namereadByContextIdAndApplication(String id, String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read the sandbox by ID for the current applicationvoidsetChangeSummaryGroupService(ChangeSummaryGroupService<ChangeSummaryGroup> changeSummaryGroupService) voidsetChangeSummaryService(ChangeSummaryService<ChangeSummary> changeSummaryService) voidsetNotificationManager(com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager) voidsetNotificationStateService(com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService) voidvalidateExistsByContextIdAndApplication(String id, String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates that the sandbox with the given ID belongs to the current applicationMethods 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, create, createAll, createAllAllowingPartialSuccess, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, 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
create, createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Constructor Details
-
DefaultSandboxService
public DefaultSandboxService(SandboxRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, org.springframework.transaction.support.TransactionTemplate template)
-
-
Method Details
-
createWithIdIfDoesNotExist
public P createWithIdIfDoesNotExist(@NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SandboxServiceThis is a custom create method that will override the autogenerated context ID produced byCreateSetupDomainMapperMember, and instead use theSandbox.idthat is supplied in the givensandbox.This method will perform an atomic upsert, returning the sandbox if it was newly created,
nullotherwise. This differs from the normal save/create in that whether or not a new entity should be created is based on thecontextIdrather than the data-store ID.This method is solely intended for use in
CreateSandboxRequestListener, and should not be used elsewhere.- Specified by:
createWithIdIfDoesNotExistin interfaceSandboxService<P extends Sandbox>- Parameters:
businessInstance- the sandbox to create, with itsSandbox.idsetcontextInfo- context information surrounding multitenant state- Returns:
- the sandbox if it was newly created,
nullotherwise
-
readAllByNameAndApplication
@NonNull public org.springframework.data.domain.Page<P> readAllByNameAndApplication(@NonNull String name, @Nullable String applicationId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SandboxServiceRead all the sandboxes for the current application with the given name- Specified by:
readAllByNameAndApplicationin interfaceSandboxService<P extends Sandbox>- Parameters:
name- Name query by which to filter resultsapplicationId- Id of the application that owns the sandbox. Null if not application-owned.filters- additional filters to apply in the query, can be nullpageInfo- results paging infocontext- contains the application context- Returns:
- all the valid (un-archived) sandboxes for the current application context
-
readAllByApplication
@NonNull public org.springframework.data.domain.Page<P> readAllByApplication(@Nullable String applicationId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SandboxServiceRead all the sandboxes for the current application.- Specified by:
readAllByApplicationin interfaceSandboxService<P extends Sandbox>- Parameters:
applicationId- Id of the application that owns the sandbox. Null if not application-owned.filters- additional filters to apply in the query, can be nullpageInfo- results paging infocontext- contains the application context- Returns:
- all the valid (un-archived) sandboxes for the current application context
-
readByContextIdAndApplication
@NonNull public P readByContextIdAndApplication(@NonNull String id, @Nullable String applicationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SandboxServiceRead the sandbox by ID for the current application- Specified by:
readByContextIdAndApplicationin interfaceSandboxService<P extends Sandbox>- Parameters:
id- ID of the Sandbox.applicationId- Id of the application that owns the sandbox. Null if not application-owned.context- contains the application context- Returns:
- all the valid (un-archived) sandboxes for the current application context
-
validateExistsByContextIdAndApplication
public void validateExistsByContextIdAndApplication(@NonNull String id, @Nullable String applicationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:SandboxServiceValidates that the sandbox with the given ID belongs to the current application- Specified by:
validateExistsByContextIdAndApplicationin interfaceSandboxService<P extends Sandbox>- Parameters:
id- ID of the Sandbox.applicationId- Id of the application that owns the sandbox. Null if not application-owned.context- contains the application context
-
existsByApplication
public boolean existsByApplication(String applicationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SandboxServiceDetermines whether anySandboxesexist for the application- Specified by:
existsByApplicationin interfaceSandboxService<P extends Sandbox>- Parameters:
applicationId- Id of the application that owns the sandbox. Null if not application-owned.contextInfo- contains the application context- Returns:
- Whether any Sandboxes exist for the application
-
delete
@Transactional("sandboxTransactionManager") public void delete(@NonNull String sandboxId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes the sandbox with specified id, archives all change summaries, change summary groups related to that sandbox, and sends the
SandboxDeleteProducer.TYPEnotification.Note: the setup for the
SandboxDeleteProducer.TYPEnotification state happens inNotificationAwareDomainMapperMember.- Specified by:
deletein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends Sandbox>- Overrides:
deletein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends Sandbox>- Parameters:
sandboxId- the sandbox id to deletecontext- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if the sandbox doesn't existArchiveChangeSummaryException- if there areChangeSummaryin active state.- See Also:
-
getRepository
@NonNull protected SandboxRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository() -
getValidator
@NonNull protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager getValidator() -
getTemplate
@NonNull protected org.springframework.transaction.support.TransactionTemplate getTemplate() -
getChangeSummaryService
-
setChangeSummaryService
@Autowired @Lazy public void setChangeSummaryService(ChangeSummaryService<ChangeSummary> changeSummaryService) -
getChangeSummaryGroupService
-
setChangeSummaryGroupService
@Autowired public void setChangeSummaryGroupService(ChangeSummaryGroupService<ChangeSummaryGroup> changeSummaryGroupService) -
getNotificationManager
@NonNull protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager() -
setNotificationManager
@Autowired public void setNotificationManager(com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager) -
getNotificationStateService
@NonNull protected com.broadleafcommerce.common.messaging.notification.NotificationStateService getNotificationStateService() -
setNotificationStateService
@Autowired public void setNotificationStateService(com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService)
-