Interface VendorVisibilityManager

  • All Known Implementing Classes:
    DefaultVendorVisibilityManager

    public interface VendorVisibilityManager
    This is the top-level component that consumers should typically rely on when needing to perform vendor-visibility-related operations relating to entities.

    Ultimately, the purpose of this component is to inject all VendorVisibilityHandler beans, and then delegate to the one that supports performing a given operation on a particular entity.

    See Also:
    VendorVisibilityHandler
    • Method Detail

      • supportsVendorDiscrimination

        boolean supportsVendorDiscrimination​(Class<?> persistedDomainEntityType)
        Ultimately reports whether this manager has a VendorVisibilityHandler which can support the provided persistedDomainEntityType.

        This can be useful to determine whether an entity should participate in vendor-discrimination behavior.

        Parameters:
        persistedDomainEntityType - the persisted-domain entity type for which to check vendor-handling support
        Returns:
        true if there is a VendorVisibilityHandler which can handle the entity, false otherwise
      • isEntityMutableByVendorRestrictions

        boolean isEntityMutableByVendorRestrictions​(Object persistedDomainEntity,
                                                    Set<String> restrictedVendorRefs,
                                                    @Nullable
                                                    ContextInfo contextInfo)
        Given a persistedDomainEntity, report whether that entity is mutable by the given vendor restrictions.

        This is particularly useful to validate whether an entity can be inserted or updated by a vendor-restricted authentication.

        If no VendorVisibilityHandler supports this operation for the given persistedDomainEntity, true will be returned with the assumption that there is no visibility check that needs to be performed.

        Parameters:
        persistedDomainEntity - the persisted-domain entity to validate visibility for
        restrictedVendorRefs - the "vendorRef" (typically a vendor ID or code) of all vendors that visibility should be restricted to. Cannot be empty.
        contextInfo - context information surrounding sandboxing/multitenant state
        Returns:
        true if the entity is visible by the given vendor restrictions, false otherwise
        See Also:
        VendorAwareTrackablePolicyUtils, VendorVisibilityHandler.isEntityMutableByVendorRestrictions(Object, Set, ContextInfo)
      • createVendorNarrowingFilter

        @Nullable
        String createVendorNarrowingFilter​(Class<?> persistedDomainEntityTypeBeingRead,
                                           Set<String> restrictedVendorRefs,
                                           @Nullable
                                           ContextInfo contextInfo)
        Given a persistedDomainEntityTypeBeingRead that is being read in a query, return a Node filter string for it that restricts results to only include data from the restrictedVendorRefs.

        This is particularly useful to prevent vendor-restricted authentications from accessing data outside of their allowed vendors.

        If no VendorVisibilityHandler supports this operation for the given persistedDomainEntityTypeBeingRead, null will be returned with the assumption that there is no filtration that needs to be performed for that entity.

        Parameters:
        persistedDomainEntityTypeBeingRead - the persisted-domain entity type for which to produce a vendor-narrowing filter
        restrictedVendorRefs - the "vendorRef" (typically a vendor ID or code) of all vendors that the results need to be restricted to. Cannot be empty.
        contextInfo - context information surrounding sandboxing/multitenant state. Some implementations may inform their filtration decisions with this.
        Returns:
        a Node filter string that can be used to restrict results to only include data from the restrictedVendorRefs. Alternatively, return null if the handlers shouldn't/can't produce a filter for the given inputs.
        See Also:
        VendorNarrowingContextInfoCustomizer, VendorVisibilityHandler.createVendorNarrowingFilter(Set, ContextInfo)
      • getAssociatedVendorRef

        @Nullable
        String getAssociatedVendorRef​(Object persistedDomainEntity,
                                      @Nullable
                                      ContextInfo contextInfo)
        Given a persistedDomainEntity, determine what vendor it is associated to (if any).

        If no VendorVisibilityHandler supports this operation for the given persistedDomainEntity, null will be returned with the assumption that there is no associated vendor.

        Parameters:
        persistedDomainEntity - the persisted-domain entity to determine the vendor association for
        contextInfo - context information surrounding multitenant state
        Returns:
        the vendorRef that the given entity is associated to, or null if not associated to a vendor
        See Also:
        VendorVisibilityHandler.getAssociatedVendorRef(Object, ContextInfo)