Class DefaultAdminPermissionService<P extends AdminPermission>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.adminuser.user.service.DefaultAdminPermissionService<P>
- All Implemented Interfaces:
AdminPermissionService<P>
,com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
@Deprecated
public class DefaultAdminPermissionService<P extends AdminPermission>
extends com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
implements AdminPermissionService<P>
Deprecated.
- Author:
- Samarth Dhruva (samarthd)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAdminPermissionService
(AdminPermissionContextValidator<P> adminPermissionContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, AdminPermissionRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityHelper helper, 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.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> OperationAwarePersistenceMessage<T>
buildPersistenceMessage
(T entity, com.broadleafcommerce.data.tracking.core.type.OperationType operationType, Instant timestamp) Deprecated.protected P
convertFromPersistentDomain
(Object persistedDomain, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Similar toMappableCrudEntityHelper.convertFromPersistentDomain(java.lang.Object)
, except will invokeDomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo)
with the givencontextInfo
argument instead of justnull
.<D,
R extends org.springframework.data.repository.CrudRepository<D, String> & com.broadleafcommerce.common.extension.DomainTypeAware>
PDeprecated.Deprecated.Creates the permission.protected <D,
R extends org.springframework.data.repository.CrudRepository<D, String> & com.broadleafcommerce.common.extension.DomainTypeAware>
DcreateInternal
(P businessInstance) Deprecated.Mostly copied fromMappableCrudEntityHelper.create(Object, CrudRepository)
, but overridden to support notifying on persistence events viainitializePersistenceProducerState(NotificationStateAware, OperationType)
.void
Deprecated.Mostly copied fromMappableCrudEntityHelper.delete(String, CrudRepository)
, but overridden to support notifying on persistence events viaattemptDirectlySendingDeletePersistenceMessage(String, Object)
.void
Deprecated.Deletes the given permission.boolean
existsById
(@NonNull String id) Deprecated.Performs an existence check to determine if there is a permission in the data store matching the given id.boolean
existsByNameAndIdNot
(@NonNull String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reports whether there exists a permission in the data store whoseAdminPermission.name
is equal to the givenname
and whoseAdminPermission.id
is not equal to the givenid
.protected AdminPermissionContextValidator<P>
Deprecated.protected com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper
Deprecated.protected com.broadleafcommerce.common.messaging.notification.NotificationManager
Deprecated.protected com.broadleafcommerce.common.messaging.notification.NotificationStateService
Deprecated.protected com.broadleafcommerce.common.messaging.PersistenceProducer
Deprecated.protected AdminPermissionRepository<?>
Deprecated.Override this to save callers a cast toDomainTypeAware
or other interfaces that it implements.protected String
getSerializedRepresentation
(Object object) Deprecated.protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager
Deprecated.protected void
initializePersistenceProducerState
(com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware repositoryDomain, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) Deprecated.protected void
notifyPersistenceProducer
(com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware domain) Deprecated.org.springframework.data.domain.Page<P>
readAll
(org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads all permissions in the data store.org.springframework.data.domain.Page<P>
readAllByName
(String name, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads permissions in the data store, filtering to those whose name contains the given value.Deprecated.Reads the permission in the data store matching the given ID.readByIds
(List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads the permissions in the data store matching the given IDs.readByIdsAndGlobal
(List<String> ids) Deprecated.Reads the permissions in the data store matching the given IDs that have anull
AdminPermission.tenantId
.Deprecated.replace
(String id, P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Replaces the given permission.protected <D> D
replaceInternal
(String id, P businessInstance) Deprecated.Mostly copied fromMappableCrudEntityHelper.replace(String, Object, CrudRepository)
, but overridden to support notifying on persistence events viainitializePersistenceProducerState(NotificationStateAware, OperationType)
.protected void
throwIfErrors
(org.springframework.validation.Errors errors) Deprecated.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService
convertFromPersistentDomain, createAll, createAllAllowingPartialSuccess, getHelper, readAll, readAll, readAll, readAllByIds, readById, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
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.MappableCrudEntityService
createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByIds, readById, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
-
Constructor Details
-
DefaultAdminPermissionService
public DefaultAdminPermissionService(AdminPermissionContextValidator<P> adminPermissionContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, AdminPermissionRepository<?> repository, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityHelper helper, 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.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser) Deprecated.
-
-
Method Details
-
getRepository
Deprecated.Override this to save callers a cast toDomainTypeAware
or other interfaces that it implements.- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminPermission>
- Returns:
- the repository that supports this service
-
readByIds
public List<P> readByIds(List<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Reads the permissions in the data store matching the given IDs. If any of the permissions are not accessible from the given context as described in the class-level javadocs, they will not be returned (effectively not found).- Specified by:
readByIds
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
ids
- the ids of the permissions to findcontextInfo
- context information about multitenant state- Returns:
- the permissions matching the given ids if found and accessible from the given context
-
readByIdsAndGlobal
Deprecated.Description copied from interface:AdminPermissionService
Reads the permissions in the data store matching the given IDs that have anull
AdminPermission.tenantId
.- Specified by:
readByIdsAndGlobal
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
ids
- the ids of the permissions to find- Returns:
- the permissions matching the given ids that have a null
AdminPermission.tenantId
-
readAllByName
public org.springframework.data.domain.Page<P> readAllByName(String name, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Reads 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:
readAllByName
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
name
- the value that permission names must contain in order to matchpageable
- describes the page of results to returncontextInfo
- context information about multitenant state- Returns:
- permissions accessible in the current context that match the given name
-
readAll
public org.springframework.data.domain.Page<P> readAll(org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Reads all permissions in the data store. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Specified by:
readAll
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
pageable
- describes the page of results to returncontextInfo
- context information about multitenant state- Returns:
- permissions accessible in the current context
-
readById
public P readById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Reads the permission in the data store matching the given ID.- Specified by:
readById
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
id
- the id of the permission to findcontextInfo
- context information about multitenant state- Returns:
- the permission matching the given id if found and accessible from the given context
-
existsById
Deprecated.Description copied from interface:AdminPermissionService
Performs an existence check to determine if there is a permission in the data store matching the given id.- Specified by:
existsById
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
id
- the id of the permission to find- Returns:
- true if the permission exists, false otherwise
-
existsByNameAndIdNot
public boolean existsByNameAndIdNot(@NonNull @NonNull String name, @Nullable String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Reports whether there exists a permission in the data store whoseAdminPermission.name
is equal to the givenname
and whoseAdminPermission.id
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:
existsByNameAndIdNot
in interfaceAdminPermissionService<P extends AdminPermission>
- 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.contextInfo
- context information about multitenant state- Returns:
true
if there exists a permission accessible from the given context matching the given name and not matching the given id,false
otherwise
-
create
public P create(P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Creates the permission.If in a tenant or application context, the permission's context information will be overwritten and initialized to match the given context.
If in a global context, the permission's context information will be untouched from what is supplied.
Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Specified by:
create
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
permission
- the permission to createcontextInfo
- context information about multitenant state- Returns:
- the permission after it has been created in the data store
-
throwIfErrors
protected void throwIfErrors(org.springframework.validation.Errors errors) Deprecated. -
create
public <D,R extends org.springframework.data.repository.CrudRepository<D, P createString> & com.broadleafcommerce.common.extension.DomainTypeAware> (@NonNull P businessInstance) Deprecated.- Specified by:
create
in interfacecom.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminPermission>
- Overrides:
create
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminPermission>
- See Also:
-
createInternal
protected <D,R extends org.springframework.data.repository.CrudRepository<D, D createInternalString> & com.broadleafcommerce.common.extension.DomainTypeAware> (@NonNull P businessInstance) Deprecated.Mostly copied fromMappableCrudEntityHelper.create(Object, CrudRepository)
, but overridden to support notifying on persistence events viainitializePersistenceProducerState(NotificationStateAware, OperationType)
.- Parameters:
businessInstance
- The business domain instance. In general, theDomainMapperManager
is responsible for converting to a repository platform type for persistence.- 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
-
initializePersistenceProducerState
protected void initializePersistenceProducerState(com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware repositoryDomain, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) Deprecated. -
buildPersistenceMessage
protected <T> OperationAwarePersistenceMessage<T> buildPersistenceMessage(T entity, com.broadleafcommerce.data.tracking.core.type.OperationType operationType, Instant timestamp) Deprecated. -
getSerializedRepresentation
Deprecated. -
notifyPersistenceProducer
protected void notifyPersistenceProducer(com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware domain) Deprecated. -
replace
public P replace(String id, P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Replaces the given permission.Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Specified by:
replace
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
id
- the id of the permission to replacepermission
- the replacement permissioncontextInfo
- context information about multitenant state- Returns:
- the permission after it has been replaced in the data store
-
replace
Deprecated.- Specified by:
replace
in interfacecom.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminPermission>
- Overrides:
replace
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminPermission>
- See Also:
-
replaceInternal
Deprecated.Mostly copied fromMappableCrudEntityHelper.replace(String, Object, CrudRepository)
, but overridden to support notifying on persistence events viainitializePersistenceProducerState(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.- Returns:
- The replaced entity instance in the form of a persisted instance, or
EntityMissingException
if 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(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Description copied from interface:AdminPermissionService
Deletes the given permission.Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Specified by:
delete
in interfaceAdminPermissionService<P extends AdminPermission>
- Parameters:
id
- the ID of the permission to deletecontextInfo
- context information about multitenant state
-
delete
Deprecated.Mostly copied fromMappableCrudEntityHelper.delete(String, CrudRepository)
, but overridden to support notifying on persistence events viaattemptDirectlySendingDeletePersistenceMessage(String, Object)
.- Specified by:
delete
in interfacecom.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminPermission>
- Overrides:
delete
in classcom.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminPermission>
- Parameters:
id
- The id of the entity to delete- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if the permission was not found
-
convertFromPersistentDomain
protected P convertFromPersistentDomain(Object persistedDomain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Similar toMappableCrudEntityHelper.convertFromPersistentDomain(java.lang.Object)
, except will invokeDomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo)
with the givencontextInfo
argument instead of justnull
.Ensures
MutabilityContextStateMapperMember
will have a context to base its mutability determination on.- Parameters:
persistedDomain
- the persisted-domain instance to convert to the business domaincontextInfo
- context information surrounding multitenant state
-
getAdminPermissionContextValidator
Deprecated. -
getValidator
protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager getValidator()Deprecated. -
getPersistenceProducer
protected com.broadleafcommerce.common.messaging.PersistenceProducer getPersistenceProducer()Deprecated. -
getNotificationStateService
protected com.broadleafcommerce.common.messaging.notification.NotificationStateService getNotificationStateService()Deprecated. -
getNotificationManager
protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()Deprecated. -
getMessageSerializationHelper
protected com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper getMessageSerializationHelper()Deprecated.
-