Search in sources :

Example 6 with FieldValueMarshaller

use of org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.FieldValueMarshaller in project kie-wb-common by kiegroup.

the class ModelMarshaller method toRawValue.

public Object toRawValue(final Map<String, Object> values) {
    if (model == null) {
        model = newInstance();
    }
    iterateFormFields(fieldDefinition -> {
        String binding = fieldDefinition.getBinding();
        FieldValueMarshaller marshaller = marshallers.get(binding);
        Object flatValue = values.get(binding);
        if (marshaller != null) {
            writeValue(binding, marshaller.toRawValue(flatValue));
        } else {
            writeValue(binding, flatValue);
        }
    });
    return model;
}
Also used : FieldValueMarshaller(org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.FieldValueMarshaller)

Aggregations

FieldValueMarshaller (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.FieldValueMarshaller)6 HashMap (java.util.HashMap)3 Arrays (java.util.Arrays)2 Map (java.util.Map)2 SessionScoped (javax.enterprise.context.SessionScoped)2 Inject (javax.inject.Inject)2 StringUtils (org.apache.commons.lang3.StringUtils)2 FieldValueMarshallerRegistry (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.FieldValueMarshallerRegistry)2 ContextModelConstraintsExtractor (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.validation.ContextModelConstraintsExtractor)2 BackendFormRenderingContext (org.kie.workbench.common.forms.dynamic.service.context.generation.dynamic.BackendFormRenderingContext)2 BackendFormRenderingContextManager (org.kie.workbench.common.forms.dynamic.service.context.generation.dynamic.BackendFormRenderingContextManager)2 MapModelRenderingContext (org.kie.workbench.common.forms.dynamic.service.shared.impl.MapModelRenderingContext)2 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Instance (javax.enterprise.inject.Instance)1 Before (org.junit.Before)1 FieldValueMarshallerRegistryImpl (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.FieldValueMarshallerRegistryImpl)1 TextAreaFormFieldValueMarshaller (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.TextAreaFormFieldValueMarshaller)1 StringMultipleInputValueMarshaller (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.marshalling.lists.StringMultipleInputValueMarshaller)1