Search in sources :

Example 6 with ComplexValue

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;
}
Also used : ComplexValue(eu.esdihumboldt.hale.common.core.io.impl.ComplexValue) Parameters(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore.Parameters) DataStore(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore) Parameter(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore.Parameters.Parameter)

Example 7 with ComplexValue

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;
}
Also used : ComplexValue(eu.esdihumboldt.hale.common.core.io.impl.ComplexValue) WorkspaceMetadata(eu.esdihumboldt.hale.io.appschema.model.WorkspaceMetadata) HashSet(java.util.HashSet)

Aggregations

ComplexValue (eu.esdihumboldt.hale.common.core.io.impl.ComplexValue)7 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)4 HashSet (java.util.HashSet)4 JoinParameter (eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter)2 JoinCondition (eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter.JoinCondition)2 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)2 AttributeMappingType (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AttributeMappingType)2 DataStore (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore)2 SpatialJoinParameter (eu.esdihumboldt.cst.functions.geometric.join.SpatialJoinParameter)1 SpatialJoinCondition (eu.esdihumboldt.cst.functions.geometric.join.SpatialJoinParameter.SpatialJoinCondition)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 Type (eu.esdihumboldt.hale.common.align.model.Type)1 DefaultType (eu.esdihumboldt.hale.common.align.model.impl.DefaultType)1 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)1 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)1 Value (eu.esdihumboldt.hale.common.core.io.Value)1 LogProgressIndicator (eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator)1 StringValue (eu.esdihumboldt.hale.common.core.io.impl.StringValue)1 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)1 FileIOSupplier (eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier)1