Package org.apache.myfaces.extensions.validator.crossval

Examples of org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry


    public static ProcessedInformationEntry resolveValidationTargetEntry(
            Map<String, ProcessedInformationEntry> keyToConvertedValueMapping,
            String targetKey, CrossValidationStorageEntry crossValidationStorageEntry)
    {
        ProcessedInformationEntry processedInformationEntry =
            keyToConvertedValueMapping.get(targetKey);

        //value not submitted at this request - use model value (validation against the model)
        if(processedInformationEntry == null)
        {
            return null;
        }

        //simple case
        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))
        {
            return processedInformationEntry;
        }

        for (ProcessedInformationEntry entry : processedInformationEntry.getFurtherEntries())
        {
            if (entry.getBean().equals(targetBean))
            {
                return entry;
            }
View Full Code Here


        String newKey = createTargetKey(crossValidationStorageEntry, targetKey);

        if (keyConvertedValueMapping.containsKey(newKey))
        {
            ProcessedInformationEntry validationTargetEntry = keyConvertedValueMapping.get(newKey);

            processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
        }
        //no target - because there is no target component - value was validated against the model
        else
View Full Code Here

            targetKey = targetKey.substring(targetKey.lastIndexOf(".") + 1, targetKey.length());
        }

        Object targetValue = getValueOfProperty(newBase, targetKey);

        ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();
        targetEntry.setBean(newBase);
        targetEntry.setConvertedValue(targetValue);

        CrossValidationHelper
                .crossValidateCompareStrategy(
                        compareStrategy, crossValidationStorageEntry, targetEntry, true);
    }
View Full Code Here

            CrossValidationStorageEntry crossValidationStorageEntry,
            ValueBindingExpression validationTarget,
            CrossValidationStorage crossValidationStorage,
            AbstractCompareStrategy compareStrategy)
    {
        ProcessedInformationEntry validationTargetEntry =
                resolveTargetForCrossComponentValidation(crossValidationStorageEntry, validationTarget);

        if(validationTargetEntry != null)
        {
            processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
View Full Code Here

            ValueBindingExpression validationTarget)
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Object targetValue = ExtValUtils.getELHelper().getValueOfExpression(facesContext, validationTarget);

        ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();
        targetEntry.setBean(
                ExtValUtils.getELHelper().getValueOfExpression(facesContext, validationTarget.getBaseExpression()));
        targetEntry.setConvertedValue(targetValue);

        CrossValidationHelper
                .crossValidateCompareStrategy(compareStrategy, crossValidationStorageEntry, targetEntry, true);
    }
View Full Code Here

        String targetProperty = targetKey;

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

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

        if (validationTargetEntry != null && validationTargetEntry.getComponent() != null && !isModelAwareValidation)
        {
            processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
        }
        //no target - because there is no target component - value was validated against the model
        else if(isModelAwareValidation)
View Full Code Here

    private void processModelAwareCrossValidation(
            AbstractCompareStrategy compareStrategy,
            CrossValidationStorageEntry crossValidationStorageEntry,
            String targetProperty)
    {
        ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();

        targetEntry.setBean(
                crossValidationStorageEntry.getMetaDataEntry()
                        .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class).getBaseObject());
        targetEntry
                .setConvertedValue(getValueOfProperty(targetEntry.getBean(), targetProperty));

        CrossValidationHelper
                .crossValidateCompareStrategy(compareStrategy, crossValidationStorageEntry, targetEntry, true);
    }
View Full Code Here

            AbstractCompareStrategy compareStrategy)
    {
        Map<String, ProcessedInformationEntry> keyConvertedValueMapping = CrossValidationUtils
                .getOrInitKeyToConvertedValueMapping();

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

        if(validationTargetEntry != null)
View Full Code Here

            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
View Full Code Here

        //to support local cross-validation (within the same entity)
        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()))
        {
            //for the validation within a complex component e.g. a table
            //don't override existing expression (style: #{entry.property}) - make a special mapping

            List<ProcessedInformationEntry> furtherEntries =
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry

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.