use of eu.esdihumboldt.hale.common.core.io.impl.ComplexValue in project hale by halestudio.
the class AppSchemaDataStoreConfigurationPage method updateConfiguration.
@Override
public boolean updateConfiguration(AbstractAppSchemaConfigurator provider) {
if (!validateHost()) {
updateMessage(Field.HOST);
return false;
}
if (!validateDatabase()) {
updateMessage(Field.DATABASE);
return false;
}
if (!validateSchema()) {
updateMessage(Field.SCHEMA);
return false;
}
DataStore dataStoreParam = provider.getParameter(AppSchemaIO.PARAM_DATASTORE).as(DataStore.class);
if (dataStoreParam == null) {
dataStoreParam = new DataStore();
}
if (dataStoreParam.getParameters() == null) {
dataStoreParam.setParameters(new Parameters());
}
String hostValue = host.getText();
Parameter hostParam = new Parameter();
hostParam.setName("host");
hostParam.setValue(extractHost(hostValue));
dataStoreParam.getParameters().getParameter().add(hostParam);
Integer portValue = extractPort(hostValue);
if (portValue != null) {
Parameter portParam = new Parameter();
portParam.setName("port");
portParam.setValue(portValue.toString());
dataStoreParam.getParameters().getParameter().add(portParam);
}
Parameter databaseParam = new Parameter();
databaseParam.setName("database");
databaseParam.setValue(database.getText());
dataStoreParam.getParameters().getParameter().add(databaseParam);
Parameter schemaParam = new Parameter();
schemaParam.setName("schema");
schemaParam.setValue(schema.getText());
dataStoreParam.getParameters().getParameter().add(schemaParam);
Parameter userParam = new Parameter();
userParam.setName("user");
userParam.setValue(user.getText());
dataStoreParam.getParameters().getParameter().add(userParam);
Parameter passwordParam = new Parameter();
passwordParam.setName("passwd");
passwordParam.setValue(password.getText());
dataStoreParam.getParameters().getParameter().add(passwordParam);
Parameter exposePKParam = new Parameter();
exposePKParam.setName("Expose primary keys");
exposePKParam.setValue(Boolean.toString(exposePK.getSelection()));
dataStoreParam.getParameters().getParameter().add(exposePKParam);
// TODO: only "postgis" dbtype is supported so far
dataStoreParam.getParameters().getParameter().add(DBTYPE_PARAMETER);
provider.setParameter(AppSchemaIO.PARAM_DATASTORE, new ComplexValue(dataStoreParam));
return true;
}
use of eu.esdihumboldt.hale.common.core.io.impl.ComplexValue in project hale by halestudio.
the class WorkspaceConfigurationPage method updateConfiguration.
/**
* @see eu.esdihumboldt.hale.ui.io.IOWizardPage#updateConfiguration(eu.esdihumboldt.hale.common.core.io.IOProvider)
*/
@Override
public boolean updateConfiguration(AbstractAppSchemaConfigurator provider) {
boolean isValid = true;
// check for duplicates
Set<String> newNames = new HashSet<>();
for (WorkspaceMetadata workspace : workspaceConf.getWorkspaces()) {
if (newNames.contains(workspace.getName())) {
// duplicate found
setErrorMessage("Duplicated workspace name found: \"" + workspace.getName() + "\"");
isValid = false;
break;
}
newNames.add(workspace.getName());
}
if (!isValid) {
return false;
}
provider.setParameter(AppSchemaIO.PARAM_WORKSPACE, new ComplexValue(workspaceConf));
return true;
}
Aggregations