use of org.pentaho.di.repository.pur.model.RepositoryLock in project pentaho-kettle by pentaho.
the class SpoonLockController method viewLockNote.
public void viewLockNote() throws Exception {
if (workingMeta != null && supportsLocking(Spoon.getInstance().getRepository())) {
try {
RepositoryLock repoLock = fetchRepositoryLock(workingMeta);
if (repoLock != null) {
// $NON-NLS-1$
XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
// $NON-NLS-1$
msgBox.setTitle(BaseMessages.getString(PKG, "PurRepository.LockNote.Title"));
msgBox.setMessage(repoLock.getMessage());
msgBox.setModalParent(shell);
msgBox.open();
}
} catch (Throwable th) {
// $NON-NLS-1$
log.error(BaseMessages.getString(PKG, "LockController.NoLockingSupport"), th);
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "LockController.NoLockingSupport"), // $NON-NLS-1$ //$NON-NLS-2$
th);
}
} else {
// $NON-NLS-1$
XulMessageBox msgBox = (XulMessageBox) document.createElement("messagebox");
// $NON-NLS-1$
msgBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
// $NON-NLS-1$
msgBox.setMessage(BaseMessages.getString(PKG, "LockController.NoLockingSupport"));
msgBox.setModalParent(shell);
msgBox.open();
}
}
use of org.pentaho.di.repository.pur.model.RepositoryLock in project pentaho-kettle by pentaho.
the class UIEETransformation method lock.
public void lock(String lockNote) throws KettleException {
RepositoryLock lock = lockService.lockTransformation(getObjectId(), lockNote);
repObj.setLock(lock);
uiParent.fireCollectionChanged();
}
use of org.pentaho.di.repository.pur.model.RepositoryLock in project pentaho-kettle by pentaho.
the class PurRepository method getPdiObjects.
protected List<RepositoryElementMetaInterface> getPdiObjects(ObjectId dirId, List<RepositoryObjectType> objectTypes, boolean includeDeleted) throws KettleException {
try {
// RepositoryDirectoryInterface repDir = getRootDir().findDirectory( dirId );
RepositoryFile dirFile = pur.getFileById(dirId.getId());
RepositoryDirectory repDir = new RepositoryDirectory();
repDir.setObjectId(dirId);
repDir.setName(dirFile.getName());
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
List<RepositoryFile> nonDeletedChildren = getAllFilesOfType(dirId, objectTypes);
for (RepositoryFile file : nonDeletedChildren) {
RepositoryLock lock = unifiedRepositoryLockService.getLock(file);
RepositoryObjectType objectType = getObjectType(file.getName());
list.add(new EERepositoryObject(file, repDir, null, objectType, null, lock, false));
}
if (includeDeleted) {
String dirPath = null;
if (dirId != null) {
// derive path using id
dirPath = pur.getFileById(dirId.getId()).getPath();
}
List<RepositoryFile> deletedChildren = getAllDeletedFilesOfType(dirPath, objectTypes);
for (RepositoryFile file : deletedChildren) {
RepositoryLock lock = unifiedRepositoryLockService.getLock(file);
RepositoryObjectType objectType = getObjectType(file.getName());
list.add(new EERepositoryObject(file, repDir, null, objectType, null, lock, true));
}
}
return list;
} catch (Exception e) {
throw new KettleException("Unable to get list of objects from directory [" + dirId + "]", e);
}
}
Aggregations