use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class ClustersController method createCluster.
public void createCluster() {
try {
ClusterSchema cluster = new ClusterSchema();
ClusterSchemaDialog clusterDialog = new ClusterSchemaDialog(shell, cluster, repository.getSlaveServers());
if (clusterDialog.open()) {
// See if this cluster already exists...
ObjectId idCluster = repository.getClusterID(cluster.getName());
if (idCluster == null) {
if (cluster.getName() != null && !cluster.getName().equals("")) {
repository.insertLogEntry(BaseMessages.getString(RepositoryExplorer.class, "ClusterController.Message.CreatingNewCluster", cluster.getName()));
repository.save(cluster, Const.VERSION_COMMENT_INITIAL_VERSION, null);
if (mainController != null && mainController.getSharedObjectSyncUtil() != null) {
mainController.getSharedObjectSyncUtil().reloadTransformationRepositoryObjects(true);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Edit.InvalidName.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Edit.Title"));
mb.open();
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Title"));
mb.open();
}
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Message"), e);
}
} finally {
refreshClusters();
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class ConnectionsController method removeConnection.
public void removeConnection() {
try {
Collection<UIDatabaseConnection> connections = connectionsTable.getSelectedItems();
if (connections != null && !connections.isEmpty()) {
for (Object obj : connections) {
if (obj != null && obj instanceof UIDatabaseConnection) {
UIDatabaseConnection connection = (UIDatabaseConnection) obj;
DatabaseMeta databaseMeta = connection.getDatabaseMeta();
// Make sure this connection already exists and store its id for updating
ObjectId idDatabase = repository.getDatabaseID(databaseMeta.getName());
if (idDatabase == null) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.DoesNotExists.Message", databaseMeta.getName()));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
mb.open();
} else {
repository.deleteDatabaseMeta(databaseMeta.getName());
reloadLoadedJobsAndTransformations();
}
}
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.NoItemSelected.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
mb.open();
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Remove.UnexpectedError.Message"), e);
}
} finally {
refreshConnectionList();
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class ConnectionsController method editConnection.
public void editConnection() {
try {
Collection<UIDatabaseConnection> connections = connectionsTable.getSelectedItems();
if (connections != null && !connections.isEmpty()) {
// Grab the first item in the list & send it to the database dialog
DatabaseMeta databaseMeta = ((UIDatabaseConnection) connections.toArray()[0]).getDatabaseMeta();
// Make sure this connection already exists and store its id for updating
ObjectId idDatabase = repository.getDatabaseID(databaseMeta.getName());
if (idDatabase == null) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.DoesNotExists.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.DoesNotExists.Title"));
mb.open();
} else {
getDatabaseDialog().setDatabaseMeta(databaseMeta);
String dbName = getDatabaseDialog().open();
if (dbName != null) {
dbName = dbName.trim();
databaseMeta.setName(dbName);
databaseMeta.setDisplayName(dbName);
if (!dbName.isEmpty()) {
ObjectId idRenamed = repository.getDatabaseID(dbName);
if (idRenamed == null || idRenamed.equals(idDatabase)) {
// renaming to non-existing name or updating the current
repository.insertLogEntry(BaseMessages.getString(PKG, "ConnectionsController.Message.UpdatingDatabase", databaseMeta.getName()));
repository.save(databaseMeta, Const.VERSION_COMMENT_EDIT_VERSION, null);
reloadLoadedJobsAndTransformations();
} else {
// trying to rename to an existing name - show error dialog
showAlreadyExistsMessage();
}
}
}
// We should be able to tell the difference between a cancel and an empty database name
//
// else {
// MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
// mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.MissingName.Message"));
// mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.MissingName.Title"));
// mb.open();
// }
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.NoItemSelected.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.NoItemSelected.Title"));
mb.open();
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.UnexpectedError.Message"), e);
}
} finally {
refreshConnectionList();
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class UIRepositoryDirectory method equals.
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
UIRepositoryDirectory other = (UIRepositoryDirectory) obj;
ObjectId id = getObjectId();
ObjectId otherId = other.getObjectId();
if (id == null) {
if (otherId != null) {
return false;
}
} else if (!id.equals(otherId)) {
return false;
}
return true;
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class UIRepositoryDirectory method hashCode.
// end PDI-3326 hack
// Must implement equals/hashcode to compare object ids since the cache of directories may be refreshed
// and therefore would not be the same instances
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
ObjectId id = getObjectId();
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
Aggregations