Package org.apache.beehive.netui.script

Examples of org.apache.beehive.netui.script.Expression


        // given a hierarchy of "container.container.container.item.someProp", the correct parent needs
        // to be found so that expression rewriting can happen correctly.
        //
        // ensure that this expression contains container.item
        Expression parsed = getExpressionEvaluator().parseExpression(name);
        assert parsed != null;

        int containerCount = 0;
        List tokens = parsed.getTokens();
        for (int i = 0; i < tokens.size(); i++) {
            String tok = tokens.get(i).toString();
            if (i == 0) {
                if (!tok.equals("container"))
                    break;
                else
                    continue;
            }
            // this skips the "current" IDataAccessProvider
            else if (tok.equals("container"))
                containerCount++;
            else if (tok.equals("item"))
                break;
        }

        if (_logger.isDebugEnabled()) _logger.debug("container parent count: " + containerCount);

        // now walk up the DataAccessProvier hierarchy until the top-most parent is found
        // the top-most parent is the first one that does not reference "container.item" but
        // is bound directly to a specific object such as "actionForm" or "pageFlow".  This
        // handles the case where a set of nested IDataAccessProvider tags are "skipped" by
        // an expression like "container.container.container.item.foo".  In order to find
        // the correct root to start rewriting the names, one needs to walk up three
        // DAPs in order to find the correct root from which to start.
        //
        // In general, containerCount is zero here for the "container.item.foo" case.
        for (int i = 0; i < containerCount; i++) {
            dap = dap.getProviderParent();
        }

        // now, the top-most DAP parent is known
        assert dap != null;
       
        // strip off the "container.item" from the expression that is being rewritten
        // this should be two tokens into the expression.
        if (containerCount > 0) {
            name = parsed.getExpression(containerCount);
        }

        // now, change the binding context of the parent DAP hierarchy to create a
        // String that looks like "actionForm.customers[42].order[12].lineItem[2].name"
        // note, this is done without using the expression that was passed-in and
View Full Code Here


            throws ExpressionEvaluationException
    {
        if (_logger.isDebugEnabled())
            _logger.debug("assign index to name: " + dap.getDataSource());

        Expression parsedDataSource = getExpressionEvaluator().parseExpression(dap.getDataSource());
        assert parsedDataSource != null;

        // @todo: perf
        boolean isContainerBound = (parsedDataSource.getTokens().get(0)).toString().equals("container");

        // rewrite the name of the current IDataAccessProvider.
        String parentName = null;
        // if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent
        if (dap.getProviderParent() != null)
            parentName = rewriteNameInternal(dap.getProviderParent());
        // if the current DAP has no parent, or it does not reference the "container." binding context,
        // we've found the "root" IDataAccessProvider
        else if (dap.getProviderParent() == null || (dap.getProviderParent() != null && !isContainerBound)) {
            return dap.getDataSource();
        }

        // now, we've found the root and can start rewriting the expressions throughout
        // the rest of the DAP hierarchy
        if (_logger.isDebugEnabled()) {
            _logger.debug("changeContext: DAP.dataSource=" + dap.getDataSource() + " oldContext=container newContext=" +
                    parentName + " currentIndex=" + dap.getProviderParent().getCurrentIndex() +
                    " parentName is container: " + isContainerBound);
        }

        String retVal = null;
        String ds = dap.getDataSource();

        // If the current DAP's dataSource is "container.item", the binding context needs to change to that
        // of the parent.  This case should only occur for the last token -- the "name" passed into
        // the method.  Oterwise, just replace the "container" to that of the parent.  Both are
        // qualified with the DAP's current index so that "actionForm.customers" becomes
        // "actionForm.customers[12]". 

        boolean isContainerItemBound = false;
        if (isContainerBound && (parsedDataSource.getTokens().get(1)).toString().equals("item"))
            isContainerItemBound = true;

        if (isContainerItemBound)
            retVal = changeContext(ds, "container.item", parentName, dap.getProviderParent().getCurrentIndex());
        else
View Full Code Here

                            if (!requestHasPopulated)
                                ee.update(expr, updateValue, variableResolver, true);
                            // must check the expression to make sure pageFlow. and globalApp. don't get executed more than once
                            else
                            {
                                Expression pe = ee.parseExpression(expr);
                                String contextName = pe.getContext();
                                if (!contextName.equals(PAGE_FLOW_CONTEXT) && !contextName.equals(GLOBAL_APP_CONTEXT))
                                    ee.update(expr, updateValue, variableResolver, true);
                            }
                        }
                    }
