Search in sources :

Example 6 with RepositoryLock

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();
    }
}
Also used : XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) Spoon(org.pentaho.di.ui.spoon.Spoon) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RepositoryLock(org.pentaho.di.repository.pur.model.RepositoryLock)

Example 7 with RepositoryLock

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();
}
Also used : RepositoryLock(org.pentaho.di.repository.pur.model.RepositoryLock)

Example 8 with RepositoryLock

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);
    }
}
Also used : EERepositoryObject(org.pentaho.di.repository.pur.model.EERepositoryObject) KettleException(org.pentaho.di.core.exception.KettleException) RepositoryDirectory(org.pentaho.di.repository.RepositoryDirectory) ArrayList(java.util.ArrayList) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryLock(org.pentaho.di.repository.pur.model.RepositoryLock) MetaStoreNamespaceExistsException(org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) UnifiedRepositoryCreateFileException(org.pentaho.platform.api.repository2.unified.UnifiedRepositoryCreateFileException) UnifiedRepositoryUpdateFileException(org.pentaho.platform.api.repository2.unified.UnifiedRepositoryUpdateFileException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) KettleException(org.pentaho.di.core.exception.KettleException) IdNotFoundException(org.pentaho.di.core.exception.IdNotFoundException) KettleSecurityException(org.pentaho.di.core.exception.KettleSecurityException) RepositoryElementMetaInterface(org.pentaho.di.repository.RepositoryElementMetaInterface)

Aggregations

RepositoryLock (org.pentaho.di.repository.pur.model.RepositoryLock)8 KettleException (org.pentaho.di.core.exception.KettleException)5 RepositoryElementMetaInterface (org.pentaho.di.repository.RepositoryElementMetaInterface)3 RepositoryObjectType (org.pentaho.di.repository.RepositoryObjectType)3 EERepositoryObject (org.pentaho.di.repository.pur.model.EERepositoryObject)3 Spoon (org.pentaho.di.ui.spoon.Spoon)3 ArrayList (java.util.ArrayList)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 IdNotFoundException (org.pentaho.di.core.exception.IdNotFoundException)2 KettleFileException (org.pentaho.di.core.exception.KettleFileException)2 KettleSecurityException (org.pentaho.di.core.exception.KettleSecurityException)2 RepositoryDirectory (org.pentaho.di.repository.RepositoryDirectory)2 PurRepository (org.pentaho.di.repository.pur.PurRepository)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 ILockService (org.pentaho.di.ui.repository.pur.services.ILockService)2 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)2 MetaStoreNamespaceExistsException (org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 RepositoryFileTree (org.pentaho.platform.api.repository2.unified.RepositoryFileTree)2 UnifiedRepositoryCreateFileException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryCreateFileException)2