EntityPolicy
classin packageklyn.data
public abstract class EntityPolicy<T> implements EntityPolicyRegistration
EntityPolicy
All Implemented Interfaces: EntityPolicyRegistration

Typed mandatory filter applied before provider lowering.

Implementations return a KQL query over the supplied source. The compiler therefore validates the policy with ordinary KQL rules, and SQL providers receive its canonical QIR rather than an opaque callback.

Example
@QueryPolicy
public class ActiveCustomerPolicy extends EntityPolicy<Customer>:
    public override apply(
        source as Queryable<Customer>,
        context as PolicyContext
    ) as Query<Customer>:
        return query:
            from source customer
            where customer.active
Properties
Modifier and Type Member Description
public readonly property entityType
entityType as Type
Exact entity type protected by this policy.
public readonly property policyType
policyType as Type
Concrete policy type used by authorization and audit events.
Methods
Modifier and Type Member Description
public allows
allows(entity as Object, context as PolicyContext) as Boolean
Evaluates the identical policy over one materialized entity.
public abstract apply
apply( source as Queryable<T>, context as PolicyContext ) as Query<T>
Builds the mandatory typed query filter.
public applyUntyped
applyUntyped(source as Object, context as PolicyContext) as Object
Applies this policy through the heterogeneous factory registry.
public canonicalPolicy
canonicalPolicy(context as PolicyContext) as QirEntityPolicy
Compiles this policy once to the canonical QIR used by all providers.