Search in sources :

Example 21 with ValueProperties

use of eu.esdihumboldt.hale.common.core.io.ValueProperties in project hale by halestudio.

the class ElementTypeFactory method store.

@Override
public Value store(ElementType constraint, TypeReferenceBuilder typeIndex) throws Exception {
    ValueProperties props = new ValueProperties();
    // type definition
    if (constraint.getDefinition() != null) {
        Optional<Value> ref = typeIndex.createReference(constraint.getDefinition());
        if (ref.isPresent()) {
            props.put(P_TYPE, ref.get());
        }
    }
    // binding
    String className = constraint.getBinding().getName();
    props.put(P_BINDING, Value.of(className));
    return props.toValue();
}
Also used : ValueProperties(eu.esdihumboldt.hale.common.core.io.ValueProperties) Value(eu.esdihumboldt.hale.common.core.io.Value)

Example 22 with ValueProperties

use of eu.esdihumboldt.hale.common.core.io.ValueProperties in project hale by halestudio.

the class GeometryMetadataFactory method store.

@Override
public Value store(GeometryMetadata constraint, TypeReferenceBuilder typeIndex) throws Exception {
    ValueProperties props = new ValueProperties();
    String srs = constraint.getSrs();
    if (srs != null) {
        props.put(NAME_SRS, Value.of(srs));
    }
    props.put(NAME_DIMENSION, Value.of(constraint.getDimension()));
    String srsText = constraint.getSrsText();
    if (srsText != null) {
        props.put(NAME_SRS_TEXT, Value.of(srsText));
    }
    String auth_name = constraint.getAuthName();
    if (auth_name != null) {
        props.put(NAME_AUTH_NAME, Value.of(auth_name));
    }
    return props.toValue();
}
Also used : ValueProperties(eu.esdihumboldt.hale.common.core.io.ValueProperties)

Example 23 with ValueProperties

use of eu.esdihumboldt.hale.common.core.io.ValueProperties in project hale by halestudio.

the class LengthValidatorFactory method store.

@Override
public Value store(LengthValidator validator) throws Exception {
    ValueProperties props = new ValueProperties();
    props.put(P_TYPE, Value.of(validator.getType().name()));
    props.put(P_LENGTH, Value.of(validator.getLength()));
    return props.toValue();
}
Also used : ValueProperties(eu.esdihumboldt.hale.common.core.io.ValueProperties)

Example 24 with ValueProperties

use of eu.esdihumboldt.hale.common.core.io.ValueProperties in project hale by halestudio.

the class LengthValidatorFactory method restore.

@Override
public Validator restore(Value value) throws Exception {
    ValueProperties props = value.as(ValueProperties.class);
    Type type = Type.valueOf(props.getSafe(P_TYPE).as(String.class));
    int length = props.getSafe(P_LENGTH).as(Integer.class);
    return new LengthValidator(type, length);
}
Also used : LengthValidator(eu.esdihumboldt.util.validator.LengthValidator) Type(eu.esdihumboldt.util.validator.LengthValidator.Type) ValueProperties(eu.esdihumboldt.hale.common.core.io.ValueProperties)

Example 25 with ValueProperties

use of eu.esdihumboldt.hale.common.core.io.ValueProperties in project hale by halestudio.

the class NumberValidatorFactory method store.

@Override
public Value store(NumberValidator validator) throws Exception {
    ValueProperties props = new ValueProperties();
    props.put(P_TYPE, Value.of(validator.getType().name()));
    props.put(P_VALUE, Value.of(validator.getValue()));
    return props.toValue();
}
Also used : ValueProperties(eu.esdihumboldt.hale.common.core.io.ValueProperties)

Aggregations

ValueProperties (eu.esdihumboldt.hale.common.core.io.ValueProperties)26 Value (eu.esdihumboldt.hale.common.core.io.Value)11 ValueList (eu.esdihumboldt.hale.common.core.io.ValueList)8 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)4 Function (com.google.common.base.Function)1 Reference (eu.esdihumboldt.hale.common.schema.model.constraint.property.Reference)1 Enumeration (eu.esdihumboldt.hale.common.schema.model.constraint.type.Enumeration)1 GeometryMetadata (eu.esdihumboldt.hale.common.schema.model.constraint.type.GeometryMetadata)1 DatabaseTable (eu.esdihumboldt.hale.io.jdbc.constraints.DatabaseTable)1 SQLArray (eu.esdihumboldt.hale.io.jdbc.constraints.SQLArray)1 XmlElement (eu.esdihumboldt.hale.io.xsd.model.XmlElement)1 ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)1 DynamicScrolledComposite (eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite)1 DigitCountValidator (eu.esdihumboldt.util.validator.DigitCountValidator)1 Type (eu.esdihumboldt.util.validator.DigitCountValidator.Type)1 LengthValidator (eu.esdihumboldt.util.validator.LengthValidator)1 Type (eu.esdihumboldt.util.validator.LengthValidator.Type)1 NumberValidator (eu.esdihumboldt.util.validator.NumberValidator)1 Type (eu.esdihumboldt.util.validator.NumberValidator.Type)1 BigDecimal (java.math.BigDecimal)1