Examples of JexlUtil


Examples of org.apache.syncope.core.util.JexlUtil

     * @param attributes the set of attributes against which evaluate this derived attribute
     * @return the value of this derived attribute
     */
    public String getValue(final Collection<? extends AbstractAttr> attributes) {
        final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
        final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

        // Prepare context using user attributes
        final JexlContext jexlContext = new MapContext();
        jexlUtil.addAttrsToContext(attributes, jexlContext);
        jexlUtil.addFieldsToContext(getOwner(), jexlContext);

        // Evaluate expression using the context prepared before
        return jexlUtil.evaluate(getDerivedSchema().getExpression(), jexlContext);
    }
View Full Code Here

Examples of org.apache.syncope.core.util.JexlUtil

     * @return the value of this derived attribute
     */
    public String getValue(final Collection<? extends AbstractAttr> attributes) {

        final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
        final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

        // Prepare context using user attributes
        final JexlContext jexlContext = jexlUtil.addAttrsToContext(attributes, null);

        final AbstractAttributable owner = getOwner();
        if (owner instanceof SyncopeUser) {
            jexlContext.set("username", ((SyncopeUser) owner).getUsername() != null
                    ? ((SyncopeUser) owner).getUsername()
                    : "");
            jexlContext.set("creationDate", ((SyncopeUser) owner).getCreationDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getCreationDate())
                    : "");
            jexlContext.set("lastLoginDate", ((SyncopeUser) owner).getLastLoginDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getLastLoginDate())
                    : "");
            jexlContext.set("failedLogins", ((SyncopeUser) owner).getFailedLogins() != null
                    ? ((SyncopeUser) owner).getFailedLogins()
                    : "");
            jexlContext.set("changePwdDate", ((SyncopeUser) owner).getChangePwdDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getChangePwdDate())
                    : "");
        }

        // Evaluate expression using the context prepared before
        return jexlUtil.evaluate(getDerivedSchema().getExpression(), jexlContext);
    }
View Full Code Here

Examples of org.apache.syncope.core.util.JexlUtil

     * @return the value of this derived attribute
     */
    public String getValue(final Collection<? extends AbstractAttr> attributes) {

        final ConfigurableApplicationContext context = ApplicationContextManager.getApplicationContext();
        final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

        // Prepare context using user attributes
        final JexlContext jexlContext = jexlUtil.addAttrsToContext(attributes, null);

        final AbstractAttributable owner = getOwner();
        if (owner instanceof SyncopeUser) {
            jexlContext.set("username", ((SyncopeUser) owner).getUsername() != null
                    ? ((SyncopeUser) owner).getUsername()
                    : "");
            jexlContext.set("creationDate", ((SyncopeUser) owner).getCreationDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getCreationDate())
                    : "");
            jexlContext.set("lastLoginDate", ((SyncopeUser) owner).getLastLoginDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getLastLoginDate())
                    : "");
            jexlContext.set("failedLogins", ((SyncopeUser) owner).getFailedLogins() != null
                    ? ((SyncopeUser) owner).getFailedLogins()
                    : "");
            jexlContext.set("changePwdDate", ((SyncopeUser) owner).getChangePwdDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getChangePwdDate())
                    : "");
        }

        // Evaluate expression using the context prepared before
        return jexlUtil.evaluate(getDerivedSchema().getExpression(), jexlContext);
    }
View Full Code Here

Examples of org.apache.syncope.core.util.jexl.JexlUtil

     * @return the value of this derived attribute
     */
    public String getValue(final Collection<? extends AbstractAttr> attributes) {

        final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
        final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

        // Prepare context using user attributes
        final JexlContext jexlContext = jexlUtil.addAttrsToContext(attributes, null);

        final AbstractAttributable owner = getOwner();
        if (owner instanceof SyncopeUser) {
            jexlContext.set("username", ((SyncopeUser) owner).getUsername() != null
                    ? ((SyncopeUser) owner).getUsername()
                    : "");
            jexlContext.set("creationDate", ((SyncopeUser) owner).getCreationDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getCreationDate())
                    : "");
            jexlContext.set("lastLoginDate", ((SyncopeUser) owner).getLastLoginDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getLastLoginDate())
                    : "");
            jexlContext.set("failedLogins", ((SyncopeUser) owner).getFailedLogins() != null
                    ? ((SyncopeUser) owner).getFailedLogins()
                    : "");
            jexlContext.set("changePwdDate", ((SyncopeUser) owner).getChangePwdDate() != null
                    ? ((SyncopeUser) owner).getDateFormatter().format(((SyncopeUser) owner).getChangePwdDate())
                    : "");
        }

        // Evaluate expression using the context prepared before
        return jexlUtil.evaluate(getDerivedSchema().getExpression(), jexlContext);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.