Class DefaultAdminRoleService<P extends AdminRole>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P>
com.broadleafcommerce.adminuser.user.service.DefaultAdminRoleService<P>
All Implemented Interfaces:
AdminRoleService<P>, com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>

@Deprecated public class DefaultAdminRoleService<P extends AdminRole> extends com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P> implements AdminRoleService<P>
Deprecated.
Author:
Samarth Dhruva (samarthd)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultAdminRoleService(AdminPermissionHydrationService adminPermissionHydrationService, AdminRoleContextValidator<P> adminRoleContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, AdminRoleRepository<?> 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 Type
    Method
    Description
    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 to MappableCrudEntityHelper.convertFromPersistentDomain(java.lang.Object), except will invoke DomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo) with the given contextInfo argument instead of just null.
    <D, R extends org.springframework.data.repository.CrudRepository<D, String> & com.broadleafcommerce.common.extension.DomainTypeAware>
    P
    create(P businessInstance)
    Deprecated.
     
    create(P role, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Creates the role.
    protected <D, R extends org.springframework.data.repository.CrudRepository<D, String> & com.broadleafcommerce.common.extension.DomainTypeAware>
    D
    createInternal(P businessInstance)
    Deprecated.
    Mostly copied from MappableCrudEntityHelper.create(Object, CrudRepository), but overridden to support notifying on persistence events via notifyPersistenceProducer(NotificationStateAware).
    void
    Deprecated.
    Mostly copied from MappableCrudEntityHelper.delete(String, CrudRepository), but overridden to support notifying on persistence events via attemptDirectlySendingDeletePersistenceMessage(String, Object).
    void
    delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Deletes the given role.
    boolean
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given id.
    boolean
    existsById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given ID.
    boolean
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given ID that has a null AdminRole.tenantId.
    boolean
    existsByNameAndIdNot(@NonNull String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Reports whether there exists a role in the data store whose AdminRole.name is equal to the given name and whose AdminRole.id is not equal to the given id.
    Deprecated.
     
    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 AdminRoleRepository<?>
    Deprecated.
    Override this to save callers a cast to DomainTypeAware or other interfaces that it implements.
    protected String
    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 roles 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 roles in the data store, filtering to those whose name contains the given value.
    readById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Reads the role in the data store matching the given ID.
    Deprecated.
    Read a single role by id.
    readByIds(List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Reads the roles in the data store matching the given IDs.
    replace(@NonNull String id, P businessInstance)
    Deprecated.
     
    replace(String id, P role, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Replaces the given role.
    protected <D> D
    replaceInternal(@NonNull String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Mostly copied from MappableCrudEntityHelper.replace(String, Object, CrudRepository), but overridden to support notifying on persistence events via notifyPersistenceProducer(NotificationStateAware).
    protected void
    throwIfErrors(org.springframework.validation.Errors errors)
    Deprecated.
     
    protected void
    Deprecated.
    Given a role that is requested to be deleted, checks that it does not have any child roles in the data store.

    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

    • DefaultAdminRoleService

      public DefaultAdminRoleService(AdminPermissionHydrationService adminPermissionHydrationService, AdminRoleContextValidator<P> adminRoleContextValidator, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.messaging.PersistenceProducer persistenceProducer, AdminRoleRepository<?> 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

      protected AdminRoleRepository<?> getRepository()
      Deprecated.
      Override this to save callers a cast to DomainTypeAware or other interfaces that it implements.
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminRole>
      Returns:
      the repository that supports this service
    • readByIdOptional

      public Optional<P> readByIdOptional(String id)
      Deprecated.
      Description copied from interface: AdminRoleService
      Read a single role by id.

      Similar to MappableCrudEntityService.readById(String), but does not throw an exception if the entity is not found.

      Specified by:
      readByIdOptional in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to find
      Returns:
      an Optional containing the role if found, otherwise Optional.empty()
    • readByIds

      public List<P> readByIds(List<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Description copied from interface: AdminRoleService
      Reads the roles in the data store matching the given IDs. If any of the roles 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 interface AdminRoleService<P extends AdminRole>
      Parameters:
      ids - the ids of the roles to find
      contextInfo - context information about multitenant state
      Returns:
      the roles matching the given ids if found and accessible from the given context
    • 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: AdminRoleService
      Reads roles in the data store, filtering to those whose name contains the given value. Results are restricted to only the roles accessible from the given context as described in the class-level javadocs.
      Specified by:
      readAllByName in interface AdminRoleService<P extends AdminRole>
      Parameters:
      name - the value that role names must contain in order to match
      pageable - describes the page of results to return
      contextInfo - context information about multitenant state
      Returns:
      roles 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 contextInfo)
      Deprecated.
      Description copied from interface: AdminRoleService
      Reports whether there exists a role in the data store whose AdminRole.name is equal to the given name and whose AdminRole.id is not equal to the given id. Results are restricted to only the roles accessible from the given context as described in the class-level javadocs.
      Specified by:
      existsByNameAndIdNot in interface AdminRoleService<P extends AdminRole>
      Parameters:
      name - the value that role name must equal in order to match
      id - (optional) the value that the role's id must not equal in order to match. If this value is null, then results will not be filtered by their id.
      contextInfo - context information about multitenant state
      Returns:
      true if there exists a role accessible from the given context matching the given name and not matching the given id, false otherwise
    • 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: AdminRoleService
      Reads all roles in the data store. Results are restricted to only the roles accessible from the given context as described in the class-level javadocs.
      Specified by:
      readAll in interface AdminRoleService<P extends AdminRole>
      Parameters:
      pageable - describes the page of results to return
      contextInfo - context information about multitenant state
      Returns:
      roles 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: AdminRoleService
      Reads the role in the data store matching the given ID.
      Specified by:
      readById in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to find
      contextInfo - context information about multitenant state
      Returns:
      the role matching the given id if found and accessible from the given context
    • existsById

      public boolean existsById(String id)
      Deprecated.
      Description copied from interface: AdminRoleService
      Performs an existence check to determine if there is a role in the data store matching the given id.
      Specified by:
      existsById in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to find
      Returns:
      true if the role exists, false otherwise
    • existsByIdInGlobal

      public boolean existsByIdInGlobal(String id)
      Deprecated.
      Description copied from interface: AdminRoleService
      Performs an existence check to determine if there is a role in the data store matching the given ID that has a null AdminRole.tenantId.
      Specified by:
      existsByIdInGlobal in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to find
      Returns:
      true if the role exists and has a null AdminRole.tenantId, false otherwise
    • existsById

      public boolean existsById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Description copied from interface: AdminRoleService
      Performs an existence check to determine if there is a role in the data store matching the given ID.

      Result will only be true if the record is also accessible from the given context as described in the class-level javadocs.

      Specified by:
      existsById in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to find
      contextInfo - context information about multitenant state
      Returns:
      true if a role exists that matches the given id and is accessible from the given context
    • create

      public P create(P role, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Description copied from interface: AdminRoleService
      Creates the role.

      If in a tenant or application context, the role's context information will be overwritten and initialized to match the given context.

      If in a global context, the role's context information will be untouched from what is supplied.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Specified by:
      create in interface AdminRoleService<P extends AdminRole>
      Parameters:
      role - the role to create
      contextInfo - context information about multitenant state
      Returns:
      the role 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, String> & com.broadleafcommerce.common.extension.DomainTypeAware> P create(@NonNull P businessInstance)
      Deprecated.
      Specified by:
      create in interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminRole>
      Overrides:
      create in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminRole>
      See Also:
    • createInternal

      protected <D, R extends org.springframework.data.repository.CrudRepository<D, String> & com.broadleafcommerce.common.extension.DomainTypeAware> D createInternal(@NonNull P businessInstance)
      Deprecated.
      Mostly copied from MappableCrudEntityHelper.create(Object, CrudRepository), but overridden to support notifying on persistence events via notifyPersistenceProducer(NotificationStateAware).
      Parameters:
      businessInstance - The business domain instance. In general, the DomainMapperManager 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

      protected String getSerializedRepresentation(Object object)
      Deprecated.
    • notifyPersistenceProducer

      protected void notifyPersistenceProducer(com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware domain)
      Deprecated.
    • replace

      public P replace(String id, P role, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Description copied from interface: AdminRoleService
      Replaces the given role.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Specified by:
      replace in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the id of the role to replace
      role - the replacement role
      contextInfo - context information about multitenant state
      Returns:
      the role after it has been replaced in the data store
    • replace

      public P replace(@NonNull @NonNull String id, @NonNull P businessInstance)
      Deprecated.
      Specified by:
      replace in interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminRole>
      Overrides:
      replace in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminRole>
      See Also:
    • replaceInternal

      protected <D> D replaceInternal(@NonNull @NonNull String id, @NonNull P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Mostly copied from MappableCrudEntityHelper.replace(String, Object, CrudRepository), but overridden to support notifying on persistence events via notifyPersistenceProducer(NotificationStateAware).
      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 replacement
      com.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: AdminRoleService
      Deletes the given role.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Specified by:
      delete in interface AdminRoleService<P extends AdminRole>
      Parameters:
      id - the ID of the role to delete
      contextInfo - context information about multitenant state
    • delete

      public void delete(@NonNull String id)
      Deprecated.
      Mostly copied from MappableCrudEntityHelper.delete(String, CrudRepository), but overridden to support notifying on persistence events via attemptDirectlySendingDeletePersistenceMessage(String, Object).
      Specified by:
      delete in interface AdminRoleService<P extends AdminRole>
      Specified by:
      delete in interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminRole>
      Overrides:
      delete in class com.broadleafcommerce.data.tracking.core.service.BaseMappableCrudEntityService<P extends AdminRole>
      Parameters:
      id - The id of the entity to delete
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the role was not found
    • validateNoChildrenOfRoleBeforeDeletion

      protected void validateNoChildrenOfRoleBeforeDeletion(@NonNull @NonNull String roleToDeleteId)
      Deprecated.
      Given a role that is requested to be deleted, checks that it does not have any child roles in the data store. This protects against descendants being suddenly orphaned.
      Parameters:
      roleToDeleteId - the id of the role which should be validated to have no children in the data store
      Throws:
      InvalidAdminRoleDeleteException - if the role has children in the data store
    • convertFromPersistentDomain

      protected P convertFromPersistentDomain(Object persistedDomain, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Similar to MappableCrudEntityHelper.convertFromPersistentDomain(java.lang.Object), except will invoke DomainMapperManager.fromRepositoryDomain(BusinessTypeAware, ContextInfo) with the given contextInfo argument instead of just null.

      Ensures MutabilityContextStateMapperMember will have a context to base its mutability determination on.

      Parameters:
      persistedDomain - the persisted-domain instance to convert to the business domain
      contextInfo - context information surrounding multitenant state
    • getAdminRoleContextValidator

      protected AdminRoleContextValidator<P> getAdminRoleContextValidator()
      Deprecated.
    • getAdminPermissionHydrationService

      protected AdminPermissionHydrationService getAdminPermissionHydrationService()
      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.