}
private DirectoryPurgeConfiguration buildDirPurgeConfiguration()
throws Exception
{
DirectoryPurgeConfiguration dirPurge = (DirectoryPurgeConfiguration) purgeConfig;
dirPurge.setDeleteAll( this.deleteAll );
dirPurge.setEnabled( this.enabled );
dirPurge.setDaysOlder( this.daysOlder );
dirPurge.setRetentionCount( this.retentionCount );
// escape xml to prevent xss attacks
dirPurge.setDescription( StringEscapeUtils.escapeXml( StringEscapeUtils.unescapeXml( this.description ) ) );
dirPurge.setDirectoryType( this.directoryType );
dirPurge.setDefaultPurge( this.defaultPurgeConfiguration );
if ( scheduleId > 0 )
{
Schedule schedule = getContinuum().getSchedule( scheduleId );
dirPurge.setSchedule( schedule );
}
ConfigurationService configService = getContinuum().getConfiguration();
String path = null;
if ( this.directoryType.equals( PURGE_DIRECTORY_RELEASES ) )
{
path = configService.getWorkingDirectory().getAbsolutePath();
}
else if ( this.directoryType.equals( PURGE_DIRECTORY_BUILDOUTPUT ) )
{
path = configService.getBuildOutputDirectory().getAbsolutePath();
}
dirPurge.setLocation( path );
return dirPurge;
}