protected static FileList transformFileList ( final CSNodeWrapper node ) { final List < File > files = new LinkedList < File > ( ) ; // Add all the child files if ( node . getChildren ( ) != null && node . getChildren ( ) . getItems ( ) != null ) { final List < CSNodeWrapper > childNodes = node . getChildren ( ) . getItems ( ) ; final HashMap < CSNodeWrapper , File > fileNodes = new HashMap < CSNodeWrapper , File > ( ) ; for ( final CSNodeWrapper childNode : childNodes ) { fileNodes . put ( childNode , transformFile ( childNode ) ) ; } // Sort the file list nodes so that they are in the right order based on next/prev values. final LinkedHashMap < CSNodeWrapper , File > sortedMap = CSNodeSorter . sortMap ( fileNodes ) ; // Add the child nodes to the file list now that they are in the right order. final Iterator < Map . Entry < CSNodeWrapper , File > > iter = sortedMap . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final Map . Entry < CSNodeWrapper , File > entry = iter . next ( ) ; files . add ( entry . getValue ( ) ) ; } } return new FileList ( CommonConstants . CS_FILE_TITLE , files ) ; }
Transforms a MetaData CSNode into a FileList that can be added to a ContentSpec object .