Package com.axelor.ai.db.repo
Class AiPolicyRepository
java.lang.Object
com.axelor.db.JpaRepository<AiPolicy>
com.axelor.ai.db.repo.AbstractAiPolicyRepository
com.axelor.ai.db.repo.AiPolicyRepository
- All Implemented Interfaces:
Repository<AiPolicy>
-
Field Summary
Fields inherited from class com.axelor.db.JpaRepository
modelClass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTakes the agent off every policy listing it, before the agent is removed.voidThe same, for a model.voidforget(AiProvider provider) The same, for a provider.Checks the policy's restrictions first: they and their fields are saved by cascade from the policy, past any repository of their own.voidWhatsave(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.Methods inherited from class com.axelor.ai.db.repo.AbstractAiPolicyRepository
findByNameMethods inherited from class com.axelor.db.JpaRepository
all, all, copy, create, fields, find, findById, findByIds, flush, getReferenceById, isPermitted, isPermitted, merge, of, persist, populate, refresh, remove, validate
-
Constructor Details
-
AiPolicyRepository
public AiPolicyRepository()
-
-
Method Details
-
save
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:
savein interfaceRepository<AiPolicy>- Overrides:
savein classJpaRepository<AiPolicy>- Parameters:
policy- the entity object to save- Returns:
- an instance of the entity with saved state
- Throws:
ResponseException- titled as a validation error, asvalidate(com.axelor.ai.db.AiPolicy)refuses it
-
validate
Whatsave(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
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
The same, for a model. -
forget
The same, for a provider.
-