public UIRepositoryDirectories getChildren() { if ( kidDirectoryCache == null ) { kidDirectoryCache = new UIRepositoryDirectories(); if ( getParent() != null ) { RepositoryDirectory repositoryDirectory = new RepositoryDirectory(); repositoryDirectory.setObjectId( null ); UIRepositoryDirectory uiRepositoryDirectory = new UIRepositoryDirectory( repositoryDirectory, null, null ); kidDirectoryCache.add( uiRepositoryDirectory ); } } return kidDirectoryCache; }
public void populateChildren() { if ( kidDirectoryCache == null || !populated ) { kidDirectoryCache = new UIRepositoryDirectories(); } for ( RepositoryDirectoryInterface child : rd.getChildren() ) { try { kidDirectoryCache.add( UIObjectRegistry.getInstance().constructUIRepositoryDirectory( child, this, rep ) ); } catch ( UIObjectCreationException e ) { kidDirectoryCache.add( new UIRepositoryDirectory( child, this, rep ) ); } } populated = true; }
public UIRepositoryDirectory createFolder( String name ) throws Exception { RepositoryDirectoryInterface thisDir = getDirectory(); RepositoryDirectoryInterface dir; //PDI-5202: the directory might exist already. If so, don't create a new one. String dirName = checkDirNameExistsInRepo( name ); if ( dirName == null ) { dir = rep.createRepositoryDirectory( thisDir, name ); } else { dir = rep.findDirectory( thisDir.getPath() + "/" + dirName ); } UIRepositoryDirectory newDir = null; try { newDir = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( dir, this, rep ); } catch ( UIObjectCreationException uoe ) { newDir = new UIRepositoryDirectory( dir, this, rep ); } UIRepositoryDirectories directories = getChildren(); if ( !contains( directories, newDir ) ) { directories.add( newDir ); } else { throw new KettleException( "Unable to create folder with the same name [" + name + "]" ); } kidElementCache = null; // rebuild the element cache for correct positioning. return newDir; }
@SuppressWarnings( "deprecation" ) public void init( Repository repository ) throws ControllerInitializationException { try { this.repository = repository; mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); RepositoryDirectoryInterface root; try { if ( repository instanceof RepositoryExtended ) { root = ( (RepositoryExtended) repository ).loadRepositoryDirectoryTree( false ); } else { root = repository.loadRepositoryDirectoryTree(); } this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( root, null, repository ); } catch ( UIObjectCreationException uoe ) { this.repositoryDirectory = new UIRepositoryDirectory( repository.loadRepositoryDirectoryTree(), null, repository ); } this.repositoryDirectory.populateChildren(); dirMap = new HashMap<ObjectId, UIRepositoryDirectory>(); populateDirMap( repositoryDirectory ); bf = new SwtBindingFactory(); bf.setDocument( this.getXulDomContainer().getDocumentRoot() ); messageBox = (XulMessageBox) document.createElement( "messagebox" ); createBindings(); } catch ( Exception e ) { throw new ControllerInitializationException( e ); } }