Package com.axelor.ai.seed
Class Seeds
java.lang.Object
com.axelor.ai.seed.Seeds
Shared plumbing for the per-type importers: entry iteration and the SEED_ONCE lifecycle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumOutcome of seeding one record, accumulated into aSeedResult. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclaim(AiSeedType type, String key, boolean exists, SeedMode mode) Decides whether a record should be written undermode.static SeedResultforEachDir(AiSource source, BiFunction<String, Map<String, byte[]>, Seeds.Outcome> handler) Iterates dir-grouped entries: each<dir>/<relpath>becomesdir → (relpath → bytes).static SeedResultforEachMarkdown(AiSource source, BiFunction<String, Frontmatter.Document, Seeds.Outcome> handler) Iterates flat<stem>.mdentries, parsing each into a frontmatter document.static SeedResultforEachYaml(AiSource source, String kind, BiFunction<String, Map<String, Object>, Seeds.Outcome> handler) Iterates flat<stem>.yamlentries asforEachYaml(AiSource, BiFunction)does, but a file the handler refuses with anIllegalArgumentExceptionis logged as this kind and skipped too.static SeedResultforEachYaml(AiSource source, BiFunction<String, Map<String, Object>, Seeds.Outcome> handler) Iterates flat<stem>.yamlentries, parsing each into a nested map.groupByDir(Map<String, byte[]> entries) Groups entries by their first path segment:<dir>/<relpath>.
-
Method Details
-
forEachYaml
public static SeedResult forEachYaml(AiSource source, BiFunction<String, Map<String, Object>, Seeds.Outcome> handler) Iterates flat<stem>.yamlentries, parsing each into a nested map. A file that does not parse, holds nothing or is not a mapping is logged and skipped: it must not fail the whole bundle, nor be read as one declaring nothing. -
forEachYaml
public static SeedResult forEachYaml(AiSource source, String kind, BiFunction<String, Map<String, Object>, Seeds.Outcome> handler) Iterates flat<stem>.yamlentries asforEachYaml(AiSource, BiFunction)does, but a file the handler refuses with anIllegalArgumentExceptionis logged as this kind and skipped too. -
forEachMarkdown
public static SeedResult forEachMarkdown(AiSource source, BiFunction<String, Frontmatter.Document, Seeds.Outcome> handler) Iterates flat<stem>.mdentries, parsing each into a frontmatter document. -
forEachDir
public static SeedResult forEachDir(AiSource source, BiFunction<String, Map<String, byte[]>, Seeds.Outcome> handler) Iterates dir-grouped entries: each<dir>/<relpath>becomesdir → (relpath → bytes). -
claim
Decides whether a record should be written undermode. UnderSEED_ONCEthis returnsfalseonce the record has been seeded before, or adopts a pre-existing unmarked record by marking it (without overwriting). Callers mark records they actually write. -
groupByDir
Groups entries by their first path segment:<dir>/<relpath>.
-