use of org.ndx.agile.architecture.base.OutputBuilder in project agile-architecture-documentation-system by Riduidel.
the class ADRExtractor method writeArchitectureDecisionsUsing.
private void writeArchitectureDecisionsUsing(Element element, String project, String label, TicketsHandler handler, OutputBuilder builder) {
File output = builder.outputFor(AgileArchitectureSection.decision_log, element, this, "adoc");
if (force) {
output.delete();
}
Collection<Ticket> tickets = handler.getTicketsTagged(project, label);
// Write each decision
Map<Ticket, String> ticketsTexts = tickets.stream().sorted(new ByStatusThenDate()).collect(Collectors.toMap(Function.identity(), t -> writeArchitectureDecisionTicket(builder, element, t)));
try {
try (FileWriter writer = new FileWriter(output)) {
decisionList.process(new IndexModel(handler.getIssuesUrl(project), handler.getProjectName(project), label, ticketsTexts), writer);
}
} catch (IOException | TemplateException e) {
throw new UnableToCreateDecisionLog(String.format("Can't write decision log index to file %s", output), e);
}
// Make sure the decision record uses that index
}
use of org.ndx.agile.architecture.base.OutputBuilder in project agile-architecture-documentation-system by Riduidel.
the class ADRExtractor method processElement.
@Override
protected void processElement(StaticStructureElement element, OutputBuilder builder) {
if (element.getProperties().containsKey(AGILE_ARCHITECTURE_TICKETS_PROJECT)) {
String ticketsProject = element.getProperties().get(AGILE_ARCHITECTURE_TICKETS_PROJECT);
Optional<TicketsHandler> usableHandler = ticketsHandlers.stream().filter(handler -> handler.canHandle(ticketsProject)).findFirst();
if (usableHandler.isPresent()) {
String label = element.getProperties().getOrDefault(AGILE_ARCHITECTURE_TICKETS_ADR_LABEL, "decision");
TicketsHandler handler = usableHandler.get();
writeArchitectureDecisionsUsing(element, ticketsProject, label, handler, builder);
} else {
logger.warning(String.format("We have this set of handlers\n%s\nin which we couldn't find one for tickets project %s", ticketsHandlers.stream().map(handler -> handler.toString()).collect(Collectors.joining()), ticketsProject));
}
}
}
use of org.ndx.agile.architecture.base.OutputBuilder in project agile-architecture-documentation-system by Riduidel.
the class DocumentsCollector method collect.
/**
* Collect elements of all sections produced for the given component
* @param element the element for which we want the output
* @param builder output generator used
*/
public void collect(Element element, OutputBuilder builder) {
for (AgileArchitectureSection section : AgileArchitectureSection.values()) {
File sectionFolderFor = builder.outputDirectoryFor(section, element);
File[] filesArray = sectionFolderFor.listFiles((dir, name) -> name.toLowerCase().endsWith(".adoc"));
if (filesArray != null && filesArray.length > 0) {
Set<File> files = Stream.of(filesArray).map(file -> file.getAbsoluteFile()).collect(Collectors.toCollection(() -> new TreeSet<File>()));
hierarchy.get(section).put(element, files);
}
}
}
Aggregations