private IBasicFile[] getFileList( String dir, String dashboardPath, final String fileExtensions, String permission,
boolean showHiddenFiles ) {
ArrayList<String> extensionsList = new ArrayList<String>();
String[] extensions = StringUtils.split( fileExtensions, "." );
IResourceLoader loader = ( new ResourceLoaderFactory() ).getResourceLoader( dashboardPath );
if ( extensions != null ) {
for ( String extension : extensions ) {
// For some reason, in 4.5 filebased rep started to report a leading dot in extensions
// Adding both just to be sure we don't break stuff
extensionsList.add( "." + extension );
extensionsList.add( extension );
}
}
FileAccess fileAccess = FileAccess.parse( permission );
if ( fileAccess == null ) {
fileAccess = FileAccess.READ;
}
GenericBasicFileFilter fileFilter =
new GenericBasicFileFilter( null, extensionsList.toArray( new String[ extensionsList.size() ] ), true );
//check if it is a system dashboard
List<IBasicFile> fileList;
boolean isSystem = false;
if ( !dashboardPath.isEmpty() ) {
String path = dashboardPath.toLowerCase().replaceFirst( "/", "" );
if ( path.startsWith( CdeEnvironment.getSystemDir() + "/" ) ) {
isSystem = true;
}
}
IReadAccess access = loader.getReader();
GenericFileAndDirectoryFilter fileAndDirFilter = new GenericFileAndDirectoryFilter( fileFilter );
if ( isSystem ) {
// folder filtering ( see settings.xml ) will only occur for non-admin users