@Override public void move( UIRepositoryDirectory newParentDir ) throws Exception { if ( newParentDir != null ) { rep.renameRepositoryDirectory( obj.getObjectId(), newParentDir.getDirectory(), null ); // Try to make sure the directories are updated properly if ( !newParentDir.equals( getParent() ) ) { getParent().getChildren().remove( this ); newParentDir.getChildren().add( this ); getParent().refresh(); newParentDir.refresh(); } } }
/** * Synchronize this folder with the back-end * * */ public void refresh() { kidElementCache = null; kidDirectoryCache = null; rd.clear(); populateChildren(); try { if ( obj != null ) { getRepositoryObjects(); } } catch ( KettleException ignored ) { // Ignored } fireCollectionChanged(); }
public void delete() throws Exception { if ( uiParent.checkDirNameExistsInRepo( getName() ) != null ) { rep.deleteRepositoryDirectory( getDirectory() ); } uiParent.getChildren().remove( this ); if ( uiParent.getRepositoryObjects().contains( this ) ) { uiParent.getRepositoryObjects().remove( this ); } uiParent.refresh(); }
@Override public UIRepositoryDirectory sourceToTarget( final UIRepositoryDirectory value ) { if ( value == null || value.size() == 0 ) { return null; } if ( !value.get( value.size() - 1 ).equals( trashDir ) ) { // add directly to children collection to bypass events value.getChildren().add( trashDir ); } return value; }
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; }
public void delete( boolean deleteHomeDirectories ) throws Exception { if ( rep instanceof RepositoryExtended ) { ( (RepositoryExtended) rep ).deleteRepositoryDirectory( getDirectory(), deleteHomeDirectories ); } else { rep.deleteRepositoryDirectory( getDirectory() ); } if ( getParent().getChildren().contains( this ) ) { getParent().getChildren().remove( this ); } if ( getParent().getRepositoryObjects().contains( this ) ) { getParent().getRepositoryObjects().remove( this ); } getParent().refresh(); }
public void fireCollectionChanged() { firePropertyChange( "children", null, getChildren() ); getChildren(); // prime cache before firing event (already primed from above getChildren call but to be consistent) kidDirectoryCache.fireCollectionChanged(); try { getRepositoryObjects(); // prime cache before firing event if ( kidElementCache != null ) { kidElementCache.fireCollectionChanged(); } } catch ( KettleException ignored ) { // Ignore errors } }
public void setName( String name ) throws Exception { if ( getDirectory().getName().equalsIgnoreCase( name ) ) { return; } rep.renameRepositoryDirectory( getDirectory().getObjectId(), null, name ); // Update the object reference so the new name is displayed obj = rep.findDirectory( getObjectId() ); getParent().refresh(); }
public void unlock() throws KettleException { lockService.unlockJob( getObjectId() ); repObj.setLock( null ); uiParent.fireCollectionChanged(); }
public UIRepositoryObjects getRepositoryObjects() throws KettleException { if ( getObjectId() == null ) { return new UIRepositoryObjects(); populateChildren(); for ( UIRepositoryObject child : getChildren() ) { kidElementCache.add( child ); List<RepositoryElementMetaInterface> jobsAndTransformations = getDirectory().getRepositoryObjects(); if ( jobsAndTransformations == null ) { RepositoryDirectoryInterface dir = getDirectory(); jobsAndTransformations = rep.getJobAndTransformationObjects( dir.getObjectId(), false ); dir.setRepositoryObjects( jobsAndTransformations );
private boolean repositoryDirectoryHasLockedObject( DropEvent event, UIRepositoryDirectory dir ) throws KettleException { if ( areAnyRepositoryObjectsLocked( event, dir.getRepositoryObjects() ) ) { return true; } for ( UIRepositoryObject ro : dir.getChildren() ) { if ( ro instanceof UIRepositoryDirectory ) { UIRepositoryDirectory directory = (UIRepositoryDirectory) ro; repositoryDirectoryHasLockedObject( event, directory ); } } return false; }
public UIRepositoryObjects getSelectedRepoDirChildren() { UIRepositoryObjects repoObjects = null; if ( selectedFolderItems != null && selectedFolderItems.size() > 0 ) { try { repoObjects = repositoryDirectories.get( 0 ).getRepositoryObjects(); } catch ( KettleException e ) { // convert to runtime exception so it bubbles up through the UI if ( mainController == null || !mainController.handleLostRepository( e ) ) { throw new RuntimeException( e ); } } } return repoObjects; }
boolean folderExistsInUI = selectedFolder.contains( newName ); if ( folderExistsInUI ) { throw new Exception( String newNameInRepo = selectedFolder.checkDirNameExistsInRepo( newName ); if ( newNameInRepo != null ) { messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Warning" ) ); newName = newNameInRepo; UIRepositoryDirectory newDir = selectedFolder.createFolder( newName ); dirMap.put( newDir.getObjectId(), newDir );
fileTable = (XulTree) document.getElementById( "file-table" ); if ( !repositoryDirectory.isVisible() ) { folderTree.setHiddenrootnode( true ); } else { repositoryDirectory.addPropertyChangeListener( "children", childrenListener ); if ( homePath.length > 0 && tempRoot.getName().equalsIgnoreCase( homePath[ currentDir ] ) ) { if ( homePath.length == 1 ) { if ( uiObj.getName().equalsIgnoreCase( homePath[ currentDir ] ) ) { ( (UIRepositoryDirectory) uiObj ).populateChildren(); directoryBinding.fireSourceChanged(); tempRoot = (UIRepositoryDirectory) uiObj;
public void move( UIRepositoryDirectory newParentDir ) throws KettleException { if ( newParentDir != null ) { rep.renameTransformation( obj.getObjectId(), newParentDir.getDirectory(), null ); newParentDir.refresh(); } }
@Override public UIRepositoryObject get( int index ) { return getChildren().get( index ); }
protected void deleteContent( UIRepositoryObject repoObject ) throws Exception { repoObject.delete(); if ( repoObject instanceof UIRepositoryDirectory ) { directoryBinding.fireSourceChanged(); if ( repoDir != null ) { repoDir.refresh(); } } selectedItemsBinding.fireSourceChanged(); }
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; }
@Override public void setSelectedFolderItems( List<UIRepositoryDirectory> selectedFolderItems ) { if ( selectedFolderItems != null && selectedFolderItems.size() == 1 && selectedFolderItems.get( 0 ).equals( trashDir ) ) { try { setTrash( trashService.getTrash() ); } catch ( KettleException e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { throw new RuntimeException( e ); } } deck.setSelectedIndex( 1 ); } else { deck.setSelectedIndex( 0 ); super.setSelectedFolderItems( selectedFolderItems ); } }