use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class WizardConnectionController method createIDatabaseConnectionBean.
protected AutoBean<IDatabaseConnection> createIDatabaseConnectionBean(IDatabaseConnection connection) {
AutoBean<IDatabaseConnection> bean = connectionAutoBeanFactory.iDatabaseConnection();
IDatabaseConnection connectionBean = bean.as();
copyDatabaseConnectionProperties(connection, connectionBean);
return AutoBeanUtils.getAutoBean(connectionBean);
// return connectionBean;
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class WizardConnectionController method overwriteCheck.
@Bindable
public void overwriteCheck() {
if (!saveConnectionConfirmationDialog.isHidden()) {
closeSaveConnectionConfirmationDialog();
}
if (!renameConnectionConfirmationDialog.isHidden()) {
closeRenameConnectionConfirmationDialog();
}
if (datasourceModel.isEditing() && previousConnectionName.equals(currentConnection.getName())) {
// if editing and no name change, proceed.
updateConnection();
} else {
String cacheBuster = String.valueOf(new java.util.Date().getTime());
// either new connection, or editing involved a name change.
RequestBuilder getConnectionBuilder = new RequestBuilder(RequestBuilder.GET, ConnectionController.getServiceURL("get", new String[][] { { "name", currentConnection.getName() }, { "ts", cacheBuster } }));
getConnectionBuilder.setHeader("Content-Type", "application/json");
try {
AutoBean<IDatabaseConnection> bean = createIDatabaseConnectionBean(currentConnection);
getConnectionBuilder.sendRequest(AutoBeanCodex.encode(bean).getPayload(), new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
switch(response.getStatusCode()) {
case Response.SC_OK:
showOverwriteConnectionConfirmationDialog();
break;
case Response.SC_NOT_FOUND:
saveConnection();
break;
default:
// TODO: error message
saveConnection();
}
}
public void onError(Request request, Throwable exception) {
displayErrorMessage(exception);
}
});
} catch (Exception e) {
displayErrorMessage(e);
}
}
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class WizardRelationalDatasourceController method setRelationalConnections.
@Bindable
public void setRelationalConnections(List<IDatabaseConnection> connections) {
List<String> names = new ArrayList<String>();
for (IDatabaseConnection conn : connections) {
names.add(conn.getName());
}
firePropertyChange(connectionNamesListProp, null, names);
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class GuiStateModel method updateConnection.
public void updateConnection(String oldName, IDatabaseConnection connection) {
List<IDatabaseConnection> previousValue = getPreviousValue();
IDatabaseConnection conn = getConnectionByName(oldName);
if (conn == null) {
return;
}
String newName = connection.getName();
conn.setName(newName);
conn.setAccessType(connection.getAccessType());
conn.setConnectionPoolingProperties(connection.getConnectionPoolingProperties());
conn.setConnectSql(connection.getConnectSql());
conn.setDatabaseName(connection.getDatabaseName());
conn.setDatabasePort(connection.getDatabasePort());
conn.setDatabaseType(connection.getDatabaseType());
conn.setDataTablespace(connection.getDataTablespace());
conn.setForcingIdentifiersToLowerCase(connection.isForcingIdentifiersToLowerCase());
conn.setForcingIdentifiersToUpperCase(connection.isForcingIdentifiersToUpperCase());
conn.setHostname(connection.getHostname());
conn.setIndexTablespace(connection.getIndexTablespace());
conn.setInformixServername(connection.getInformixServername());
conn.setInitialPoolSize(connection.getInitialPoolSize());
conn.setMaximumPoolSize(connection.getMaximumPoolSize());
conn.setPartitioned(connection.isPartitioned());
conn.setPartitioningInformation(connection.getPartitioningInformation());
conn.setPassword(connection.getPassword());
conn.setQuoteAllFields(connection.isQuoteAllFields());
conn.setExtraOptions(connection.getExtraOptions());
conn.setExtraOptionsOrder(connection.getExtraOptionsOrder());
conn.setStreamingResults(connection.isStreamingResults());
conn.setUsername(connection.getUsername());
conn.setUsingConnectionPool(connection.isUsingConnectionPool());
conn.setUsingDoubleDecimalAsSchemaTableSeparator(connection.isUsingDoubleDecimalAsSchemaTableSeparator());
// Force an update of any views on the connection list.
if (!oldName.equals(newName)) {
// $NON-NLS-1$
this.firePropertyChange("connections", previousValue, Collections.emptyList());
previousValue = Collections.emptyList();
}
// $NON-NLS-1$
this.firePropertyChange("connections", previousValue, connections);
}
use of org.pentaho.database.model.IDatabaseConnection in project data-access by pentaho.
the class DatasourceModel method setSelectedRelationalConnection.
@Bindable
public void setSelectedRelationalConnection(IDatabaseConnection value) {
try {
IDatabaseConnection previousValue = this.selectedRelationalConnection;
this.selectedRelationalConnection = value;
if (value != null) {
this.firePropertyChange("selectedRelationalConnection", previousValue, value);
validate();
}
} catch (BindingException e) {
// ignore since any binding issues with datasource parameters will be more obviously caught elsewhere
}
}
Aggregations