RepositoryDirectory item = path.get( i ); RepositoryDirectory parent = path.get( i + 1 ); item.setParent( parent ); parent.addSubdirectory( item );
/** * Load the directory & subdirectories from XML * * @param repdirnode * The node in which the Repository directory information resides. * @return True if all went well, false if an error occured. */ public boolean loadXML( Node repdirnode ) { try { clear(); directoryname = XMLHandler.getTagValue( repdirnode, "name" ); Node subdirsnode = XMLHandler.getSubNode( repdirnode, "subdirs" ); if ( subdirsnode != null ) { int n = XMLHandler.countNodes( subdirsnode, "repdir" ); for ( int i = 0; i < n; i++ ) { Node subdirnode = XMLHandler.getSubNodeByNr( subdirsnode, "repdir", i ); RepositoryDirectory subdir = new RepositoryDirectory(); if ( subdir.loadXML( subdirnode ) ) { subdir.setParent( this ); addSubdirectory( subdir ); } else { return false; } } } return true; } catch ( Exception e ) { return false; } }