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 addedRef = new ArrayList( 4 );
List items = new ArrayList( 4 );
// append generated report defined as MavenReport
for ( final Iterator it = getGeneratedMavenReports( locale ).iterator(); it.hasNext(); )
{
final MavenReport report = (MavenReport) it.next();
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 generatedDirs = FileUtils.getDirectoryNames( generatedSiteDirectory, "*", excludes, true );
if ( !locale.getLanguage().equals( getDefaultLocale().getLanguage() ) )
{
generatedDirs =
FileUtils.getFileNames( new File( generatedSiteDirectory, locale.getLanguage() ), "*",
excludes, true );
}
for ( final Iterator it = generatedDirs.iterator(); it.hasNext(); )
{
final String generatedDir = it.next().toString();
List generatedFiles =
FileUtils.getFileNames( new File( generatedDir ), "**.*", excludes, false );
for ( final Iterator it2 = generatedFiles.iterator(); it2.hasNext(); )
{
final String generatedFile = it2.next().toString();
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 );
}
}
}