final Collection<EntityVO> aggregatedEntities = new TreeSet<EntityVO>();
final Collection<QueryVO> aggregatedQueries = new TreeSet<QueryVO>();
printOutputToDebug(result);
getLog().info("Starting creation of report");
final Sink sink = getSink();
sink.head();
sink.title();
sink.text(getName(null));
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.sectionTitle1();
sink.text("Report");
sink.sectionTitle1_();
sink.paragraph();
addTitleLink(titleEntitiesPerPackage, sink);
addTitleLink(titleNamesPerEntity, sink);
addTitleLink(titleJPQLQueries, sink);
addTitleLink(titleSQLQueries, sink);
addTitleLink(titleFaults, sink);
sink.paragraph_();
sink.section2();
sink.sectionTitle2();
sink.text("Entities per packages");
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
sink.text("Package");
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text("Entities");
sink.tableHeaderCell_();
sink.tableRow_();
for (final PackageVO packge : result.getPackages()) {
sink.tableRow();
sink.tableCell();
sink.text(packge.getName());
sink.tableCell_();
sink.tableCell();
sink.list();
for (final EntityVO e : packge.getEntities()) {
aggregatedEntities.add(e);
sink.listItem();
sink.text(e.getName());
sink.listItem_();
}
sink.list_();
sink.tableCell_();
sink.tableRow_();
}
sink.table_();
sink.section2_();
sink.section2();
sink.sectionTitle2();
sink.text("List of NamedQueries per entity");
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
sink.text("Entity");
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text("Named Query");
sink.tableHeaderCell_();
sink.tableRow_();
for (final EntityVO entity : aggregatedEntities) {
sink.tableRow();
sink.tableCell();
sink.text(entity.getName());
sink.tableCell_();
sink.tableCell();
sink.list();
for (final QueryVO query : entity.getQueries()) {
aggregatedQueries.add(query);
sink.listItem();
sink.text(query.getName());
sink.listItem_();
}
sink.list_();
sink.tableCell_();
sink.tableRow_();
}
sink.table_();
sink.section2_();
sink.section2();
sink.sectionTitle2();
sink.text("List of JPQL queries");
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
sink.text("Name");
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text("JPQL Query");
sink.tableHeaderCell_();
sink.tableRow_();
for (final QueryVO query : aggregatedQueries) {
sink.tableRow();
sink.tableCell();
sink.text(query.getName());
sink.tableCell_();
sink.tableCell();
sink.text(query.getJPQLQuery());
sink.tableCell_();
sink.tableRow_();
}
sink.table_();
sink.section2_();
sink.section2();
sink.sectionTitle2();
sink.text("List of SQL Queries");
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
sink.text("Name");
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text("SQL Query");
sink.tableHeaderCell_();
sink.tableRow_();
for (final QueryVO query : aggregatedQueries) {
if (query.isValid()) {
sink.tableRow();
sink.tableCell();
sink.text(query.getName());
sink.tableCell_();
sink.tableCell();
sink.list();
for (final String sql : query.getSQLQuery()) {
sink.listItem();
sink.text(sql);
sink.listItem_();
}
sink.list_();
sink.tableCell_();
sink.tableRow_();
}
}
sink.table_();
sink.section2_();
sink.section2();
sink.sectionTitle2();
sink.text("List of Faulty Queries");
sink.sectionTitle2_();
sink.table();
sink.tableRow();
sink.tableHeaderCell();
sink.text("Name");
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text("SQL Query");
sink.tableHeaderCell_();
sink.tableRow_();
for (final QueryVO query : aggregatedQueries) {
if (!query.isValid()) {
sink.tableRow();
sink.tableCell();
sink.text(query.getName());
sink.tableCell_();
sink.tableCell();
sink.text(query.getError());
sink.tableCell_();
sink.tableRow_();
}
}
sink.table_();
sink.section2_();
sink.section1_();
sink.body_();
sink.flush();
sink.close();
} catch (ClassNotFoundException e) {
getLog().error(e);
throw new MavenReportException(e.getMessage());
} catch (IOException e) {
getLog().error(e);