Example usage for org.springframework.validation DataBinder getAllowedFields

List of usage examples for org.springframework.validation DataBinder getAllowedFields

Introduction

In this page you can find the example usage for org.springframework.validation DataBinder getAllowedFields.

Prototype

@Nullable
public String[] getAllowedFields() 

Source Link

Document

Return the fields that should be allowed for binding.

Usage

From source file:org.agatom.springatom.cmp.wizards.core.AbstractWizardProcessor.java

private void doBind(final DataBinder binder, Map<String, Object> params) throws Exception {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format(
                "Binding allowed request parameters in %s to form object with name '%s', pre-bind formObject toString = %s",
                params, binder.getObjectName(), binder.getTarget()));
        if (binder.getAllowedFields() != null && binder.getAllowedFields().length > 0) {
            LOGGER.debug(//from  ww  w.j  a  v  a 2 s  .com
                    String.format("(Allowed fields are %s)", StylerUtils.style(binder.getAllowedFields())));
        } else {
            LOGGER.debug("(Any field is allowed)");
        }
    }
    binder.bind(new MutablePropertyValues(params));
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(String.format(
                "Binding completed for form object with name '%s', post-bind formObject toString = %s",
                binder.getObjectName(), binder.getTarget()));
        LOGGER.debug(String.format("There are [%d] errors, details: %s",
                binder.getBindingResult().getErrorCount(), binder.getBindingResult().getAllErrors()));
    }
}

From source file:no.abmu.questionnaire.webflow.MuseumStatisticFormAction.java

/**
 * Bind allowed parameters in the external context request parameter map to the form object using given binder.
 * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope"
 * @param binder the data binder to use//from w  ww.ja v  a2  s.  c  o m
 * @throws Exception when an unrecoverable exception occurs
 */
protected void doBind(RequestContext context, DataBinder binder) throws Exception {
    logger.debug("Execute local doBind");
    if (logger.isDebugEnabled()) {
        logger.debug("Binding allowed request parameters in "
                + StylerUtils.style(context.getExternalContext().getRequestParameterMap())
                + " to form object with name '" + binder.getObjectName() + "', pre-bind formObject toString = "
                + binder.getTarget());
        if (binder.getAllowedFields() != null && binder.getAllowedFields().length > 0) {
            logger.debug("(Allowed fields are " + StylerUtils.style(binder.getAllowedFields()) + ")");
        } else {
            logger.debug("(Any field is allowed)");
        }
    }
    logger.debug("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBb");
    logger.debug("BBBBBBBBB Value of binder befor binding BBBBBBBBBBBBBBBBBBb");
    logger.debug("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBb");
    logger.debug(binder);
    binder.bind(new MutablePropertyValues(context.getRequestParameters().asMap()));
    logger.debug("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBb");
    logger.debug("BBBBBBBBB Value of binder after binding BBBBBBBBBBBBBBBBBBb");
    logger.debug("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBb");
    logger.debug(binder);

    if (logger.isDebugEnabled()) {
        logger.debug("Binding completed for form object with name '" + binder.getObjectName()
                + "', post-bind formObject toString = " + binder.getTarget());
        logger.debug("There are [" + binder.getErrors().getErrorCount() + "] errors, details: "
                + binder.getErrors().getAllErrors());
    }
}