use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobEntryTransDialog method selectTransformation.
private void selectTransformation() {
RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject("*.ktr", log);
if (repositoryObject != null) {
String path = DialogUtils.getPath(jobMeta.getRepositoryDirectory().getPath(), repositoryObject.getRepositoryDirectory().getPath());
String fullPath = (path.equals("/") ? "/" : path + "/") + repositoryObject.getName();
wPath.setText(fullPath);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class KettleFileRepository method getTransformationObjects.
@Override
public List<RepositoryElementMetaInterface> getTransformationObjects(ObjectId idDirectory, boolean includeDeleted) throws KettleException {
try {
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(idDirectory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_TRANSFORMATION)) {
String transName = name.substring(0, name.length() - 4);
ObjectId id = new StringObjectId(calcObjectId(directory, transName, EXT_TRANSFORMATION));
Date date = new Date(child.getContent().getLastModifiedTime());
list.add(new RepositoryObject(id, transName, directory, "-", date, RepositoryObjectType.TRANSFORMATION, "", false));
}
}
}
}
return list;
} catch (Exception e) {
throw new KettleException("Unable to get list of transformations in folder with id : " + idDirectory, e);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class KettleFileRepository method getJobObjects.
@Override
public List<RepositoryElementMetaInterface> getJobObjects(ObjectId id_directory, boolean includeDeleted) throws KettleException {
try {
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_JOB)) {
String jobName = name.substring(0, name.length() - 4);
ObjectId id = new StringObjectId(calcObjectId(directory, jobName, EXT_JOB));
Date date = new Date(child.getContent().getLastModifiedTime());
list.add(new RepositoryObject(id, jobName, directory, "-", date, RepositoryObjectType.JOB, "", false));
}
}
}
}
return list;
} catch (Exception e) {
throw new KettleException("Unable to get list of jobs in folder with id : " + id_directory, e);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method populateFiles.
private void populateFiles(RepositoryDirectory repositoryDirectory, RepositoryDirectoryInterface repositoryDirectoryInterface, String filter) throws KettleException {
if (getRepository() instanceof RepositoryExtended && !repositoryDirectory.getPath().equals("/")) {
populateFilesLazy(repositoryDirectory, filter);
} else {
Date latestDate = null;
for (RepositoryObjectInterface repositoryObject : getRepositoryElements(repositoryDirectoryInterface)) {
org.pentaho.di.repository.RepositoryObject ro = (org.pentaho.di.repository.RepositoryObject) repositoryObject;
String extension = ro.getObjectType().getExtension();
if (!Util.isFiltered(extension, filter)) {
RepositoryFile repositoryFile = RepositoryFile.build(ro);
repositoryDirectory.addChild(repositoryFile);
}
if (latestDate == null || ro.getModifiedDate().after(latestDate)) {
latestDate = ro.getModifiedDate();
}
}
repositoryDirectory.setDate(latestDate);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method setFileProperties.
@Override
public void setFileProperties(FileDetails fileDetails, FileDialogOperation fileDialogOperation) {
RepositoryObject repositoryObject = new RepositoryObject();
repositoryObject.setObjectId(fileDetails::getObjectId);
repositoryObject.setName(fileDetails.getName());
try {
repositoryObject.setRepositoryDirectory(getRepository().findDirectory(fileDetails.getParentPath()));
} catch (KettleException ignored) {
// Don't set directory if not found
}
if (fileDetails.getType() != null) {
repositoryObject.setObjectType(fileDetails.getType().equals(TRANSFORMATION) ? RepositoryObjectType.TRANSFORMATION : RepositoryObjectType.JOB);
}
fileDialogOperation.setRepositoryObject(repositoryObject);
fileDialogOperation.setProvider(fileDetails.getProvider());
fileDialogOperation.setFilename(fileDetails.getName());
}
Aggregations