Interface AccountPermissionService<P extends AccountPermission>

  • All Superinterfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    All Known Implementing Classes:
    DefaultAccountPermissionService

    public interface AccountPermissionService<P extends AccountPermission>
    extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    Service API for management of AccountPermission.

    Supported by AccountPermissionRepository.

    Declares different versions of CRUD operations beyond just those provided by MappableCrudEntityService - these operations declare a ContextInfo argument to enable access control based upon context. In most scenarios, these operations should be preferred to those without ContextInfo arguments to prevent unwanted mutation/assignment in invalid contexts.

    Certain operations will emit an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel, which is expected to be consumed by the authentication service and synchronized there.

    Author:
    Samarth Dhruva (samarthd), Chris Kittrell (ckittrell)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      P create​(P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates the permission.
      void delete​(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deletes the given permission.
      boolean existsByNameAndIdNot​(String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reports whether there exists a permission in the data store whose AccountPermission.getName() is equal to the given name and whose AccountPermission.getId() is not equal to the given id.
      org.springframework.data.domain.Page<P> readAllByName​(String name, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads permissions in the data store, filtering to those whose name contains the given value.
      P replace​(String id, P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Replaces the given permission.
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

        createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

        readAll, readAll, readAll, readAll
    • Method Detail

      • readAllByName

        org.springframework.data.domain.Page<P> readAllByName​(String name,
                                                              @Nullable
                                                              org.springframework.data.domain.Pageable pageable,
                                                              @Nullable
                                                              com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        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.
        Parameters:
        name - the value that permission names must contain in order to match
        pageable - describes the page of results to return
        contextInfo - context information about multitenant state
        Returns:
        permissions accessible in the current context that match the given name
      • existsByNameAndIdNot

        boolean existsByNameAndIdNot​(String name,
                                     @Nullable
                                     String id,
                                     @Nullable
                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Reports whether there exists a permission in the data store whose AccountPermission.getName() is equal to the given name and whose AccountPermission.getId() is not equal to the given id. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.
        Parameters:
        name - the value that permission name must equal in order to match
        id - (optional) the value that the permission'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 permission accessible from the given context matching the given name and not matching the given id, false otherwise
      • create

        P create​(P permission,
                 @Nullable
                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Creates the permission. Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.
        Specified by:
        create in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>
        Parameters:
        permission - the permission to create
        contextInfo - context information about multitenant state
        Returns:
        the permission after it has been created in the data store
        Throws:
        com.broadleafcommerce.common.error.validation.ValidationException - if there were any validation errors
      • replace

        P replace​(String id,
                  P permission,
                  @Nullable
                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Replaces the given permission.

        Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

        Specified by:
        replace in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>
        Parameters:
        id - the id of the permission to replace
        permission - the replacement permission
        contextInfo - context information about multitenant state
        Returns:
        the permission after it has been replaced in the data store
        Throws:
        com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the permission was not found or accessible from the given context
        com.broadleafcommerce.common.error.validation.ValidationException - if there were validation errors
      • delete

        void delete​(String id,
                    @Nullable
                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deletes the given permission.

        Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

        Specified by:
        delete in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends AccountPermission>
        Parameters:
        id - the ID of the permission to delete
        contextInfo - context information about multitenant state
        Throws:
        com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the permission was not found or accessible from the given context
        com.broadleafcommerce.common.error.validation.ValidationException - if there were validation errors