use of org.ndx.agile.architecture.base.enhancers.tickets.TicketsHandler 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.enhancers.tickets.TicketsHandler 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));
}
}
}
Aggregations