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;
}
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);
}
}
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);
}
}
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;
}
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;
}
Aggregations