use of org.ndx.agile.architecture.base.enhancers.tickets.Ticket 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.Ticket in project agile-architecture-documentation-system by Riduidel.
the class GitLabTicketsHandler method getTicketsTagged.
@Override
public Collection<Ticket> getTicketsTagged(String project, String label) {
try {
Object projectId = gitlab.getApi().getIssuesApi().getProjectIdOrPath(project);
IssueFilter filter = new IssueFilter();
filter.setLabels(Arrays.asList(label));
Collection<Ticket> returned = new ArrayList<>();
for (Issue issue : gitlab.getApi().getIssuesApi().getIssues(filter)) {
returned.add(new GitLabTicket(issue, gitlab.getApi().getDiscussionsApi().getIssueDiscussions(projectId, issue.getId())));
}
return returned;
} catch (GitLabApiException e) {
throw new GitLabHandlerException(String.format("Unable to et project name of %s", project), e);
}
}
Aggregations