本文整理汇总了Java中org.pentaho.di.repository.RepositoryDirectory.getNrSubdirectories方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryDirectory.getNrSubdirectories方法的具体用法?Java RepositoryDirectory.getNrSubdirectories怎么用?Java RepositoryDirectory.getNrSubdirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.repository.RepositoryDirectory
的用法示例。
在下文中一共展示了RepositoryDirectory.getNrSubdirectories方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: getDirectoryTree
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
/**
* Gets a directory tree on a TreeItem to work with.
* @param ti The TreeItem to set the directory tree on
* @param dircolor The color of the directory tree item.
*/
public static void getDirectoryTree(TreeItem ti, Color dircolor, RepositoryDirectory dir)
{
ti.setText(dir.getDirectoryName());
ti.setForeground(dircolor);
// First, we draw the directories
for (int i=0;i<dir.getNrSubdirectories();i++)
{
RepositoryDirectory subdir = dir.getSubdirectory(i);
TreeItem subti = new TreeItem(ti, SWT.NONE);
subti.setImage(GUIResource.getInstance().getImageArrow());
getDirectoryTree(subti, dircolor, subdir);
}
}
示例3: getTreeWithNames
import org.pentaho.di.repository.RepositoryDirectory; //导入方法依赖的package包/类
/**
* Set the name of this directory on a TreeItem.
* Also, create children on this TreeItem to reflect the subdirectories.
* In these sub-directories, fill in the available transformations from the repository.
* @param ti The TreeItem to set the name on and to create the subdirectories
* @param rep The repository
* @param dircolor The color in which the directories will be drawn.
* @param sortPosition The sort position
* @param ascending The ascending flag
* @param getTransformations Include transformations in the tree or not
* @param getJobs Include jobs in the tree or not
* @throws KettleDatabaseException
*/
public static void getTreeWithNames(TreeItem ti, Repository rep, Color dircolor, int sortPosition, boolean ascending, boolean getTransformations, boolean getJobs, RepositoryDirectory dir) throws KettleDatabaseException
{
ti.setText(dir.getDirectoryName());
ti.setForeground(dircolor);
// First, we draw the directories
for (int i=0;i<dir.getNrSubdirectories();i++)
{
RepositoryDirectory subdir = dir.getSubdirectory(i);
TreeItem subti = new TreeItem(ti, SWT.NONE);
subti.setImage(GUIResource.getInstance().getImageArrow());
getTreeWithNames(subti, rep, dircolor, sortPosition, ascending, getTransformations, getJobs, subdir);
}
try
{
List<RepositoryObject> repositoryObjects = new ArrayList<RepositoryObject>();
// Then show the transformations & jobs in that directory...
if (getTransformations)
{
List<RepositoryObject> repositoryTransformations = rep.getTransformationObjects(dir.getID());
if (repositoryTransformations!=null)
{
repositoryObjects.addAll(repositoryTransformations);
}
}
if (getJobs)
{
List<RepositoryObject> repositoryJobs = rep.getJobObjects(dir.getID());
if (repositoryJobs!=null)
{
repositoryObjects.addAll(repositoryJobs);
}
}
// Sort the directory list appropriately...
//
RepositoryObject.sortRepositoryObjects(repositoryObjects, sortPosition, ascending);
for (int i=0;i<repositoryObjects.size();i++)
{
TreeItem tiObject = new TreeItem(ti, SWT.NONE);
RepositoryObject repositoryObject = (RepositoryObject)repositoryObjects.get(i);
if(repositoryObject.getObjectType()==RepositoryObject.STRING_OBJECT_TYPE_TRANSFORMATION)
tiObject.setImage(GUIResource.getInstance().getImageTransGraph());
else if(repositoryObject.getObjectType()==RepositoryObject.STRING_OBJECT_TYPE_JOB)
tiObject.setImage(GUIResource.getInstance().getImageJobGraph());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
tiObject.setText(0, Const.NVL(repositoryObject.getName(), ""));
tiObject.setText(1, Const.NVL(repositoryObject.getObjectType(), ""));
tiObject.setText(2, Const.NVL(repositoryObject.getModifiedUser(), ""));
tiObject.setText(3, repositoryObject.getModifiedDate()!=null ? simpleDateFormat.format(repositoryObject.getModifiedDate()) : "");
tiObject.setText(4, Const.NVL(repositoryObject.getDescription(), ""));
}
}
catch(KettleException dbe)
{
throw new KettleDatabaseException("Unable to populate tree with repository objects", dbe);
}
ti.setExpanded(dir.isRoot());
}