Record Class SyncRules

java.lang.Object
java.lang.Record
com.axelor.ai.provider.sync.SyncRules
Record Components:
exclude - regexes rejected before any family is consulted. Families are matched in order and the first match wins, so a filter listed only on a broad family never sees an id a narrower one already claimed — noise belongs here, where it cannot be forgotten per family.

A family's defaults are applied only when a model is created. Nothing a rule set declares is re-applied later: it is a guess, and overwriting an administrator who corrected it would be wrong. Only values the provider itself reports are refreshed on every sync.

families - matched in order; the first family whose regex accepts an id claims it
maxModels - hard cap across all families, bounding a rule set that matches far more than intended

public record SyncRules(List<String> exclude, List<SyncRules.Family> families, int maxModels) extends Record
The admin-editable rules stored in AiProvider.syncRules, deciding which of a provider's models to take and what they can do.

Authored as a YAML sync: block in the shipped bundle and stored as the JSON equivalent — one schema, two encodings.

  • Field Details

  • Constructor Details

    • SyncRules

      public SyncRules(List<String> exclude, List<SyncRules.Family> families, int maxModels)
      Creates an instance of a SyncRules record class.
      Parameters:
      exclude - the value for the exclude record component
      families - the value for the families record component
      maxModels - the value for the maxModels record component
  • Method Details

    • parse

      public static SyncRules parse(String json)
      Parses the stored JSON.
      Throws:
      IllegalArgumentException - with a message naming the problem. The rules are hand-edited, so a parse failure is an everyday event that has to read well on the provider form — not an internal error.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • exclude

      public List<String> exclude()
      Returns the value of the exclude record component.
      Returns:
      the value of the exclude record component
    • families

      public List<SyncRules.Family> families()
      Returns the value of the families record component.
      Returns:
      the value of the families record component
    • maxModels

      public int maxModels()
      Returns the value of the maxModels record component.
      Returns:
      the value of the maxModels record component