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();
}
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();
}
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();
}
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);
}
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();
}
Aggregations