Search in sources :

Example 1 with Ticket

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
}
Also used : Date(java.util.Date) TemplateException(freemarker.template.TemplateException) OutputBuilder(org.ndx.agile.architecture.base.OutputBuilder) SimpleDateFormat(java.text.SimpleDateFormat) ModelElementAdapter(org.ndx.agile.architecture.base.enhancers.ModelElementAdapter) Function(java.util.function.Function) ConfigProperty(org.apache.deltaspike.core.api.config.ConfigProperty) ModelElementKeys(org.ndx.agile.architecture.base.enhancers.ModelElementKeys) Inject(javax.inject.Inject) Map(java.util.Map) Template(freemarker.template.Template) StaticStructureElement(com.structurizr.model.StaticStructureElement) Instance(javax.enterprise.inject.Instance) TicketStatus(org.ndx.agile.architecture.base.enhancers.tickets.TicketStatus) Ticket(org.ndx.agile.architecture.base.enhancers.tickets.Ticket) Collection(java.util.Collection) FileWriter(java.io.FileWriter) IOException(java.io.IOException) AgileArchitectureSection(org.ndx.agile.architecture.base.AgileArchitectureSection) Enhancer(org.ndx.agile.architecture.base.Enhancer) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) File(java.io.File) Optional(java.util.Optional) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Comparator(java.util.Comparator) TicketsHandler(org.ndx.agile.architecture.base.enhancers.tickets.TicketsHandler) Element(com.structurizr.model.Element) Ticket(org.ndx.agile.architecture.base.enhancers.tickets.Ticket) TemplateException(freemarker.template.TemplateException) FileWriter(java.io.FileWriter) IOException(java.io.IOException) File(java.io.File)

Example 2 with Ticket

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);
    }
}
Also used : Ticket(org.ndx.agile.architecture.base.enhancers.tickets.Ticket) Issue(org.gitlab4j.api.models.Issue) ArrayList(java.util.ArrayList) GitLabApiException(org.gitlab4j.api.GitLabApiException) IssueFilter(org.gitlab4j.api.models.IssueFilter)

Aggregations

Ticket (org.ndx.agile.architecture.base.enhancers.tickets.Ticket)2 Element (com.structurizr.model.Element)1 StaticStructureElement (com.structurizr.model.StaticStructureElement)1 Template (freemarker.template.Template)1 TemplateException (freemarker.template.TemplateException)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 Date (java.util.Date)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Function (java.util.function.Function)1 Logger (java.util.logging.Logger)1 Collectors (java.util.stream.Collectors)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Instance (javax.enterprise.inject.Instance)1