Package org.apache.myfaces.extensions.validator.core.property

Examples of org.apache.myfaces.extensions.validator.core.property.PropertyDetails


        }
        else
        {
            if(logger.isWarnEnabled())
            {
                PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
                        .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
                logger.warn("couldn't find converted object for " + propertyDetails.getKey());
            }
        }

        return true;
    }
View Full Code Here


        if (!keyConvertedValueMapping.containsKey(newKey))
        {
            return false;
        }

        PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
                .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);

        String sourceKey = propertyDetails.getKey();

        if(!sourceKey.contains("."))
        {
            throw new IllegalStateException("source path: " + sourceKey + " invalid");
        }

        targetKey = sourceKey.substring(0, sourceKey.lastIndexOf(".") + 1) + targetKey;

        ProcessedInformationEntry validationTargetEntry = CrossValidationUtils.resolveValidationTargetEntry(
                keyConvertedValueMapping, targetKey, crossValidationStorageEntry);

        if (validationTargetEntry != null)
        {
            CrossValidationHelper
                    .crossValidateCompareStrategy(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
        }
        else
        {
            if(logger.isWarnEnabled())
            {
                logger.warn("couldn't find converted object for " + propertyDetails.getKey());
            }
        }

        return true;
    }
View Full Code Here

        if (!(object instanceof PropertyDetails))
        {
            throw new IllegalStateException(object.getClass() + " is not a " + PropertyDetails.class.getName());
        }

        PropertyDetails propertyDetails = (PropertyDetails)object;

        Class entityClass = propertyDetails.getBaseObject().getClass();

        //TODO test with complex components
        propertyInformation.setInformation(
            PropertyInformationKeys.PROPERTY_DETAILS, propertyDetails);

        /*
         * find and add annotations
         */
        addPropertyAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
        addFieldAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);

        return propertyInformation;
    }
View Full Code Here

        ValidationStrategy validationStrategy;
        MetaDataTransformer metaDataTransformer;

        Map<String, Object> results = new HashMap<String, Object>();

        PropertyDetails propertyDetails;
        for (String targetExpression : targetExpressions)
        {
            propertyDetails = ExtValUtils
                .createPropertyDetailsForNewTarget(metaDataEntry, targetExpression);
View Full Code Here

            ValueBindingExpression vbe = new ValueBindingExpression(targetExpression);

            String expression = vbe.getExpressionString();
            baseObject = ExtValUtils.getELHelper()
                    .getValueOfExpression(FacesContext.getCurrentInstance(), vbe.getBaseExpression());
            return new PropertyDetails(
                expression.substring(2, expression.length() - 1), baseObject, vbe.getProperty());
        }

        PropertyDetails original = metaDataEntry.getProperty(
            PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);

        String newBaseKey = original.getKey().substring(0, original.getKey().lastIndexOf(".") + 1);
        String newKey = newBaseKey + targetExpression;

        baseObject = ReflectionUtils.getBaseOfPropertyChain(original.getBaseObject(), targetExpression);
        return new PropertyDetails(
            newKey, baseObject, targetExpression.substring(targetExpression.lastIndexOf(".") + 1,
            targetExpression.length()));
    }
View Full Code Here

        Map<String, ProcessedInformationEntry> keyToConvertedValueMapping = CrossValidationUtils
            .getOrInitKeyToConvertedValueMapping();

        ProcessedInformationEntry entry;

        PropertyDetails propertyDetails =
            ExtValUtils.getELHelper().getPropertyDetailsOfValueBinding(uiComponent);

        if(propertyDetails == null)
        {
            return;
        }
       
        entry = new ProcessedInformationEntry();
        entry.setBean(propertyDetails.getBaseObject());
        entry.setConvertedValue(value);
        entry.setComponent(uiComponent);
        entry.setClientId(uiComponent.getClientId(FacesContext.getCurrentInstance()));

        String key = propertyDetails.getKey();

        //for local cross-validation
        if (keyToConvertedValueMapping.containsKey(key) &&
            keyToConvertedValueMapping.get(key).getBean() != null &&
            !keyToConvertedValueMapping.get(key).getBean().equals(entry.getBean()))
View Full Code Here

        if (processedInformationEntry.getFurtherEntries() == null)
        {
            return processedInformationEntry;
        }

        PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
                .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);

        Object targetBean = propertyDetails.getBaseObject();

        //process complex component entries (e.g. a table)
        //supported: cross-component but no cross-entity validation (= locale validation)
        if (processedInformationEntry.getBean().equals(targetBean))
        {
View Full Code Here

        String[] targetExpressions = metaDataEntry.getValue(JoinValidation.class).value();

        ValidationStrategy validationStrategy;

        PropertyDetails propertyDetails;
        for (String targetExpression : targetExpressions)
        {
            propertyDetails = ExtValUtils
                .createPropertyDetailsForNewTarget(metaDataEntry, targetExpression);
View Full Code Here

        if(logger.isTraceEnabled())
        {
            logger.trace("start extracting meta-data of " + uiComponent.getClass().getName());
        }

        PropertyDetails propertyDetails = ExtValUtils.getELHelper().getPropertyDetailsOfValueBinding(uiComponent);

        if (propertyDetails == null)
        {
            return propertyInformation;
        }

        /*
         * get bean class and property name
         */
        Class entityClass = propertyDetails.getBaseObject().getClass();

        //create
        propertyInformation.setInformation(PropertyInformationKeys.PROPERTY_DETAILS, propertyDetails);

        /*
         * find and add annotations
         */
        Class currentClass = entityClass;

        while (!Object.class.getName().equals(currentClass.getName()))
        {
            addPropertyAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);
            addFieldAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);

            currentClass = currentClass.getSuperclass();
        }

        for (Class currentInterface : entityClass.getInterfaces())
        {
            currentClass = currentInterface;

            while (currentClass != null)
            {
                addPropertyAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);

                currentClass = currentClass.getSuperclass();
            }
        }

View Full Code Here

    }

    PropertyDetails extractPropertyDetails(
            FacesContext facesContext, UIComponent uiComponent, Map<String, Object> propertiesForExtraction)
    {
        PropertyDetails result = getComponentMetaDataExtractor(propertiesForExtraction)
                .extract(facesContext, uiComponent)
                .getInformation(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);

        if (result.getBaseObject() == null && this.logger.isWarnEnabled())
        {
            this.logger.warn("no base object at " + result.getKey() +
                    " component-id: " + uiComponent.getClientId(facesContext));
        }

        return result.getBaseObject() != null ? result : null;
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.validator.core.property.PropertyDetails

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.