Search in sources :

Example 71 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class RepositoryExplorerDialog method renameUser.

public boolean renameUser(String name, String newname) {
    boolean retval = false;
    try {
        if (Utils.isEmpty(newname)) {
            throw new KettleException(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Exception.NameCanNotBeEmpty"));
        }
        if (!name.equals(newname)) {
            ObjectId id = securityManager.getUserID(name);
            if (id != null) {
                // System.out.println("Renaming user ["+name+"] with ID = "+id);
                securityManager.renameUser(id, newname);
                retval = true;
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.Rename.ErrorFinding.Message1") + name + "]" + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.Rename.ErrorFinding.Message2"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.Rename.ErrorFinding.Title"));
                mb.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.Rename.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.Rename.UnexpectedError.Message") + name + "]", e);
    }
    return retval;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 72 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class BrowseController method init.

// end PDI-3326 hack
@SuppressWarnings("deprecation")
public void init(Repository repository) throws ControllerInitializationException {
    try {
        this.repository = repository;
        mainController = (MainController) this.getXulDomContainer().getEventHandler("mainController");
        RepositoryDirectoryInterface root;
        try {
            if (repository instanceof RepositoryExtended) {
                root = ((RepositoryExtended) repository).loadRepositoryDirectoryTree(false);
            } else {
                root = repository.loadRepositoryDirectoryTree();
            }
            this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory(root, null, repository);
        } catch (UIObjectCreationException uoe) {
            this.repositoryDirectory = new UIRepositoryDirectory(repository.loadRepositoryDirectoryTree(), null, repository);
        }
        this.repositoryDirectory.populateChildren();
        dirMap = new HashMap<ObjectId, UIRepositoryDirectory>();
        populateDirMap(repositoryDirectory);
        bf = new SwtBindingFactory();
        bf.setDocument(this.getXulDomContainer().getDocumentRoot());
        messageBox = (XulMessageBox) document.createElement("messagebox");
        createBindings();
    } catch (Exception e) {
        throw new ControllerInitializationException(e);
    }
}
Also used : UIRepositoryDirectory(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) SwtBindingFactory(org.pentaho.ui.xul.swt.SwtBindingFactory) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) ObjectId(org.pentaho.di.repository.ObjectId) RepositoryExtended(org.pentaho.di.repository.RepositoryExtended) XulException(org.pentaho.ui.xul.XulException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException) KettleException(org.pentaho.di.core.exception.KettleException) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)

Example 73 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class RepositoryExplorerDialog method editSlaveServer.

public void editSlaveServer(String slaveName) {
    try {
        ObjectId id = rep.getSlaveID(slaveName);
        // Load the last version
        SlaveServer slaveServer = rep.loadSlaveServer(id, null);
        SlaveServerDialog dd = new SlaveServerDialog(shell, slaveServer);
        if (dd.open()) {
            rep.insertLogEntry("Updating slave server '" + slaveServer.getName() + "'");
            rep.save(slaveServer, Const.VERSION_COMMENT_EDIT_VERSION, null);
            if (!slaveName.equalsIgnoreCase(slaveServer.getName())) {
                refreshTree();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Message") + slaveName + "]", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) SlaveServerDialog(org.pentaho.di.ui.cluster.dialog.SlaveServerDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 74 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class RepositoryExplorerDialog method renameJob.

public boolean renameJob(String name, RepositoryDirectoryInterface repdir, String newname) {
    boolean retval = false;
    try {
        if (Utils.isEmpty(newname)) {
            throw new KettleException(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Exception.NameCanNotBeEmpty"));
        }
        if (!name.equals(newname)) {
            ObjectId id = rep.getJobId(name, repdir);
            if (id != null) {
                // System.out.println("Renaming transformation ["+name+"] with ID = "+id);
                String comment = BaseMessages.getString(REPOSITORY_PKG, "Repository.Rename", name, newname);
                rep.renameJob(id, comment, repdir, newname);
                retval = true;
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Rename.ErrorFinding.Message1") + name + "]" + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Rename.ErrorFinding.Message2"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Rename.ErrorFinding.Title"));
                mb.open();
            }
        }
    } catch (KettleException dbe) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Rename.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Rename.UnexpectedError.Message") + name + "]", dbe);
    }
    return retval;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 75 with ObjectId

use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.

the class RepositoryExplorerDialog method moveJob.

public boolean moveJob(String xml, RepositoryDirectoryInterface repdir) {
    debug = "Move Job";
    boolean retval = false;
    try {
        debug = "parse xml";
        Document doc = XMLHandler.loadXMLString(xml);
        String dirname = XMLHandler.getTagValue(doc, "dragdrop", "directory");
        String jobname = XMLHandler.getTagValue(doc, "dragdrop", "job");
        if (dirname != null && jobname != null) {
            debug = "dirname=" + dirname + ", jobname=" + jobname;
            // OK, find this transformation...
            RepositoryDirectoryInterface fromdir = directoryTree.findDirectory(dirname);
            if (fromdir != null) {
                debug = "fromdir found: move job!";
                ObjectId existingjobID = rep.getJobId(jobname, repdir);
                if (existingjobID == null) {
                    ObjectId id = rep.getJobId(jobname, fromdir);
                    rep.renameJob(id, repdir, jobname);
                    retval = true;
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.ErrorDuplicate.Message", jobname) + Const.CR);
                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.ErrorDuplicate.Title"));
                    mb.open();
                }
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.ErrorMoving.Message") + dirname + "]" + Const.CR);
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.ErrorMoving.Title"));
                mb.open();
            }
        }
    } catch (Exception dbe) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Trans.Move.UnexpectedError.Message"), dbe);
    }
    return retval;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Document(org.w3c.dom.Document) IOException(java.io.IOException) KettleException(org.pentaho.di.core.exception.KettleException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

ObjectId (org.pentaho.di.repository.ObjectId)233 KettleException (org.pentaho.di.core.exception.KettleException)94 LongObjectId (org.pentaho.di.repository.LongObjectId)76 StringObjectId (org.pentaho.di.repository.StringObjectId)76 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)49 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)38 Test (org.junit.Test)37 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)37 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)34 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)33 ArrayList (java.util.ArrayList)30 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)29 MessageBox (org.eclipse.swt.widgets.MessageBox)26 Repository (org.pentaho.di.repository.Repository)18 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)18 SlaveServer (org.pentaho.di.cluster.SlaveServer)15 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)14 PartitionSchema (org.pentaho.di.partition.PartitionSchema)14 Matchers.anyString (org.mockito.Matchers.anyString)13 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)13