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

Examples of org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression


            if(!elHelper.isELTermWellFormed(actionString))
            {
                continue;
            }

            ValueBindingExpression valueBindingExpression = new ValueBindingExpression(actionString);

            FacesContext facesContext = FacesContext.getCurrentInstance();
            if (!ExtValUtils.getELHelper().isELTermValid(
                    facesContext, valueBindingExpression.getBaseExpression().getExpressionString()))
            {
                continue;
            }

            processBypassValidation(facesContext, valueBindingExpression, elHelper, AjaxBehaviorEvent.class);
View Full Code Here


{

    @Test
    public void testStandardSyntax() throws Exception
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.property1}");

        Assert.assertEquals("#{bean1.property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['property1']}");

        Assert.assertEquals("#{bean1['property1']}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].property1}");

        Assert.assertEquals("#{bean1['bean2'].property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1['bean2']}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());
    }
View Full Code Here

    }

    @Test
    public void testStandardSyntaxReplaceProperty() throws Exception
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.property1}");

        valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");

        Assert.assertEquals("#{bean1.property2}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property2", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['property1']}");

        valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");

        //TODO restore original syntax
        Assert.assertEquals("#{bean1.property2}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property2", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].property1}");

        valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");

        Assert.assertEquals("#{bean1['bean2'].property2}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1['bean2']}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("#{bean1}", valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString());
        Assert.assertEquals("property2", valueBindingExpression.getProperty());
    }
View Full Code Here

    }

    @Test
    public void testStandardSyntaxAddProperty() throws Exception
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.bean2}");

        valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");

        Assert.assertEquals("#{bean1.bean2.property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1.bean2}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['bean2']}");

        valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");

        Assert.assertEquals("#{bean1['bean2'].property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1['bean2']}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());

        valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].bean3}");

        valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");

        Assert.assertEquals("#{bean1['bean2'].bean3.property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{bean1['bean2'].bean3}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("#{bean1['bean2']}",
                valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());
    }
View Full Code Here

    }

    @Test
    public void testFaceletsCustomComponentSyntax() throws Exception
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{entity[fieldName]}");

        Assert.assertEquals("#{entity[fieldName]}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{entity}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("fieldName", valueBindingExpression.getProperty());
    }
View Full Code Here

    }

    @Test
    public void testFaceletsCustomComponentSyntaxReplaceProperty() throws Exception
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{entity[fieldName]}");

        valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "newFieldName");

        //TODO restore original syntax
        Assert.assertEquals("#{entity.newFieldName}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("#{entity}", valueBindingExpression.getBaseExpression().getExpressionString());
        Assert.assertEquals("newFieldName", valueBindingExpression.getProperty());
    }
View Full Code Here

    }

    @Test
    public void testComplexMapSyntax() throws Exception
    {
        ValueBindingExpression valueBindingExpression
                = new ValueBindingExpression("#{bean1[bean2[bean3['key1']]].property1}");

        //TODO
        //assertEquals("#{bean1[bean2[bean3['key1']]].property1}", valueBindingExpression.getExpressionString());
        Assert.assertEquals("property1", valueBindingExpression.getProperty());
    }
View Full Code Here

                                                                    String targetExpression)
    {
        Object baseObject;
        if (getELHelper().isELTermWellFormed(targetExpression))
        {
            ValueBindingExpression vbe = new ValueBindingExpression(targetExpression);

            String expression = vbe.getExpressionString();
            baseObject = 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);
View Full Code Here

        {
            if (elHelper.isELTermWellFormed(condition) &&
                    elHelper.isELTermValid(facesContext, condition))
            {
                if (Boolean.TRUE.equals(elHelper.getValueOfExpression(
                        facesContext, new ValueBindingExpression(condition))))
                {
                    return true;
                }
            }
            else
View Full Code Here

        modelValidationEntryList.add(modelValidationEntry);
    }

    private Object tryToResolveValidationTargetExpression(String validationTargetExpression)
    {
        ValueBindingExpression valueBindingExpression = new ValueBindingExpression(validationTargetExpression);
        return this.elHelper.getValueOfExpression(FacesContext.getCurrentInstance(), valueBindingExpression);
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression

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.