Search in sources :

Example 1 with Action

use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.

the class ChangesReportGenerator method constructComponent.

/**
     * Constructs table rows for specified release component. It will create header row for component name and action
     * rows for all component issues.
     *
     * @param sink Sink
     * @param bundle Resource bundle
     * @param component Release component to generate content for.
     */
private void constructComponent(Sink sink, ResourceBundle bundle, Component component) {
    if (!component.getActions().isEmpty()) {
        sink.tableRow();
        sink.tableHeaderCell();
        sink.tableHeaderCell_();
        sink.tableHeaderCell();
        sink.text(component.getName());
        sink.tableHeaderCell_();
        sink.tableHeaderCell();
        sink.tableHeaderCell_();
        if (isAddActionDate()) {
            sink.tableHeaderCell();
            sink.tableHeaderCell_();
        }
        sink.tableRow_();
        for (Action action : component.getActions()) {
            constructAction(sink, bundle, action);
        }
    }
}
Also used : Action(org.apache.maven.plugins.changes.model.Action)

Example 2 with Action

use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.

the class IssueAdapter method createAction.

/**
     * Create an <code>Action</code> from an issue.
     *
     * @param issue The issue to extract the information from
     * @return An <code>Action</code>
     */
public Action createAction(Issue issue) {
    Action action = new Action();
    // @todo We need to add something like issue.getPresentationIdentifier() to be able to support other IMSes
    // beside JIRA
    action.setIssue(issue.getKey());
    // Try to map the IMS-specific issue type to one that is used in a changes.xml file
    IssueType type;
    if (getIssueTypeMap().containsKey(issue.getType())) {
        type = getIssueTypeMap().get(issue.getType());
        action.setType(type.modelRepresentation());
    } else {
        action.setType(UNKNOWN_ISSUE_TYPE);
    }
    action.setDev(issue.getAssignee());
    action.setDueTo(issue.getReporter() == null ? "" : issue.getReporter());
    action.setAction(issue.getSummary());
    return action;
}
Also used : Action(org.apache.maven.plugins.changes.model.Action)

Example 3 with Action

use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.

the class IssueAdapterTest method testCustomIssueTypeMapping.

public void testCustomIssueTypeMapping() {
    IssueManagementSystem ims = new JIRAIssueManagmentSystem();
    ims.getIssueTypeMap().put("Story", IssueType.ADD);
    ims.getIssueTypeMap().put("Epic", IssueType.ADD);
    ims.getIssueTypeMap().put("Defect", IssueType.FIX);
    ims.getIssueTypeMap().put("Error", IssueType.FIX);
    IssueAdapter adapter = new IssueAdapter(ims);
    Issue issue = createIssue("TST-1", "Story");
    Action action = adapter.createAction(issue);
    assertEquals("add", action.getType());
    issue = createIssue("TST-2", "Epic");
    action = adapter.createAction(issue);
    assertEquals("add", action.getType());
    issue = createIssue("TST-3", "Error");
    action = adapter.createAction(issue);
    assertEquals("fix", action.getType());
    issue = createIssue("TST-4", "Defect");
    action = adapter.createAction(issue);
    assertEquals("fix", action.getType());
    // Test the default mapping for "update" hasn't been overridden
    issue = createIssue("TST-5", "Improvement");
    action = adapter.createAction(issue);
    assertEquals("update", action.getType());
}
Also used : IssueAdapter(org.apache.maven.plugins.changes.IssueAdapter) Action(org.apache.maven.plugins.changes.model.Action) Issue(org.apache.maven.plugins.issues.Issue) IssueManagementSystem(org.apache.maven.plugins.issues.IssueManagementSystem) JIRAIssueManagmentSystem(org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)

Example 4 with Action

use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.

the class IssueAdapterTest method testCustomIssueTypeMappingOveridesDefaultMapping.

