本文整理汇总了Java中org.pentaho.di.repository.RepositoryDirectory.setObjectId方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryDirectory.setObjectId方法的具体用法?Java RepositoryDirectory.setObjectId怎么用?Java RepositoryDirectory.setObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.repository.RepositoryDirectory
的用法示例。
在下文中一共展示了RepositoryDirectory.setObjectId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
String folder = calcDirectoryName(parentDirectory);
String newFolder = folder;
if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
FileObject parent = KettleVFS.getFileObject(newFolder);
try {
parent.createFolder();
} catch (FileSystemException e) {
throw new KettleException("Unable to create folder "+newFolder, e);
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
parentDirectory.addSubdirectory(newDir);
newDir.setObjectId(new StringObjectId(newDir.toString()));
return newDir;
}
示例2: loadRepositoryDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree(RepositoryDirectoryInterface dir) throws KettleException {
try {
String folderName = calcDirectoryName(dir);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FOLDER)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
RepositoryDirectory subDir = new RepositoryDirectory(dir, child.getName().getBaseName());
subDir.setObjectId(new StringObjectId(calcObjectId(subDir)));
dir.addSubdirectory(subDir);
loadRepositoryDirectoryTree(subDir);
}
}
}
return dir;
}
catch(Exception e) {
throw new KettleException("Unable to load the directory tree from this file repository", e);
}
}
示例3: initRepositoryDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
private RepositoryDirectoryInterface initRepositoryDirectoryTree( RepositoryFileTree repoTree )
throws KettleException {
RepositoryFile rootFolder = repoTree.getFile();
RepositoryDirectory rootDir = new RepositoryDirectory();
rootDir.setObjectId( new StringObjectId( rootFolder.getId().toString() ) );
fillRepositoryDirectoryFromTree( rootDir, repoTree );
// Example: /etc
RepositoryDirectory etcDir = rootDir.findDirectory( ClientRepositoryPaths.getEtcFolderPath() );
RepositoryDirectory newRoot = new RepositoryDirectory();
newRoot.setObjectId( rootDir.getObjectId() );
newRoot.setVisible( false );
for ( int i = 0; i < rootDir.getNrSubdirectories(); i++ ) {
RepositoryDirectory childDir = rootDir.getSubdirectory( i );
// Don't show /etc
boolean isEtcChild = childDir.equals( etcDir );
if ( isEtcChild ) {
continue;
}
newRoot.addSubdirectory( childDir );
}
return newRoot;
}
示例4: testGetRepositoryObjectsNulled
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
@Test
public void testGetRepositoryObjectsNulled() throws Exception {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId( new LongObjectId( 0L ) );
RepositoryDirectory dir = new RepositoryDirectory();
dir.setObjectId( new LongObjectId( 1L ) );
root.addSubdirectory( dir );
RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class );
when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION );
Repository repo = mock( Repository.class );
when( repo.getJobAndTransformationObjects( dir.getObjectId(), false ) ).thenReturn(
Collections.singletonList( meta ) );
when( repo.getJobAndTransformationObjects( root.getObjectId(), false ) ).thenReturn( Collections.emptyList() );
UIRepositoryDirectory uiDir = new UIRepositoryDirectory( root, null, repo );
UIRepositoryObjects objects = uiDir.getRepositoryObjects();
assertNotNull( objects );
uiDir = new UIRepositoryDirectory( dir, uiDir, repo );
objects = uiDir.getRepositoryObjects();
assertEquals( 1, objects.size() );
}
示例5: createRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
String folder = calcDirectoryName(parentDirectory);
String newFolder = folder;
if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
FileObject parent = KettleVFS.getFileObject(newFolder);
try {
parent.createFolder();
} catch (FileSystemException e) {
throw new KettleException("Unable to create folder "+newFolder, e);
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
parentDirectory.addSubdirectory(newDir);
newDir.setObjectId(new StringObjectId(calcObjectId(newDir)));
return newDir;
}
示例6: fillRepositoryDirectoryFromTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
private void fillRepositoryDirectoryFromTree( final RepositoryDirectoryInterface parentDir,
final RepositoryFileTree treeNode ) throws KettleException {
try {
List<RepositoryElementMetaInterface> fileChildren = new ArrayList<RepositoryElementMetaInterface>();
List<RepositoryFileTree> children = treeNode.getChildren();
if ( children != null ) {
for ( RepositoryFileTree child : children ) {
if ( child.getFile().isFolder() ) {
RepositoryDirectory dir = new RepositoryDirectory( parentDir, child.getFile().getName() );
dir.setObjectId( new StringObjectId( child.getFile().getId().toString() ) );
parentDir.addSubdirectory( dir );
fillRepositoryDirectoryFromTree( dir, child );
} else {
// a real file, like a Transformation or Job
RepositoryLock lock = unifiedRepositoryLockService.getLock( child.getFile() );
RepositoryObjectType objectType = getObjectType( child.getFile().getName() );
fileChildren.add( new EERepositoryObject( child, parentDir, null, objectType, null, lock, false ) );
}
}
parentDir.setRepositoryObjects( fileChildren );
}
} catch ( Exception e ) {
throw new KettleException( "Unable to load directory structure from repository", e );
}
}
示例7: loadRepositoryDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree(RepositoryDirectoryInterface dir) throws KettleException {
try {
String folderName = calcDirectoryName(dir);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FOLDER)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
RepositoryDirectory subDir = new RepositoryDirectory(dir, child.getName().getBaseName());
subDir.setObjectId(new StringObjectId(calcObjectId(subDir)));
dir.addSubdirectory(subDir);
loadRepositoryDirectoryTree(subDir);
}
}
}
return dir;
}
catch(Exception e) {
throw new KettleException("Unable to load the directory tree from this file repository", e);
}
}
示例8: createRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
@Override
public RepositoryDirectoryInterface createRepositoryDirectory( RepositoryDirectoryInterface parentDirectory,
String directoryPath ) throws KettleException {
String folder = calcDirectoryName( parentDirectory );
String newFolder = folder;
if ( folder.endsWith( "/" ) ) {
newFolder += directoryPath;
} else {
newFolder += "/" + directoryPath;
}
FileObject parent = KettleVFS.getFileObject( newFolder );
try {
parent.createFolder();
} catch ( FileSystemException e ) {
throw new KettleException( "Unable to create folder " + newFolder, e );
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory( parentDirectory, directoryPath );
parentDirectory.addSubdirectory( newDir );
newDir.setObjectId( new StringObjectId( calcObjectId( newDir ) ) );
return newDir;
}
示例9: loadRepositoryDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree( RepositoryDirectoryInterface dir ) throws KettleException {
try {
String folderName = calcDirectoryName( dir );
FileObject folder = KettleVFS.getFileObject( folderName );
for ( FileObject child : folder.getChildren() ) {
if ( child.getType().equals( FileType.FOLDER ) ) {
if ( !child.isHidden() || !repositoryMeta.isHidingHiddenFiles() ) {
if ( !".meta".equals( child.getName().getBaseName() ) ) {
RepositoryDirectory subDir = new RepositoryDirectory( dir, child.getName().getBaseName() );
subDir.setObjectId( new StringObjectId( calcObjectId( subDir ) ) );
dir.addSubdirectory( subDir );
loadRepositoryDirectoryTree( subDir );
}
}
}
}
return dir;
} catch ( Exception e ) {
throw new KettleException( "Unable to load the directory tree from this file repository", e );
}
}
示例10: testGetRepositoryObjectsFilled
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
@Test
public void testGetRepositoryObjectsFilled() throws Exception {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId( new LongObjectId( 0L ) );
RepositoryDirectory dir = new RepositoryDirectory();
dir.setObjectId( new LongObjectId( 1L ) );
root.addSubdirectory( dir );
RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class );
when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION );
root.setRepositoryObjects( Collections.emptyList() );
dir.setRepositoryObjects( Collections.singletonList( meta ) );
Repository repo = mock( Repository.class );
UIRepositoryDirectory uiDir = new UIRepositoryDirectory( root, null, repo );
UIRepositoryObjects objects = uiDir.getRepositoryObjects();
assertNotNull( objects );
uiDir = new UIRepositoryDirectory( dir, uiDir, repo );
objects = uiDir.getRepositoryObjects();
assertEquals( 1, objects.size() );
verifyZeroInteractions( repo );
}
示例11: testLoadRepositoryObjectsFilled
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
@Test
public void testLoadRepositoryObjectsFilled() throws Exception {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId( new LongObjectId( 0L ) );
RepositoryDirectory dir = new RepositoryDirectory();
dir.setObjectId( new LongObjectId( 1L ) );
root.addSubdirectory( dir );
RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class );
when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION );
root.setRepositoryObjects( Collections.emptyList() );
dir.setRepositoryObjects( Collections.singletonList( meta ) );
Repository repo = mock( Repository.class );
assertTrue( RepositoryDirectoryUI.loadRepositoryObjects( root, true, true, repo ).isEmpty() );
assertEquals( 1, RepositoryDirectoryUI.loadRepositoryObjects( dir, true, true, repo ).size() );
verifyZeroInteractions( repo );
}
示例12: testLoadRepositoryObjectsNulled
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
@Test
public void testLoadRepositoryObjectsNulled() throws Exception {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId( new LongObjectId( 0L ) );
RepositoryDirectory dir = new RepositoryDirectory();
dir.setObjectId( new LongObjectId( 1L ) );
root.addSubdirectory( dir );
RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class );
when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION );
Repository repo = mock( Repository.class );
when( repo.getJobAndTransformationObjects( dir.getObjectId(), false ) ).thenReturn(
Collections.singletonList( meta ) );
when( repo.getJobAndTransformationObjects( root.getObjectId(), false ) ).thenReturn( Collections.emptyList() );
assertTrue( RepositoryDirectoryUI.loadRepositoryObjects( root, true, true, repo ).isEmpty() );
assertEquals( 1, RepositoryDirectoryUI.loadRepositoryObjects( dir, true, true, repo ).size() );
}
示例13: loadRepositoryDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree() throws KettleException {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId(new LongObjectId(0L));
return directoryDelegate.loadRepositoryDirectoryTree(root);
}
示例14: getUserHomeDirectory
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectory getUserHomeDirectory() throws KettleException {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId(new LongObjectId(0L));
directoryDelegate.loadRepositoryDirectory(root, root.getObjectId());
return root;
}
示例15: getUserHomeDirectory
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
public RepositoryDirectoryInterface getUserHomeDirectory() throws KettleException {
RepositoryDirectory root = new RepositoryDirectory();
root.setObjectId(null);
return loadRepositoryDirectoryTree(root);
}