public int compare( RepositoryElementMetaInterface r1, RepositoryElementMetaInterface r2 ) { int result = 0; switch ( sortPosition ) { case 0: result = compareStrings( r1.getName(), r2.getName() ); break; case 1: result = compareStrings( r1.getObjectType().getTypeDescription(), r2.getObjectType().getTypeDescription() ); break; case 2: result = compareStrings( r1.getModifiedUser(), r2.getModifiedUser() ); break; case 3: result = compareDates( r1.getModifiedDate(), r2.getModifiedDate() ); break; case 4: result = compareStrings( r1.getDescription(), r2.getDescription() ); break; default: break; } if ( !ascending ) { result *= -1; } return result; } } );
public static String getPathOf( RepositoryElementMetaInterface object ) { if ( object != null && !object.isDeleted() ) { RepositoryDirectoryInterface directory = object.getRepositoryDirectory(); if ( directory != null ) { String path = directory.getPath(); if ( path != null ) { if ( !path.endsWith( "/" ) ) { path += "/"; } path += object.getName(); return path; } } } return null; }
int outputIndex = 0; String directory = repositoryObject.getRepositoryDirectory().getPath(); String name = repositoryObject.getName(); String path = directory.endsWith( "/" ) ? directory + name : directory + "/" + name; outputRow[outputIndex++] = repositoryObject.getObjectType().getTypeDescription(); // the object type outputRow[outputIndex++] = repositoryObject.getObjectId().toString(); // the object ID outputRow[outputIndex++] = repositoryObject.getModifiedUser(); // modified user outputRow[outputIndex++] = repositoryObject.getModifiedDate(); // modified date outputRow[outputIndex++] = repositoryObject.getDescription(); // description
repositoryObject = (RepositoryElementMetaInterface) ti.getData(); if ( repositoryObject != null ) { objectName = repositoryObject.getName(); objectDirectory = repositoryObject.getRepositoryDirectory(); objectId = repositoryObject.getObjectId(); objectType = repositoryObject.getObjectType(); } else {
switch ( repositoryObject.getObjectType() ) { case TRANSFORMATION: rep.deleteTransformation( repositoryObject.getObjectId() ); break; case JOB: rep.deleteJob( repositoryObject.getObjectId() ); break; default: BaseMessages.getString( PKG, "RepositoryExplorerDialog.Trans.Delete.ErrorRemoving.Title" ), BaseMessages .getString( PKG, "RepositoryExplorerDialog.Trans.Delete.ErrorRemoving.Message" ) + repositoryObject.getName() + "]", e ); error = true;
public RepositoryObjectType getRepositoryElementType() { return rc.getObjectType(); }
private void getByReferenceData( RepositoryElementMetaInterface transInf ) { String path = DialogUtils.getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); }
@Override public void undeleteObject( final RepositoryElementMetaInterface element ) throws KettleException { readWriteLock.writeLock().lock(); try { pur.undeleteFile( element.getObjectId().getId(), null ); } finally { readWriteLock.writeLock().unlock(); } rootRef.clearRef(); }
private List<RepositoryElementMetaInterface> getRepositoryObjects( RepositoryDirectoryInterface directory, String nameMask, String excludeNameMask ) throws KettleException { List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>(); if ( directory.getRepositoryObjects() != null ) { for ( RepositoryElementMetaInterface object : directory.getRepositoryObjects() ) { boolean add = false; if ( Utils.isEmpty( nameMask ) || object.getName().matches( nameMask ) ) { add = true; } if ( !Utils.isEmpty( excludeNameMask ) && object.getName().matches( excludeNameMask ) ) { add = false; } if ( add ) { list.add( object ); } } } if ( directory.getChildren() != null ) { for ( RepositoryDirectoryInterface subdir : directory.getChildren() ) { list.addAll( getRepositoryObjects( subdir, nameMask, excludeNameMask ) ); } } return list; }
final RepositoryDirectoryInterface repdir = repositoryObject.getRepositoryDirectory(); if ( !repositoryObject.isDeleted() ) { if ( repositoryObject.isDeleted() ) { if ( capabilities.supportsRevisions() ) { case ITEM_CATEGORY_JOB: if ( level >= 2 && repositoryObject != null ) { final RepositoryDirectoryInterface repdir = repositoryObject.getRepositoryDirectory(); if ( !repositoryObject.isDeleted() ) { if ( repositoryObject.isDeleted() ) { if ( capabilities.supportsRevisions() ) {
@Override public Date getModifiedDate() { return rc.getModifiedDate(); }
public List<RepositoryElementMetaInterface> getTransformationObjects( ObjectId id_directory, boolean includeDeleted ) throws KettleException { List<RepositoryElementMetaInterface> objects = getRepositoryObjects( quoteTable( KettleDatabaseRepository.TABLE_R_TRANSFORMATION ), RepositoryObjectType.TRANSFORMATION, id_directory ); if ( ( log != null ) && log.isDebug() && objects.size() > 0 ) { log.logDebug( objects.get( 0 ).getRepositoryDirectory().getPath() ); } return objects; }
@Override public String getDescription() { return rc.getDescription(); }
@Override public String getModifiedUser() { return rc.getModifiedUser(); }
@Override public String getType() { return rc.getObjectType().name(); }
public void onRemove( UIRepositoryObject child ) { List<? extends RepositoryElementMetaInterface> dirRepoObjects = getDirectory().getRepositoryObjects(); if ( dirRepoObjects != null ) { Iterator<? extends RepositoryElementMetaInterface> iter = dirRepoObjects.iterator(); while ( iter.hasNext() ) { RepositoryElementMetaInterface e = iter.next(); if ( child.getObjectId().equals( e.getObjectId() ) ) { iter.remove(); return; } } } } };
private List<RepositoryElementMetaInterface> getRepositoryObjects( Repository repository, RepositoryDirectoryInterface directory, boolean subdirs, String nameMask, String excludeNameMask ) throws KettleException { List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>(); List<RepositoryElementMetaInterface> objects = new ArrayList<RepositoryElementMetaInterface>(); if ( meta.getObjectTypeSelection().areTransformationsSelected() ) { objects.addAll( repository.getTransformationObjects( directory.getObjectId(), false ) ); } if ( meta.getObjectTypeSelection().areJobsSelected() ) { objects.addAll( repository.getJobObjects( directory.getObjectId(), false ) ); } for ( RepositoryElementMetaInterface object : objects ) { boolean add = false; if ( Utils.isEmpty( nameMask ) || object.getName().matches( nameMask ) ) { add = true; } if ( !Utils.isEmpty( excludeNameMask ) && object.getName().matches( excludeNameMask ) ) { add = false; } if ( add ) { list.add( object ); } } if ( subdirs ) { for ( RepositoryDirectoryInterface child : directory.getChildren() ) { list.addAll( getRepositoryObjects( repository, child, subdirs, nameMask, excludeNameMask ) ); } } return list; }
@Override public String getFormatModifiedDate() { Date date = rc.getModifiedDate(); String str = null; if ( date != null ) { SimpleDateFormat sdf = new SimpleDateFormat( "d MMM yyyy HH:mm:ss z" ); str = sdf.format( date ); } return str; }
private static void addToTree( TreeItem ti, String filterString, Pattern pattern, List<RepositoryElementMetaInterface> repositoryObjects ) { for ( int i = 0; i < repositoryObjects.size(); i++ ) { boolean add = false; RepositoryElementMetaInterface repositoryObject = repositoryObjects.get( i ); if ( filterString == null && pattern == null ) { add = true; } else { add |= addItem( repositoryObject.getName(), filterString, pattern ); add |= addItem( repositoryObject.getDescription(), filterString, pattern ); add |= addItem( repositoryObject.getModifiedUser(), filterString, pattern ); if ( !add && repositoryObject.getModifiedDate() != null ) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat( DATE_FORMAT ); add = addItem( simpleDateFormat.format( repositoryObject.getModifiedDate() ), filterString, pattern ); } if ( !add && repositoryObject.getObjectType() != null ) { add = addItem( repositoryObject.getObjectType().getTypeDescription(), filterString, pattern ); } } if ( add ) { createTreeItem( ti, repositoryObject ); } } }