View Full Code Here

                            // common case, make this fast
                            if (!requestHasPopulated)
                                ee.update(expr, updateValue, variableResolver, true);
                            // must check the expression to make sure pageFlow. and globalApp. don't get executed more than once
                            else {
                                Expression pe = ee.parseExpression(expr);
                                String contextName = pe.getContext();
                                if (!contextName.equals(PAGE_FLOW_CONTEXT) && !contextName.equals(GLOBAL_APP_CONTEXT))
                                    ee.update(expr, updateValue, variableResolver, true);
                            }
                        }
                    }
View Full Code Here

        // given a hierarchy of "container.container.container.item.someProp", the correct parent needs
        // to be found so that expression rewriting can happen correctly.
        //
        // ensure that this expression contains container.item
        Expression parsed = getExpressionEvaluator().parseExpression(name);
        assert parsed != null;

        int containerCount = 0;
        List tokens = parsed.getTokens();
        for (int i = 0; i < tokens.size(); i++) {
            String tok = tokens.get(i).toString();
            if (i == 0) {
                if (!tok.equals("container"))
                    break;
                else
                    continue;
            }
            // this skips the "current" IDataAccessProvider
            else if (tok.equals("container"))
                containerCount++;
            else if (tok.equals("item"))
                break;
        }

        if (_logger.isDebugEnabled()) _logger.debug("container parent count: " + containerCount);

        // now walk up the DataAccessProvier hierarchy until the top-most parent is found
        // the top-most parent is the first one that does not reference "container.item" but
        // is bound directly to a specific object such as "actionForm" or "pageFlow".  This
        // handles the case where a set of nested IDataAccessProvider tags are "skipped" by
        // an expression like "container.container.container.item.foo".  In order to find
        // the correct root to start rewriting the names, one needs to walk up three
        // DAPs in order to find the correct root from which to start.
        //
        // In general, containerCount is zero here for the "container.item.foo" case.
        for (int i = 0; i < containerCount; i++) {
            dap = dap.getProviderParent();
        }

        // now, the top-most DAP parent is known
        assert dap != null;
       
        // strip off the "container.item" from the expression that is being rewritten
        // this should be two tokens into the expression.
        if (containerCount > 0) {
            name = parsed.getExpression(containerCount);
        }

        // now, change the binding context of the parent DAP hierarchy to create a
        // String that looks like "actionForm.customers[42].order[12].lineItem[2].name"
        // note, this is done without using the expression that was passed-in and
View Full Code Here

            throws ExpressionEvaluationException
    {
        if (_logger.isDebugEnabled())
            _logger.debug("assign index to name: " + dap.getDataSource());

        Expression parsedDataSource = getExpressionEvaluator().parseExpression(dap.getDataSource());
        assert parsedDataSource != null;

        // @todo: perf
        boolean isContainerBound = (parsedDataSource.getTokens().get(0)).toString().equals("container");

        // rewrite the name of the current IDataAccessProvider.
        String parentName = null;
        // if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent
        if (dap.getProviderParent() != null)
            parentName = rewriteNameInternal(dap.getProviderParent());
        // if the current DAP has no parent, or it does not reference the "container." binding context,
        // we've found the "root" IDataAccessProvider
        else if (dap.getProviderParent() == null || (dap.getProviderParent() != null && !isContainerBound)) {
            return dap.getDataSource();
        }

        // now, we've found the root and can start rewriting the expressions throughout
        // the rest of the DAP hierarchy
        if (_logger.isDebugEnabled()) {
            _logger.debug("changeContext: DAP.dataSource=" + dap.getDataSource() + " oldContext=container newContext=" +
                    parentName + " currentIndex=" + dap.getProviderParent().getCurrentIndex() +
                    " parentName is container: " + isContainerBound);
        }

        String retVal = null;
        String ds = dap.getDataSource();

        // If the current DAP's dataSource is "container.item", the binding context needs to change to that
        // of the parent.  This case should only occur for the last token -- the "name" passed into
        // the method.  Oterwise, just replace the "container" to that of the parent.  Both are
        // qualified with the DAP's current index so that "actionForm.customers" becomes
        // "actionForm.customers[12]". 

        boolean isContainerItemBound = false;
        if (isContainerBound && (parsedDataSource.getTokens().get(1)).toString().equals("item"))
            isContainerItemBound = true;

        if (isContainerItemBound)
            retVal = changeContext(ds, "container.item", parentName, dap.getProviderParent().getCurrentIndex());
        else
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.script.Expression

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.