use of com.nedap.archie.aom.TemplateOverlay in project archetype-languageserver by nedap.
the class BroadcastingArchetypeRepository method invalidateAndRecompileArchetypes.
public void invalidateAndRecompileArchetypes(Archetype newArchetype) {
// now invalidate all related archetypes
Set<String> archetypesToInvalidate = new HashSet<>();
archetypesToInvalidate.add(newArchetype.getArchetypeId().toString());
for (Archetype result : getAllArchetypes()) {
if (isDescendant(result, newArchetype.getArchetypeId().getFullId())) {
archetypesToInvalidate.add(result.getArchetypeId().toString());
}
// this assumes templates cannot be further specialized
if (result instanceof Template) {
Template template = (Template) result;
for (TemplateOverlay overlay : template.getTemplateOverlays()) {
// TODO: not only direct descendants, but also those far below should be checked with (a variant of?) isDescendant
if (archetypesToInvalidate.contains(overlay.getParentArchetypeId())) {
archetypesToInvalidate.add(result.getArchetypeId().getFullId());
}
}
}
}
for (String archetypeId : archetypesToInvalidate) {
removeValidationResult(archetypeId);
}
// TODO: for operational templates we need to scan way more, all archetype roots as well. future addition
if (compile) {
for (String archetypeId : archetypesToInvalidate) {
Archetype archetype = getArchetype(archetypeId);
if (archetype != null && getValidationResult(archetypeId) == null) {
validator.validate(archetype, this);
}
}
resolveDocumentLinks();
}
}
Aggregations