use of com.enonic.xp.inputtype.InputType in project xp by enonic.
the class JsonToPropertyTreeTranslator method mapValue.
private void mapValue(final PropertySet parent, final String key, final JsonNode value) {
final Property parentProperty = parent.getProperty();
final Input input = getInput(parentProperty, key);
if (input == null) {
if (this.strictMode) {
throw new IllegalArgumentException("No mapping defined for property " + key + " with value " + resolveStringValue(value));
}
parent.addProperty(key, resolveCoreValue(value));
} else {
final InputType type = this.inputTypeResolver.resolve(input.getInputType());
final Value mappedPropertyValue = type.createValue(resolveCoreValue(value), input.getInputTypeConfig());
parent.addProperty(key, mappedPropertyValue);
}
}
use of com.enonic.xp.inputtype.InputType in project xp by enonic.
the class FormJsonToPropertyTreeTranslator method mapValue.
private void mapValue(final PropertySet parent, final String key, final JsonNode value) {
final Property parentProperty = parent.getProperty();
final Input input = getInput(parentProperty, key);
if (input == null) {
if (this.strictMode && !isOptionSetSelection(key, parentProperty)) {
throw new IllegalArgumentException("No mapping defined for property " + key + " with value " + resolveStringValue(value));
}
parent.addProperty(key, resolveCoreValue(value));
} else {
final InputType type = this.inputTypeResolver.resolve(input.getInputType());
final Value mappedPropertyValue = type.createValue(resolveCoreValue(value), input.getInputTypeConfig());
parent.addProperty(key, mappedPropertyValue);
}
}
use of com.enonic.xp.inputtype.InputType in project xp by enonic.
the class InputValidationVisitor method checkValidity.
private void checkValidity(final Input input, final Property property) {
if (property == null) {
return;
}
final InputType type = this.inputTypeResolver.resolve(input.getInputType());
type.validate(property, input.getInputTypeConfig());
}