Class DefaultAccountPermissionService<P extends AccountPermission>
- java.lang.Object
 - 
- com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
 - 
- com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
 - 
- com.broadleafcommerce.customer.service.DefaultAccountPermissionService<P>
 
 
 
 
- 
- All Implemented Interfaces:
 AccountPermissionService<P>,com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
public class DefaultAccountPermissionService<P extends AccountPermission> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements AccountPermissionService<P>
- Author:
 - Samarth Dhruva (samarthd), Chris Kittrell (ckittrell)
 
 
- 
- 
Constructor Summary
Constructors Constructor Description DefaultAccountPermissionService(AccountPermissionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, AccountPermissionContextValidator<P> accountPermissionContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper messageSerializationHelper, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PconvertFromPersistentDomain(@NonNull Object persistedDomain, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Similar toMappableCrudEntityHelper.convertFromPersistentDomain(Object), except will invokeDomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo)with the givencontextargument instead of justnull.Pcreate(P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Creates the permission.protected com.broadleafcommerce.data.tracking.core.TrackablecreateInternal(P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Mostly copied fromMappableCrudEntityHelper.create(Object, CrudRepository), but overridden to support notifying on persistence events via#initializePersistenceProducerState(NotificationStateAware, OperationType).voiddelete(@NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Deletes the given permission.booleanexistsByNameAndIdNot(@NonNull String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Reports whether there exists a permission in the data store whoseAccountPermission.getName()is equal to the givennameand whoseAccountPermission.getId()is not equal to the givenid.protected AccountPermissionContextValidator<P>getAccountPermissionContextValidator()protected com.broadleafcommerce.common.messaging.notification.MessageSerializationHelpergetMessageSerializationHelper()protected com.broadleafcommerce.common.messaging.notification.NotificationManagergetNotificationManager()protected com.broadleafcommerce.common.messaging.notification.NotificationStateServicegetNotificationStateService()protected com.broadleafcommerce.common.messaging.PersistenceProducergetPersistenceProducer()protected AccountPermissionRepository<com.broadleafcommerce.data.tracking.core.Trackable>getRepository()protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManagergetValidator()org.springframework.data.domain.Page<P>readAllByName(@NonNull String name, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Reads permissions in the data store, filtering to those whose name contains the given value.Preplace(@NonNull String id, P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Replaces the given permission.protected com.broadleafcommerce.data.tracking.core.TrackablereplaceInternal(@NonNull String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Mostly copied fromMappableCrudEntityHelper.replace(String, Object, CrudRepository), but overridden to support notifying on persistence events via#initializePersistenceProducerState(NotificationStateAware, OperationType).protected voidthrowIfErrors(@NonNull org.springframework.validation.Errors errors)- 
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, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, 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, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
DefaultAccountPermissionService
public DefaultAccountPermissionService(AccountPermissionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, AccountPermissionContextValidator<P> accountPermissionContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper messageSerializationHelper, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
 
 - 
 
- 
Method Detail
- 
readAllByName
public org.springframework.data.domain.Page<P> readAllByName(@NonNull @NonNull String name, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:AccountPermissionServiceReads permissions in the data store, filtering to those whose name contains the given value. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Specified by:
 readAllByNamein interfaceAccountPermissionService<P extends AccountPermission>- Parameters:
 name- the value that permission names must contain in order to matchpageable- describes the page of results to returncontext- context information about multitenant state- Returns:
 - permissions accessible in the current context that match the given name
 
 
- 
existsByNameAndIdNot
public boolean existsByNameAndIdNot(@NonNull @NonNull String name, @Nullable String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Description copied from interface:AccountPermissionServiceReports whether there exists a permission in the data store whoseAccountPermission.getName()is equal to the givennameand whoseAccountPermission.getId()is not equal to the givenid. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Specified by:
 existsByNameAndIdNotin interfaceAccountPermissionService<P extends AccountPermission>- Parameters:
 name- the value that permission name must equal in order to matchid- (optional) the value that the permission's id must not equal in order to match. If this value isnull, then results will not be filtered by their id.context- context information about multitenant state- Returns:
 trueif there exists a permission accessible from the given context matching the given name and not matching the given id,falseotherwise
 
- 
create
public P create(@NonNull P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:AccountPermissionServiceCreates the permission. Emits anOperationAwarePersistenceMessageto thePersistenceProducer.TYPEchannel.- Specified by:
 createin interfaceAccountPermissionService<P extends AccountPermission>- Specified by:
 createin interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>- Overrides:
 createin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends AccountPermission>- Parameters:
 permission- the permission to createcontext- context information about multitenant state- Returns:
 - the permission after it has been created in the data store
 
 
- 
createInternal
protected com.broadleafcommerce.data.tracking.core.Trackable createInternal(@NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Mostly copied fromMappableCrudEntityHelper.create(Object, CrudRepository), but overridden to support notifying on persistence events via#initializePersistenceProducerState(NotificationStateAware, OperationType).- Parameters:
 businessInstance- The business domain instance. In general, theDomainMapperManageris responsible for converting to a repository platform type for persistence.context-- Returns:
 - The new entity instance in the form of a persisted type instance.
 - Throws:
 com.broadleafcommerce.common.error.validation.ValidationException- if the given businessInstance could not be created
 
- 
replace
public P replace(@NonNull @NonNull String id, @NonNull P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:AccountPermissionServiceReplaces the given permission.Emits an
OperationAwarePersistenceMessageto thePersistenceProducer.TYPEchannel.- Specified by:
 replacein interfaceAccountPermissionService<P extends AccountPermission>- Specified by:
 replacein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>- Overrides:
 replacein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends AccountPermission>- Parameters:
 id- the id of the permission to replacepermission- the replacement permissioncontext- context information about multitenant state- Returns:
 - the permission after it has been replaced in the data store
 
 
- 
replaceInternal
protected com.broadleafcommerce.data.tracking.core.Trackable replaceInternal(@NonNull @NonNull String id, @NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Mostly copied fromMappableCrudEntityHelper.replace(String, Object, CrudRepository), but overridden to support notifying on persistence events via#initializePersistenceProducerState(NotificationStateAware, OperationType).- Parameters:
 id- The id for the entity.businessInstance- The payload type that domain class should be converted to. In general, the payload is what the rest API responds with.context-- Returns:
 - The replaced entity instance in the form of a persisted instance, or
         
EntityMissingExceptionif not available. - Throws:
 com.broadleafcommerce.common.error.validation.ValidationException- if the given businessInstance failed validation on replacementcom.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if a managed instance corresponding to the given id could not be found
 
- 
delete
public void delete(@NonNull @NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Description copied from interface:AccountPermissionServiceDeletes the given permission.Emits an
OperationAwarePersistenceMessageto thePersistenceProducer.TYPEchannel.- Specified by:
 deletein interfaceAccountPermissionService<P extends AccountPermission>- Specified by:
 deletein interfacecom.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>- Overrides:
 deletein classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends AccountPermission>- Parameters:
 id- the ID of the permission to deletecontext- context information about multitenant state
 
- 
throwIfErrors
protected void throwIfErrors(@NonNull @NonNull org.springframework.validation.Errors errors) 
- 
convertFromPersistentDomain
protected P convertFromPersistentDomain(@NonNull @NonNull Object persistedDomain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Similar toMappableCrudEntityHelper.convertFromPersistentDomain(Object), except will invokeDomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo)with the givencontextargument instead of justnull.Ensures
MutabilityContextStateMapperMemberwill have a context to base its mutability determination on.- Parameters:
 persistedDomain- the persisted-domain instance to convert to the business domaincontext- context information surrounding multitenant state
 
- 
getRepository
protected AccountPermissionRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
- Overrides:
 getRepositoryin classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends AccountPermission>
 
- 
getAccountPermissionContextValidator
protected AccountPermissionContextValidator<P> getAccountPermissionContextValidator()
 
- 
getValidator
protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager getValidator()
 
- 
getPersistenceProducer
protected com.broadleafcommerce.common.messaging.PersistenceProducer getPersistenceProducer()
 
- 
getNotificationStateService
protected com.broadleafcommerce.common.messaging.notification.NotificationStateService getNotificationStateService()
 
- 
getNotificationManager
protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
 
- 
getMessageSerializationHelper
protected com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper getMessageSerializationHelper()
 
 - 
 
 -