public void testCustomIssueTypeMappingOveridesDefaultMapping() {
    IssueManagementSystem ims = new JIRAIssueManagmentSystem();
    ims.getIssueTypeMap().clear();
    IssueAdapter adapter = new IssueAdapter(ims);
    Issue issue = createIssue("TST-1", "New Feature");
    Action action = adapter.createAction(issue);
    assertEquals("", action.getType());
    issue = createIssue("TST-2", "Bug");
    action = adapter.createAction(issue);
    assertEquals("", action.getType());
    issue = createIssue("TST-3", "Improvement");
    action = adapter.createAction(issue);
    assertEquals("", action.getType());
    issue = createIssue("TST-4", "Unknown Type");
    action = adapter.createAction(issue);
    assertEquals("", action.getType());
}
Also used : IssueAdapter(org.apache.maven.plugins.changes.IssueAdapter) Action(org.apache.maven.plugins.changes.model.Action) Issue(org.apache.maven.plugins.issues.Issue) IssueManagementSystem(org.apache.maven.plugins.issues.IssueManagementSystem) JIRAIssueManagmentSystem(org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)

Example 5 with Action

use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.

the class ChangesReportGenerator method constructRelease.

/**
     * Constructs document section for specified release.
     *
     * @param sink Sink
     * @param bundle Resource bundle
     * @param release Release to create document section for
     */
private void constructRelease(Sink sink, ResourceBundle bundle, Release release) {
    sink.section2();
    final String date = (release.getDateRelease() == null) ? "" : " – " + release.getDateRelease();
    SinkEventAttributes attrs = new SinkEventAttributeSet();
    attrs.addAttribute(SinkEventAttributes.ID, HtmlTools.encodeId(release.getVersion()));
    sink.sectionTitle(Sink.SECTION_LEVEL_2, attrs);
    sink.text(bundle.getString("report.changes.label.release") + " " + release.getVersion() + date);
    sink.sectionTitle_(Sink.SECTION_LEVEL_2);
    if (isReleaseEmpty(release)) {
        sink.paragraph();
        sink.text(bundle.getString("report.changes.text.no.changes"));
        sink.paragraph_();
    } else {
        sink.table();
        sink.tableRow();
        sinkHeader(sink, bundle.getString("report.issues.label.type"));
        sinkHeader(sink, bundle.getString("report.issues.label.summary"));
        sinkHeader(sink, bundle.getString("report.issues.label.assignee"));
        if (this.isAddActionDate()) {
            sinkHeader(sink, bundle.getString("report.issues.label.updated"));
        }
        sink.tableRow_();
        for (Action action : release.getActions()) {
            constructAction(sink, bundle, action);
        }
        for (Object o : release.getComponents()) {
            Component component = (Component) o;
            constructComponent(sink, bundle, component);
        }
        sink.table_();
    }
    sink.section2_();
}
Also used : SinkEventAttributes(org.apache.maven.doxia.sink.SinkEventAttributes) SinkEventAttributeSet(org.apache.maven.doxia.sink.SinkEventAttributeSet) Action(org.apache.maven.plugins.changes.model.Action) Component(org.apache.maven.plugins.changes.model.Component)

Aggregations

Action (org.apache.maven.plugins.changes.model.Action)9 Issue (org.apache.maven.plugins.issues.Issue)4 IssueAdapter (org.apache.maven.plugins.changes.IssueAdapter)3 JIRAIssueManagmentSystem (org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)3 Release (org.apache.maven.plugins.changes.model.Release)2 IssueManagementSystem (org.apache.maven.plugins.issues.IssueManagementSystem)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 SinkEventAttributeSet (org.apache.maven.doxia.sink.SinkEventAttributeSet)1 SinkEventAttributes (org.apache.maven.doxia.sink.SinkEventAttributes)1 ChangesXML (org.apache.maven.plugins.changes.ChangesXML)1 Component (org.apache.maven.plugins.changes.model.Component)1