if ( getGeneratedMavenReports( locale ).isEmpty() )
{
return;
}
final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
documentTOCItem.setName( i18n.getString( "pdf-plugin", locale, "toc.project-info.item" ) );
documentTOCItem.setRef( "/project-info" ); // see #generateMavenReports(Locale)
List<String> addedRef = new ArrayList<String>( 4 );
List<DocumentTOCItem> items = new ArrayList<DocumentTOCItem>( 4 );
// append generated report defined as MavenReport
for ( final MavenReport report : getGeneratedMavenReports( locale ) )
{
final DocumentTOCItem reportItem = new DocumentTOCItem();
reportItem.setName( report.getName( locale ) );
reportItem.setRef( "/" + report.getOutputName() );
items.add( reportItem );
addedRef.add( report.getOutputName() );
}
// append all generated reports from generated-site
try
{
if ( generatedSiteDirectory.exists() )
{
String excludes = getDefaultExcludesWithLocales( getAvailableLocales(), getDefaultLocale() );
List<String> generatedDirs = FileUtils.getDirectoryNames( generatedSiteDirectory, "*", excludes, true );
if ( !locale.getLanguage().equals( getDefaultLocale().getLanguage() ) )
{
generatedDirs =
FileUtils.getFileNames( new File( generatedSiteDirectory, locale.getLanguage() ), "*",
excludes, true );
}
for ( final String generatedDir : generatedDirs )
{
List<String> generatedFiles =
FileUtils.getFileNames( new File( generatedDir ), "**.*", excludes, false );
for ( final String generatedFile : generatedFiles )
{
final String ref = generatedFile.substring( 0, generatedFile.lastIndexOf( '.' ) );
if ( !addedRef.contains( ref ) )
{
final String title =
getGeneratedDocumentTitle( new File( generatedDir, generatedFile ) );
if ( title != null )
{
final DocumentTOCItem reportItem = new DocumentTOCItem();
reportItem.setName( title );
reportItem.setRef( "/" + ref );
items.add( reportItem );
}
}
}