Class AiPolicyRepository

All Implemented Interfaces:
Repository<AiPolicy>

public class AiPolicyRepository extends AbstractAiPolicyRepository
  • Constructor Details

    • AiPolicyRepository

      public AiPolicyRepository()
  • Method Details

    • save

      public AiPolicy save(AiPolicy policy)
      Checks the policy's restrictions first: they and their fields are saved by cascade from the policy, past any repository of their own. A global policy applies to every call: the agents, models and providers it listed go.
      Specified by:
      save in interface Repository<AiPolicy>
      Overrides:
      save in class JpaRepository<AiPolicy>
      Parameters:
      policy - the entity object to save
      Returns:
      an instance of the entity with saved state
      Throws:
      ResponseException - titled as a validation error, as validate(com.axelor.ai.db.AiPolicy) refuses it
    • validate

      public void validate(AiPolicy policy)
      What save(com.axelor.ai.db.AiPolicy) checks and normalizes, for a policy that is not saved yet: a seed file's restrictions must be valid before the policy they replace changes. Each restriction's object is kept canonical.
      Throws:
      IllegalArgumentException - naming the first restriction that names nothing, takes a condition no record can be told by or one beside fields, or names fields of no single model or that it lacks
    • forget

      public void forget(AiAgent agent)
      Takes the agent off every policy listing it, before the agent is removed. A policy left listing nothing applies nowhere, which an administrator sees on it; it never turns global.
    • forget

      public void forget(AiModel model)
      The same, for a model.
    • forget

      public void forget(AiProvider provider)
      The same, for a provider.