Example usage for org.springframework.beans BeanWrapperImpl getNestedPath

List of usage examples for org.springframework.beans BeanWrapperImpl getNestedPath

Introduction

In this page you can find the example usage for org.springframework.beans BeanWrapperImpl getNestedPath.

Prototype

public final String getNestedPath() 

Source Link

Document

Return the nested path of the object wrapped by this accessor.

Usage

From source file:org.kuali.rice.krad.web.bind.UifViewBeanWrapper.java

/**
 * Checks whether the given property is secure.
 *
 * @param wrappedClass class the property is associated with
 * @param propertyPath path to the property
 * @return boolean true if the property is secure, false if not
 *///  w  w w  . jav  a 2 s  .com
protected boolean isSecure(Class<?> wrappedClass, String propertyPath) {
    if (KRADServiceLocatorWeb.getDataObjectAuthorizationService()
            .attributeValueNeedsToBeEncryptedOnFormsAndLinks(wrappedClass, propertyPath)) {
        return true;
    }

    BeanWrapperImpl beanWrapper;
    try {
        beanWrapper = getBeanWrapperForPropertyPath(propertyPath);
    } catch (NotReadablePropertyException nrpe) {
        LOG.debug("Bean wrapper was not found for " + propertyPath
                + ", but since it cannot be accessed it will not be set as secure.", nrpe);
        return false;
    }

    if (org.apache.commons.lang.StringUtils.isNotBlank(beanWrapper.getNestedPath())) {
        PropertyTokenHolder tokens = getPropertyNameTokens(propertyPath);
        String nestedPropertyPath = org.apache.commons.lang.StringUtils.removeStart(tokens.canonicalName,
                beanWrapper.getNestedPath());

        return isSecure(beanWrapper.getWrappedClass(), nestedPropertyPath);
    }

    return false;
}